diff --git a/nova/api/opts.py b/nova/api/opts.py index 3d4cfcf51d..b175a506e3 100644 --- a/nova/api/opts.py +++ b/nova/api/opts.py @@ -81,7 +81,6 @@ import nova.network.rpcapi import nova.network.security_group.openstack_driver import nova.notifications import nova.objects.network -import nova.paths import nova.pci.request import nova.pci.whitelist import nova.quota diff --git a/nova/compute/manager.py b/nova/compute/manager.py index b233440535..54a88cb51c 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -67,6 +67,7 @@ from nova.compute import utils as compute_utils from nova.compute import vm_states from nova import conductor import nova.conf +from nova.conf import paths from nova import consoleauth import nova.context from nova import exception @@ -86,7 +87,6 @@ from nova import objects from nova.objects import base as obj_base from nova.objects import instance as obj_instance from nova.objects import migrate_data as migrate_data_obj -from nova import paths from nova import rpc from nova import safe_utils from nova.scheduler import client as scheduler_client diff --git a/nova/conf/__init__.py b/nova/conf/__init__.py index ec5beba37f..dd88870828 100644 --- a/nova/conf/__init__.py +++ b/nova/conf/__init__.py @@ -62,6 +62,7 @@ from nova.conf import neutron from nova.conf import notifications from nova.conf import novnc # from nova.conf import osapi_v21 +from nova.conf import paths from nova.conf import pci from nova.conf import quota from nova.conf import rdp @@ -130,6 +131,7 @@ neutron.register_opts(CONF) notifications.register_opts(CONF) novnc.register_opts(CONF) # osapi_v21.register_opts(CONF) +paths.register_opts(CONF) pci.register_opts(CONF) quota.register_opts(CONF) rdp.register_opts(CONF) diff --git a/nova/conf/cloudpipe.py b/nova/conf/cloudpipe.py index 39230c4044..ecf7a1a47f 100644 --- a/nova/conf/cloudpipe.py +++ b/nova/conf/cloudpipe.py @@ -14,8 +14,8 @@ from oslo_config import cfg +from nova.conf import paths from nova.i18n import _ -from nova import paths cloudpipe_opts = [ cfg.StrOpt( diff --git a/nova/conf/crypto.py b/nova/conf/crypto.py index 060e94d9fb..116c547f4b 100644 --- a/nova/conf/crypto.py +++ b/nova/conf/crypto.py @@ -16,8 +16,8 @@ import os from oslo_config import cfg +from nova.conf import paths from nova.i18n import _ -from nova import paths crypto_opts_group = cfg.OptGroup( 'crypto', diff --git a/nova/conf/network.py b/nova/conf/network.py index f02457d0d0..e4cb57ac38 100644 --- a/nova/conf/network.py +++ b/nova/conf/network.py @@ -15,7 +15,7 @@ from oslo_config import cfg -from nova import paths +from nova.conf import paths network_opts = [ diff --git a/nova/paths.py b/nova/conf/paths.py similarity index 77% rename from nova/paths.py rename to nova/conf/paths.py index 4f683741da..519418dbc5 100644 --- a/nova/paths.py +++ b/nova/conf/paths.py @@ -23,7 +23,7 @@ from oslo_config import cfg path_opts = [ cfg.StrOpt('pybasedir', default=os.path.abspath(os.path.join(os.path.dirname(__file__), - '../')), + '../../')), help='Directory where the nova python module is installed'), cfg.StrOpt('bindir', default=os.path.join(sys.prefix, 'local', 'bin'), @@ -33,9 +33,6 @@ path_opts = [ help="Top-level directory for maintaining nova's state"), ] -CONF = cfg.CONF -CONF.register_opts(path_opts) - def basedir_def(*args): """Return an uninterpolated path relative to $pybasedir.""" @@ -52,16 +49,27 @@ def state_path_def(*args): return os.path.join('$state_path', *args) +# TODO(markus_z): This needs to be removed in a new patch. No one uses this. def basedir_rel(*args): """Return a path relative to $pybasedir.""" - return os.path.join(CONF.pybasedir, *args) + return os.path.join(cfg.CONF.pybasedir, *args) +# TODO(markus_z): This needs to be removed in a new patch. No one uses this. def bindir_rel(*args): """Return a path relative to $bindir.""" - return os.path.join(CONF.bindir, *args) + return os.path.join(cfg.CONF.bindir, *args) +# TODO(markus_z): This needs to be removed in a new patch. No one uses this. def state_path_rel(*args): """Return a path relative to $state_path.""" - return os.path.join(CONF.state_path, *args) + return os.path.join(cfg.CONF.state_path, *args) + + +def register_opts(conf): + conf.register_opts(path_opts) + + +def list_opts(): + return {"DEFAULT": path_opts} diff --git a/nova/conf/virt.py b/nova/conf/virt.py index 158c596870..d0b40b7c8c 100644 --- a/nova/conf/virt.py +++ b/nova/conf/virt.py @@ -14,7 +14,7 @@ from oslo_config import cfg -from nova import paths +from nova.conf import paths vcpu_pin_set = cfg.StrOpt( 'vcpu_pin_set', diff --git a/nova/conf/xvp.py b/nova/conf/xvp.py index e90d97796f..5f211cb435 100644 --- a/nova/conf/xvp.py +++ b/nova/conf/xvp.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from nova import paths +from nova.conf import paths from oslo_config import cfg diff --git a/nova/config.py b/nova/config.py index bdefd09f3d..ff25628c6e 100644 --- a/nova/config.py +++ b/nova/config.py @@ -21,8 +21,8 @@ from oslo_log import log from nova.common import config import nova.conf +from nova.conf import paths from nova.db.sqlalchemy import api as sqlalchemy_api -from nova import paths from nova import rpc from nova import version diff --git a/nova/opts.py b/nova/opts.py index 9892fe6335..c87f31d9a6 100644 --- a/nova/opts.py +++ b/nova/opts.py @@ -28,7 +28,6 @@ import nova.db.sqlalchemy.api import nova.exception import nova.image.download.file import nova.netconf -import nova.paths import nova.servicegroup.api import nova.spice import nova.volume @@ -46,7 +45,6 @@ def list_opts(): nova.db.sqlalchemy.api.db_opts, nova.exception.exc_log_opts, nova.netconf.netconf_opts, - nova.paths.path_opts, nova.volume._volume_opts, )), ('cinder', nova.volume.cinder.cinder_opts), diff --git a/nova/tests/functional/api_paste_fixture.py b/nova/tests/functional/api_paste_fixture.py index f7968b555b..1656189712 100644 --- a/nova/tests/functional/api_paste_fixture.py +++ b/nova/tests/functional/api_paste_fixture.py @@ -15,12 +15,12 @@ import os import fixtures -from oslo_config import cfg -from nova import paths +import nova.conf +from nova.conf import paths -CONF = cfg.CONF +CONF = nova.conf.CONF class ApiPasteV21Fixture(fixtures.Fixture): diff --git a/nova/tests/unit/conf_fixture.py b/nova/tests/unit/conf_fixture.py index 2b002cb490..90e9e5f17a 100644 --- a/nova/tests/unit/conf_fixture.py +++ b/nova/tests/unit/conf_fixture.py @@ -18,9 +18,9 @@ from oslo_config import fixture as config_fixture from oslo_policy import opts as policy_opts import nova.conf +from nova.conf import paths from nova import config from nova import ipv6 -from nova import paths from nova.tests.unit import utils CONF = nova.conf.CONF diff --git a/nova/tests/unit/policy_fixture.py b/nova/tests/unit/policy_fixture.py index 6ba189190c..49d3d65e87 100644 --- a/nova/tests/unit/policy_fixture.py +++ b/nova/tests/unit/policy_fixture.py @@ -15,16 +15,16 @@ import os import fixtures -from oslo_config import cfg from oslo_policy import policy as oslo_policy from oslo_serialization import jsonutils import six -from nova import paths +import nova.conf +from nova.conf import paths import nova.policy from nova.tests.unit import fake_policy -CONF = cfg.CONF +CONF = nova.conf.CONF class RealPolicyFixture(fixtures.Fixture): diff --git a/nova/virt/libvirt/volume/glusterfs.py b/nova/virt/libvirt/volume/glusterfs.py index f83776ef3c..e286f0d60e 100644 --- a/nova/virt/libvirt/volume/glusterfs.py +++ b/nova/virt/libvirt/volume/glusterfs.py @@ -16,13 +16,14 @@ from oslo_config import cfg from oslo_log import log as logging import six +import nova.conf +from nova.conf import paths from nova.i18n import _LE, _LW -from nova import paths from nova import utils from nova.virt.libvirt import utils as libvirt_utils from nova.virt.libvirt.volume import fs -CONF = cfg.CONF +CONF = nova.conf.CONF CONF.import_opt('qemu_allowed_storage_drivers', 'nova.virt.libvirt.volume.volume', group='libvirt') diff --git a/nova/virt/libvirt/volume/nfs.py b/nova/virt/libvirt/volume/nfs.py index d7d41050ef..caa3fe1036 100644 --- a/nova/virt/libvirt/volume/nfs.py +++ b/nova/virt/libvirt/volume/nfs.py @@ -16,8 +16,9 @@ from oslo_config import cfg from oslo_log import log as logging import six +import nova.conf +from nova.conf import paths from nova.i18n import _LE, _LW -from nova import paths from nova import utils from nova.virt.libvirt import utils as libvirt_utils from nova.virt.libvirt.volume import fs @@ -34,7 +35,7 @@ volume_opts = [ 'of the nfs man page for details'), ] -CONF = cfg.CONF +CONF = nova.conf.CONF CONF.register_opts(volume_opts, 'libvirt') diff --git a/nova/virt/libvirt/volume/quobyte.py b/nova/virt/libvirt/volume/quobyte.py index 199439be5d..52c01f4f53 100644 --- a/nova/virt/libvirt/volume/quobyte.py +++ b/nova/virt/libvirt/volume/quobyte.py @@ -22,11 +22,12 @@ from oslo_log import log as logging from oslo_utils import fileutils import six +import nova.conf +from nova.conf import paths from nova import exception as nova_exception from nova.i18n import _ from nova.i18n import _LE from nova.i18n import _LI -from nova import paths from nova import utils from nova.virt.libvirt import utils as libvirt_utils from nova.virt.libvirt.volume import fs @@ -42,7 +43,7 @@ volume_opts = [ help='Path to a Quobyte Client configuration file.'), ] -CONF = cfg.CONF +CONF = nova.conf.CONF CONF.register_opts(volume_opts, 'libvirt') SOURCE_PROTOCOL = 'quobyte' diff --git a/nova/virt/libvirt/volume/smbfs.py b/nova/virt/libvirt/volume/smbfs.py index eafc10d746..d59dcf13e5 100644 --- a/nova/virt/libvirt/volume/smbfs.py +++ b/nova/virt/libvirt/volume/smbfs.py @@ -14,7 +14,8 @@ import re from oslo_config import cfg -from nova import paths +import nova.conf +from nova.conf import paths from nova.virt.libvirt import utils as libvirt_utils from nova.virt.libvirt.volume import fs from nova.virt.libvirt.volume import remotefs @@ -31,7 +32,7 @@ volume_opts = [ 'libvirt-qemu uid and gid must be specified.'), ] -CONF = cfg.CONF +CONF = nova.conf.CONF CONF.register_opts(volume_opts, 'libvirt') USERNAME_REGEX = re.compile(r"(user(?:name)?)=(?:[^ ,]+\\)?([^ ,]+)")