CLOUDSTACK-9199: Fixed deployVirtualMachine API does not throw an error when cpunumber is specified for static compute offering

This commit is contained in:
Anshul Gangwar 2015-12-23 12:12:44 +05:30
parent 7e12ebf280
commit 149f6c0514

View File

@ -553,6 +553,14 @@ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd {
throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
}
if(!serviceOffering.isDynamic()) {
for(String detail: getDetails().keySet()) {
if(detail.equalsIgnoreCase("cpuNumber") || detail.equalsIgnoreCase("cpuSpeed") || detail.equalsIgnoreCase("memory")) {
throw new InvalidParameterValueException("cpuNumber or cpuSpeed or memory should not be specified for static service offering");
}
}
}
VirtualMachineTemplate template = _entityMgr.findById(VirtualMachineTemplate.class, templateId);
// Make sure a valid template ID was specified
if (template == null) {