192ee79
From 12c4a54a92f935abceb358a8d7ba8f391597f014 Mon Sep 17 00:00:00 2001
192ee79
From: Cole Robinson <crobinso@redhat.com>
192ee79
Date: Mon, 17 Feb 2014 11:43:53 -0500
192ee79
Subject: [PATCH] caps: Simplify guest lookup routines
192ee79
192ee79
Checking for acceleration should always be done, API users can opt out
192ee79
by requesting a specific domain type.
192ee79
192ee79
(cherry picked from commit 63b27ceae1e5a1521b968deb7e04d1a5ebd3de39)
192ee79
---
192ee79
 .../compare/virt-convert-ovf-compare.xml           |  7 +++-
192ee79
 .../compare/virt-convert-vmx-compare.xml           |  7 +++-
192ee79
 .../ovf2libvirt_ovf_directory.libvirt              |  7 +++-
192ee79
 .../libvirt_output/ovf2libvirt_test1.libvirt       |  7 +++-
192ee79
 .../ovf2libvirt_test1.libvirt.disk_qcow2           |  7 +++-
192ee79
 .../libvirt_output/ovf2libvirt_test2.libvirt       |  7 +++-
192ee79
 .../vmx2libvirt_test-vmx-zip.libvirt               |  7 +++-
192ee79
 .../libvirt_output/vmx2libvirt_test1.libvirt       |  7 +++-
192ee79
 .../vmx2libvirt_test1.libvirt.disk_raw             |  7 +++-
192ee79
 .../libvirt_output/vmx2libvirt_vmx-dir.libvirt     |  7 +++-
192ee79
 virt-install                                       |  3 --
192ee79
 virtManager/create.py                              |  4 +-
192ee79
 virtinst/capabilities.py                           | 49 +++++-----------------
192ee79
 virtinst/virtimage.py                              |  9 +---
192ee79
 14 files changed, 63 insertions(+), 72 deletions(-)
192ee79
192ee79
diff --git a/tests/cli-test-xml/compare/virt-convert-ovf-compare.xml b/tests/cli-test-xml/compare/virt-convert-ovf-compare.xml
192ee79
index c073ffc..a1d2f75 100644
192ee79
--- a/tests/cli-test-xml/compare/virt-convert-ovf-compare.xml
192ee79
+++ b/tests/cli-test-xml/compare/virt-convert-ovf-compare.xml
192ee79
@@ -1,6 +1,6 @@
192ee79
 Copying test.ovf-disk1.vmdk to /tmp/test.ovf-disk1
192ee79
 Copying testfile to /tmp/testfile
192ee79
-<domain type="qemu">
192ee79
+<domain type="kvm">
192ee79
   <name>test.ovf</name>
192ee79
   <uuid>00000000-1111-2222-3333-444444444444</uuid>
192ee79
   <description>This is the description, created by RWMJ.</description>
192ee79
@@ -16,6 +16,9 @@ Copying testfile to /tmp/testfile
192ee79
     <apic/>
192ee79
     <pae/>
192ee79
   </features>
192ee79
+  <cpu mode="custom" match="exact">
192ee79
+    <model>core2duo</model>
192ee79
+  </cpu>
192ee79
   <clock offset="utc">
192ee79
     <timer name="rtc" tickpolicy="catchup"/>
192ee79
     <timer name="pit" tickpolicy="delay"/>
192ee79
@@ -25,7 +28,7 @@ Copying testfile to /tmp/testfile
192ee79
   <on_reboot>restart</on_reboot>
192ee79
   <on_crash>restart</on_crash>
192ee79
   <devices>
192ee79
-    <emulator>/usr/bin/qemu-system-x86_64</emulator>
192ee79
+    <emulator>/usr/bin/qemu-kvm</emulator>
192ee79
     <disk type="file" device="disk">
192ee79
       <driver name="qemu"/>
192ee79
       <source file="/tmp/test.ovf-disk1"/>
192ee79
diff --git a/tests/cli-test-xml/compare/virt-convert-vmx-compare.xml b/tests/cli-test-xml/compare/virt-convert-vmx-compare.xml
192ee79
index 20f046d..ffe7b59 100644
192ee79
--- a/tests/cli-test-xml/compare/virt-convert-vmx-compare.xml
192ee79
+++ b/tests/cli-test-xml/compare/virt-convert-vmx-compare.xml
192ee79
@@ -1,5 +1,5 @@
192ee79
 Running /usr/bin/qemu-img convert -O qcow2 fedora.vmdk /var/lib/libvirt/images/fedora.qcow2
192ee79
-<domain type="qemu">
192ee79
+<domain type="kvm">
192ee79
   <name>fedora</name>
192ee79
   <uuid>00000000-1111-2222-3333-444444444444</uuid>
192ee79
   <memory>524288</memory>
192ee79
@@ -14,6 +14,9 @@ Running /usr/bin/qemu-img convert -O qcow2 fedora.vmdk /var/lib/libvirt/images/f
192ee79
     <apic/>
192ee79
     <pae/>
192ee79
   </features>
192ee79
+  <cpu mode="custom" match="exact">
192ee79
+    <model>core2duo</model>
192ee79
+  </cpu>
192ee79
   <clock offset="utc">
192ee79
     <timer name="rtc" tickpolicy="catchup"/>
192ee79
     <timer name="pit" tickpolicy="delay"/>
192ee79
@@ -23,7 +26,7 @@ Running /usr/bin/qemu-img convert -O qcow2 fedora.vmdk /var/lib/libvirt/images/f
192ee79
   <on_reboot>restart</on_reboot>
192ee79
   <on_crash>restart</on_crash>
192ee79
   <devices>
192ee79
-    <emulator>/usr/bin/qemu-system-x86_64</emulator>
192ee79
+    <emulator>/usr/bin/qemu-kvm</emulator>
192ee79
     <disk type="file" device="disk">
192ee79
       <driver name="qemu" type="qcow2"/>
192ee79
       <source file="/var/lib/libvirt/images/fedora.qcow2"/>
192ee79
diff --git a/tests/virtconv-files/libvirt_output/ovf2libvirt_ovf_directory.libvirt b/tests/virtconv-files/libvirt_output/ovf2libvirt_ovf_directory.libvirt
192ee79
index c88c140..597a0c5 100644
192ee79
--- a/tests/virtconv-files/libvirt_output/ovf2libvirt_ovf_directory.libvirt
192ee79
+++ b/tests/virtconv-files/libvirt_output/ovf2libvirt_ovf_directory.libvirt
192ee79
@@ -1,4 +1,4 @@
192ee79
-<domain type="qemu">
192ee79
+<domain type="kvm">
192ee79
   <name>CentOS-6.4-i386-Gnome.ovf</name>
192ee79
   <uuid>00000000-1111-2222-3333-444444444444</uuid>
192ee79
   <memory>524288</memory>
192ee79
@@ -13,6 +13,9 @@
192ee79
     <apic/>
192ee79
     <pae/>
192ee79
   </features>
192ee79
+  <cpu mode="custom" match="exact">
192ee79
+    <model>core2duo</model>
192ee79
+  </cpu>
192ee79
   <clock offset="utc">
192ee79
     <timer name="rtc" tickpolicy="catchup"/>
192ee79
     <timer name="pit" tickpolicy="delay"/>
192ee79
@@ -22,7 +25,7 @@
192ee79
   <on_reboot>restart</on_reboot>
192ee79
   <on_crash>restart</on_crash>
192ee79
   <devices>
192ee79
-    <emulator>/usr/bin/qemu-system-x86_64</emulator>
192ee79
+    <emulator>/usr/bin/qemu-kvm</emulator>
192ee79
     <disk type="file" device="disk">
192ee79
       <driver name="qemu"/>
192ee79
       <source file="/var/lib/libvirt/images/CentOS-6.4-i386-Gnome-disk1"/>
192ee79
diff --git a/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt b/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt
192ee79
index 22978ca..83c3f90 100644
192ee79
--- a/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt
192ee79
+++ b/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt
192ee79
@@ -1,4 +1,4 @@
192ee79
-<domain type="qemu">
192ee79
+<domain type="kvm">
192ee79
   <name>test.ovf</name>
192ee79
   <uuid>00000000-1111-2222-3333-444444444444</uuid>
192ee79
   <description>This is the description, created by RWMJ.</description>
192ee79
@@ -14,6 +14,9 @@
192ee79
     <apic/>
192ee79
     <pae/>
192ee79
   </features>
192ee79
+  <cpu mode="custom" match="exact">
192ee79
+    <model>core2duo</model>
192ee79
+  </cpu>
192ee79
   <clock offset="utc">
192ee79
     <timer name="rtc" tickpolicy="catchup"/>
192ee79
     <timer name="pit" tickpolicy="delay"/>
192ee79
@@ -23,7 +26,7 @@
192ee79
   <on_reboot>restart</on_reboot>
192ee79
   <on_crash>restart</on_crash>
192ee79
   <devices>
192ee79
-    <emulator>/usr/bin/qemu-system-x86_64</emulator>
192ee79
+    <emulator>/usr/bin/qemu-kvm</emulator>
192ee79
     <disk type="file" device="disk">
192ee79
       <driver name="qemu"/>
192ee79
       <source file="/var/lib/libvirt/images/test.ovf-disk1"/>
192ee79
diff --git a/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt.disk_qcow2 b/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt.disk_qcow2
192ee79
index d86ced0..1b50422 100644
192ee79
--- a/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt.disk_qcow2
192ee79
+++ b/tests/virtconv-files/libvirt_output/ovf2libvirt_test1.libvirt.disk_qcow2
192ee79
@@ -1,4 +1,4 @@
192ee79
-<domain type="qemu">
192ee79
+<domain type="kvm">
192ee79
   <name>test.ovf</name>
192ee79
   <uuid>00000000-1111-2222-3333-444444444444</uuid>
192ee79
   <description>This is the description, created by RWMJ.</description>
192ee79
@@ -14,6 +14,9 @@
192ee79
     <apic/>
192ee79
     <pae/>
192ee79
   </features>
192ee79
+  <cpu mode="custom" match="exact">
192ee79
+    <model>core2duo</model>
192ee79
+  </cpu>
192ee79
   <clock offset="utc">
192ee79
     <timer name="rtc" tickpolicy="catchup"/>
192ee79
     <timer name="pit" tickpolicy="delay"/>
192ee79
@@ -23,7 +26,7 @@
192ee79
   <on_reboot>restart</on_reboot>
192ee79
   <on_crash>restart</on_crash>
192ee79
   <devices>
192ee79
-    <emulator>/usr/bin/qemu-system-x86_64</emulator>
192ee79
+    <emulator>/usr/bin/qemu-kvm</emulator>
192ee79
     <disk type="file" device="disk">
192ee79
       <driver name="qemu" type="qcow2"/>
192ee79
       <source file="/var/lib/libvirt/images/test.ovf-disk1.qcow2"/>
192ee79
diff --git a/tests/virtconv-files/libvirt_output/ovf2libvirt_test2.libvirt b/tests/virtconv-files/libvirt_output/ovf2libvirt_test2.libvirt
192ee79
index aa0303e..9d28269 100644
192ee79
--- a/tests/virtconv-files/libvirt_output/ovf2libvirt_test2.libvirt
192ee79
+++ b/tests/virtconv-files/libvirt_output/ovf2libvirt_test2.libvirt
192ee79
@@ -1,4 +1,4 @@
192ee79
-<domain type="qemu">
192ee79
+<domain type="kvm">
192ee79
   <name>w2k3_32bit</name>
192ee79
   <uuid>00000000-1111-2222-3333-444444444444</uuid>
192ee79
   <description>Description added by RWMJ.</description>
192ee79
@@ -14,6 +14,9 @@
192ee79
     <apic/>
192ee79
     <pae/>
192ee79
   </features>
192ee79
+  <cpu mode="custom" match="exact">
192ee79
+    <model>core2duo</model>
192ee79
+  </cpu>
192ee79
   <clock offset="utc">
192ee79
     <timer name="rtc" tickpolicy="catchup"/>
192ee79
     <timer name="pit" tickpolicy="delay"/>
192ee79
@@ -23,7 +26,7 @@
192ee79
   <on_reboot>restart</on_reboot>
192ee79
   <on_crash>restart</on_crash>
192ee79
   <devices>
192ee79
-    <emulator>/usr/bin/qemu-system-x86_64</emulator>
192ee79
+    <emulator>/usr/bin/qemu-kvm</emulator>
192ee79
     <disk type="file" device="disk">
192ee79
       <driver name="qemu"/>
192ee79
       <source file="/var/lib/libvirt/images/w2k3_32bit-disk1"/>
192ee79
diff --git a/tests/virtconv-files/libvirt_output/vmx2libvirt_test-vmx-zip.libvirt b/tests/virtconv-files/libvirt_output/vmx2libvirt_test-vmx-zip.libvirt
192ee79
index 179978b..9e2058f 100644
192ee79
--- a/tests/virtconv-files/libvirt_output/vmx2libvirt_test-vmx-zip.libvirt
192ee79
+++ b/tests/virtconv-files/libvirt_output/vmx2libvirt_test-vmx-zip.libvirt
192ee79
@@ -1,4 +1,4 @@
192ee79
-<domain type="qemu">
192ee79
+<domain type="kvm">
192ee79
   <name>minix</name>
192ee79
   <uuid>00000000-1111-2222-3333-444444444444</uuid>
192ee79
   <memory>204800</memory>
192ee79
@@ -14,6 +14,9 @@
192ee79
     <apic/>
192ee79
     <pae/>
192ee79
   </features>
192ee79
+  <cpu mode="custom" match="exact">
192ee79
+    <model>core2duo</model>
192ee79
+  </cpu>
192ee79
   <clock offset="utc">
192ee79
     <timer name="rtc" tickpolicy="catchup"/>
192ee79
     <timer name="pit" tickpolicy="delay"/>
192ee79
@@ -23,7 +26,7 @@
192ee79
   <on_reboot>restart</on_reboot>
192ee79
   <on_crash>restart</on_crash>
192ee79
   <devices>
192ee79
-    <emulator>/usr/bin/qemu-system-x86_64</emulator>
192ee79
+    <emulator>/usr/bin/qemu-kvm</emulator>
192ee79
     <disk type="block" device="cdrom">
192ee79
       <driver type="raw"/>
192ee79
       <target dev="hda" bus="ide"/>
192ee79
diff --git a/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt b/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt
192ee79
index 1ff4eec..a6fc259 100644
192ee79
--- a/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt
192ee79
+++ b/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt
192ee79
@@ -1,4 +1,4 @@
192ee79
-<domain type="qemu">
192ee79
+<domain type="kvm">
192ee79
   <name>fedora</name>
192ee79
   <uuid>00000000-1111-2222-3333-444444444444</uuid>
192ee79
   <memory>524288</memory>
192ee79
@@ -13,6 +13,9 @@
192ee79
     <apic/>
192ee79
     <pae/>
192ee79
   </features>
192ee79
+  <cpu mode="custom" match="exact">
192ee79
+    <model>core2duo</model>
192ee79
+  </cpu>
192ee79
   <clock offset="utc">
192ee79
     <timer name="rtc" tickpolicy="catchup"/>
192ee79
     <timer name="pit" tickpolicy="delay"/>
192ee79
@@ -22,7 +25,7 @@
192ee79
   <on_reboot>restart</on_reboot>
192ee79
   <on_crash>restart</on_crash>
192ee79
   <devices>
192ee79
-    <emulator>/usr/bin/qemu-system-x86_64</emulator>
192ee79
+    <emulator>/usr/bin/qemu-kvm</emulator>
192ee79
     <disk type="file" device="disk">
192ee79
       <driver name="qemu"/>
192ee79
       <source file="/var/lib/libvirt/images/fedora"/>
192ee79
diff --git a/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt.disk_raw b/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt.disk_raw
192ee79
index 2abd1e2..9c3d6e2 100644
192ee79
--- a/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt.disk_raw
192ee79
+++ b/tests/virtconv-files/libvirt_output/vmx2libvirt_test1.libvirt.disk_raw
192ee79
@@ -1,4 +1,4 @@
192ee79
-<domain type="qemu">
192ee79
+<domain type="kvm">
192ee79
   <name>fedora</name>
192ee79
   <uuid>00000000-1111-2222-3333-444444444444</uuid>
192ee79
   <memory>524288</memory>
192ee79
@@ -13,6 +13,9 @@
192ee79
     <apic/>
192ee79
     <pae/>
192ee79
   </features>
192ee79
+  <cpu mode="custom" match="exact">
192ee79
+    <model>core2duo</model>
192ee79
+  </cpu>
192ee79
   <clock offset="utc">
192ee79
     <timer name="rtc" tickpolicy="catchup"/>
192ee79
     <timer name="pit" tickpolicy="delay"/>
192ee79
@@ -22,7 +25,7 @@
192ee79
   <on_reboot>restart</on_reboot>
192ee79
   <on_crash>restart</on_crash>
192ee79
   <devices>
192ee79
-    <emulator>/usr/bin/qemu-system-x86_64</emulator>
192ee79
+    <emulator>/usr/bin/qemu-kvm</emulator>
192ee79
     <disk type="file" device="disk">
192ee79
       <driver name="qemu" type="raw"/>
192ee79
       <source file="/var/lib/libvirt/images/fedora.raw"/>
192ee79
diff --git a/tests/virtconv-files/libvirt_output/vmx2libvirt_vmx-dir.libvirt b/tests/virtconv-files/libvirt_output/vmx2libvirt_vmx-dir.libvirt
192ee79
index 7887f36..74f3541 100644
192ee79
--- a/tests/virtconv-files/libvirt_output/vmx2libvirt_vmx-dir.libvirt
192ee79
+++ b/tests/virtconv-files/libvirt_output/vmx2libvirt_vmx-dir.libvirt
192ee79
@@ -1,4 +1,4 @@
192ee79
-<domain type="qemu">
192ee79
+<domain type="kvm">
192ee79
   <name>esx4.0-rhel4.8-i386</name>
192ee79
   <uuid>00000000-1111-2222-3333-444444444444</uuid>
192ee79
   <memory>524288</memory>
192ee79
@@ -14,6 +14,9 @@
192ee79
     <apic/>
192ee79
     <pae/>
192ee79
   </features>
192ee79
+  <cpu mode="custom" match="exact">
192ee79
+    <model>core2duo</model>
192ee79
+  </cpu>
192ee79
   <clock offset="utc">
192ee79
     <timer name="rtc" tickpolicy="catchup"/>
192ee79
     <timer name="pit" tickpolicy="delay"/>
192ee79
@@ -23,7 +26,7 @@
192ee79
   <on_reboot>restart</on_reboot>
192ee79
   <on_crash>restart</on_crash>
192ee79
   <devices>
192ee79
-    <emulator>/usr/bin/qemu-system-x86_64</emulator>
192ee79
+    <emulator>/usr/bin/qemu-kvm</emulator>
192ee79
     <disk type="block" device="cdrom">
192ee79
       <target dev="hda" bus="ide"/>
192ee79
       <readonly/>
192ee79
diff --git a/virt-install b/virt-install
192ee79
index 6453f77..a801952 100755
192ee79
--- a/virt-install
192ee79
+++ b/virt-install
192ee79
@@ -177,7 +177,6 @@ def get_guest(conn, options):
192ee79
                               options.container]]) > 1:
192ee79
         fail(_("Can't do more than one of --hvm, --paravirt, or --container"))
192ee79
 
192ee79
-    req_accel = True
192ee79
     req_hv_type = options.hv_type and options.hv_type.lower() or None
192ee79
     if options.fullvirt:
192ee79
         req_virt_type = "hvm"
192ee79
@@ -203,7 +202,6 @@ def get_guest(conn, options):
192ee79
                         os_type=req_virt_type,
192ee79
                         arch=arch,
192ee79
                         typ=req_hv_type,
192ee79
-                        accelerated=req_accel,
192ee79
                         machine=options.machine)
192ee79
         guest = conn.caps.build_virtinst_guest(conn, capsguest, capsdomain)
192ee79
         guest.os.machine = options.machine
192ee79
@@ -212,7 +210,6 @@ def get_guest(conn, options):
192ee79
 
192ee79
     if (not req_virt_type and
192ee79
         not req_hv_type and
192ee79
-        req_accel and
192ee79
         conn.is_qemu() and
192ee79
         capsguest.arch in ["i686", "x86_64"] and
192ee79
         not capsdomain.is_accelerated()):
192ee79
diff --git a/virtManager/create.py b/virtManager/create.py
192ee79
index f1c57b7..2af62c4 100644
192ee79
--- a/virtManager/create.py
192ee79
+++ b/virtManager/create.py
192ee79
@@ -858,9 +858,7 @@ class vmmCreate(vmmGObjectUI):
192ee79
                     gtype = "hvm"
192ee79
                     break
192ee79
 
192ee79
-        (newg, newdom) = self.caps.guest_lookup(os_type=gtype,
192ee79
-                                                accelerated=True,
192ee79
-                                                arch=arch)
192ee79
+        (newg, newdom) = self.caps.guest_lookup(os_type=gtype, arch=arch)
192ee79
 
192ee79
         if (self.capsguest and self.capsdomain and
192ee79
             (newg.arch == self.capsguest.arch and
192ee79
diff --git a/virtinst/capabilities.py b/virtinst/capabilities.py
192ee79
index c55f67d..b8d3330 100644
192ee79
--- a/virtinst/capabilities.py
192ee79
+++ b/virtinst/capabilities.py
192ee79
@@ -345,18 +345,15 @@ class Guest(object):
192ee79
 
192ee79
             child = child.next
192ee79
 
192ee79
-    def _favoredDomain(self, accelerated, domains):
192ee79
+    def _favoredDomain(self, domains):
192ee79
         """
192ee79
         Return the recommended domain for use if the user does not explicitly
192ee79
         request one.
192ee79
         """
192ee79
-        if accelerated is None:
192ee79
-            # Picking last in list so we favour KVM/KQEMU over QEMU
192ee79
-            return domains[-1]
192ee79
+        if not domains:
192ee79
+            return None
192ee79
 
192ee79
         priority = ["kvm", "xen", "kqemu", "qemu"]
192ee79
-        if not accelerated:
192ee79
-            priority.reverse()
192ee79
 
192ee79
         for t in priority:
192ee79
             for d in domains:
192ee79
@@ -366,7 +363,7 @@ class Guest(object):
192ee79
         # Fallback, just return last item in list
192ee79
         return domains[-1]
192ee79
 
192ee79
-    def bestDomainType(self, accelerated=None, dtype=None, machine=None):
192ee79
+    def bestDomainType(self, dtype=None, machine=None):
192ee79
         domains = []
192ee79
         for d in self.domains:
192ee79
             if dtype and d.hypervisor_type != dtype.lower():
192ee79
@@ -375,22 +372,7 @@ class Guest(object):
192ee79
                 continue
192ee79
             domains.append(d)
192ee79
 
192ee79
-        if len(domains) == 0:
192ee79
-            domainerr = ""
192ee79
-            machineerr = ""
192ee79
-            if dtype:
192ee79
-                domainerr = _(", domain type '%s'") % dtype
192ee79
-            if machine:
192ee79
-                machineerr = _(", machine type '%s'") % machine
192ee79
-
192ee79
-            error = (_("No domains available for virt type '%(type)s', "
192ee79
-                      "arch '%(arch)s'") %
192ee79
-                      {'type': self.os_type, 'arch': self.arch})
192ee79
-            error += domainerr
192ee79
-            error += machineerr
192ee79
-            raise RuntimeError(error)
192ee79
-
192ee79
-        return self._favoredDomain(accelerated, domains)
192ee79
+        return self._favoredDomain(domains)
192ee79
 
192ee79
 
192ee79
 class Domain(object):
192ee79
@@ -621,7 +603,7 @@ class Capabilities(object):
192ee79
                 return True
192ee79
         return False
192ee79
 
192ee79
-    def guestForOSType(self, typ=None, arch=None):
192ee79
+    def _guestForOSType(self, typ=None, arch=None):
192ee79
         if self.host is None:
192ee79
             return None
192ee79
 
192ee79
@@ -652,8 +634,7 @@ class Capabilities(object):
192ee79
         return self._cpu_values.get_arch(arch)
192ee79
 
192ee79
 
192ee79
-    def guest_lookup(self, os_type=None, arch=None, typ=None,
192ee79
-                     accelerated=False, machine=None):
192ee79
+    def guest_lookup(self, os_type=None, arch=None, typ=None, machine=None):
192ee79
         """
192ee79
         Simple virtualization availability lookup
192ee79
 
192ee79
@@ -671,20 +652,13 @@ class Capabilities(object):
192ee79
         not found.
192ee79
 
192ee79
         @param typ: Virtualization type ('hvm', 'xen', ...)
192ee79
-        @type typ: C{str}
192ee79
         @param arch: Guest architecture ('x86_64', 'i686' ...)
192ee79
-        @type arch: C{str}
192ee79
         @param os_type: Hypervisor name ('qemu', 'kvm', 'xen', ...)
192ee79
-        @type os_type: C{str}
192ee79
-        @param accelerated: Whether to look for accelerated domain if none is
192ee79
-                            specifically requested
192ee79
-        @type accelerated: C{bool}
192ee79
         @param machine: Optional machine type to emulate
192ee79
-        @type machine: C{str}
192ee79
 
192ee79
         @returns: A (Capabilities Guest, Capabilities Domain) tuple
192ee79
         """
192ee79
-        guest = self.guestForOSType(os_type, arch)
192ee79
+        guest = self._guestForOSType(os_type, arch)
192ee79
         if not guest:
192ee79
             archstr = _("for arch '%s'") % arch
192ee79
             if not arch:
192ee79
@@ -697,12 +671,9 @@ class Capabilities(object):
192ee79
             raise ValueError(_("Host does not support %(virttype)s %(arch)s") %
192ee79
                                {'virttype' : osstr, 'arch' : archstr})
192ee79
 
192ee79
-        domain = guest.bestDomainType(accelerated=accelerated,
192ee79
-                                      dtype=typ,
192ee79
-                                      machine=machine)
192ee79
-
192ee79
+        domain = guest.bestDomainType(dtype=typ, machine=machine)
192ee79
         if domain is None:
192ee79
-            machinestr = "with machine '%s'" % machine
192ee79
+            machinestr = " with machine '%s'" % machine
192ee79
             if not machine:
192ee79
                 machinestr = ""
192ee79
             raise ValueError(_("Host does not support domain type %(domain)s"
192ee79
diff --git a/virtinst/virtimage.py b/virtinst/virtimage.py
192ee79
index 44c5640..c09428b 100644
192ee79
--- a/virtinst/virtimage.py
192ee79
+++ b/virtinst/virtimage.py
192ee79
@@ -348,13 +348,8 @@ class ImageInstaller(Installer):
192ee79
             self._boot_caps = image.domain.boots[boot_index]
192ee79
 
192ee79
         # Set up internal caps.guest object
192ee79
-        self._guest = self.conn.caps.guestForOSType(self.boot_caps.type,
192ee79
-                                                    self.boot_caps.arch)
192ee79
-        if self._guest is None:
192ee79
-            raise RuntimeError(_("Unsupported virtualization type: %s %s" %
192ee79
-                               (self.boot_caps.type, self.boot_caps.arch)))
192ee79
-        self._domain = self._guest.bestDomainType()
192ee79
-
192ee79
+        self._guest, self._domain = self.conn.caps.guest_lookup(
192ee79
+            os_type=self.boot_caps.type, arch=self.boot_caps.arch)
192ee79
 
192ee79
 
192ee79
     # Custom ImageInstaller methods