This is an automated email from the ASF dual-hosted git repository.

nvazquez pushed a commit to branch 4.16
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.16 by this push:
     new 067c1de  Fix get upload params NPE (#6079)
067c1de is described below

commit 067c1de080a8e3e4b9a088e470382b30172c258f
Author: Nicolas Vazquez <[email protected]>
AuthorDate: Thu Mar 10 09:33:50 2022 -0300

    Fix get upload params NPE (#6079)
---
 .../api/command/user/template/GetUploadParamsForTemplateCmd.java   | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/api/src/main/java/org/apache/cloudstack/api/command/user/template/GetUploadParamsForTemplateCmd.java
 
b/api/src/main/java/org/apache/cloudstack/api/command/user/template/GetUploadParamsForTemplateCmd.java
index 6dbaddb..3a9e1c8 100644
--- 
a/api/src/main/java/org/apache/cloudstack/api/command/user/template/GetUploadParamsForTemplateCmd.java
+++ 
b/api/src/main/java/org/apache/cloudstack/api/command/user/template/GetUploadParamsForTemplateCmd.java
@@ -180,11 +180,12 @@ public class GetUploadParamsForTemplateCmd extends 
AbstractGetUploadParamsCmd {
         if (getZoneId() <= 0) {
             throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "invalid 
zoneid");
         }
-        if 
(!hypervisor.equalsIgnoreCase(Hypervisor.HypervisorType.VMware.toString()) && 
osTypeId == null) {
+        if (!isDeployAsIs() && osTypeId == null) {
             throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Missing 
parameter ostypeid");
         }
-        if 
(hypervisor.equalsIgnoreCase(Hypervisor.HypervisorType.VMware.toString()) && 
deployAsIs && osTypeId != null) {
-            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid 
parameter ostypeid, not applicable for VMware");
+        if (isDeployAsIs() && osTypeId != null) {
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid 
parameter ostypeid, not applicable for" +
+                    "VMware when deploy-as-is is set to true");
         }
     }
 

Reply via email to