feat: a new VM's CPU model can be chosen, from a list the hypervisor offers
create_vm_from_cloud_init takes cpu_type. Proxmox gives a VM created without one the kvm64 model, which has no AVX, so MongoDB 5.0 and later do not start there, and netOrk's graylog role failed on every VM it provisioned (netork#494). Which model is right depends on the cluster: host cannot live-migrate between different CPUs, x86-64-v3 does not start on a CPU older than Haswell. So the caller chooses. get_vm_cpu_types() is the new, optional listing behind that choice. Each VMCpuTypeDict names the model, says what it is for, lists the /proc/cpuinfo flags the guest gets (so a caller can ask "does this give AVX?" without knowing model names), whether the node at hand can run it, and which one is the default. A hypervisor whose VMs have no per-VM CPU model (VMware sets CPU compatibility per cluster) does not implement it and must reject any cpu_type other than None. Both declarations sit under TYPE_CHECKING like the rest of the contract, so hasattr stays a truthful capability probe; the tests read the signature from the source.
This commit is contained in:
@@ -247,6 +247,12 @@ class ProxmoxDriver(HypervisorDriver):
|
||||
|
||||
def create_vm_snapshot(self, name, snapshot, description="", include_memory=False):
|
||||
...
|
||||
|
||||
def get_vm_cpu_types(self):
|
||||
# optional — return List[VMCpuTypeDict]: the CPU models a new VM may get
|
||||
# on this node, each with its cpuinfo flags and whether the node can run
|
||||
# it; the name goes to create_vm_from_cloud_init(cpu_type=...)
|
||||
...
|
||||
```
|
||||
|
||||
### OS / Linux
|
||||
|
||||
Reference in New Issue
Block a user