Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix NPE for live vm backup
  • Loading branch information
abh1sar committed Sep 29, 2025
commit ebd081aa4b6fbd1e8df6a7a2d4651ed707781ecb
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,17 @@ public Answer execute(TakeBackupCommand command, LibvirtComputingResource libvir
KVMStoragePoolManager storagePoolMgr = libvirtComputingResource.getStoragePoolMgr();

List<String> diskPaths = new ArrayList<>();
for (int idx = 0; idx < volumePaths.size(); idx++) {
PrimaryDataStoreTO volumePool = volumePools.get(idx);
String volumePath = volumePaths.get(idx);
if (volumePool.getPoolType() != Storage.StoragePoolType.RBD) {
diskPaths.add(volumePath);
} else {
KVMStoragePool volumeStoragePool = storagePoolMgr.getStoragePool(volumePool.getPoolType(), volumePool.getUuid());
String rbdDestVolumeFile = KVMPhysicalDisk.RBDStringBuilder(volumeStoragePool, volumePath);
diskPaths.add(rbdDestVolumeFile);
if (Objects.nonNull(volumePaths)) {
for (int idx = 0; idx < volumePaths.size(); idx++) {
PrimaryDataStoreTO volumePool = volumePools.get(idx);
String volumePath = volumePaths.get(idx);
if (volumePool.getPoolType() != Storage.StoragePoolType.RBD) {
diskPaths.add(volumePath);
} else {
KVMStoragePool volumeStoragePool = storagePoolMgr.getStoragePool(volumePool.getPoolType(), volumePool.getUuid());
String rbdDestVolumeFile = KVMPhysicalDisk.RBDStringBuilder(volumeStoragePool, volumePath);
diskPaths.add(rbdDestVolumeFile);
}
}
}

Expand All @@ -76,7 +78,7 @@ public Answer execute(TakeBackupCommand command, LibvirtComputingResource libvir
"-m", Objects.nonNull(mountOptions) ? mountOptions : "",
"-p", backupPath,
"-q", command.getQuiesce() != null && command.getQuiesce() ? "true" : "false",
"-d", (Objects.nonNull(diskPaths) && !diskPaths.isEmpty()) ? String.join(",", diskPaths) : ""
"-d", diskPaths.isEmpty() ? "" : String.join(",", diskPaths)
});

Pair<Integer, String> result = Script.executePipedCommands(commands, libvirtComputingResource.getCmdsTimeout());
Expand Down
Loading