Ensure there is only one instance of LibvirtDriver
The HostState() class in libvirt creates a second instance of the LibvirtDriver() class, which cause duplicate initialization of various things. This is pointless, since it was a method on the original LibvirtDriver() which created the HostState() instance, and thus it could easily pass in the original object. Blueprint: compute-driver-events Change-Id: I0734bfcc1b014406ffe64ef7abb14a533998dea2 Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
@@ -3393,13 +3393,7 @@ class HostStateTestCase(test.TestCase):
|
||||
return HostStateTestCase.instance_caps
|
||||
|
||||
def test_update_status(self):
|
||||
virtapi = fake.FakeVirtAPI()
|
||||
self.mox.StubOutWithMock(libvirt_driver, 'LibvirtDriver')
|
||||
libvirt_driver.LibvirtDriver(virtapi, True).AndReturn(
|
||||
self.FakeConnection())
|
||||
|
||||
self.mox.ReplayAll()
|
||||
hs = libvirt_driver.HostState(virtapi, True)
|
||||
hs = libvirt_driver.HostState(self.FakeConnection())
|
||||
stats = hs._stats
|
||||
self.assertEquals(stats["vcpus"], 1)
|
||||
self.assertEquals(stats["vcpus_used"], 0)
|
||||
|
||||
Reference in New Issue
Block a user