# HG changeset patch
# User "Cole Robinson <crobinso@redhat.com>"
# Date 1206630374 14400
# Node ID dc4c1ab45f41e9d49634e8d636c3490e7d179e25
# Parent ad08b2d193821162d9112d52b35874abcb5f638f
Fix capabilies guestForOSType to default to hosts arch if none is explicitly provided. Moves default virt-install arch back to previous values.
diff -r ad08b2d19382 -r dc4c1ab45f41 virtinst/CapabilitiesParser.py
--- a/virtinst/CapabilitiesParser.py Thu Mar 27 10:19:48 2008 -0400
+++ b/virtinst/CapabilitiesParser.py Thu Mar 27 11:06:14 2008 -0400
@@ -258,11 +258,18 @@ class Capabilities(object):
self._fixBrokenEmulator()
def guestForOSType(self, type = None, arch = None):
- for g in self.guests:
- if (type is None or g.os_type == type) and (arch is None or g.arch == arch):
- return g
- return None
-
+ if self.host is None:
+ return None
+
+ if arch is None:
+ archs = [self.host.arch, None]
+ else:
+ archs = [arch]
+ for a in archs:
+ for g in self.guests:
+ if (type is None or g.os_type == type) and \
+ (a is None or g.arch == a):
+ return g
# 32-bit HVM emulator path, on a 64-bit host is wrong due
# to bug in libvirt capabilities. We fix by copying the