Skip to content

Commit 6568e0b

Browse files
Harikrishna Patnalakoushik-das
authored andcommitted
CLOUDSTACK-7305: hypervisor type parameter is mandatory when deploying VM using ISO
Signed-off-by: Koushik Das <[email protected]>
1 parent ae207be commit 6568e0b

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd {
129129
private String group;
130130

131131
@Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "the hypervisor on which to deploy the virtual machine. "
132-
+ "The parameter is respected only when hypervisor info is not set on the ISO/Template passed to the call")
132+
+ "The parameter is required and respected only when hypervisor info is not set on the ISO/Template passed to the call")
133133
private String hypervisor;
134134

135135
@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)

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2718,6 +2718,9 @@ protected UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOf
27182718

27192719
HypervisorType hypervisorType = null;
27202720
if (template.getHypervisorType() == null || template.getHypervisorType() == HypervisorType.None) {
2721+
if (hypervisor == null || hypervisor == HypervisorType.None) {
2722+
throw new InvalidParameterValueException("hypervisor parameter is needed to deploy VM or the hypervisor parameter value passed is invalid");
2723+
}
27212724
hypervisorType = hypervisor;
27222725
} else {
27232726
if (hypervisor != null && hypervisor != HypervisorType.None && hypervisor != template.getHypervisorType()) {

0 commit comments

Comments
 (0)