Removal of unnecessary import_opts for centralized config options

Importing nova.conf module is enough when using centralized config
options. import_opt(<opt_name>, <module>) functions are not necessary.

Blueprint centralize-config-options

Change-Id: I1c23b042dfdc6b9e77cba3c1ddf31adbfa892877
This commit is contained in:
Esra Celik 2016-02-12 15:42:52 +02:00 committed by esracelik
parent c4763d46fe
commit e30c75bae0
9 changed files with 8 additions and 60 deletions

View File

@ -39,21 +39,6 @@ node_ext_fields = ['uuid', 'task_state', 'updated_at', 'pxe_config_path']
interface_fields = ['id', 'address', 'datapath_id', 'port_no'] interface_fields = ['id', 'address', 'datapath_id', 'port_no']
CONF = nova.conf.CONF CONF = nova.conf.CONF
CONF.import_opt('api_version',
'nova.virt.ironic.driver',
group='ironic')
CONF.import_opt('api_endpoint',
'nova.virt.ironic.driver',
group='ironic')
CONF.import_opt('admin_username',
'nova.virt.ironic.driver',
group='ironic')
CONF.import_opt('admin_password',
'nova.virt.ironic.driver',
group='ironic')
CONF.import_opt('admin_tenant_name',
'nova.virt.ironic.driver',
group='ironic')
def _check_ironic_client_enabled(): def _check_ironic_client_enabled():

View File

@ -36,21 +36,6 @@ node_ext_fields = ['uuid', 'task_state', 'updated_at', 'pxe_config_path']
interface_fields = ['id', 'address', 'datapath_id', 'port_no'] interface_fields = ['id', 'address', 'datapath_id', 'port_no']
CONF = nova.conf.CONF CONF = nova.conf.CONF
CONF.import_opt('api_version',
'nova.virt.ironic.driver',
group='ironic')
CONF.import_opt('api_endpoint',
'nova.virt.ironic.driver',
group='ironic')
CONF.import_opt('admin_username',
'nova.virt.ironic.driver',
group='ironic')
CONF.import_opt('admin_password',
'nova.virt.ironic.driver',
group='ironic')
CONF.import_opt('admin_tenant_name',
'nova.virt.ironic.driver',
group='ironic')
def _check_ironic_client_enabled(): def _check_ironic_client_enabled():

View File

@ -273,8 +273,6 @@ CONF.import_opt('html5_proxy_base_url', 'nova.rdp', group='rdp')
CONF.import_opt('enabled', 'nova.mks', group='mks') CONF.import_opt('enabled', 'nova.mks', group='mks')
CONF.import_opt('mksproxy_base_url', 'nova.mks', group='mks') CONF.import_opt('mksproxy_base_url', 'nova.mks', group='mks')
CONF.import_opt('destroy_after_evacuate', 'nova.utils', group='workarounds') CONF.import_opt('destroy_after_evacuate', 'nova.utils', group='workarounds')
CONF.import_opt('scheduler_tracks_instance_changes',
'nova.scheduler.host_manager')
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -13,18 +13,15 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
import nova.conf
from nova.scheduler import filters from nova.scheduler import filters
from nova.scheduler import utils from nova.scheduler import utils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
CONF = cfg.CONF CONF = nova.conf.CONF
CONF.import_opt('weight_setting',
'nova.scheduler.weights.metrics',
group='metrics')
class MetricsFilter(filters.BaseHostFilter): class MetricsFilter(filters.BaseHostFilter):

View File

@ -20,14 +20,13 @@ import copy
import datetime import datetime
import uuid import uuid
from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from nova.compute import arch from nova.compute import arch
import nova.conf
from nova import exception from nova import exception
CONF = cfg.CONF CONF = nova.conf.CONF
CONF.import_opt('null_kernel', 'nova.compute.api')
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
AUTO_DISK_CONFIG_ENABLED_IMAGE_UUID = '70a599e0-31e7-49b7-b260-868f441e862b' AUTO_DISK_CONFIG_ENABLED_IMAGE_UUID = '70a599e0-31e7-49b7-b260-868f441e862b'

View File

@ -20,7 +20,6 @@ import collections
import datetime import datetime
import mock import mock
from oslo_config import cfg
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
from oslo_utils import versionutils from oslo_utils import versionutils
import six import six
@ -28,6 +27,7 @@ import six
import nova import nova
from nova.compute import task_states from nova.compute import task_states
from nova.compute import vm_states from nova.compute import vm_states
import nova.conf
from nova import exception from nova import exception
from nova import objects from nova import objects
from nova.objects import base as obj_base from nova.objects import base as obj_base
@ -41,9 +41,7 @@ from nova.tests.unit import matchers
from nova.tests.unit.scheduler import fakes from nova.tests.unit.scheduler import fakes
from nova.tests import uuidsentinel as uuids from nova.tests import uuidsentinel as uuids
CONF = cfg.CONF CONF = nova.conf.CONF
CONF.import_opt('scheduler_tracks_instance_changes',
'nova.scheduler.host_manager')
class FakeFilterClass1(filters.BaseHostFilter): class FakeFilterClass1(filters.BaseHostFilter):

View File

@ -16,19 +16,18 @@
"""Tests for the testing base code.""" """Tests for the testing base code."""
from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
import oslo_messaging as messaging import oslo_messaging as messaging
import six import six
import nova.conf
from nova import rpc from nova import rpc
from nova import test from nova import test
from nova.tests import fixtures from nova.tests import fixtures
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
CONF = cfg.CONF CONF = nova.conf.CONF
CONF.import_opt('use_local', 'nova.conductor.api', group='conductor')
class IsolationTestCase(test.TestCase): class IsolationTestCase(test.TestCase):

View File

@ -314,15 +314,8 @@ CONF = nova.conf.CONF
CONF.register_opts(libvirt_opts, 'libvirt') CONF.register_opts(libvirt_opts, 'libvirt')
CONF.import_opt('host', 'nova.netconf') CONF.import_opt('host', 'nova.netconf')
CONF.import_opt('my_ip', 'nova.netconf') CONF.import_opt('my_ip', 'nova.netconf')
CONF.import_opt('enabled', 'nova.compute.api',
group='ephemeral_storage_encryption')
CONF.import_opt('cipher', 'nova.compute.api',
group='ephemeral_storage_encryption')
CONF.import_opt('key_size', 'nova.compute.api',
group='ephemeral_storage_encryption')
CONF.import_opt('live_migration_retry_count', 'nova.compute.manager') CONF.import_opt('live_migration_retry_count', 'nova.compute.manager')
CONF.import_opt('server_proxyclient_address', 'nova.spice', group='spice') CONF.import_opt('server_proxyclient_address', 'nova.spice', group='spice')
CONF.import_opt('vcpu_pin_set', 'nova.conf.virt')
CONF.import_opt('hw_disk_discard', 'nova.virt.libvirt.imagebackend', CONF.import_opt('hw_disk_discard', 'nova.virt.libvirt.imagebackend',
group='libvirt') group='libvirt')
CONF.import_group('workarounds', 'nova.utils') CONF.import_group('workarounds', 'nova.utils')

View File

@ -74,12 +74,6 @@ __imagebackend_opts = [
CONF = nova.conf.CONF CONF = nova.conf.CONF
CONF.register_opts(__imagebackend_opts, 'libvirt') CONF.register_opts(__imagebackend_opts, 'libvirt')
CONF.import_opt('image_cache_subdirectory_name', 'nova.virt.imagecache') CONF.import_opt('image_cache_subdirectory_name', 'nova.virt.imagecache')
CONF.import_opt('enabled', 'nova.compute.api',
group='ephemeral_storage_encryption')
CONF.import_opt('cipher', 'nova.compute.api',
group='ephemeral_storage_encryption')
CONF.import_opt('key_size', 'nova.compute.api',
group='ephemeral_storage_encryption')
CONF.import_opt('rbd_user', 'nova.virt.libvirt.volume.net', group='libvirt') CONF.import_opt('rbd_user', 'nova.virt.libvirt.volume.net', group='libvirt')
CONF.import_opt('rbd_secret_uuid', 'nova.virt.libvirt.volume.net', CONF.import_opt('rbd_secret_uuid', 'nova.virt.libvirt.volume.net',
group='libvirt') group='libvirt')