Repository: cloudstack Updated Branches: refs/heads/master ae207bea9 -> 6568e0bb3
CLOUDSTACK-7305: hypervisor type parameter is mandatory when deploying VM using ISO Signed-off-by: Koushik Das <kous...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6568e0bb Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6568e0bb Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6568e0bb Branch: refs/heads/master Commit: 6568e0bb31103ec9148a5c967db6563ca9af4307 Parents: ae207be Author: Harikrishna Patnala <harikrishna.patn...@citrix.com> Authored: Mon Aug 11 18:05:33 2014 +0530 Committer: Koushik Das <kous...@apache.org> Committed: Tue Aug 12 16:27:48 2014 +0530 ---------------------------------------------------------------------- .../org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java | 2 +- server/src/com/cloud/vm/UserVmManagerImpl.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6568e0bb/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java ---------------------------------------------------------------------- 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 8ceccb9..bb7b13c 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) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6568e0bb/server/src/com/cloud/vm/UserVmManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 05cc183..77e7f0a 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()) {