diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java index 8ceccb9d2d6..bb7b13cdad1 100755 --- a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java @@ -129,7 +129,7 @@ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd { private String group; @Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "the hypervisor on which to deploy the virtual machine. " - + "The parameter is respected only when hypervisor info is not set on the ISO/Template passed to the call") + + "The parameter is required and respected only when hypervisor info is not set on the ISO/Template passed to the call") private String hypervisor; @Parameter(name = ApiConstants.USER_DATA, type = CommandType.STRING, description = "an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding. Using HTTP POST(via POST body), you can send up to 32K of data after base64 encoding.", length = 32768) diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 05cc18385bd..77e7f0ac36e 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -2718,6 +2718,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir HypervisorType hypervisorType = null; if (template.getHypervisorType() == null || template.getHypervisorType() == HypervisorType.None) { + if (hypervisor == null || hypervisor == HypervisorType.None) { + throw new InvalidParameterValueException("hypervisor parameter is needed to deploy VM or the hypervisor parameter value passed is invalid"); + } hypervisorType = hypervisor; } else { if (hypervisor != null && hypervisor != HypervisorType.None && hypervisor != template.getHypervisorType()) {