abh1sar commented on code in PR #8947:
URL: https://github.com/apache/cloudstack/pull/8947#discussion_r1584111489


##########
server/src/main/java/com/cloud/storage/StorageManagerImpl.java:
##########
@@ -839,6 +839,21 @@ protected String createLocalStoragePoolName(Host host, 
StoragePoolInfo storagePo
         return String.format("%s-%s-%s", StringUtils.trim(host.getName()), 
"local", storagePoolInformation.getUuid().split("-")[0]);
     }
 
+    protected void checkNfsOptions(String nfsopts) throws 
InvalidParameterValueException {
+        String[] options = nfsopts.replaceAll("\\s", "").split(",");
+        Map<String, String> optionsMap = new HashMap<>();
+        for (String option : options) {
+            String[] keyValue = option.split("=");
+            if (keyValue.length > 2) {
+                throw new InvalidParameterValueException("Invalid value for 
NFS option " + keyValue[0]);
+            }
+            if (optionsMap.containsKey(keyValue[0])) {
+                throw new InvalidParameterValueException("Duplicate NFS option 
values found for option " + keyValue[0]);
+            }
+            optionsMap.put(keyValue[0], null);

Review Comment:
   I can add a few lines in the documentation PR on what happens if incorrect 
mount options are given if you are ok with the current behaviour.



-- 
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: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to