Skip to content

Commit 357f013

Browse files
abh1sardhslove
authored andcommitted
Nas BnR: Fix for restore not working correctly (apache#10785)
1 parent 4b25dbc commit 357f013

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,16 @@ private String mountBackupDirectory(String backupRepoAddress, String backupRepoT
150150
String mountDirectory = String.format("%s.%s",BACKUP_TEMP_FILE_PREFIX , randomChars);
151151
try {
152152
mountDirectory = Files.createTempDirectory(mountDirectory).toString();
153-
String mountOpts = null;
154-
if (Objects.nonNull(mountOptions)) {
155-
mountOpts = mountOptions;
156-
if ("cifs".equals(backupRepoType)) {
157-
mountOpts += ",nobrl";
153+
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";
158159
}
159160
}
160-
String mount = String.format(MOUNT_COMMAND, backupRepoType, backupRepoAddress, mountDirectory);
161-
if (Objects.nonNull(mountOpts)) {
162-
mount += " -o " + mountOpts;
161+
if (Objects.nonNull(mountOptions) && !mountOptions.trim().isEmpty()) {
162+
mount += " -o " + mountOptions;
163163
}
164164
Script.runSimpleBashScript(mount);
165165
} catch (Exception e) {

0 commit comments

Comments
 (0)