Skip to content

Commit 7e1e3f7

Browse files
author
Fabrício Duarte
committed
Merge branch 'fix-migrate-updates' into '4.20.0.0-scclouds'
Correção na migração de backups See merge request scclouds/scclouds!1330
2 parents bea7581 + f6c2082 commit 7e1e3f7

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public Answer execute(MigrateBackupsBetweenSecondaryStoragesCommand command, Lib
7373

7474
for (List<DataTO> chain : backupChains) {
7575
long lastBackupId = 0;
76+
boolean backupWasMigrated = false;
7677

7778
backupPathMap.clear();
7879
backupMigrationMap.clear();
@@ -91,6 +92,7 @@ public Answer execute(MigrateBackupsBetweenSecondaryStoragesCommand command, Lib
9192
if (imagePoolUrl.equals(srcDataStore.getUrl())) {
9293
backupPathMap.put(volumeId, copyResourceToDestDataStore(backup, resourceCurrentPath, destImagePool, resourceParentPath));
9394
backupMigrationMap.put(volumeId, true);
95+
backupWasMigrated = true;
9496
} else {
9597
if (BooleanUtils.isTrue(parentBackupMigrationMap.get(volumeId))) {
9698
backupPathMap.put(volumeId, rebaseResourceToNewParentPath(resourceCurrentPath, resourceParentPath));
@@ -107,7 +109,9 @@ public Answer execute(MigrateBackupsBetweenSecondaryStoragesCommand command, Lib
107109
parentBackupMigrationMap.clear();
108110
parentBackupMigrationMap.putAll(backupMigrationMap);
109111

110-
resourcesToUpdate.add(new Pair<>(lastBackupId, null));
112+
if (backupWasMigrated) {
113+
resourcesToUpdate.add(new Pair<>(lastBackupId, null));
114+
}
111115
}
112116
} catch (LibvirtException | QemuImgException e) {
113117
logger.error("Exception while migrating backups [{}] to secondary storage [{}] due to: [{}].",

0 commit comments

Comments
 (0)