davidjumani commented on a change in pull request #5990:
URL: https://github.com/apache/cloudstack/pull/5990#discussion_r806486136



##########
File path: server/src/main/java/com/cloud/template/TemplateManagerImpl.java
##########
@@ -2211,6 +2214,31 @@ else if (details != null && !details.isEmpty()) {
         return _tmpltDao.findById(id);
     }
 
+    void validateDetails(VMTemplateVO template, Map<String, String> details) {
+        if (details == null || details.isEmpty()) {
+            return;
+        }
+        String bootMode = details.get(ApiConstants.BootType.UEFI.toString());
+        if (bootMode == null) {
+            return;
+        }
+        if (template.isDeployAsIs()) {
+            String msg = "Deploy-as-is templates can not have UEFI parameter 
set. Settings are read directly from the template";
+            throw new InvalidParameterValueException(msg);
+        }
+        try {
+            String mode = bootMode.trim().toUpperCase();
+            ApiConstants.BootMode.valueOf(mode);
+            details.put(ApiConstants.BootType.UEFI.toString(), mode);
+            return;
+        } catch (IllegalArgumentException e) {
+            String msg = String.format("Invalid %s: %s specified. Valid values 
are: %s",
+                    ApiConstants.BOOT_MODE, bootMode, 
Arrays.toString(ApiConstants.BootMode.values()));
+            s_logger.error(msg);

Review comment:
       The exception is not thrown but logged instead. So explicitly throwing 
it in the following line




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to