[virt-tools-list] [virt-manager PATCH 3/5] virtinst: prepare XML parsers to handle GIC for ARM
Pavel Hrdina
phrdina at redhat.com
Fri Jun 10 17:30:38 UTC 2016
GIC is used instead of APIC on ARM and libvirt allows configure specific
version of GIC for guests.
Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
tests/xmlparse.py | 1 +
virtinst/domainfeatures.py | 3 ++-
virtinst/domcapabilities.py | 17 +++++++++++++++++
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/tests/xmlparse.py b/tests/xmlparse.py
index fa7eb5a..7a763b8 100644
--- a/tests/xmlparse.py
+++ b/tests/xmlparse.py
@@ -165,6 +165,7 @@ class XMLParseTest(unittest.TestCase):
check("vmport", False, True)
check("kvm_hidden", None, True)
check("pvspinlock", None, True)
+ check("gic_version", None, False)
check = self._make_checker(guest.cpu)
check("match", "exact", "strict")
diff --git a/virtinst/domainfeatures.py b/virtinst/domainfeatures.py
index 8515943..8113568 100644
--- a/virtinst/domainfeatures.py
+++ b/virtinst/domainfeatures.py
@@ -25,7 +25,7 @@ class DomainFeatures(XMLBuilder):
Class for generating <features> XML
"""
_XML_ROOT_NAME = "features"
- _XML_PROP_ORDER = ["acpi", "apic", "pae"]
+ _XML_PROP_ORDER = ["acpi", "apic", "pae", "gic_version"]
acpi = XMLProperty("./acpi", is_bool=True,
default_name="default", default_cb=lambda s: False)
@@ -33,6 +33,7 @@ class DomainFeatures(XMLBuilder):
default_name="default", default_cb=lambda s: False)
pae = XMLProperty("./pae", is_bool=True,
default_name="default", default_cb=lambda s: False)
+ gic_version = XMLProperty("./gic/@version")
hap = XMLProperty("./hap", is_bool=True)
viridian = XMLProperty("./viridian", is_bool=True)
diff --git a/virtinst/domcapabilities.py b/virtinst/domcapabilities.py
index 1bf3c60..d872d7a 100644
--- a/virtinst/domcapabilities.py
+++ b/virtinst/domcapabilities.py
@@ -71,6 +71,11 @@ class _Devices(_CapsBlock):
disk = XMLChildProperty(_make_capsblock("disk"), is_single=True)
+class _Features(_CapsBlock):
+ _XML_ROOT_NAME = "features"
+ gic = XMLChildProperty(_make_capsblock("gic"), is_single=True)
+
+
class DomainCapabilities(XMLBuilder):
@staticmethod
def build_from_params(conn, emulator, arch, machine, hvtype):
@@ -155,9 +160,21 @@ class DomainCapabilities(XMLBuilder):
return ("readonly" in self.os.loader.enum_names() and
"yes" in self.os.loader.get_enum("readonly").get_values())
+ def supports_gic(self, guest):
+ """
+ Return True if guest os is arm and libvirt advertises support for GIC
+ """
+ return self.features.gic.supported and guest.os.is_arm()
+
+ def get_gic_versions(self):
+ """
+ Return a list of supported GIC versions provided by libvirt
+ """
+ return self.features.gic.get_enum("version").get_values()
_XML_ROOT_NAME = "domainCapabilities"
os = XMLChildProperty(_OS, is_single=True)
devices = XMLChildProperty(_Devices, is_single=True)
arch = XMLProperty("./arch")
+ features = XMLChildProperty(_Features, is_single=True)
--
2.8.4
More information about the virt-tools-list
mailing list