From: Cole Robinson Date: Thu, 26 Mar 2015 17:08:15 -0400 Subject: [PATCH virt-manager] cpu: Drop vendor and features if setting host-model (bz 1190851) Otherwise via virt-manager we can try to set a with a but no , and libvirt complains. (cherry picked from commit dc1737e623aef0f661cc28c0c5b87f847fc2526b) --- tests/xmlparse-xml/change-minimal-guest-out.xml | 2 +- tests/xmlparse.py | 1 + virtinst/cpu.py | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/xmlparse-xml/change-minimal-guest-out.xml b/tests/xmlparse-xml/change-minimal-guest-out.xml index 5363080..f3be5c0 100644 --- a/tests/xmlparse-xml/change-minimal-guest-out.xml +++ b/tests/xmlparse-xml/change-minimal-guest-out.xml @@ -23,7 +23,7 @@ - foobar + foobar diff --git a/tests/xmlparse.py b/tests/xmlparse.py index c4bcb20..477de22 100644 --- a/tests/xmlparse.py +++ b/tests/xmlparse.py @@ -251,6 +251,7 @@ class XMLParseTest(unittest.TestCase): check = self._make_checker(guest.cpu) check("model", None, "foobar") + check("model_fallback", None, "allow") check("cores", None, 4) guest.cpu.add_feature("x2apic", "forbid") guest.cpu.set_topology_defaults(guest.vcpus) diff --git a/virtinst/cpu.py b/virtinst/cpu.py index 551364c..b12fd30 100644 --- a/virtinst/cpu.py +++ b/virtinst/cpu.py @@ -59,6 +59,10 @@ class CPU(XMLBuilder): if (val == self.SPECIAL_MODE_HOST_MODEL or val == self.SPECIAL_MODE_HOST_PASSTHROUGH): self.model = None + self.vendor = None + self.model_fallback = None + for f in self.features: + self.remove_feature(f) self.mode = val elif val == self.SPECIAL_MODE_HOST_COPY: self.copy_host_cpu() @@ -161,6 +165,7 @@ class CPU(XMLBuilder): self.match = "exact" return val model = XMLProperty("./model", set_converter=_set_model) + model_fallback = XMLProperty("./model/@fallback") match = XMLProperty("./@match") vendor = XMLProperty("./vendor")