diff options
-rw-r--r-- | nova/compute/manager.py | 2 | ||||
-rw-r--r-- | nova/tests/test_virt_drivers.py | 6 | ||||
-rw-r--r-- | nova/virt/connection.py | 13 |
3 files changed, 13 insertions, 8 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 3cdf35266..98552d641 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -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)) diff --git a/nova/tests/test_virt_drivers.py b/nova/tests/test_virt_drivers.py index 6443c6721..91845dce7 100644 --- a/nova/tests/test_virt_drivers.py +++ b/nova/tests/test_virt_drivers.py @@ -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 diff --git a/nova/virt/connection.py b/nova/virt/connection.py index 079675da3..e47079b80 100644 --- a/nova/virt/connection.py +++ b/nova/virt/connection.py @@ -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')) |