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


##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtRestoreBackupCommandWrapper.java:
##########
@@ -150,16 +150,12 @@ private String mountBackupDirectory(String 
backupRepoAddress, String backupRepoT
         String mountDirectory = String.format("%s.%s",BACKUP_TEMP_FILE_PREFIX 
, randomChars);
         try {
             mountDirectory = 
Files.createTempDirectory(mountDirectory).toString();
-            String mountOpts = null;
-            if (Objects.nonNull(mountOptions)) {
-                mountOpts = mountOptions;
-                if ("cifs".equals(backupRepoType)) {
-                    mountOpts += ",nobrl";
-                }
-            }
             String mount = String.format(MOUNT_COMMAND, backupRepoType, 
backupRepoAddress, mountDirectory);
-            if (Objects.nonNull(mountOpts)) {
-                mount += " -o " + mountOpts;
+            if ("cifs".equals(backupRepoType)) {
+                mountOptions += ",nobrl";
+            }
+            if (!mountOptions.trim().isEmpty()) {

Review Comment:
   mountOptions is retrieved from the backup_repository table, where the column 
is defined as not null.
   So either it will have a proper option or it will be an empty string. 
   But I'll add a null check anyway for extra safety.
   
   In case it is empty we should not be prefixing a `,` before nobrl. 
   I'll update the PR.



-- 
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