JoaoJandre commented on code in PR #13746:
URL: https://github.com/apache/cloudstack/pull/13746#discussion_r3731183982


##########
plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LinstorBackupSnapshotCommandWrapper.java:
##########
@@ -121,6 +121,49 @@ private String convertImageToQCow2(
         return dstPath;
     }
 
+    /**
+     * Writes an incremental backup: a qcow2 on secondary storage containing 
only the blocks of the
+     * snapshot device that differ from the parent snapshot qcow2, with the 
parent as backing file.
+     * The overlay starts out backed by the raw snapshot device itself; the 
safe-mode rebase onto the
+     * parent then copies every cluster in which the two backing files differ 
into the overlay. The
+     * explicit virtual size clips the DRBD metadata trailing the storage 
snapshot device.
+     */
+    private String createIncrementalQCow2(
+        final String srcPath,
+        final SnapshotObjectTO dst,
+        final KVMStoragePool secondaryPool,
+        final File parentFile,
+        final long netSize,
+        int waitMilliSeconds)
+        throws LibvirtException, QemuImgException, IOException
+    {
+        final String dstDir = secondaryPool.getLocalPath() + File.separator + 
dst.getPath();
+        FileUtils.forceMkdir(new File(dstDir));
+        final String dstPath = dstDir + File.separator + dst.getName();
+
+        final Script createOverlay = new Script("qemu-img", 
Duration.millis(waitMilliSeconds));
+        createOverlay.add("create", "-f", "qcow2", "-F", "raw", "-b", srcPath, 
dstPath, String.valueOf(netSize));
+        final String createResult = createOverlay.execute();
+        if (createResult != null) {
+            throw new QemuImgException("Unable to create qcow2 overlay of " + 
srcPath + ": " + createResult);
+        }
+
+        try {
+            final QemuImg qemu = new QemuImg(waitMilliSeconds);
+            final QemuImgFile dstFile = new QemuImgFile(dstPath, 
QemuImg.PhysicalDiskFormat.QCOW2);

Review Comment:
   I see, I didn't research the snapshot process on Linstor. But reading a bit 
of the code now, I understand it a bit better. Your explanation makes sense, 
thanks.



-- 
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]

Reply via email to