[virt-tools-list] [virt-manager PATCH 1/2] refactor detection of guest type capabilities
Pavel Hrdina
phrdina at redhat.com
Wed Jul 8 09:33:12 UTC 2015
Each guest type can have its own capabilities and we should always ask
only for those capabilities.
The old approach was to get capabilities from libvirt and then for
example cycle trough all guests and return True, if any guest type
supports kvm or pae, etc.
Now we check those capabilities only for the correct guest type
according to defaults and input from user.
Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
tests/capabilities.py | 5 +-
.../compare/virt-convert-ovf-compare.xml | 1 -
.../compare/virt-convert-vmx-compare.xml | 1 -
.../compare/virt-install-aarch64-cdrom.xml | 2 -
.../compare/virt-install-aarch64-machdefault.xml | 1 -
.../compare/virt-install-aarch64-machvirt.xml | 1 -
.../compare/virt-install-arm-defaultmach-f20.xml | 1 -
.../compare/virt-install-arm-vexpress-f19.xml | 1 -
.../compare/virt-install-arm-vexpress-plain.xml | 1 -
.../compare/virt-install-arm-virt-f20.xml | 1 -
.../compare/virt-install-f21-kvm-remote.xml | 1 -
.../compare/virt-install-kvm-centos7.xml | 2 -
.../compare/virt-install-kvm-f14-url.xml | 2 -
.../compare/virt-install-kvm-rhel6.xml | 2 -
.../compare/virt-install-kvm-rhel7.xml | 2 -
.../compare/virt-install-kvm-win2k3-cdrom.xml | 3 -
.../compare/virt-install-location-iso.xml | 2 -
.../compare/virt-install-many-devices.xml | 1 -
.../compare/virt-install-ppc64-machdefault-f20.xml | 1 -
.../compare/virt-install-ppc64-pseries-f20.xml | 1 -
.../compare/virt-install-q35-defaults.xml | 2 -
.../compare/virt-install-qemu-plain.xml | 1 -
.../compare/virt-install-singleton-config-1.xml | 1 -
.../compare/virt-install-singleton-config-2.xml | 2 -
.../compare/virt-install-win7-uefi.xml | 3 -
.../cli-test-xml/compare/virt-install-xen-hvm.xml | 1 -
.../ovf2libvirt_ovf_directory.libvirt | 1 -
.../libvirt_output/ovf2libvirt_test1.libvirt | 1 -
.../ovf2libvirt_test1.libvirt.disk_qcow2 | 1 -
.../libvirt_output/ovf2libvirt_test2.libvirt | 1 -
.../vmx2libvirt_test-nodisks.libvirt | 1 -
.../libvirt_output/vmx2libvirt_test1.libvirt | 1 -
.../vmx2libvirt_test1.libvirt.disk_raw | 1 -
.../libvirt_output/vmx2libvirt_vmx-dir.libvirt | 1 -
tests/xmlconfig.py | 2 +
virtManager/create.py | 9 +--
virtinst/capabilities.py | 87 ++++++++++------------
virtinst/guest.py | 2 +-
38 files changed, 50 insertions(+), 100 deletions(-)
diff --git a/tests/capabilities.py b/tests/capabilities.py
index 6c71fca..b727e80 100644
--- a/tests/capabilities.py
+++ b/tests/capabilities.py
@@ -70,8 +70,9 @@ class TestCapabilities(unittest.TestCase):
caps_empty = self._buildCaps("test-old-vmx.xml")
def test_utils(caps, has_guests, is_kvm):
- self.assertEquals(caps.has_install_options(), has_guests)
- self.assertEquals(caps.is_kvm_available(), is_kvm)
+ if caps.guests:
+ self.assertEquals(caps.guests[0].has_install_options(), has_guests)
+ self.assertEquals(caps.guests[0].is_kvm_available(), is_kvm)
test_utils(caps_empty, False, False)
test_utils(caps_with_kvm, True, True)
diff --git a/tests/cli-test-xml/compare/virt-convert-ovf-compare.xml b/tests/cli-test-xml/compare/virt-convert-ovf-compare.xml
index 0d8556d..eb8e131 100644
--- a/tests/cli-test-xml/compare/virt-convert-ovf-compare.xml
+++ b/tests/cli-test-xml/compare/virt-convert-ovf-compare.xml
@@ -12,7 +12,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
diff --git a/tests/cli-test-xml/compare/virt-convert-vmx-compare.xml b/tests/cli-test-xml/compare/virt-convert-vmx-compare.xml
index d5a0714..202542b 100644
--- a/tests/cli-test-xml/compare/virt-convert-vmx-compare.xml
+++ b/tests/cli-test-xml/compare/virt-convert-vmx-compare.xml
@@ -11,7 +11,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
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 1b4264b..80e5c32 100644
--- a/tests/cli-test-xml/compare/virt-install-aarch64-cdrom.xml
+++ b/tests/cli-test-xml/compare/virt-install-aarch64-cdrom.xml
@@ -14,7 +14,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
</features>
<clock offset="utc"/>
<on_poweroff>restart</on_poweroff>
@@ -57,7 +56,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
</features>
<clock offset="utc"/>
<on_poweroff>restart</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 5e526a8..8ad033b 100644
--- a/tests/cli-test-xml/compare/virt-install-aarch64-machdefault.xml
+++ b/tests/cli-test-xml/compare/virt-install-aarch64-machdefault.xml
@@ -13,7 +13,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
</features>
<cpu mode="custom" match="exact">
<model>cortex-a57</model>
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 5e526a8..8ad033b 100644
--- a/tests/cli-test-xml/compare/virt-install-aarch64-machvirt.xml
+++ b/tests/cli-test-xml/compare/virt-install-aarch64-machvirt.xml
@@ -13,7 +13,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
</features>
<cpu mode="custom" match="exact">
<model>cortex-a57</model>
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 ba23454..d10d85f 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
@@ -13,7 +13,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
</features>
<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 493de63..cdcb7c0 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
@@ -14,7 +14,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
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 a92ab4f..3defad4 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
@@ -14,7 +14,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
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 ba23454..d10d85f 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
@@ -13,7 +13,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
diff --git a/tests/cli-test-xml/compare/virt-install-f21-kvm-remote.xml b/tests/cli-test-xml/compare/virt-install-f21-kvm-remote.xml
index 735181c..f8eafbf 100644
--- a/tests/cli-test-xml/compare/virt-install-f21-kvm-remote.xml
+++ b/tests/cli-test-xml/compare/virt-install-f21-kvm-remote.xml
@@ -11,7 +11,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
diff --git a/tests/cli-test-xml/compare/virt-install-kvm-centos7.xml b/tests/cli-test-xml/compare/virt-install-kvm-centos7.xml
index 92105c1..e05fadb 100644
--- a/tests/cli-test-xml/compare/virt-install-kvm-centos7.xml
+++ b/tests/cli-test-xml/compare/virt-install-kvm-centos7.xml
@@ -12,7 +12,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
@@ -85,7 +84,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
diff --git a/tests/cli-test-xml/compare/virt-install-kvm-f14-url.xml b/tests/cli-test-xml/compare/virt-install-kvm-f14-url.xml
index d70b4fa..4a43c3b 100644
--- a/tests/cli-test-xml/compare/virt-install-kvm-f14-url.xml
+++ b/tests/cli-test-xml/compare/virt-install-kvm-f14-url.xml
@@ -13,7 +13,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="host-model"/>
@@ -73,7 +72,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="host-model"/>
diff --git a/tests/cli-test-xml/compare/virt-install-kvm-rhel6.xml b/tests/cli-test-xml/compare/virt-install-kvm-rhel6.xml
index 92105c1..e05fadb 100644
--- a/tests/cli-test-xml/compare/virt-install-kvm-rhel6.xml
+++ b/tests/cli-test-xml/compare/virt-install-kvm-rhel6.xml
@@ -12,7 +12,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
@@ -85,7 +84,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
diff --git a/tests/cli-test-xml/compare/virt-install-kvm-rhel7.xml b/tests/cli-test-xml/compare/virt-install-kvm-rhel7.xml
index 92105c1..e05fadb 100644
--- a/tests/cli-test-xml/compare/virt-install-kvm-rhel7.xml
+++ b/tests/cli-test-xml/compare/virt-install-kvm-rhel7.xml
@@ -12,7 +12,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
@@ -85,7 +84,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
diff --git a/tests/cli-test-xml/compare/virt-install-kvm-win2k3-cdrom.xml b/tests/cli-test-xml/compare/virt-install-kvm-win2k3-cdrom.xml
index 0a0ef95..8423178 100644
--- a/tests/cli-test-xml/compare/virt-install-kvm-win2k3-cdrom.xml
+++ b/tests/cli-test-xml/compare/virt-install-kvm-win2k3-cdrom.xml
@@ -12,7 +12,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
<hyperv>
<relaxed state="on"/>
@@ -83,7 +82,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
<hyperv>
<relaxed state="on"/>
@@ -154,7 +152,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
<hyperv>
<relaxed state="on"/>
diff --git a/tests/cli-test-xml/compare/virt-install-location-iso.xml b/tests/cli-test-xml/compare/virt-install-location-iso.xml
index ec40d9c..b990055 100644
--- a/tests/cli-test-xml/compare/virt-install-location-iso.xml
+++ b/tests/cli-test-xml/compare/virt-install-location-iso.xml
@@ -12,7 +12,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
@@ -77,7 +76,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
diff --git a/tests/cli-test-xml/compare/virt-install-many-devices.xml b/tests/cli-test-xml/compare/virt-install-many-devices.xml
index 7c8b39a..80535b4 100644
--- a/tests/cli-test-xml/compare/virt-install-many-devices.xml
+++ b/tests/cli-test-xml/compare/virt-install-many-devices.xml
@@ -10,7 +10,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu>
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 6c7e573..a24c0d5 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
@@ -11,7 +11,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<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 6c7e573..a24c0d5 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
@@ -11,7 +11,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<clock offset="utc"/>
diff --git a/tests/cli-test-xml/compare/virt-install-q35-defaults.xml b/tests/cli-test-xml/compare/virt-install-q35-defaults.xml
index 0f28abf..9c6bce0 100644
--- a/tests/cli-test-xml/compare/virt-install-q35-defaults.xml
+++ b/tests/cli-test-xml/compare/virt-install-q35-defaults.xml
@@ -12,7 +12,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
@@ -86,7 +85,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
diff --git a/tests/cli-test-xml/compare/virt-install-qemu-plain.xml b/tests/cli-test-xml/compare/virt-install-qemu-plain.xml
index 5f82d26..5978184 100644
--- a/tests/cli-test-xml/compare/virt-install-qemu-plain.xml
+++ b/tests/cli-test-xml/compare/virt-install-qemu-plain.xml
@@ -11,7 +11,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
diff --git a/tests/cli-test-xml/compare/virt-install-singleton-config-1.xml b/tests/cli-test-xml/compare/virt-install-singleton-config-1.xml
index 8f98aa3..9b9bafd 100644
--- a/tests/cli-test-xml/compare/virt-install-singleton-config-1.xml
+++ b/tests/cli-test-xml/compare/virt-install-singleton-config-1.xml
@@ -18,7 +18,6 @@
</os>
<features>
<acpi/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="host-model"/>
diff --git a/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml b/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml
index a03a7c0..9d35eaf 100644
--- a/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml
+++ b/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml
@@ -44,7 +44,6 @@
</idmap>
<features>
<apic eoi="on"/>
- <pae/>
<privnet/>
<hyperv>
<spinlocks state="on" retries="1234"/>
@@ -165,7 +164,6 @@
</idmap>
<features>
<apic eoi="on"/>
- <pae/>
<privnet/>
<hyperv>
<spinlocks state="on" retries="1234"/>
diff --git a/tests/cli-test-xml/compare/virt-install-win7-uefi.xml b/tests/cli-test-xml/compare/virt-install-win7-uefi.xml
index 19bab1a..4c3b9b6 100644
--- a/tests/cli-test-xml/compare/virt-install-win7-uefi.xml
+++ b/tests/cli-test-xml/compare/virt-install-win7-uefi.xml
@@ -14,7 +14,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
@@ -90,7 +89,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
@@ -166,7 +164,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
diff --git a/tests/cli-test-xml/compare/virt-install-xen-hvm.xml b/tests/cli-test-xml/compare/virt-install-xen-hvm.xml
index 3af66b9..0fe3064 100644
--- a/tests/cli-test-xml/compare/virt-install-xen-hvm.xml
+++ b/tests/cli-test-xml/compare/virt-install-xen-hvm.xml
@@ -13,7 +13,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
diff --git a/tests/virtconv-files/libvirt_output/ovf2libvirt_ovf_directory.libvirt b/tests/virtconv-files/libvirt_output/ovf2libvirt_ovf_directory.libvirt
index 4bdcac3..ec4e165 100644
--- a/tests/virtconv-files/libvirt_output/ovf2libvirt_ovf_directory.libvirt
+++ b/tests/virtconv-files/libvirt_output/ovf2libvirt_ovf_directory.libvirt
@@ -11,7 +11,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
diff --git a/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt b/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt
index a6d8651..b527bfa 100644
--- a/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt
+++ b/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt
@@ -12,7 +12,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
diff --git a/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt.disk_qcow2 b/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt.disk_qcow2
index 9dbcb05..9d09a99 100644
--- a/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt.disk_qcow2
+++ b/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt.disk_qcow2
@@ -12,7 +12,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
diff --git a/tests/virtconv-files/libvirt_output/ovf2libvirt_test2.libvirt b/tests/virtconv-files/libvirt_output/ovf2libvirt_test2.libvirt
index d2570bc..8376dff 100644
--- a/tests/virtconv-files/libvirt_output/ovf2libvirt_test2.libvirt
+++ b/tests/virtconv-files/libvirt_output/ovf2libvirt_test2.libvirt
@@ -12,7 +12,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
diff --git a/tests/virtconv-files/libvirt_output/vmx2libvirt_test-nodisks.libvirt b/tests/virtconv-files/libvirt_output/vmx2libvirt_test-nodisks.libvirt
index 85712dd..3e7f079 100644
--- a/tests/virtconv-files/libvirt_output/vmx2libvirt_test-nodisks.libvirt
+++ b/tests/virtconv-files/libvirt_output/vmx2libvirt_test-nodisks.libvirt
@@ -11,7 +11,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
diff --git a/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt b/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt
index 57282f0..687e705 100644
--- a/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt
+++ b/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt
@@ -11,7 +11,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
diff --git a/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt.disk_raw b/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt.disk_raw
index 7d9b13c..1270809 100644
--- a/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt.disk_raw
+++ b/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt.disk_raw
@@ -11,7 +11,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
diff --git a/tests/virtconv-files/libvirt_output/vmx2libvirt_vmx-dir.libvirt b/tests/virtconv-files/libvirt_output/vmx2libvirt_vmx-dir.libvirt
index 23d6c4c..4692fbf 100644
--- a/tests/virtconv-files/libvirt_output/vmx2libvirt_vmx-dir.libvirt
+++ b/tests/virtconv-files/libvirt_output/vmx2libvirt_vmx-dir.libvirt
@@ -12,7 +12,6 @@
<features>
<acpi/>
<apic/>
- <pae/>
<vmport state="off"/>
</features>
<cpu mode="custom" match="exact">
diff --git a/tests/xmlconfig.py b/tests/xmlconfig.py
index 048675d..bf41c07 100644
--- a/tests/xmlconfig.py
+++ b/tests/xmlconfig.py
@@ -52,6 +52,8 @@ def _make_guest(installer=None, conn=None):
g.os.arch = "i686"
g.os.os_type = "hvm"
+ g.capsinfo = conn.caps.guest_lookup(g.os.os_type, g.os.arch)
+
g.add_default_input_device()
g.add_default_console_device()
g.add_device(virtinst.VirtualAudio(g.conn))
diff --git a/virtManager/create.py b/virtManager/create.py
index 8401a7a..45de3c5 100644
--- a/virtManager/create.py
+++ b/virtManager/create.py
@@ -504,7 +504,7 @@ class vmmCreate(vmmGObjectUI):
self.widget("startup-error-box").hide()
self.widget("create-forward").set_sensitive(True)
- if not self.conn.caps.has_install_options():
+ if not self.capsinfo.guest.has_install_options():
error = _("No hypervisor options were found for this "
"connection.")
@@ -539,7 +539,7 @@ class vmmCreate(vmmGObjectUI):
self.startup_warning(error)
elif self.conn.is_qemu():
- if not self.conn.caps.is_kvm_available():
+ if not self.capsinfo.guest.is_kvm_available():
error = _("KVM is not available. This may mean the KVM "
"package is not installed, or the KVM kernel modules "
"are not loaded. Your virtual machines may perform poorly.")
@@ -875,11 +875,10 @@ class vmmCreate(vmmGObjectUI):
break
capsinfo = self.conn.caps.guest_lookup(os_type=gtype, arch=arch)
- newg, newdom = capsinfo.get_caps_objects()
if self.capsinfo:
- oldg, olddom = self.capsinfo.get_caps_objects()
- if oldg == newg and olddom and newdom:
+ if (self.capsinfo.guest == capsinfo.guest and
+ self.capsinfo.domain == capsinfo.domain)
return
self.capsinfo = capsinfo
diff --git a/virtinst/capabilities.py b/virtinst/capabilities.py
index bed8596..a26b4a2 100644
--- a/virtinst/capabilities.py
+++ b/virtinst/capabilities.py
@@ -268,6 +268,36 @@ class _CapsGuest(XMLBuilder):
# Fallback, just return last item in list
return domains[-1]
+ def has_install_options(self):
+ """
+ Return True if there are any install options available
+ """
+ if len(self.domains) > 0:
+ return True
+
+ return False
+
+ def is_kvm_available(self):
+ """
+ Return True if kvm guests can be installed
+ """
+ if self.os_type != "hvm":
+ return False
+
+ for d in self.domains:
+ if d.hypervisor_type == "kvm":
+ return True
+
+ return False
+
+ def supports_pae(self):
+ """
+ Return True if capabilities report support for PAE
+ """
+ if self.features.pae:
+ return True
+ return False
+
############################
# Main capabilities object #
@@ -280,23 +310,17 @@ class _CapsInfo(object):
"""
def __init__(self, conn, guest, domain, requested_machine):
self.conn = conn
- self._guest = guest
- self._domain = domain
+ self.guest = guest
+ self.domain = domain
self._requested_machine = requested_machine
- self.hypervisor_type = self._domain.hypervisor_type
- self.os_type = self._guest.os_type
- self.arch = self._guest.arch
- self.loader = self._guest.loader
+ self.hypervisor_type = self.domain.hypervisor_type
+ self.os_type = self.guest.os_type
+ self.arch = self.guest.arch
+ self.loader = self.guest.loader
- self.emulator = self._domain.emulator
- self.machines = self._domain.machines[:]
-
- def get_caps_objects(self):
- """
- Return the raw backing caps objects
- """
- return self._guest, self._domain
+ self.emulator = self.domain.emulator
+ self.machines = self.domain.machines[:]
def get_recommended_machine(self):
"""
@@ -360,39 +384,6 @@ class Capabilities(XMLBuilder):
# Public API #
##############
- def has_install_options(self):
- """
- Return True if there are any install options available
- """
- for g in self.guests:
- if len(g.domains) > 0:
- return True
-
- return False
-
- def is_kvm_available(self):
- """
- Return True if kvm guests can be installed
- """
- for g in self.guests:
- if g.os_type != "hvm":
- continue
-
- for d in g.domains:
- if d.hypervisor_type == "kvm":
- return True
-
- return False
-
- def supports_pae(self):
- """
- Return True if capabilities report support for PAE
- """
- for g in self.guests:
- if g.features.pae:
- return True
- return False
-
def get_cpu_values(self, arch):
if not arch:
return []
@@ -498,6 +489,8 @@ class Capabilities(XMLBuilder):
gobj.os.machine = capsinfo.get_recommended_machine()
+ gobj.capsinfo = capsinfo
+
return gobj
def lookup_virtinst_guest(self, *args, **kwargs):
diff --git a/virtinst/guest.py b/virtinst/guest.py
index bf4b70b..7ff7bd5 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -844,7 +844,7 @@ class Guest(XMLBuilder):
if self.features.apic == "default":
self.features.apic = self._os_object.supports_apic(default)
if self.features.pae == "default":
- self.features.pae = self.conn.caps.supports_pae()
+ self.features.pae = self.capsinfo.guest.supports_pae()
if (self.features.vmport == "default" and
self.has_spice() and
--
2.4.5
More information about the virt-tools-list
mailing list