abh1sar commented on code in PR #13074:
URL: https://github.com/apache/cloudstack/pull/13074#discussion_r3521100737
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtTakeBackupCommandWrapper.java:
##########
@@ -69,8 +86,63 @@ public Answer execute(TakeBackupCommand command,
LibvirtComputingResource libvir
}
}
- List<String[]> commands = new ArrayList<>();
- commands.add(new String[]{
+ Pair<Integer, String> result =
runBackupScript(libvirtComputingResource, command, vmName, backupRepoType,
backupRepoAddress,
+ mountOptions, backupPath, diskPaths, command.getMode(),
+ command.getBitmapNew(), command.getBitmapParent(),
command.getParentPaths(), timeout);
+
+ if (result.first() != 0) {
+ logger.debug("Failed to take VM backup: " + result.second());
+ BackupAnswer answer = new BackupAnswer(command, false,
result.second().trim());
+ if (EXIT_CLEANUP_FAILED.equals(result.first())) {
+ logger.debug("Backup cleanup failed");
+ answer.setNeedsCleanup(true);
+ }
+ return answer;
+ }
+
+ // The script self-heals to a full backup when an incremental can't
proceed (e.g. the
+ // parent checkpoint can't be re-registered) and signals it with
INCREMENTAL_FALLBACK
+ // on stdout. Detect it, then strip the marker line before parsing the
backup size.
+ String rawStdout = result.second();
+ boolean incrementalFallback =
rawStdout.contains(INCREMENTAL_FALLBACK_MARKER);
+ String stdout = stripMarkerLines(rawStdout).trim();
+ long backupSize = parseBackupSize(stdout, diskPaths);
+
Review Comment:
We shouldn't store the old bitmap data forever. With time it will build up
into metadata storage cost and IO cost.
We should delete the parent_bitmap from the disks if the incremental backup
was successful.
This can be done by deleting the checkpoint.
```
if (!incremenalFallback && command.getBitmapParent() != null) {
Script.runSimpleBashScript(String.format(CHECKPOINT_DELETE_COMMAND,
vmName, checkpointName));
}
```
Can you implement and test?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]