Remove flags.DECLARE
The cfg.ConfigOpts class has an equivalent method, so lets use that. Change-Id: I5860230336d00d7531a0ffd255c766ff77661625
This commit is contained in:
parent
efede80046
commit
8ce58defbe
@ -90,14 +90,16 @@ from nova import utils
|
||||
from nova import version
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
flags.DECLARE('flat_network_bridge', 'nova.network.manager')
|
||||
flags.DECLARE('num_networks', 'nova.network.manager')
|
||||
flags.DECLARE('multi_host', 'nova.network.manager')
|
||||
flags.DECLARE('network_size', 'nova.network.manager')
|
||||
flags.DECLARE('vlan_start', 'nova.network.manager')
|
||||
flags.DECLARE('vpn_start', 'nova.network.manager')
|
||||
flags.DECLARE('default_floating_pool', 'nova.network.manager')
|
||||
flags.DECLARE('public_interface', 'nova.network.linux_net')
|
||||
|
||||
CONF = config.CONF
|
||||
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')
|
||||
CONF.import_opt('network_size', 'nova.network.manager')
|
||||
CONF.import_opt('vlan_start', 'nova.network.manager')
|
||||
CONF.import_opt('vpn_start', 'nova.network.manager')
|
||||
CONF.import_opt('default_floating_pool', 'nova.network.manager')
|
||||
CONF.import_opt('public_interface', 'nova.network.linux_net')
|
||||
|
||||
QUOTAS = quota.QUOTAS
|
||||
|
||||
|
@ -31,6 +31,7 @@ from nova.api.ec2 import apirequest
|
||||
from nova.api.ec2 import ec2utils
|
||||
from nova.api.ec2 import faults
|
||||
from nova.api import validator
|
||||
from nova import config
|
||||
from nova import context
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
@ -74,7 +75,8 @@ ec2_opts = [
|
||||
FLAGS = flags.FLAGS
|
||||
FLAGS.register_opts(ec2_opts)
|
||||
|
||||
flags.DECLARE('use_forwarded_for', 'nova.api.auth')
|
||||
CONF = config.CONF
|
||||
CONF.import_opt('use_forwarded_for', 'nova.api.auth')
|
||||
|
||||
|
||||
def ec2_error(req, request_id, code, message):
|
||||
|
@ -24,6 +24,7 @@ import os
|
||||
|
||||
from nova.api.ec2 import ec2utils
|
||||
from nova import block_device
|
||||
from nova import config
|
||||
from nova import context
|
||||
from nova import db
|
||||
from nova import flags
|
||||
@ -41,8 +42,9 @@ metadata_opts = [
|
||||
]
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
flags.DECLARE('dhcp_domain', 'nova.network.manager')
|
||||
FLAGS.register_opts(metadata_opts)
|
||||
CONF = config.CONF
|
||||
CONF.import_opt('dhcp_domain', 'nova.network.manager')
|
||||
|
||||
|
||||
VERSIONS = [
|
||||
|
@ -23,6 +23,7 @@ import webob.dec
|
||||
import webob.exc
|
||||
|
||||
from nova.api.metadata import base
|
||||
from nova import config
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova.openstack.common import log as logging
|
||||
@ -30,7 +31,8 @@ from nova import wsgi
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
FLAGS = flags.FLAGS
|
||||
flags.DECLARE('use_forwarded_for', 'nova.api.auth')
|
||||
CONF = config.CONF
|
||||
CONF.import_opt('use_forwarded_for', 'nova.api.auth')
|
||||
|
||||
if FLAGS.memcached_servers:
|
||||
import memcache
|
||||
|
@ -21,6 +21,7 @@ import webob.dec
|
||||
import webob.exc
|
||||
|
||||
from nova.api.openstack import wsgi
|
||||
from nova import config
|
||||
from nova import context
|
||||
from nova import flags
|
||||
from nova.openstack.common import log as logging
|
||||
@ -28,7 +29,8 @@ from nova import wsgi as base_wsgi
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
FLAGS = flags.FLAGS
|
||||
flags.DECLARE('use_forwarded_for', 'nova.api.auth')
|
||||
CONF = config.CONF
|
||||
CONF.import_opt('use_forwarded_for', 'nova.api.auth')
|
||||
|
||||
|
||||
class NoAuthMiddleware(base_wsgi.Middleware):
|
||||
|
@ -28,6 +28,7 @@ import zipfile
|
||||
|
||||
from nova import compute
|
||||
from nova.compute import instance_types
|
||||
from nova import config
|
||||
from nova import crypto
|
||||
from nova import db
|
||||
from nova import exception
|
||||
@ -53,7 +54,9 @@ cloudpipe_opts = [
|
||||
help=_('Netmask to push into openvpn config')),
|
||||
]
|
||||
|
||||
flags.DECLARE('cnt_vpn_clients', 'nova.network.manager')
|
||||
CONF = config.CONF
|
||||
CONF.import_opt('cnt_vpn_clients', 'nova.network.manager')
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
FLAGS.register_opts(cloudpipe_opts)
|
||||
|
||||
|
@ -35,6 +35,7 @@ from nova.compute import rpcapi as compute_rpcapi
|
||||
from nova.compute import task_states
|
||||
from nova.compute import utils as compute_utils
|
||||
from nova.compute import vm_states
|
||||
from nova import config
|
||||
from nova.consoleauth import rpcapi as consoleauth_rpcapi
|
||||
from nova import crypto
|
||||
from nova.db import base
|
||||
@ -58,7 +59,8 @@ from nova import volume
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
flags.DECLARE('consoleauth_topic', 'nova.consoleauth')
|
||||
CONF = config.CONF
|
||||
CONF.import_opt('consoleauth_topic', 'nova.consoleauth')
|
||||
|
||||
MAX_USERDATA_SIZE = 65535
|
||||
QUOTAS = quota.QUOTAS
|
||||
|
@ -36,17 +36,6 @@ from nova.openstack.common import cfg
|
||||
FLAGS = cfg.CONF
|
||||
|
||||
|
||||
class UnrecognizedFlag(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def DECLARE(name, module_string, flag_values=FLAGS):
|
||||
if module_string not in sys.modules:
|
||||
__import__(module_string, globals(), locals())
|
||||
if name not in flag_values:
|
||||
raise UnrecognizedFlag('%s not defined by %s' % (name, module_string))
|
||||
|
||||
|
||||
def _get_my_ip():
|
||||
"""
|
||||
Returns the actual ip of the local machine.
|
||||
|
@ -17,6 +17,7 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
from nova.compute import api as compute_api
|
||||
from nova import config
|
||||
from nova.db import base
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
@ -51,7 +52,8 @@ quantum_opts = [
|
||||
'quantum in admin context'),
|
||||
]
|
||||
|
||||
flags.DECLARE('default_floating_pool', 'nova.network.manager')
|
||||
CONF = config.CONF
|
||||
CONF.import_opt('default_floating_pool', 'nova.network.manager')
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
FLAGS.register_opts(quantum_opts)
|
||||
|
@ -28,6 +28,7 @@ from nova.compute import power_state
|
||||
from nova.compute import rpcapi as compute_rpcapi
|
||||
from nova.compute import utils as compute_utils
|
||||
from nova.compute import vm_states
|
||||
from nova import config
|
||||
from nova import db
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
@ -55,8 +56,9 @@ scheduler_driver_opts = [
|
||||
FLAGS = flags.FLAGS
|
||||
FLAGS.register_opts(scheduler_driver_opts)
|
||||
|
||||
flags.DECLARE('instances_path', 'nova.compute.manager')
|
||||
flags.DECLARE('libvirt_type', 'nova.virt.libvirt.driver')
|
||||
CONF = config.CONF
|
||||
CONF.import_opt('instances_path', 'nova.compute.manager')
|
||||
CONF.import_opt('libvirt_type', 'nova.virt.libvirt.driver')
|
||||
|
||||
|
||||
def handle_schedule_error(context, ex, instance_uuid, request_spec):
|
||||
|
@ -36,6 +36,7 @@ from nova.compute import rpcapi as compute_rpcapi
|
||||
from nova.compute import task_states
|
||||
from nova.compute import utils as compute_utils
|
||||
from nova.compute import vm_states
|
||||
from nova import config
|
||||
from nova import context
|
||||
from nova import db
|
||||
from nova import exception
|
||||
@ -66,7 +67,8 @@ from nova.volume import cinder
|
||||
QUOTAS = quota.QUOTAS
|
||||
LOG = logging.getLogger(__name__)
|
||||
FLAGS = flags.FLAGS
|
||||
flags.DECLARE('live_migration_retry_count', 'nova.compute.manager')
|
||||
CONF = config.CONF
|
||||
CONF.import_opt('live_migration_retry_count', 'nova.compute.manager')
|
||||
|
||||
|
||||
FAKE_IMAGE_REF = 'fake-image-ref'
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
"""Tests For Console proxy."""
|
||||
|
||||
from nova import config
|
||||
from nova.console import api as console_api
|
||||
from nova.console import rpcapi as console_rpcapi
|
||||
from nova import context
|
||||
@ -29,7 +30,8 @@ from nova.openstack.common import rpc
|
||||
from nova import test
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
flags.DECLARE('console_driver', 'nova.console.manager')
|
||||
CONF = config.CONF
|
||||
CONF.import_opt('console_driver', 'nova.console.manager')
|
||||
|
||||
|
||||
class ConsoleTestCase(test.TestCase):
|
||||
|
@ -16,16 +16,17 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from nova import config
|
||||
from nova import flags
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
CONF = config.CONF
|
||||
|
||||
flags.DECLARE('scheduler_driver', 'nova.scheduler.manager')
|
||||
flags.DECLARE('fake_network', 'nova.network.manager')
|
||||
flags.DECLARE('iscsi_num_targets', 'nova.volume.driver')
|
||||
flags.DECLARE('network_size', 'nova.network.manager')
|
||||
flags.DECLARE('num_networks', 'nova.network.manager')
|
||||
flags.DECLARE('policy_file', 'nova.policy')
|
||||
CONF.import_opt('scheduler_driver', 'nova.scheduler.manager')
|
||||
CONF.import_opt('fake_network', 'nova.network.manager')
|
||||
CONF.import_opt('iscsi_num_targets', 'nova.volume.driver')
|
||||
CONF.import_opt('network_size', 'nova.network.manager')
|
||||
CONF.import_opt('num_networks', 'nova.network.manager')
|
||||
CONF.import_opt('policy_file', 'nova.policy')
|
||||
|
||||
|
||||
def set_defaults(conf):
|
||||
|
@ -22,6 +22,7 @@ from nova import flags
|
||||
from nova.openstack.common import cfg
|
||||
from nova import test
|
||||
|
||||
CONF = config.CONF
|
||||
FLAGS = flags.FLAGS
|
||||
FLAGS.register_opt(cfg.StrOpt('flags_unittest',
|
||||
default='foo',
|
||||
@ -30,16 +31,16 @@ FLAGS.register_opt(cfg.StrOpt('flags_unittest',
|
||||
|
||||
class FlagsTestCase(test.TestCase):
|
||||
def test_declare(self):
|
||||
self.assert_('answer' not in FLAGS)
|
||||
flags.DECLARE('answer', 'nova.tests.declare_flags')
|
||||
self.assert_('answer' in FLAGS)
|
||||
self.assertEqual(FLAGS.answer, 42)
|
||||
self.assert_('answer' not in CONF)
|
||||
CONF.import_opt('answer', 'nova.tests.declare_flags')
|
||||
self.assert_('answer' in CONF)
|
||||
self.assertEqual(CONF.answer, 42)
|
||||
|
||||
# Make sure we don't overwrite anything
|
||||
FLAGS.set_override('answer', 256)
|
||||
self.assertEqual(FLAGS.answer, 256)
|
||||
flags.DECLARE('answer', 'nova.tests.declare_flags')
|
||||
self.assertEqual(FLAGS.answer, 256)
|
||||
CONF.set_override('answer', 256)
|
||||
self.assertEqual(CONF.answer, 256)
|
||||
CONF.import_opt('answer', 'nova.tests.declare_flags')
|
||||
self.assertEqual(CONF.answer, 256)
|
||||
|
||||
def test_getopt_non_interspersed_args(self):
|
||||
self.assert_('runtime_answer' not in FLAGS)
|
||||
|
@ -60,6 +60,7 @@ from nova import block_device
|
||||
from nova.compute import instance_types
|
||||
from nova.compute import power_state
|
||||
from nova.compute import vm_mode
|
||||
from nova import config
|
||||
from nova import context as nova_context
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
@ -75,7 +76,7 @@ from nova.virt import configdrive
|
||||
from nova.virt.disk import api as disk
|
||||
from nova.virt import driver
|
||||
from nova.virt import firewall
|
||||
from nova.virt.libvirt import config
|
||||
from nova.virt.libvirt import config as vconfig
|
||||
from nova.virt.libvirt import firewall as libvirt_firewall
|
||||
from nova.virt.libvirt import imagebackend
|
||||
from nova.virt.libvirt import imagecache
|
||||
@ -187,8 +188,9 @@ libvirt_opts = [
|
||||
FLAGS = flags.FLAGS
|
||||
FLAGS.register_opts(libvirt_opts)
|
||||
|
||||
flags.DECLARE('live_migration_retry_count', 'nova.compute.manager')
|
||||
flags.DECLARE('vncserver_proxyclient_address', 'nova.vnc')
|
||||
CONF = config.CONF
|
||||
CONF.import_opt('live_migration_retry_count', 'nova.compute.manager')
|
||||
CONF.import_opt('vncserver_proxyclient_address', 'nova.vnc')
|
||||
|
||||
DEFAULT_FIREWALL_DRIVER = "%s.%s" % (
|
||||
libvirt_firewall.__name__,
|
||||
@ -1467,7 +1469,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
the capabilities of the host"""
|
||||
xmlstr = self._conn.getCapabilities()
|
||||
|
||||
caps = config.LibvirtConfigCaps()
|
||||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.parse_str(xmlstr)
|
||||
return caps
|
||||
|
||||
@ -1478,7 +1480,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
|
||||
caps = self.get_host_capabilities()
|
||||
hostcpu = caps.host.cpu
|
||||
guestcpu = config.LibvirtConfigGuestCPU()
|
||||
guestcpu = vconfig.LibvirtConfigGuestCPU()
|
||||
|
||||
guestcpu.model = hostcpu.model
|
||||
guestcpu.vendor = hostcpu.vendor
|
||||
@ -1487,7 +1489,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
guestcpu.match = "exact"
|
||||
|
||||
for hostfeat in hostcpu.features:
|
||||
guestfeat = config.LibvirtConfigGuestCPUFeature(hostfeat.name)
|
||||
guestfeat = vconfig.LibvirtConfigGuestCPUFeature(hostfeat.name)
|
||||
guestfeat.policy = "require"
|
||||
|
||||
return guestcpu
|
||||
@ -1527,11 +1529,11 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
# updated to be at least this new, we can kill off the elif
|
||||
# blocks here
|
||||
if self.has_min_version(MIN_LIBVIRT_HOST_CPU_VERSION):
|
||||
cpu = config.LibvirtConfigGuestCPU()
|
||||
cpu = vconfig.LibvirtConfigGuestCPU()
|
||||
cpu.mode = mode
|
||||
cpu.model = model
|
||||
elif mode == "custom":
|
||||
cpu = config.LibvirtConfigGuestCPU()
|
||||
cpu = vconfig.LibvirtConfigGuestCPU()
|
||||
cpu.model = model
|
||||
elif mode == "host-model":
|
||||
cpu = self.get_host_cpu_for_guest()
|
||||
@ -1552,7 +1554,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
block_device_info)
|
||||
|
||||
if FLAGS.libvirt_type == "lxc":
|
||||
fs = config.LibvirtConfigGuestFilesys()
|
||||
fs = vconfig.LibvirtConfigGuestFilesys()
|
||||
fs.source_type = "mount"
|
||||
fs.source_dir = os.path.join(FLAGS.instances_path,
|
||||
instance['name'],
|
||||
@ -1658,7 +1660,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
devices.append(cfg)
|
||||
|
||||
if configdrive.enabled_for(instance):
|
||||
diskconfig = config.LibvirtConfigGuestDisk()
|
||||
diskconfig = vconfig.LibvirtConfigGuestDisk()
|
||||
diskconfig.source_type = "file"
|
||||
diskconfig.driver_format = "raw"
|
||||
diskconfig.driver_cache = self.disk_cachemode
|
||||
@ -1683,7 +1685,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
inst_type_id = instance['instance_type_id']
|
||||
inst_type = instance_types.get_instance_type(inst_type_id)
|
||||
|
||||
guest = config.LibvirtConfigGuest()
|
||||
guest = vconfig.LibvirtConfigGuest()
|
||||
guest.virt_type = FLAGS.libvirt_type
|
||||
guest.name = instance['name']
|
||||
guest.uuid = instance['uuid']
|
||||
@ -1760,18 +1762,18 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
if FLAGS.libvirt_type != "lxc" and FLAGS.libvirt_type != "uml":
|
||||
guest.acpi = True
|
||||
|
||||
clk = config.LibvirtConfigGuestClock()
|
||||
clk = vconfig.LibvirtConfigGuestClock()
|
||||
clk.offset = "utc"
|
||||
guest.set_clock(clk)
|
||||
|
||||
if FLAGS.libvirt_type == "kvm":
|
||||
# TODO(berrange) One day this should be per-guest
|
||||
# OS type configurable
|
||||
tmpit = config.LibvirtConfigGuestTimer()
|
||||
tmpit = vconfig.LibvirtConfigGuestTimer()
|
||||
tmpit.name = "pit"
|
||||
tmpit.tickpolicy = "delay"
|
||||
|
||||
tmrtc = config.LibvirtConfigGuestTimer()
|
||||
tmrtc = vconfig.LibvirtConfigGuestTimer()
|
||||
tmrtc.name = "rtc"
|
||||
tmrtc.tickpolicy = "catchup"
|
||||
|
||||
@ -1796,29 +1798,29 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
# client app is connected. Thus we can't get away
|
||||
# with a single type=pty console. Instead we have
|
||||
# to configure two separate consoles.
|
||||
consolelog = config.LibvirtConfigGuestSerial()
|
||||
consolelog = vconfig.LibvirtConfigGuestSerial()
|
||||
consolelog.type = "file"
|
||||
consolelog.source_path = os.path.join(FLAGS.instances_path,
|
||||
instance['name'],
|
||||
"console.log")
|
||||
guest.add_device(consolelog)
|
||||
|
||||
consolepty = config.LibvirtConfigGuestSerial()
|
||||
consolepty = vconfig.LibvirtConfigGuestSerial()
|
||||
consolepty.type = "pty"
|
||||
guest.add_device(consolepty)
|
||||
else:
|
||||
consolepty = config.LibvirtConfigGuestConsole()
|
||||
consolepty = vconfig.LibvirtConfigGuestConsole()
|
||||
consolepty.type = "pty"
|
||||
guest.add_device(consolepty)
|
||||
|
||||
if FLAGS.vnc_enabled and FLAGS.libvirt_type not in ('lxc', 'uml'):
|
||||
if FLAGS.use_usb_tablet and guest.os_type == vm_mode.HVM:
|
||||
tablet = config.LibvirtConfigGuestInput()
|
||||
tablet = vconfig.LibvirtConfigGuestInput()
|
||||
tablet.type = "tablet"
|
||||
tablet.bus = "usb"
|
||||
guest.add_device(tablet)
|
||||
|
||||
graphics = config.LibvirtConfigGuestGraphics()
|
||||
graphics = vconfig.LibvirtConfigGuestGraphics()
|
||||
graphics.type = "vnc"
|
||||
graphics.keymap = FLAGS.vnc_keymap
|
||||
graphics.listen = FLAGS.vncserver_listen
|
||||
@ -2352,7 +2354,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
"""
|
||||
info = jsonutils.loads(cpu_info)
|
||||
LOG.info(_('Instance launched has CPU info:\n%s') % cpu_info)
|
||||
cpu = config.LibvirtConfigCPU()
|
||||
cpu = vconfig.LibvirtConfigCPU()
|
||||
cpu.arch = info['arch']
|
||||
cpu.model = info['model']
|
||||
cpu.vendor = info['vendor']
|
||||
|
@ -29,6 +29,7 @@ import time
|
||||
|
||||
from nova.compute import task_states
|
||||
from nova.compute import vm_states
|
||||
from nova import config
|
||||
from nova import flags
|
||||
from nova.openstack.common import cfg
|
||||
from nova.openstack.common import log as logging
|
||||
@ -55,8 +56,9 @@ imagecache_opts = [
|
||||
help='Write a checksum for files in _base to disk'),
|
||||
]
|
||||
|
||||
flags.DECLARE('instances_path', 'nova.compute.manager')
|
||||
flags.DECLARE('base_dir_name', 'nova.compute.manager')
|
||||
CONF = config.CONF
|
||||
CONF.import_opt('instances_path', 'nova.compute.manager')
|
||||
CONF.import_opt('base_dir_name', 'nova.compute.manager')
|
||||
FLAGS = flags.FLAGS
|
||||
FLAGS.register_opts(imagecache_opts)
|
||||
|
||||
|
@ -25,6 +25,8 @@ import os
|
||||
import re
|
||||
|
||||
from lxml import etree
|
||||
|
||||
from nova import config
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova.openstack.common import cfg
|
||||
@ -45,8 +47,9 @@ util_opts = [
|
||||
'non-standard locations')
|
||||
]
|
||||
|
||||
flags.DECLARE('instances_path', 'nova.compute.manager')
|
||||
flags.DECLARE('base_dir_name', 'nova.compute.manager')
|
||||
CONF = config.CONF
|
||||
CONF.import_opt('instances_path', 'nova.compute.manager')
|
||||
CONF.import_opt('base_dir_name', 'nova.compute.manager')
|
||||
FLAGS = flags.FLAGS
|
||||
FLAGS.register_opts(util_opts)
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
"""VIF drivers for libvirt."""
|
||||
|
||||
from nova import config
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova.network import linux_net
|
||||
@ -28,7 +29,7 @@ from nova import utils
|
||||
from nova.virt import netutils
|
||||
from nova.virt import vif
|
||||
|
||||
from nova.virt.libvirt import config
|
||||
from nova.virt.libvirt import config as vconfig
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -43,7 +44,8 @@ libvirt_vif_opts = [
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
FLAGS.register_opts(libvirt_vif_opts)
|
||||
flags.DECLARE('libvirt_type', 'nova.virt.libvirt.driver')
|
||||
CONF = config.CONF
|
||||
CONF.import_opt('libvirt_type', 'nova.virt.libvirt.driver')
|
||||
|
||||
LINUX_DEV_LEN = 14
|
||||
|
||||
@ -56,7 +58,7 @@ class LibvirtBridgeDriver(vif.VIFDriver):
|
||||
|
||||
mac_id = mapping['mac'].replace(':', '')
|
||||
|
||||
conf = config.LibvirtConfigGuestInterface()
|
||||
conf = vconfig.LibvirtConfigGuestInterface()
|
||||
conf.net_type = "bridge"
|
||||
conf.mac_addr = mapping['mac']
|
||||
conf.source_dev = network['bridge']
|
||||
@ -161,7 +163,7 @@ class LibvirtOpenVswitchDriver(vif.VIFDriver):
|
||||
self.create_ovs_vif_port(dev, iface_id, mapping['mac'],
|
||||
instance['uuid'])
|
||||
|
||||
conf = config.LibvirtConfigGuestInterface()
|
||||
conf = vconfig.LibvirtConfigGuestInterface()
|
||||
|
||||
if FLAGS.libvirt_use_virtio_for_bridges:
|
||||
conf.model = "virtio"
|
||||
@ -255,7 +257,7 @@ class LibvirtOpenVswitchVirtualPortDriver(vif.VIFDriver):
|
||||
""" Pass data required to create OVS virtual port element"""
|
||||
network, mapping = vif
|
||||
|
||||
conf = config.LibvirtConfigGuestInterface()
|
||||
conf = vconfig.LibvirtConfigGuestInterface()
|
||||
|
||||
conf.net_type = "bridge"
|
||||
conf.source_dev = FLAGS.libvirt_ovs_bridge
|
||||
@ -286,7 +288,7 @@ class QuantumLinuxBridgeVIFDriver(vif.VIFDriver):
|
||||
if FLAGS.libvirt_type != 'xen':
|
||||
linux_net.QuantumLinuxBridgeInterfaceDriver.create_tap_dev(dev)
|
||||
|
||||
conf = config.LibvirtConfigGuestInterface()
|
||||
conf = vconfig.LibvirtConfigGuestInterface()
|
||||
|
||||
if FLAGS.libvirt_use_virtio_for_bridges:
|
||||
conf.model = 'virtio'
|
||||
|
@ -20,17 +20,19 @@
|
||||
import os
|
||||
import time
|
||||
|
||||
from nova import config
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova.openstack.common import lockutils
|
||||
from nova.openstack.common import log as logging
|
||||
from nova import utils
|
||||
from nova.virt.libvirt import config
|
||||
from nova.virt.libvirt import config as vconfig
|
||||
from nova.virt.libvirt import utils as virtutils
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
FLAGS = flags.FLAGS
|
||||
flags.DECLARE('num_iscsi_scan_tries', 'nova.volume.driver')
|
||||
CONF = config.CONF
|
||||
CONF.import_opt('num_iscsi_scan_tries', 'nova.volume.driver')
|
||||
|
||||
|
||||
class LibvirtVolumeDriver(object):
|
||||
@ -40,7 +42,7 @@ class LibvirtVolumeDriver(object):
|
||||
|
||||
def connect_volume(self, connection_info, mount_device):
|
||||
"""Connect the volume. Returns xml for libvirt."""
|
||||
conf = config.LibvirtConfigGuestDisk()
|
||||
conf = vconfig.LibvirtConfigGuestDisk()
|
||||
conf.source_type = "block"
|
||||
conf.driver_name = virtutils.pick_disk_driver_name(is_block_dev=True)
|
||||
conf.driver_format = "raw"
|
||||
@ -60,7 +62,7 @@ class LibvirtFakeVolumeDriver(LibvirtVolumeDriver):
|
||||
"""Driver to attach Network volumes to libvirt."""
|
||||
|
||||
def connect_volume(self, connection_info, mount_device):
|
||||
conf = config.LibvirtConfigGuestDisk()
|
||||
conf = vconfig.LibvirtConfigGuestDisk()
|
||||
conf.source_type = "network"
|
||||
conf.driver_name = "qemu"
|
||||
conf.driver_format = "raw"
|
||||
@ -77,7 +79,7 @@ class LibvirtNetVolumeDriver(LibvirtVolumeDriver):
|
||||
"""Driver to attach Network volumes to libvirt."""
|
||||
|
||||
def connect_volume(self, connection_info, mount_device):
|
||||
conf = config.LibvirtConfigGuestDisk()
|
||||
conf = vconfig.LibvirtConfigGuestDisk()
|
||||
conf.source_type = "network"
|
||||
conf.driver_name = virtutils.pick_disk_driver_name(is_block_dev=False)
|
||||
conf.driver_format = "raw"
|
||||
|
@ -23,12 +23,13 @@
|
||||
|
||||
import netaddr
|
||||
|
||||
from nova import config
|
||||
from nova import flags
|
||||
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
|
||||
flags.DECLARE('injected_network_template', 'nova.virt.disk.api')
|
||||
CONF = config.CONF
|
||||
CONF.import_opt('injected_network_template', 'nova.virt.disk.api')
|
||||
|
||||
Template = None
|
||||
|
||||
|
@ -30,6 +30,7 @@ from nova.compute import api as compute
|
||||
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 as nova_context
|
||||
from nova import db
|
||||
from nova import exception
|
||||
@ -63,7 +64,8 @@ xenapi_vmops_opts = [
|
||||
FLAGS = flags.FLAGS
|
||||
FLAGS.register_opts(xenapi_vmops_opts)
|
||||
|
||||
flags.DECLARE('vncserver_proxyclient_address', 'nova.vnc')
|
||||
CONF = config.CONF
|
||||
CONF.import_opt('vncserver_proxyclient_address', 'nova.vnc')
|
||||
|
||||
DEFAULT_FIREWALL_DRIVER = "%s.%s" % (
|
||||
firewall.__name__,
|
||||
|
@ -27,17 +27,17 @@ if os.path.exists(os.path.join(possible_topdir, "nova", "__init__.py")):
|
||||
sys.path.insert(0, possible_topdir)
|
||||
|
||||
|
||||
from nova import config
|
||||
from nova import context
|
||||
from nova import db
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova.openstack.common import cfg
|
||||
from nova.openstack.common import timeutils
|
||||
from nova.virt.xenapi import driver as xenapi_driver
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
flags.DECLARE("resize_confirm_window", "nova.compute.manager")
|
||||
CONF = config.CONF
|
||||
CONF.import_opt("resize_confirm_window", "nova.compute.manager")
|
||||
|
||||
|
||||
ALLOWED_COMMANDS = ["list-vdis", "clean-vdis", "list-instances",
|
||||
|
Loading…
Reference in New Issue
Block a user