virt: pass emulator when getting domain capabilities from libvirt

On aarch64, for some emulated architectures like armv6l libvirt needs to
have the emulator path to properly return the domain capabilities.

Passing it will avoid virt.all_capabilities to fail on such
architectures.
This commit is contained in:
Cédric Bosdonnat 2021-07-05 17:24:27 +02:00 committed by Megan Wilhite
parent 46ab10fc42
commit 7b49d7559b
3 changed files with 16 additions and 3 deletions

1
changelog/60491.fixed Normal file
View file

@ -0,0 +1 @@
Pass emulator path to get guest capabilities from libvirt

View file

@ -6940,7 +6940,11 @@ def all_capabilities(**kwargs):
host_caps = ElementTree.fromstring(conn.getCapabilities())
domains = [
[
(guest.get("arch", {}).get("name", None), key)
(
guest.get("arch", {}).get("name", None),
key,
guest.get("arch", {}).get("emulator", None),
)
for key in guest.get("arch", {}).get("domains", {}).keys()
]
for guest in [
@ -6958,10 +6962,10 @@ def all_capabilities(**kwargs):
"domains": [
_parse_domain_caps(
ElementTree.fromstring(
conn.getDomainCapabilities(None, arch, None, domain)
conn.getDomainCapabilities(emulator, arch, None, domain)
)
)
for (arch, domain) in flattened
for (arch, domain, emulator) in flattened
],
}
return result

View file

@ -5079,6 +5079,14 @@ class VirtTestCase(TestCase, LoaderModuleMockMixin):
{"qemu", "kvm"}, {domainCaps["domain"] for domainCaps in caps["domains"]},
)
self.assertEqual(
{call[0] for call in self.mock_conn.getDomainCapabilities.call_args_list},
{
("/usr/bin/qemu-system-x86_64", "x86_64", None, "kvm"),
("/usr/bin/qemu-system-x86_64", "x86_64", None, "qemu"),
},
)
def test_network_tag(self):
"""
Test virt._get_net_xml() with VLAN tag