Skip to content

Commit 0f1cc69

Browse files
committed
Fix Nas bnr restore
1 parent 80b5d5c commit 0f1cc69

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,12 @@ 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";
158-
}
159-
}
160153
String mount = String.format(MOUNT_COMMAND, backupRepoType, backupRepoAddress, mountDirectory);
161-
if (Objects.nonNull(mountOpts)) {
162-
mount += " -o " + mountOpts;
154+
if ("cifs".equals(backupRepoType)) {
155+
mountOptions += ",nobrl";
156+
}
157+
if (!mountOptions.trim().isEmpty()) {
158+
mount += " -o " + mountOptions;
163159
}
164160
Script.runSimpleBashScript(mount);
165161
} catch (Exception e) {

0 commit comments

Comments
 (0)