abh1sar commented on code in PR #13877:
URL: https://github.com/apache/cloudstack/pull/13877#discussion_r3978148810
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtRestoreBackupCommandWrapper.java:
##########
@@ -275,11 +284,28 @@ private boolean
replaceVolumeWithBackup(KVMStoragePoolManager storagePoolMgr, Pr
return replaceBlockDeviceWithBackup(storagePoolMgr, volumePool,
volumePath, backupPath, timeout, createTargetVolume, size);
}
+ // For NAS-backed incremental backups, the source qcow2 has a
backing-file
+ // reference to its parent (set by nasbackup.sh's qemu-img rebase). A
plain
+ // rsync would copy only the differential blocks, leaving a volume that
+ // depends on a backing file the primary storage doesn't have. Flatten
the
+ // chain via qemu-img convert, which follows the backing-file links and
+ // produces a single self-contained qcow2.
+ if (hasBackingChain(backupPath)) {
+ int flattenExit = Script.runSimpleBashScriptForExitValue(
+ String.format(QEMU_IMG_FLATTEN_COMMAND, backupPath,
volumePath), timeout, false);
Review Comment:
Thanks for checking @rp-
Does this look ok now?
https://github.com/apache/cloudstack/pull/13877/changes/f513c2ae7515f9fcebeb0de699b263b0dfccfc2d..054ee3411b7eaf388e402d28cb0c0be49b90a41f
--
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]