[virt-tools-list] [virt-manager PATCH 2/2] capabilities: detect ACPI and APIC capabilites properly
Pavel Hrdina
phrdina at redhat.com
Wed Jul 8 09:33:13 UTC 2015
Instead of hard-coding that ACPI and APIC are enabled by default, detect
their presence from libvirt capabilities and use it.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1215692
Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
tests/cli-test-xml/compare/virt-install-aarch64-cdrom.xml | 8 --------
.../cli-test-xml/compare/virt-install-aarch64-kvm-import.xml | 4 ----
.../compare/virt-install-aarch64-machdefault.xml | 4 ----
tests/cli-test-xml/compare/virt-install-aarch64-machvirt.xml | 4 ----
.../compare/virt-install-arm-defaultmach-f20.xml | 4 ----
tests/cli-test-xml/compare/virt-install-arm-kvm-import.xml | 4 ----
tests/cli-test-xml/compare/virt-install-arm-vexpress-f19.xml | 4 ----
.../cli-test-xml/compare/virt-install-arm-vexpress-plain.xml | 4 ----
tests/cli-test-xml/compare/virt-install-arm-virt-f20.xml | 4 ----
tests/cli-test-xml/compare/virt-install-cpuset-auto.xml | 4 ----
.../compare/virt-install-ppc64-machdefault-f20.xml | 2 --
.../cli-test-xml/compare/virt-install-ppc64-pseries-f20.xml | 2 --
.../cli-test-xml/compare/virt-install-ppc64le-kvm-import.xml | 2 --
tests/cli-test-xml/compare/virt-install-simple-pxe.xml | 4 ----
tests/cli-test-xml/compare/virt-install-w2k3-cdrom.xml | 6 ------
virtinst/capabilities.py | 12 ++++++++++++
virtinst/guest.py | 7 +++++--
virtinst/osdict.py | 8 --------
18 files changed, 17 insertions(+), 70 deletions(-)
diff --git a/tests/cli-test-xml/compare/virt-install-aarch64-cdrom.xml b/tests/cli-test-xml/compare/virt-install-aarch64-cdrom.xml
index 80e5c32..e00d6a7 100644
--- a/tests/cli-test-xml/compare/virt-install-aarch64-cdrom.xml
+++ b/tests/cli-test-xml/compare/virt-install-aarch64-cdrom.xml
@@ -11,10 +11,6 @@
<boot dev="cdrom"/>
<boot dev="hd"/>
</os>
- <features>
- <acpi/>
- <apic/>
- </features>
<clock offset="utc"/>
<on_poweroff>restart</on_poweroff>
<on_reboot>destroy</on_reboot>
@@ -53,10 +49,6 @@
<nvram template="VARS.fd"/>
<boot dev="hd"/>
</os>
- <features>
- <acpi/>
- <apic/>
- </features>
<clock offset="utc"/>
<on_poweroff>restart</on_poweroff>
<on_reboot>destroy</on_reboot>
diff --git a/tests/cli-test-xml/compare/virt-install-aarch64-kvm-import.xml b/tests/cli-test-xml/compare/virt-install-aarch64-kvm-import.xml
index 77b768b..06dc0bf 100644
--- a/tests/cli-test-xml/compare/virt-install-aarch64-kvm-import.xml
+++ b/tests/cli-test-xml/compare/virt-install-aarch64-kvm-import.xml
@@ -9,10 +9,6 @@
<loader readonly="yes" type="pflash">/usr/share/AAVMF/AAVMF_CODE.fd</loader>
<boot dev="hd"/>
</os>
- <features>
- <acpi/>
- <apic/>
- </features>
<cpu mode="host-passthrough"/>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
diff --git a/tests/cli-test-xml/compare/virt-install-aarch64-machdefault.xml b/tests/cli-test-xml/compare/virt-install-aarch64-machdefault.xml
index 8ad033b..231cb34 100644
--- a/tests/cli-test-xml/compare/virt-install-aarch64-machdefault.xml
+++ b/tests/cli-test-xml/compare/virt-install-aarch64-machdefault.xml
@@ -10,10 +10,6 @@
<initrd>/f19-arm.initrd</initrd>
<cmdline>console=ttyAMA0,1234 rw root=/dev/vda3</cmdline>
</os>
- <features>
- <acpi/>
- <apic/>
- </features>
<cpu mode="custom" match="exact">
<model>cortex-a57</model>
</cpu>
diff --git a/tests/cli-test-xml/compare/virt-install-aarch64-machvirt.xml b/tests/cli-test-xml/compare/virt-install-aarch64-machvirt.xml
index 8ad033b..231cb34 100644
--- a/tests/cli-test-xml/compare/virt-install-aarch64-machvirt.xml
+++ b/tests/cli-test-xml/compare/virt-install-aarch64-machvirt.xml
@@ -10,10 +10,6 @@
<initrd>/f19-arm.initrd</initrd>
<cmdline>console=ttyAMA0,1234 rw root=/dev/vda3</cmdline>
</os>
- <features>
- <acpi/>
- <apic/>
- </features>
<cpu mode="custom" match="exact">
<model>cortex-a57</model>
</cpu>
diff --git a/tests/cli-test-xml/compare/virt-install-arm-defaultmach-f20.xml b/tests/cli-test-xml/compare/virt-install-arm-defaultmach-f20.xml
index d10d85f..21d778c 100644
--- a/tests/cli-test-xml/compare/virt-install-arm-defaultmach-f20.xml
+++ b/tests/cli-test-xml/compare/virt-install-arm-defaultmach-f20.xml
@@ -10,10 +10,6 @@
<initrd>/f19-arm.initrd</initrd>
<cmdline>console=ttyAMA0,1234 rw root=/dev/vda3</cmdline>
</os>
- <features>
- <acpi/>
- <apic/>
- </features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
diff --git a/tests/cli-test-xml/compare/virt-install-arm-kvm-import.xml b/tests/cli-test-xml/compare/virt-install-arm-kvm-import.xml
index f8b0b51..8d8cdce 100644
--- a/tests/cli-test-xml/compare/virt-install-arm-kvm-import.xml
+++ b/tests/cli-test-xml/compare/virt-install-arm-kvm-import.xml
@@ -8,10 +8,6 @@
<type arch="armv7l" machine="virt">hvm</type>
<boot dev="hd"/>
</os>
- <features>
- <acpi/>
- <apic/>
- </features>
<cpu mode="host-passthrough"/>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
diff --git a/tests/cli-test-xml/compare/virt-install-arm-vexpress-f19.xml b/tests/cli-test-xml/compare/virt-install-arm-vexpress-f19.xml
index cdcb7c0..54b8c67 100644
--- a/tests/cli-test-xml/compare/virt-install-arm-vexpress-f19.xml
+++ b/tests/cli-test-xml/compare/virt-install-arm-vexpress-f19.xml
@@ -11,10 +11,6 @@
<cmdline>console=ttyAMA0,1234 rw root=/dev/vda3</cmdline>
<dtb>/f19-arm.dtb</dtb>
</os>
- <features>
- <acpi/>
- <apic/>
- </features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
diff --git a/tests/cli-test-xml/compare/virt-install-arm-vexpress-plain.xml b/tests/cli-test-xml/compare/virt-install-arm-vexpress-plain.xml
index 3defad4..59f441c 100644
--- a/tests/cli-test-xml/compare/virt-install-arm-vexpress-plain.xml
+++ b/tests/cli-test-xml/compare/virt-install-arm-vexpress-plain.xml
@@ -11,10 +11,6 @@
<cmdline>console=ttyAMA0 rw root=/dev/mmcblk0p3</cmdline>
<dtb>/f19-arm.dtb</dtb>
</os>
- <features>
- <acpi/>
- <apic/>
- </features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
diff --git a/tests/cli-test-xml/compare/virt-install-arm-virt-f20.xml b/tests/cli-test-xml/compare/virt-install-arm-virt-f20.xml
index d10d85f..21d778c 100644
--- a/tests/cli-test-xml/compare/virt-install-arm-virt-f20.xml
+++ b/tests/cli-test-xml/compare/virt-install-arm-virt-f20.xml
@@ -10,10 +10,6 @@
<initrd>/f19-arm.initrd</initrd>
<cmdline>console=ttyAMA0,1234 rw root=/dev/vda3</cmdline>
</os>
- <features>
- <acpi/>
- <apic/>
- </features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
diff --git a/tests/cli-test-xml/compare/virt-install-cpuset-auto.xml b/tests/cli-test-xml/compare/virt-install-cpuset-auto.xml
index 9876af6..f555396 100644
--- a/tests/cli-test-xml/compare/virt-install-cpuset-auto.xml
+++ b/tests/cli-test-xml/compare/virt-install-cpuset-auto.xml
@@ -9,8 +9,6 @@
<boot dev="network"/>
</os>
<features>
- <acpi/>
- <apic/>
<pae/>
</features>
<clock offset="utc"/>
@@ -51,8 +49,6 @@
<boot dev="network"/>
</os>
<features>
- <acpi/>
- <apic/>
<pae/>
</features>
<clock offset="utc"/>
diff --git a/tests/cli-test-xml/compare/virt-install-ppc64-machdefault-f20.xml b/tests/cli-test-xml/compare/virt-install-ppc64-machdefault-f20.xml
index a24c0d5..8056115 100644
--- a/tests/cli-test-xml/compare/virt-install-ppc64-machdefault-f20.xml
+++ b/tests/cli-test-xml/compare/virt-install-ppc64-machdefault-f20.xml
@@ -9,8 +9,6 @@
<boot dev="network"/>
</os>
<features>
- <acpi/>
- <apic/>
<vmport state="off"/>
</features>
<clock offset="utc"/>
diff --git a/tests/cli-test-xml/compare/virt-install-ppc64-pseries-f20.xml b/tests/cli-test-xml/compare/virt-install-ppc64-pseries-f20.xml
index a24c0d5..8056115 100644
--- a/tests/cli-test-xml/compare/virt-install-ppc64-pseries-f20.xml
+++ b/tests/cli-test-xml/compare/virt-install-ppc64-pseries-f20.xml
@@ -9,8 +9,6 @@
<boot dev="network"/>
</os>
<features>
- <acpi/>
- <apic/>
<vmport state="off"/>
</features>
<clock offset="utc"/>
diff --git a/tests/cli-test-xml/compare/virt-install-ppc64le-kvm-import.xml b/tests/cli-test-xml/compare/virt-install-ppc64le-kvm-import.xml
index 0a27562..720c8a5 100644
--- a/tests/cli-test-xml/compare/virt-install-ppc64le-kvm-import.xml
+++ b/tests/cli-test-xml/compare/virt-install-ppc64le-kvm-import.xml
@@ -9,8 +9,6 @@
<boot dev="hd"/>
</os>
<features>
- <acpi/>
- <apic/>
<vmport state="off"/>
</features>
<clock offset="utc"/>
diff --git a/tests/cli-test-xml/compare/virt-install-simple-pxe.xml b/tests/cli-test-xml/compare/virt-install-simple-pxe.xml
index 504efbe..c0a4b52 100644
--- a/tests/cli-test-xml/compare/virt-install-simple-pxe.xml
+++ b/tests/cli-test-xml/compare/virt-install-simple-pxe.xml
@@ -9,8 +9,6 @@
<boot dev="network"/>
</os>
<features>
- <acpi/>
- <apic/>
<pae/>
</features>
<clock offset="utc"/>
@@ -51,8 +49,6 @@
<boot dev="network"/>
</os>
<features>
- <acpi/>
- <apic/>
<pae/>
</features>
<clock offset="utc"/>
diff --git a/tests/cli-test-xml/compare/virt-install-w2k3-cdrom.xml b/tests/cli-test-xml/compare/virt-install-w2k3-cdrom.xml
index 0d78c19..19304d5 100644
--- a/tests/cli-test-xml/compare/virt-install-w2k3-cdrom.xml
+++ b/tests/cli-test-xml/compare/virt-install-w2k3-cdrom.xml
@@ -10,8 +10,6 @@
<boot dev="hd"/>
</os>
<features>
- <acpi/>
- <apic/>
<pae/>
<hyperv>
<relaxed state="on"/>
@@ -60,8 +58,6 @@
<boot dev="hd"/>
</os>
<features>
- <acpi/>
- <apic/>
<pae/>
<hyperv>
<relaxed state="on"/>
@@ -110,8 +106,6 @@
<boot dev="hd"/>
</os>
<features>
- <acpi/>
- <apic/>
<pae/>
<hyperv>
<relaxed state="on"/>
diff --git a/virtinst/capabilities.py b/virtinst/capabilities.py
index a26b4a2..553a430 100644
--- a/virtinst/capabilities.py
+++ b/virtinst/capabilities.py
@@ -206,6 +206,8 @@ class _CapsGuestFeatures(XMLBuilder):
_XML_ROOT_NAME = "features"
pae = XMLProperty("./pae", is_bool=True)
+ acpi = XMLProperty("./acpi/@default", is_onoff=True)
+ apic = XMLProperty("./apic/@default", is_onoff=True)
class _CapsGuest(XMLBuilder):
@@ -298,6 +300,16 @@ class _CapsGuest(XMLBuilder):
return True
return False
+ def supports_acpi(self):
+ if self.features.acpi:
+ return True
+ return False
+
+ def supports_apic(self):
+ if self.features.apic:
+ return True
+ return False
+
############################
# Main capabilities object #
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 7ff7bd5..3f91ae9 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -840,9 +840,12 @@ class Guest(XMLBuilder):
default = False
if self.features.acpi == "default":
- self.features.acpi = self._os_object.supports_acpi(default)
+ if default:
+ self.features.acpi = self.capsinfo.guest.supports_acpi()
+ else:
+ self.features.acpi = False
if self.features.apic == "default":
- self.features.apic = self._os_object.supports_apic(default)
+ self.features.apic = self.capsinfo.guest.supports_apic()
if self.features.pae == "default":
self.features.pae = self.capsinfo.guest.supports_pae()
diff --git a/virtinst/osdict.py b/virtinst/osdict.py
index 76c2260..bd82ae1 100644
--- a/virtinst/osdict.py
+++ b/virtinst/osdict.py
@@ -447,14 +447,6 @@ class _OsVariant(object):
def supports_virtiommio(self):
return self._is_related_to(["fedora19"])
- def supports_acpi(self, default):
- if self._family in ['msdos']:
- return False
- return default
-
- def supports_apic(self, default):
- return self.supports_acpi(default)
-
def default_netmodel(self):
"""
Default non-virtio net-model, since we check for that separately
--
2.4.5
More information about the virt-tools-list
mailing list