remove the use of import_object_ns
This function dates back to I5eee3389c7719d5f361532b0eddaa249233283a5 when it was introduced to make it easier to seamlessly load drivers from out of tree. This no long is something we want to do. Also, the way this works it means that it makes it really hard to debug when an import of a driver fails (as it's masked out). This is the only use of the function in all of OpenStack, it should just go away as an anti-pattern. Tests were updated to pass, and the compute_driver flag was removed from tests that passed even when they now had completely bogus values. Change-Id: I65a537292aa8eda9f3d89e408caa50c445f2050a
This commit is contained in:
parent
e1522c1d86
commit
8eb03de1eb
@ -77,7 +77,7 @@ class NUMAServersTest(ServersTestBase):
|
||||
pass
|
||||
|
||||
def _setup_scheduler_service(self):
|
||||
self.flags(compute_driver='nova.virt.libvirt.LibvirtDriver')
|
||||
self.flags(compute_driver='libvirt.LibvirtDriver')
|
||||
|
||||
self.flags(scheduler_driver='filter_scheduler')
|
||||
self.flags(scheduler_default_filters=CONF.scheduler_default_filters
|
||||
|
@ -73,7 +73,7 @@ class RealTimeServersTest(ServersTestBase):
|
||||
self.flags(sysinfo_serial='none', group='libvirt')
|
||||
|
||||
def _setup_compute_service(self):
|
||||
self.flags(compute_driver='nova.virt.libvirt.LibvirtDriver')
|
||||
self.flags(compute_driver='libvirt.LibvirtDriver')
|
||||
|
||||
def test_no_dedicated_cpu(self):
|
||||
flavor = self._create_flavor(extra_spec={'hw:cpu_realtime': 'yes'})
|
||||
|
@ -397,7 +397,7 @@ class UsageInfoTestCase(test.TestCase):
|
||||
self.addCleanup(fake_notifier.reset)
|
||||
|
||||
self.flags(use_local=True, group='conductor')
|
||||
self.flags(compute_driver='nova.virt.fake.FakeDriver',
|
||||
self.flags(compute_driver='fake.FakeDriver',
|
||||
network_manager='nova.network.manager.FlatManager')
|
||||
self.compute = importutils.import_object(CONF.compute_manager)
|
||||
self.user_id = 'fake'
|
||||
|
@ -64,7 +64,7 @@ class FakeDriverMultiNodeTestCase(BaseTestCase):
|
||||
class MultiNodeComputeTestCase(BaseTestCase):
|
||||
def setUp(self):
|
||||
super(MultiNodeComputeTestCase, self).setUp()
|
||||
self.flags(compute_driver='nova.virt.fake.FakeDriver')
|
||||
self.flags(compute_driver='fake.FakeDriver')
|
||||
self.compute = importutils.import_object(CONF.compute_manager)
|
||||
self.flags(use_local=True, group='conductor')
|
||||
self.conductor = self.start_service('conductor',
|
||||
|
@ -38,8 +38,7 @@ class ConfFixture(config_fixture.Config):
|
||||
paths.state_path_def('etc/nova/api-paste.ini'),
|
||||
group='wsgi')
|
||||
self.conf.set_default('host', 'fake-mini')
|
||||
self.conf.set_default('compute_driver',
|
||||
'nova.virt.fake.SmallFakeDriver')
|
||||
self.conf.set_default('compute_driver', 'fake.SmallFakeDriver')
|
||||
self.conf.set_default('fake_network', True)
|
||||
self.conf.set_default('flat_network_bridge', 'br100')
|
||||
self.conf.set_default('floating_ip_dns_manager',
|
||||
|
@ -54,8 +54,7 @@ class NotificationsTestCase(test.TestCase):
|
||||
fake_notifier.stub_notifier(self.stubs)
|
||||
self.addCleanup(fake_notifier.reset)
|
||||
|
||||
self.flags(compute_driver='nova.virt.fake.FakeDriver',
|
||||
network_manager='nova.network.manager.FlatManager',
|
||||
self.flags(network_manager='nova.network.manager.FlatManager',
|
||||
notify_on_state_change="vm_and_task_state",
|
||||
host='testhost')
|
||||
|
||||
|
@ -41,8 +41,7 @@ class QuotaIntegrationTestCase(test.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(QuotaIntegrationTestCase, self).setUp()
|
||||
self.flags(compute_driver='nova.virt.fake.FakeDriver',
|
||||
quota_instances=2,
|
||||
self.flags(quota_instances=2,
|
||||
quota_cores=4,
|
||||
quota_floating_ips=1,
|
||||
network_manager='nova.network.manager.FlatDHCPManager')
|
||||
|
@ -209,11 +209,7 @@ class VirtDriverLoaderTestCase(_FakeDriverBackendTestCase, test.TestCase):
|
||||
"""
|
||||
|
||||
# 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',
|
||||
'fake.FakeDriver': 'FakeDriver',
|
||||
'libvirt.LibvirtDriver': 'LibvirtDriver'
|
||||
}
|
||||
|
@ -1618,9 +1618,9 @@ def load_compute_driver(virtapi, compute_driver=None):
|
||||
|
||||
LOG.info(_LI("Loading compute driver '%s'"), compute_driver)
|
||||
try:
|
||||
driver = importutils.import_object_ns('nova.virt',
|
||||
compute_driver,
|
||||
virtapi)
|
||||
driver = importutils.import_object(
|
||||
'nova.virt.%s' % compute_driver,
|
||||
virtapi)
|
||||
return utils.check_isinstance(driver, ComputeDriver)
|
||||
except ImportError:
|
||||
LOG.exception(_LE("Unable to load the virtualization driver"))
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
other:
|
||||
|
||||
- Virt drivers are no longer loaded with the import_object_ns
|
||||
function, which means that only virt drivers in the nova.virt
|
||||
namespace can be loaded.
|
Loading…
x
Reference in New Issue
Block a user