From 56b2ea15628ec3937063f530127ed5b95fb5270f Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 12 Feb 2026 16:54:00 +0530 Subject: [PATCH] server: prevent adding of compute details for vm when using fixed offering cpuNumber, memory and cpuSpeed shouldn't be added for VMs which use fixed offerings. It creates confusion and when adding cpuSpeed as zero for constrained offering which uses limit CPU flag, VM can failed to boot if speed specified is zero or very low. Signed-off-by: Abhishek Kumar --- .../main/java/com/cloud/vm/UserVmManagerImpl.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java index 815ac4f70fe8..7c60614c97e4 100644 --- a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java @@ -1305,8 +1305,9 @@ public void validateCustomParameters(ServiceOfferingVO serviceOffering, Map details) Map customParameters = new HashMap<>(); customParameters.put(VmDetailConstants.CPU_NUMBER, String.valueOf(newCpu)); customParameters.put(VmDetailConstants.MEMORY, String.valueOf(newMemory)); - if (svcOffering.isCustomCpuSpeedSupported()) { + if (details.containsKey(VmDetailConstants.CPU_SPEED)) { customParameters.put(VmDetailConstants.CPU_SPEED, details.get(VmDetailConstants.CPU_SPEED)); } validateCustomParameters(svcOffering, customParameters); + } else { + if (details.containsKey(VmDetailConstants.CPU_NUMBER) || details.containsKey(VmDetailConstants.MEMORY) || + details.containsKey(VmDetailConstants.CPU_SPEED)) { + throw new InvalidParameterValueException("CPU number, Memory and CPU speed cannot be updated for a " + + "non-dynamic offering"); + } } if (VirtualMachineManager.ResourceCountRunningVMsonly.value()) { return;