mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-08 11:16:47 +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:
parent
4997950e75
commit
103ce111ef
4 changed files with 21 additions and 6 deletions
|
|
@ -779,11 +779,12 @@ class wvmInstance(wvmConnect):
|
|||
def get_max_memory(self):
|
||||
return self.host_info[1] * 1048576
|
||||
|
||||
def get_max_cpus(self):
|
||||
"""Get number of physical CPUs."""
|
||||
def get_max_cpus(self, at_least=0):
|
||||
"""The vCPU counts to offer: up to the host's logical CPUs, or up to
|
||||
at_least when that is more (a VM's own maximum, kept by a resize)."""
|
||||
hostinfo = self.host_info
|
||||
pcpus = hostinfo[4] * hostinfo[5] * hostinfo[6] * hostinfo[7]
|
||||
return range(1, int(pcpus + 1))
|
||||
return range(1, max(int(pcpus), at_least) + 1)
|
||||
|
||||
def get_interface_addresses(self, iface_mac):
|
||||
"""The running VM's addresses of the NIC with iface_mac: (IPv4, IPv6
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue