Skip to content

Commit ca2cf7f

Browse files
abh1sardhslove
authored andcommitted
Nas BnR: Fix for restore not working correctly (apache#10785)
1 parent 24ce416 commit ca2cf7f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtRestoreBackupCommandWrapper.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,16 @@ private String mountBackupDirectory(String backupRepoAddress, String backupRepoT
151151
try {
152152
mountDirectory = Files.createTempDirectory(mountDirectory).toString();
153153
String mount = String.format(MOUNT_COMMAND, backupRepoType, backupRepoAddress, mountDirectory);
154+
if ("cifs".equals(backupRepoType)) {
155+
if (Objects.isNull(mountOptions) || mountOptions.trim().isEmpty()) {
156+
mountOptions = "nobrl";
157+
} else {
158+
mountOptions += ",nobrl";
159+
}
160+
}
161+
if (Objects.nonNull(mountOptions) && !mountOptions.trim().isEmpty()) {
162+
mount += " -o " + mountOptions;
163+
}
154164
Script.runSimpleBashScript(mount);
155165
} catch (Exception e) {
156166
throw new CloudRuntimeException(String.format("Failed to mount %s to %s", backupRepoType, backupRepoAddress), e);

0 commit comments

Comments
 (0)