1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-09 03:36:48 +00:00

fix(instances): a resize keeps a VM's maximum vCPUs above the host's CPUs

The Resize tab offered vCPU counts only up to the host's logical CPUs.
A VM whose maximum was higher (4 on a 2-CPU host, say) found no option
for it, so the Maximum list showed 1, and a resize of the shut-off VM
lowered its maximum to that without a word.

get_max_cpus() now takes the VM's own maximum as a floor, and the
Instance's vcpu_range passes it. The host's CPU count shown on the page
and used by the clone form is read from the host alone, not from that
range.
This commit is contained in:
catborise 2026-11-03 22:37:51 +03:00
parent 4997950e75
commit 103ce111ef
4 changed files with 21 additions and 6 deletions

View file

@ -117,7 +117,8 @@ class Instance(models.Model):
@cached_property
def vcpu_range(self):
return self.proxy.get_max_cpus()
"""The vCPU counts the Resize tab offers, the VM's own maximum among them."""
return self.proxy.get_max_cpus(at_least=self.config_vcpu)
@cached_property
def cur_vcpu(self):