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

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


The following commit(s) were added to refs/heads/4.20 by this push:
     new 2674da2ee9e Nas BnR: Fix for restore not working correctly  (#10785)
2674da2ee9e is described below

commit 2674da2ee9e667ce051b996832c0f3167672688c
Author: Abhisar Sinha <[email protected]>
AuthorDate: Thu May 8 12:50:06 2025 +0530

    Nas BnR: Fix for restore not working correctly  (#10785)
---
 .../wrapper/LibvirtRestoreBackupCommandWrapper.java      | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git 
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtRestoreBackupCommandWrapper.java
 
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtRestoreBackupCommandWrapper.java
index 49b67194356..141c1d5ea19 100644
--- 
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtRestoreBackupCommandWrapper.java
+++ 
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtRestoreBackupCommandWrapper.java
@@ -150,16 +150,16 @@ public class LibvirtRestoreBackupCommandWrapper extends 
CommandWrapper<RestoreBa
         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 ("cifs".equals(backupRepoType)) {
+                if (Objects.isNull(mountOptions) || 
mountOptions.trim().isEmpty()) {
+                    mountOptions = "nobrl";
+                } else {
+                    mountOptions += ",nobrl";
                 }
             }
-            String mount = String.format(MOUNT_COMMAND, backupRepoType, 
backupRepoAddress, mountDirectory);
-            if (Objects.nonNull(mountOpts)) {
-                mount += " -o " + mountOpts;
+            if (Objects.nonNull(mountOptions) && 
!mountOptions.trim().isEmpty()) {
+                mount += " -o " + mountOptions;
             }
             Script.runSimpleBashScript(mount);
         } catch (Exception e) {

Reply via email to