[virt-tools-list] [virt-manager PATCH 2/3] virtinst.capabilities: return recommended machine for XEN

Pavel Hrdina phrdina at redhat.com
Thu Jun 16 10:23:20 UTC 2016


This is required in order to ask for correct domcapabilities.  If you don't
specify any machine libvirt will return domcapabilities for default machine
which is xenpv.

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 tests/cli-test-xml/compare/virt-install-xen-hvm.xml | 2 +-
 tests/cli-test-xml/compare/virt-install-xen-pv.xml  | 2 +-
 virtinst/capabilities.py                            | 7 ++++++-
 3 files changed, 8 insertions(+), 3 deletions(-)

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 746cce8..59c9daf 100644
--- a/tests/cli-test-xml/compare/virt-install-xen-hvm.xml
+++ b/tests/cli-test-xml/compare/virt-install-xen-hvm.xml
@@ -5,7 +5,7 @@
   <currentMemory>65536</currentMemory>
   <vcpu>1</vcpu>
   <os>
-    <type arch="x86_64">hvm</type>
+    <type arch="x86_64" machine="xenfv">hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
     <boot dev="cdrom"/>
     <boot dev="hd"/>
diff --git a/tests/cli-test-xml/compare/virt-install-xen-pv.xml b/tests/cli-test-xml/compare/virt-install-xen-pv.xml
index e0b0f0a..fd886a4 100644
--- a/tests/cli-test-xml/compare/virt-install-xen-pv.xml
+++ b/tests/cli-test-xml/compare/virt-install-xen-pv.xml
@@ -5,7 +5,7 @@
   <currentMemory>65536</currentMemory>
   <vcpu>1</vcpu>
   <os>
-    <type arch="x86_64">linux</type>
+    <type arch="x86_64" machine="xenpv">linux</type>
     <kernel>/tmp/virtinst-vmlinuz.</kernel>
     <initrd>/tmp/virtinst-initrd.img.</initrd>
     <cmdline>method=tests/cli-test-xml/faketree</cmdline>
diff --git a/virtinst/capabilities.py b/virtinst/capabilities.py
index 4fa1724..a056c3f 100644
--- a/virtinst/capabilities.py
+++ b/virtinst/capabilities.py
@@ -350,9 +350,14 @@ class _CapsInfo(object):
 
         # For any other HV just let libvirt get us the default, these
         # are the only ones we've tested.
-        if not self.conn.is_test() and not self.conn.is_qemu():
+        if (not self.conn.is_test() and
+            not self.conn.is_qemu() and
+            not self.conn.is_xen()):
             return None
 
+        if self.conn.is_xen() and len(self.machines):
+            return self.machines[0]
+
         if (self.arch in ["ppc64", "ppc64le"] and
             "pseries" in self.machines):
             return "pseries"
-- 
2.9.0




More information about the virt-tools-list mailing list