mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-01 08:26:03 +00:00
fix(instances): a refused vCPU resize keeps the VM's vCPU hotplug
With vCPU hotplug on, a resize defined the VM three times: without its hotplug settings, with the new counts, with hotplug settings again. When libvirt refused the new counts (a maximum over the machine type's limit), the VM was left with hotplug switched off and an error. The counts and the hotplug settings for them now go in one definition. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
parent
34048dce83
commit
63fb7defee
2 changed files with 25 additions and 23 deletions
|
|
@ -35,6 +35,10 @@ class ResizeCpuTests(unittest.TestCase):
|
|||
for topology, count in (("<topology sockets='2' cores='2' threads='1'/>", "4"), ("", "4")):
|
||||
with self.subTest(topology):
|
||||
inst = shut_off_vm(DOMAIN_XML.format(count=2, topology=topology))
|
||||
inst.resize_cpu("2", count)
|
||||
vcpu = etree.fromstring(inst.wvm.defineXML.call_args_list[1].args[0]).find("vcpu")
|
||||
self.assertEqual((vcpu.text, vcpu.get("current")), ("4", "2"))
|
||||
inst.resize_cpu("3", count)
|
||||
# one definition: libvirt refusing it leaves the hotplug settings as they were
|
||||
tree = etree.fromstring(inst.wvm.defineXML.call_args.args[0])
|
||||
self.assertEqual(inst.wvm.defineXML.call_count, 1)
|
||||
vcpu = tree.find("vcpu")
|
||||
self.assertEqual((vcpu.text, vcpu.get("current")), ("4", "3"))
|
||||
self.assertEqual(tree.xpath("vcpus/vcpu[@enabled='yes']/@id"), ["0", "1", "2"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue