Removal of unnecessary import_opts for cells config options

After centralizing cells options, importing nova.conf module is
enough for using cells options. import_opt(<opt_name>, <module>)
functions are not necessary.

Blueprint centralize-config-options

Change-Id: I9aabe8f2cc337c1237c2a73475cc1a3d3f4a1575
This commit is contained in:
Esra Celik 2016-02-12 14:16:54 +02:00
parent 8a74b3c517
commit f0d73175c7
17 changed files with 30 additions and 53 deletions

View File

@ -29,6 +29,7 @@ from webob import exc
from nova.compute import task_states from nova.compute import task_states
from nova.compute import utils as compute_utils from nova.compute import utils as compute_utils
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.i18n import _ from nova.i18n import _
from nova.i18n import _LE from nova.i18n import _LE
@ -49,14 +50,12 @@ osapi_opts = [
help='Base URL that will be presented to users in links ' help='Base URL that will be presented to users in links '
'to glance resources'), 'to glance resources'),
] ]
CONF = cfg.CONF CONF = nova.conf.CONF
CONF.register_opts(osapi_opts) CONF.register_opts(osapi_opts)
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
QUOTAS = quota.QUOTAS QUOTAS = quota.QUOTAS
CONF.import_opt('enable', 'nova.cells.opts', group='cells')
_STATE_MAP = { _STATE_MAP = {
vm_states.ACTIVE: { vm_states.ACTIVE: {

View File

@ -16,7 +16,6 @@
"""The cells extension.""" """The cells extension."""
from oslo_config import cfg
import oslo_messaging as messaging import oslo_messaging as messaging
from oslo_utils import strutils from oslo_utils import strutils
import six import six
@ -28,14 +27,13 @@ from nova.api.openstack import extensions
from nova.api.openstack import wsgi from nova.api.openstack import wsgi
from nova.api import validation from nova.api import validation
from nova.cells import rpcapi as cells_rpcapi from nova.cells import rpcapi as cells_rpcapi
import nova.conf
from nova import exception from nova import exception
from nova.i18n import _ from nova.i18n import _
from nova import rpc from nova import rpc
CONF = cfg.CONF CONF = nova.conf.CONF
CONF.import_opt('name', 'nova.cells.opts', group='cells')
CONF.import_opt('capabilities', 'nova.cells.opts', group='cells')
ALIAS = "os-cells" ALIAS = "os-cells"
authorize = extensions.os_compute_authorizer(ALIAS) authorize = extensions.os_compute_authorizer(ALIAS)

View File

@ -16,7 +16,6 @@
"""The cells extension.""" """The cells extension."""
from oslo_config import cfg
import oslo_messaging as messaging import oslo_messaging as messaging
from oslo_utils import strutils from oslo_utils import strutils
from oslo_utils import timeutils from oslo_utils import timeutils
@ -26,15 +25,14 @@ from webob import exc
from nova.api.openstack import common from nova.api.openstack import common
from nova.api.openstack import extensions from nova.api.openstack import extensions
from nova.cells import rpcapi as cells_rpcapi from nova.cells import rpcapi as cells_rpcapi
import nova.conf
from nova import context as nova_context from nova import context as nova_context
from nova import exception from nova import exception
from nova.i18n import _ from nova.i18n import _
from nova import rpc from nova import rpc
CONF = cfg.CONF CONF = nova.conf.CONF
CONF.import_opt('name', 'nova.cells.opts', group='cells')
CONF.import_opt('capabilities', 'nova.cells.opts', group='cells')
authorize = extensions.extension_authorizer('compute', 'cells') authorize = extensions.extension_authorizer('compute', 'cells')

View File

@ -17,19 +17,17 @@
import sys import sys
from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from oslo_reports import guru_meditation_report as gmr from oslo_reports import guru_meditation_report as gmr
import nova.conf
from nova import config from nova import config
from nova import objects from nova import objects
from nova import service from nova import service
from nova import utils from nova import utils
from nova import version from nova import version
CONF = cfg.CONF CONF = nova.conf.CONF
CONF.import_opt('topic', 'nova.cells.opts', group='cells')
CONF.import_opt('manager', 'nova.cells.opts', group='cells')
def main(): def main():

View File

@ -89,7 +89,6 @@ wrap_exception = functools.partial(exception.wrap_exception,
CONF = nova.conf.CONF CONF = nova.conf.CONF
CONF.import_opt('compute_topic', 'nova.compute.rpcapi') CONF.import_opt('compute_topic', 'nova.compute.rpcapi')
CONF.import_opt('enable', 'nova.cells.opts', group='cells')
MAX_USERDATA_SIZE = 65535 MAX_USERDATA_SIZE = 65535
RO_SECURITY_GROUPS = ['default'] RO_SECURITY_GROUPS = ['default']

View File

@ -268,7 +268,6 @@ CONF.import_opt('console_topic', 'nova.console.rpcapi')
CONF.import_opt('host', 'nova.netconf') CONF.import_opt('host', 'nova.netconf')
CONF.import_opt('enabled', 'nova.vnc', group='vnc') CONF.import_opt('enabled', 'nova.vnc', group='vnc')
CONF.import_opt('enabled', 'nova.spice', group='spice') CONF.import_opt('enabled', 'nova.spice', group='spice')
CONF.import_opt('enable', 'nova.cells.opts', group='cells')
CONF.import_opt('image_cache_manager_interval', 'nova.virt.imagecache') CONF.import_opt('image_cache_manager_interval', 'nova.virt.imagecache')
CONF.import_opt('enabled', 'nova.rdp', group='rdp') CONF.import_opt('enabled', 'nova.rdp', group='rdp')
CONF.import_opt('html5_proxy_base_url', 'nova.rdp', group='rdp') CONF.import_opt('html5_proxy_base_url', 'nova.rdp', group='rdp')

View File

@ -26,6 +26,7 @@ from oslo_serialization import jsonutils
from nova import cache_utils from nova import cache_utils
from nova.cells import rpcapi as cells_rpcapi from nova.cells import rpcapi as cells_rpcapi
from nova.compute import rpcapi as compute_rpcapi from nova.compute import rpcapi as compute_rpcapi
import nova.conf
from nova.i18n import _LI, _LW from nova.i18n import _LI, _LW
from nova import manager from nova import manager
from nova import objects from nova import objects
@ -39,9 +40,8 @@ consoleauth_opts = [
help='How many seconds before deleting tokens') help='How many seconds before deleting tokens')
] ]
CONF = cfg.CONF CONF = nova.conf.CONF
CONF.register_opts(consoleauth_opts) CONF.register_opts(consoleauth_opts)
CONF.import_opt('enable', 'nova.cells.opts', group='cells')
class ConsoleAuthManager(manager.Manager): class ConsoleAuthManager(manager.Manager):

View File

@ -12,12 +12,10 @@
# 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 import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
CONF = cfg.CONF CONF = nova.conf.CONF
CONF.import_opt('manager', 'nova.cells.opts', group='cells')
CONF.import_opt('osapi_compute_extension', CONF.import_opt('osapi_compute_extension',
'nova.api.openstack.compute.legacy_v2.extensions') 'nova.api.openstack.compute.legacy_v2.extensions')

View File

@ -13,15 +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 six.moves import range from six.moves import range
from nova.cells import state from nova.cells import state
import nova.conf
from nova.db.sqlalchemy import models from nova.db.sqlalchemy import models
from nova import exception from nova import exception
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
CONF = cfg.CONF CONF = nova.conf.CONF
CONF.import_opt('osapi_compute_extension', CONF.import_opt('osapi_compute_extension',
'nova.api.openstack.compute.legacy_v2.extensions') 'nova.api.openstack.compute.legacy_v2.extensions')

View File

@ -21,9 +21,9 @@ import random
import string import string
import uuid import uuid
from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
import nova.conf
import nova.image.glance import nova.image.glance
from nova import test from nova import test
from nova.tests import fixtures as nova_fixtures from nova.tests import fixtures as nova_fixtures
@ -31,9 +31,8 @@ from nova.tests.unit import cast_as_call
import nova.tests.unit.image.fake import nova.tests.unit.image.fake
CONF = cfg.CONF CONF = nova.conf.CONF
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
CONF.import_opt('manager', 'nova.cells.opts', group='cells')
def generate_random_alphanumeric(length): def generate_random_alphanumeric(length):

View File

@ -16,19 +16,17 @@
Fakes For Cells tests. Fakes For Cells tests.
""" """
from oslo_config import cfg
from nova.cells import driver from nova.cells import driver
from nova.cells import manager as cells_manager from nova.cells import manager as cells_manager
from nova.cells import state as cells_state from nova.cells import state as cells_state
from nova.cells import utils as cells_utils from nova.cells import utils as cells_utils
import nova.conf
import nova.db import nova.db
from nova.db import base from nova.db import base
from nova import exception from nova import exception
from nova import objects from nova import objects
CONF = cfg.CONF CONF = nova.conf.CONF
CONF.import_opt('name', 'nova.cells.opts', group='cells')
# Fake Cell Hierarchy # Fake Cell Hierarchy

View File

@ -19,12 +19,12 @@ import copy
import datetime import datetime
import mock import mock
from oslo_config import cfg
from oslo_utils import timeutils from oslo_utils import timeutils
from six.moves import range from six.moves import range
from nova.cells import messaging from nova.cells import messaging
from nova.cells import utils as cells_utils from nova.cells import utils as cells_utils
import nova.conf
from nova import context from nova import context
from nova import objects from nova import objects
from nova import test from nova import test
@ -33,7 +33,7 @@ from nova.tests.unit import fake_instance
from nova.tests.unit import fake_server_actions from nova.tests.unit import fake_server_actions
from nova.tests.unit.objects import test_flavor from nova.tests.unit.objects import test_flavor
CONF = cfg.CONF CONF = nova.conf.CONF
CONF.import_opt('compute_topic', 'nova.compute.rpcapi') CONF.import_opt('compute_topic', 'nova.compute.rpcapi')

View File

@ -21,7 +21,6 @@ import uuid
import mock import mock
from mox3 import mox from mox3 import mox
from oslo_config import cfg
import oslo_messaging import oslo_messaging
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
from oslo_utils import timeutils from oslo_utils import timeutils
@ -32,6 +31,7 @@ from nova.cells import rpcapi as cells_rpcapi
from nova.cells import utils as cells_utils from nova.cells import utils as cells_utils
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 context from nova import context
from nova import db from nova import db
from nova import exception from nova import exception
@ -44,8 +44,7 @@ from nova.tests.unit.cells import fakes
from nova.tests.unit import fake_instance from nova.tests.unit import fake_instance
from nova.tests.unit import fake_server_actions from nova.tests.unit import fake_server_actions
CONF = cfg.CONF CONF = nova.conf.CONF
CONF.import_opt('name', 'nova.cells.opts', group='cells')
class CellsMessageClassesTestCase(test.NoDBTestCase): class CellsMessageClassesTestCase(test.NoDBTestCase):

View File

@ -19,19 +19,17 @@ Tests For Cells RPC Communication Driver
import mock import mock
from mox3 import mox from mox3 import mox
from oslo_config import cfg
import oslo_messaging import oslo_messaging
from nova.cells import messaging from nova.cells import messaging
from nova.cells import rpc_driver from nova.cells import rpc_driver
import nova.conf
from nova import context from nova import context
from nova import rpc from nova import rpc
from nova import test from nova import test
from nova.tests.unit.cells import fakes from nova.tests.unit.cells import fakes
CONF = cfg.CONF CONF = nova.conf.CONF
CONF.import_opt('rpc_driver_queue_base', 'nova.cells.rpc_driver',
group='cells')
class CellsRPCDriverTestCase(test.NoDBTestCase): class CellsRPCDriverTestCase(test.NoDBTestCase):

View File

@ -16,17 +16,16 @@
Tests For Cells RPCAPI Tests For Cells RPCAPI
""" """
from oslo_config import cfg
import six import six
from nova.cells import rpcapi as cells_rpcapi from nova.cells import rpcapi as cells_rpcapi
import nova.conf
from nova import exception from nova import exception
from nova import objects from nova import objects
from nova import test from nova import test
from nova.tests.unit import fake_instance from nova.tests.unit import fake_instance
CONF = cfg.CONF CONF = nova.conf.CONF
CONF.import_opt('topic', 'nova.cells.opts', group='cells')
class CellsAPITestCase(test.NoDBTestCase): class CellsAPITestCase(test.NoDBTestCase):

View File

@ -18,13 +18,13 @@ Tests For CellsScheduler
import copy import copy
import time import time
from oslo_config import cfg
from oslo_utils import uuidutils from oslo_utils import uuidutils
from nova import block_device from nova import block_device
from nova.cells import filters from nova.cells import filters
from nova.cells import weights from nova.cells import weights
from nova.compute import vm_states from nova.compute import vm_states
import nova.conf
from nova import context from nova import context
from nova import db from nova import db
from nova import exception from nova import exception
@ -35,12 +35,7 @@ from nova.tests.unit.cells import fakes
from nova.tests.unit import fake_block_device from nova.tests.unit import fake_block_device
from nova import utils from nova import utils
CONF = cfg.CONF CONF = nova.conf.CONF
CONF.import_opt('scheduler_retries', 'nova.cells.scheduler', group='cells')
CONF.import_opt('scheduler_filter_classes', 'nova.cells.scheduler',
group='cells')
CONF.import_opt('scheduler_weight_classes', 'nova.cells.scheduler',
group='cells')
class FakeFilterClass1(filters.BaseCellFilter): class FakeFilterClass1(filters.BaseCellFilter):

View File

@ -20,7 +20,6 @@ import inspect
import mock import mock
from mox3 import mox from mox3 import mox
from oslo_config import cfg
from oslo_utils import timeutils from oslo_utils import timeutils
from nova import block_device from nova import block_device
@ -30,6 +29,7 @@ from nova.compute import cells_api as compute_cells_api
from nova.compute import flavors from nova.compute import flavors
from nova.compute import utils as compute_utils from nova.compute import utils as compute_utils
from nova.compute import vm_states from nova.compute import vm_states
import nova.conf
from nova import context from nova import context
from nova import db from nova import db
from nova import exception from nova import exception
@ -43,7 +43,7 @@ from nova.tests import uuidsentinel as uuids
ORIG_COMPUTE_API = None ORIG_COMPUTE_API = None
cfg.CONF.import_opt('enable', 'nova.cells.opts', group='cells') CONF = nova.conf.CONF
def stub_call_to_cells(context, instance, method, *args, **kwargs): def stub_call_to_cells(context, instance, method, *args, **kwargs):