Nas BnR: Fix for restore not working correctly (#10785)

This commit is contained in:
Abhisar Sinha 2025-05-08 12:50:06 +05:30 committed by GitHub
parent c45ed06098
commit 2674da2ee9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -150,16 +150,16 @@ public class LibvirtRestoreBackupCommandWrapper extends CommandWrapper<RestoreBa
String mountDirectory = String.format("%s.%s",BACKUP_TEMP_FILE_PREFIX , randomChars); String mountDirectory = String.format("%s.%s",BACKUP_TEMP_FILE_PREFIX , randomChars);
try { try {
mountDirectory = Files.createTempDirectory(mountDirectory).toString(); mountDirectory = Files.createTempDirectory(mountDirectory).toString();
String mountOpts = null; String mount = String.format(MOUNT_COMMAND, backupRepoType, backupRepoAddress, mountDirectory);
if (Objects.nonNull(mountOptions)) { if ("cifs".equals(backupRepoType)) {
mountOpts = mountOptions; if (Objects.isNull(mountOptions) || mountOptions.trim().isEmpty()) {
if ("cifs".equals(backupRepoType)) { mountOptions = "nobrl";
mountOpts += ",nobrl"; } else {
mountOptions += ",nobrl";
} }
} }
String mount = String.format(MOUNT_COMMAND, backupRepoType, backupRepoAddress, mountDirectory); if (Objects.nonNull(mountOptions) && !mountOptions.trim().isEmpty()) {
if (Objects.nonNull(mountOpts)) { mount += " -o " + mountOptions;
mount += " -o " + mountOpts;
} }
Script.runSimpleBashScript(mount); Script.runSimpleBashScript(mount);
} catch (Exception e) { } catch (Exception e) {