Skip to content

Commit b784cd9

Browse files
Added dynamic scalable flag on template while updating stopped VM.
Fixed some log messages
1 parent 74ded95 commit b784cd9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

server/src/main/java/com/cloud/vm/UserVmManagerImpl.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,7 +1851,7 @@ private boolean upgradeRunningVirtualMachine(Long vmId, Long newServiceOfferingI
18511851

18521852
ServiceOfferingVO currentServiceOffering = _offeringDao.findByIdIncludingRemoved(vmInstance.getId(), vmInstance.getServiceOfferingId());
18531853
if (newServiceOffering.isDynamicallyScalable() != currentServiceOffering.isDynamicallyScalable()) {
1854-
throw new InvalidParameterValueException("Unable to Scale VM: since dynamicscalingenabled flag is not same for new service offering and old service offering");
1854+
throw new InvalidParameterValueException("Unable to Scale VM: since dynamic scaling enabled flag is not same for new service offering and old service offering");
18551855
}
18561856

18571857
int newCpu = newServiceOffering.getCpu();
@@ -1905,7 +1905,7 @@ private boolean upgradeRunningVirtualMachine(Long vmId, Long newServiceOfferingI
19051905

19061906
// Check vm flag
19071907
if (!vmInstance.isDynamicallyScalable()) {
1908-
throw new CloudRuntimeException("Unable to Scale the vm: " + vmInstance.getUuid() + " as vm does not have tools to support dynamic scaling");
1908+
throw new CloudRuntimeException("Unable to Scale the VM: " + vmInstance.getUuid() + " as VM is not configured to be dynamically scalable");
19091909
}
19101910

19111911
// Check disable threshold for cluster is not crossed
@@ -2732,11 +2732,15 @@ public UserVm updateVirtualMachine(long id, String displayName, String group, Bo
27322732
isDynamicallyScalable = vm.isDynamicallyScalable();
27332733
} else {
27342734
if (isDynamicallyScalable == true) {
2735+
VMTemplateVO template = _templateDao.findByIdIncludingRemoved(vm.getTemplateId());
2736+
if (!template.isDynamicallyScalable()) {
2737+
throw new InvalidParameterValueException("Dynamic Scaling cannot be enabled on the VM since template is not dynamic scaling enabled");
2738+
}
27352739
if (!offering.isDynamicallyScalable()) {
27362740
throw new InvalidParameterValueException("Dynamic Scaling cannot be enabled on the VM since service offering is not dynamic scaling enabled");
27372741
}
27382742
if (!UserVmManager.EnableDynamicallyScaleVm.valueIn(vm.getDataCenterId())) {
2739-
throw new InvalidParameterValueException("Dynamic Scaling cannot be enabled on the VM since global configuration \"enable.dynamic.scale.vm\" is false");
2743+
throw new InvalidParameterValueException("Dynamic Scaling cannot be enabled on the VM since corresponding global setting is false");
27402744
}
27412745
}
27422746
}

0 commit comments

Comments
 (0)