Merge "Config options: centralize base path configuration"
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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)
|
||||
|
@@ -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(
|
||||
|
@@ -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',
|
||||
|
@@ -15,7 +15,7 @@
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from nova import paths
|
||||
from nova.conf import paths
|
||||
|
||||
|
||||
network_opts = [
|
||||
|
@@ -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}
|
@@ -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',
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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),
|
||||
|
@@ -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):
|
||||
|
@@ -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
|
||||
|
@@ -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):
|
||||
|
@@ -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')
|
||||
|
@@ -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')
|
||||
|
||||
|
||||
|
@@ -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'
|
||||
|
@@ -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)?)=(?:[^ ,]+\\)?([^ ,]+)")
|
||||
|
Reference in New Issue
Block a user