On 7/2/20 9:40 AM, Peter Krempa wrote:
Introduce code which merges the appropriate bitmaps and queries the
final size of the backup, so that we can print the XML with size
information.

Signed-off-by: Peter Krempa <pkre...@redhat.com>
---
  src/qemu/qemu_checkpoint.c | 143 ++++++++++++++++++++++++++++++++++++-
  1 file changed, 142 insertions(+), 1 deletion(-)


+    /* we need to calculate the merged bitmap to obtain accurate data */
+    for (i = 0; i < ndisks; i++) {
+        virDomainDiskDefPtr domdisk = diskmap[i].domdisk;
+        g_autoptr(virJSONValue) actions = NULL;
+
+        /* possibly delete leftovers from previous cases */
+        if (qemuBlockNamedNodeDataGetBitmapByName(blockNamedNodeData, 
domdisk->src,
+                                                  "libvirt-tmp-size-xml")) {
+            if (!recoveractions)
+                recoveractions = virJSONValueNewArray();
+
+            if (qemuMonitorTransactionBitmapRemove(recoveractions,
+                                                   domdisk->src->nodeformat,
+                                                   "libvirt-tmp-size-xml") < 0)
+                goto endjob;
+        }

Odd that we may leave a temporary bitmap in qemu's memory if we fail partway through, but not the end of the world, and you handle it nicely here.

Nice that we finally got this feature working even across snapshots or multiple checkpoints, thanks to your recent refactoring to make checkpoints simpler (my original implementation only grabbed this information for the most recent checkpoint, because the work to merge bitmaps for older bitmaps was tougher).

Reviewed-by: Eric Blake <ebl...@redhat.com>

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Reply via email to