Fix broken Systems listing in dynamic emulator

The `.../Systems` resource libvirt handler uses a wrong way of
turning libvirt domain name into UUID. That results in emulator
crashing on resource access.

Change-Id: Ie10b236d171d84f9abe9a3446fd0b88f15ab2d08
This commit is contained in:
Ilya Etingof 2019-03-11 19:22:27 +01:00
parent b6ccaf6da8
commit 0a74170a7e
2 changed files with 3 additions and 1 deletions

View File

@ -149,7 +149,7 @@ class LibvirtDriver(AbstractDriver):
:returns: list of UUIDs representing the systems
"""
with libvirt_open(self._uri, readonly=True) as conn:
return [domain.UUIDString()
return [conn.lookupByName(domain).UUIDString()
for domain in conn.listDefinedDomains()]
def uuid(self, identity):

View File

@ -60,6 +60,8 @@ class LibvirtDriverTestCase(base.BaseTestCase):
domain = mock.MagicMock()
domain.UUIDString.return_value = self.uuid
conn_mock.listDefinedDomains.return_value = [domain]
uuidstring_mock = conn_mock.lookupByName.return_value.UUIDString
uuidstring_mock.return_value = self.uuid
systems = self.test_driver.systems
self.assertEqual([self.uuid], systems)