DaanHoogland commented on a change in pull request #3925: Add cache mode param 
properly
URL: https://github.com/apache/cloudstack/pull/3925#discussion_r387804255
 
 

 ##########
 File path: 
server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
 ##########
 @@ -2318,6 +2319,11 @@ public ServiceOffering createServiceOffering(final 
CreateServiceOfferingCmd cmd)
             }
         }
 
+        // check if valid cache_mode parameter
+        if(isCacheModeInvalid(cmd.getCacheMode())){
+            throw new InvalidParameterValueException("Please specify a valid 
cache mode parameter");
+        }
+
 
 Review comment:
   I think it is better to call the method `validateCachMode(String cacheMode)` 
and include this code as it is duplicated below in lines 2951 - 2955:
   ```java
   void validateCachMode(String cacheMode){
       if( cacheMode != null &&
           !Enums.getIfPresent(DiskOffering.DiskCacheMode.class,
                               cacheMode.toUpperCase()).isPresent() {
           throw new InvalidParameterValueException("Please specify a valid 
cache mode parameter");
       }
   }
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to