From 310f65273f7cafb148250b44aa442a62228e33d8 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Tue, 23 Sep 2014 17:09:36 -0400 Subject: [PATCH] osdict: Restrict n-cpus to 1 for machvirt It fails to boot otherwise --- virtManager/create.py | 2 +- virtinst/osdict.py | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/virtManager/create.py b/virtManager/create.py index 65dd83d2e..f15763c9a 100644 --- a/virtManager/create.py +++ b/virtManager/create.py @@ -1633,7 +1633,7 @@ class vmmCreate(vmmGObjectUI): self.addstorage.check_path_search( self, self.conn, path) - res = virtinst.osdict.get_recommended_resources(variant, self.capsguest.arch) + res = virtinst.osdict.get_recommended_resources(variant, self.guest) # Change the default values suggested to the user. ram_size = DEFAULT_MEM diff --git a/virtinst/osdict.py b/virtinst/osdict.py index 16a1fb1de..515eaf21a 100644 --- a/virtinst/osdict.py +++ b/virtinst/osdict.py @@ -484,7 +484,7 @@ class _OsVariant(_OsVariantType): return None - def get_recommended_resources(self, arch): + def get_recommended_resources(self, guest): ret = {} def read_resource(resources, minimum, arch): # If we are reading the "minimum" block, allocate more @@ -505,9 +505,14 @@ class _OsVariant(_OsVariantType): # in this case read first the minimum resources (if present) # and use them. read_resource(self._os.get_minimum_resources(), True, "all") - read_resource(self._os.get_minimum_resources(), True, arch) + read_resource(self._os.get_minimum_resources(), True, guest.os.arch) read_resource(self._os.get_recommended_resources(), False, "all") - read_resource(self._os.get_recommended_resources(), False, arch) + read_resource(self._os.get_recommended_resources(), + False, guest.os.arch) + + # machvirt doesn't allow smp in non-kvm mode + if guest.type != "kvm" and guest.os.is_arm_machvirt(): + ret["n-cpus"] = 1 return ret @@ -607,13 +612,13 @@ def lookup_osdict_key(variant, key, default): return val -def get_recommended_resources(variant, arch): +def get_recommended_resources(variant, guest): _load_os_data() v = _allvariants.get(variant) if v is None: return None - return v.get_recommended_resources(arch) + return v.get_recommended_resources(guest) def lookup_os_by_media(location):