feat(provisioning): accept cpu_type, and refuse one that cannot be honoured
napalm_device_types' create_vm_from_cloud_init gained cpu_type, the CPU model a new VM gets (netork#494). VMware sets CPU compatibility per cluster (EVC), not per VM, and this driver has no get_vm_cpu_types() to offer a model, so None is the only value it can honour. Anything else raises ValueError before the image is fetched rather than being dropped silently.
This commit is contained in:
@@ -147,9 +147,14 @@ class VmwareProvisioningMixin:
|
||||
ssh_public_keys: list[str] | None = None,
|
||||
disk_resize_gb: int | None = None,
|
||||
storage: str | None = None,
|
||||
cpu_type: str | None = None,
|
||||
download_timeout: int = 300,
|
||||
timeout: int = 180,
|
||||
) -> VMProvisionResultDict:
|
||||
if cpu_type is not None:
|
||||
# CPU compatibility is a cluster setting here (EVC), not a per-VM
|
||||
# one, and there is no get_vm_cpu_types() that could offer a model.
|
||||
raise ValueError(f"VMware cannot give a single VM a CPU type ({cpu_type!r})")
|
||||
self._check_nics(nics)
|
||||
try:
|
||||
vmdk, image_size = ImageCache(self._image_cache_dir).vmdk(
|
||||
|
||||
Reference in New Issue
Block a user