Merge "use import_object_ns for compute_driver loading"
This commit is contained in:
commit
dde5b01ce1
@ -239,7 +239,7 @@ class ComputeManager(manager.SchedulerDependentManager):
|
||||
|
||||
try:
|
||||
self.driver = utils.check_isinstance(
|
||||
importutils.import_object(compute_driver),
|
||||
importutils.import_object_ns('nova.virt', compute_driver),
|
||||
driver.ComputeDriver)
|
||||
except ImportError as e:
|
||||
LOG.error(_("Unable to load the virtualization driver: %s") % (e))
|
||||
|
@ -117,9 +117,13 @@ class VirtDriverLoaderTestCase(_FakeDriverBackendTestCase):
|
||||
final class"""
|
||||
|
||||
# if your driver supports being tested in a fake way, it can go here
|
||||
#
|
||||
# both long form and short form drivers are supported
|
||||
new_drivers = {
|
||||
'nova.virt.fake.FakeDriver': 'FakeDriver',
|
||||
'nova.virt.libvirt.LibvirtDriver': 'LibvirtDriver'
|
||||
'nova.virt.libvirt.LibvirtDriver': 'LibvirtDriver',
|
||||
'fake.FakeDriver': 'FakeDriver',
|
||||
'libvirt.LibvirtDriver': 'LibvirtDriver'
|
||||
}
|
||||
|
||||
# NOTE(sdague): remove after Folsom release when connection_type
|
||||
|
@ -33,11 +33,11 @@ LOG = logging.getLogger(__name__)
|
||||
FLAGS = flags.FLAGS
|
||||
|
||||
known_drivers = {
|
||||
'baremetal': 'nova.virt.baremetal.proxy.ProxyConnection',
|
||||
'fake': 'nova.virt.fake.FakeDriver',
|
||||
'libvirt': 'nova.virt.libvirt.LibvirtDriver',
|
||||
'vmwareapi': 'nova.virt.vmwareapi_conn.VMWareESXDriver',
|
||||
'xenapi': 'nova.virt.xenapi.connection.XenAPIDriver'
|
||||
'baremetal': 'baremetal.proxy.ProxyConnection',
|
||||
'fake': 'fake.FakeDriver',
|
||||
'libvirt': 'libvirt.LibvirtDriver',
|
||||
'vmwareapi': 'vmwareapi_conn.VMWareESXDriver',
|
||||
'xenapi': 'xenapi.connection.XenAPIDriver'
|
||||
}
|
||||
|
||||
|
||||
@ -75,7 +75,8 @@ def get_connection(read_only=False):
|
||||
if driver_name is None:
|
||||
raise exception.VirtDriverNotFound(name=FLAGS.connection_type)
|
||||
|
||||
conn = importutils.import_object(driver_name, read_only=read_only)
|
||||
conn = importutils.import_object_ns('nova.virt', driver_name,
|
||||
read_only=read_only)
|
||||
|
||||
if conn is None:
|
||||
LOG.error(_('Failed to open connection to underlying virt platform'))
|
||||
|
Loading…
Reference in New Issue
Block a user