summaryrefslogtreecommitdiff
path: root/virtinst/capabilities.py
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2014-09-23 16:05:48 -0400
committerCole Robinson <crobinso@redhat.com>2014-09-23 16:05:48 -0400
commitc4162f6708764a3e458baeea16ce7026ed8b0b2c (patch)
tree13450be0b44d60b244f7947be7a685c6d4e94cd2 /virtinst/capabilities.py
parent0182ba3eadfee3acc5458ffe0b28d27748ef522a (diff)
downloadvirt-manager-c4162f6708764a3e458baeea16ce7026ed8b0b2c.tar.gz
Use -M virt as default machine for arm/aarch64
Centralize the default machine logic in caps and use it consistently
Diffstat (limited to 'virtinst/capabilities.py')
-rw-r--r--virtinst/capabilities.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/virtinst/capabilities.py b/virtinst/capabilities.py
index f1cf8b7e..167f6131 100644
--- a/virtinst/capabilities.py
+++ b/virtinst/capabilities.py
@@ -360,10 +360,15 @@ class Guest(object):
def bestDomainType(self, dtype=None, machine=None):
domains = []
for d in self.domains:
+ d.set_recommended_machine(None)
+
if dtype and d.hypervisor_type != dtype.lower():
continue
if machine and machine not in d.machines:
continue
+
+ if machine:
+ d.set_recommended_machine(machine)
domains.append(d)
return self._favoredDomain(domains)
@@ -378,9 +383,30 @@ class Domain(object):
self.loader = loader
self.machines = machines
+ self._recommended_machine = None
+
if node is not None:
self.parseXML(node)
+ def get_recommended_machine(self, conn, capsguest):
+ if self._recommended_machine:
+ return self._recommended_machine
+
+ if not conn.is_test() and not conn.is_qemu():
+ return None
+
+ if capsguest.arch == "ppc64" and "pseries" in self.machines:
+ return "pseries"
+ if capsguest.arch in ["armv7l", "aarch64"]:
+ if "virt" in self.machines:
+ return "virt"
+ if "vexpress-a15" in self.machines:
+ return "vexpress-a15"
+
+ return None
+
+ def set_recommended_machine(self, machine):
+ self._recommended_machine = machine
def parseXML(self, node):
child = node.children
@@ -695,5 +721,6 @@ class Capabilities(object):
gobj.os.arch = guest.arch
gobj.os.loader = domain.loader
gobj.emulator = domain.emulator
+ gobj.os.machine = domain.get_recommended_machine(conn, guest)
return gobj