Use CONF.import_opt() for nova.config opts

The only reason for importing nova.config now is where one of the
options defined in that file is needed. Rather than importing
nova.config using an import statement, use CONF.import_opt() so
that it is clear which option we actually require.

In future, we will move many options out of nova.config so many
of these import_opt() calls will either go away or cause a module
other than nova.config to be imported.

Change-Id: I0646efddecdf2530903afd50c1f4364cb1d5dce1
This commit is contained in:
Mark McLoughlin
2012-11-17 22:50:21 +00:00
parent 1573b2794c
commit 09cc03b31b
15 changed files with 23 additions and 6 deletions

View File

@@ -50,6 +50,7 @@ from nova.vnc import xvp_proxy
CONF = cfg.CONF
CONF.import_opt('enabled_apis', 'nova.config')
LOG = logging.getLogger('nova.all')
if __name__ == '__main__':

View File

@@ -43,6 +43,7 @@ from nova import service
from nova import utils
CONF = cfg.CONF
CONF.import_opt('enabled_apis', 'nova.config')
if __name__ == '__main__':
config.parse_args(sys.argv)

View File

@@ -39,6 +39,7 @@ from nova import service
from nova import utils
CONF = cfg.CONF
CONF.import_opt('cert_topic', 'nova.config')
if __name__ == '__main__':
config.parse_args(sys.argv)

View File

@@ -48,6 +48,7 @@ from nova import service
from nova import utils
CONF = cfg.CONF
CONF.import_opt('compute_topic', 'nova.config')
if __name__ == '__main__':
config.parse_args(sys.argv)

View File

@@ -39,6 +39,7 @@ from nova.openstack.common import log as logging
from nova import service
CONF = cfg.CONF
CONF.import_opt('console_topic', 'nova.config')
if __name__ == '__main__':
config.parse_args(sys.argv)

View File

@@ -47,6 +47,8 @@ from nova.openstack.common import rpc
from nova import utils
CONF = cfg.CONF
CONF.import_opt('host', 'nova.config')
CONF.import_opt('network_manager', 'nova.config')
LOG = logging.getLogger('nova.dhcpbridge')

View File

@@ -89,6 +89,8 @@ from nova import utils
from nova import version
CONF = cfg.CONF
CONF.import_opt('network_manager', 'nova.config')
CONF.import_opt('service_down_time', 'nova.config')
CONF.import_opt('flat_network_bridge', 'nova.network.manager')
CONF.import_opt('num_networks', 'nova.network.manager')
CONF.import_opt('multi_host', 'nova.network.manager')

View File

@@ -41,6 +41,7 @@ from nova import service
from nova import utils
CONF = cfg.CONF
CONF.import_opt('network_topic', 'nova.config')
if __name__ == '__main__':
config.parse_args(sys.argv)

View File

@@ -43,6 +43,7 @@ from nova import service
from nova import utils
CONF = cfg.CONF
CONF.import_opt('scheduler_topic', 'nova.config')
if __name__ == '__main__':
config.parse_args(sys.argv)

View File

@@ -18,12 +18,12 @@
Client side of the scheduler manager RPC API.
"""
from nova import config
from nova.openstack.common import cfg
from nova.openstack.common import jsonutils
import nova.openstack.common.rpc.proxy
CONF = cfg.CONF
CONF.import_opt('scheduler_topic', 'nova.config')
class SchedulerAPI(nova.openstack.common.rpc.proxy.RpcProxy):

View File

@@ -16,10 +16,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from nova import config
from nova.openstack.common import cfg
CONF = cfg.CONF
CONF.import_opt('state_path', 'nova.config')
CONF.import_opt('scheduler_driver', 'nova.scheduler.manager')
CONF.import_opt('fake_network', 'nova.network.manager')

View File

@@ -18,7 +18,6 @@
Unit Tests for nova.scheduler.rpcapi
"""
from nova import config
from nova import context
from nova.openstack.common import cfg
from nova.openstack.common import rpc
@@ -26,6 +25,7 @@ from nova.scheduler import rpcapi as scheduler_rpcapi
from nova import test
CONF = cfg.CONF
CONF.import_opt('scheduler_topic', 'nova.config')
class SchedulerRpcAPITestCase(test.TestCase):

View File

@@ -27,7 +27,6 @@ from nova import test
from nova.compute import manager as compute_manager
from nova.compute import vm_states
from nova import config
from nova import db
from nova.openstack.common import cfg
from nova.openstack.common import importutils
@@ -37,6 +36,8 @@ from nova.virt.libvirt import imagecache
from nova.virt.libvirt import utils as virtutils
CONF = cfg.CONF
CONF.import_opt('compute_manager', 'nova.config')
CONF.import_opt('host', 'nova.config')
LOG = log.getLogger(__name__)

View File

@@ -33,7 +33,6 @@ from nova.compute import instance_types
from nova.compute import power_state
from nova.compute import vm_mode
from nova.compute import vm_states
from nova import config
from nova import context
from nova import db
from nova import exception
@@ -71,6 +70,9 @@ libvirt_driver.libvirt = libvirt
CONF = cfg.CONF
CONF.import_opt('compute_manager', 'nova.config')
CONF.import_opt('host', 'nova.config')
CONF.import_opt('my_ip', 'nova.config')
LOG = logging.getLogger(__name__)
_fake_network_info = fake_network.fake_get_instance_nw_info

View File

@@ -29,7 +29,6 @@ from nova.compute import instance_types
from nova.compute import power_state
from nova.compute import task_states
from nova.compute import vm_states
from nova import config
from nova import context
from nova import db
from nova import exception
@@ -58,6 +57,10 @@ from nova.virt.xenapi import volume_utils
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
CONF.import_opt('compute_manager', 'nova.config')
CONF.import_opt('host', 'nova.config')
CONF.import_opt('network_manager', 'nova.config')
CONF.import_opt('node_availability_zone', 'nova.config')
IMAGE_MACHINE = '1'
IMAGE_KERNEL = '2'