Skip to content

Commit c73c1c9

Browse files
committed
Add null check, remove preceding comma before nobrl
1 parent 0f1cc69 commit c73c1c9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,13 @@ private String mountBackupDirectory(String backupRepoAddress, String backupRepoT
152152
mountDirectory = Files.createTempDirectory(mountDirectory).toString();
153153
String mount = String.format(MOUNT_COMMAND, backupRepoType, backupRepoAddress, mountDirectory);
154154
if ("cifs".equals(backupRepoType)) {
155-
mountOptions += ",nobrl";
155+
if (Objects.isNull(mountOptions) || mountOptions.trim().isEmpty()) {
156+
mountOptions = "nobrl";
157+
} else {
158+
mountOptions += ",nobrl";
159+
}
156160
}
157-
if (!mountOptions.trim().isEmpty()) {
161+
if (Objects.nonNull(mountOptions) && !mountOptions.trim().isEmpty()) {
158162
mount += " -o " + mountOptions;
159163
}
160164
Script.runSimpleBashScript(mount);

0 commit comments

Comments
 (0)