mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-11 05:17:59 +03:00
cpu: Drop vendor and features if setting host-model (bz 1190851)
Otherwise via virt-manager we can try to set a <cpu> with a <vendor> but no <model>, and libvirt complains.
This commit is contained in:
parent
2c9d2a2360
commit
dc1737e623
@ -23,7 +23,7 @@
|
||||
<label>frob</label>
|
||||
</seclabel>
|
||||
<cpu mode="custom" match="exact">
|
||||
<model>foobar</model>
|
||||
<model fallback="allow">foobar</model>
|
||||
<topology sockets="1" cores="4" threads="1"/>
|
||||
<feature policy="forbid" name="x2apic"/>
|
||||
</cpu>
|
||||
|
@ -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)
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user