mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-08 19:26:48 +00:00
fix(instances): enabling vCPU hot plug keeps the current vCPU count
Enabling hot plug on a stopped VM wrote every vCPU up to the maximum as enabled, so a VM with 2 of 4 vCPUs booted with 4. The current vCPUs stay enabled now; libvirt adds the rest as disabled hotpluggable vCPUs.
This commit is contained in:
parent
251ddbbec1
commit
c1d2e9610d
4 changed files with 29 additions and 3 deletions
|
|
@ -1105,8 +1105,9 @@ class wvmInstance(wvmConnect):
|
|||
self.instance.setVcpu(str(cpu_id), enabled)
|
||||
|
||||
def set_vcpu_hotplug(self, status, vcpus_hotplug=0):
|
||||
"""vcpus_hotplug = 0 make all vpus hotpluggable"""
|
||||
vcpus_hotplug = int(self.get_vcpu()) if vcpus_hotplug == 0 else vcpus_hotplug
|
||||
"""vcpus_hotplug: the vCPUs enabled at boot, 0 keeps the current ones;
|
||||
libvirt adds the rest up to the maximum as disabled hotpluggable vCPUs"""
|
||||
vcpus_hotplug = self.get_cur_vcpu() if vcpus_hotplug == 0 else vcpus_hotplug
|
||||
if self.get_status() == 5: # shutoff
|
||||
if status:
|
||||
xml = """ <vcpus>"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue