render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
b971b8
From 6c139a45537d021f6fd4287bd3c74cba06e6a264 Mon Sep 17 00:00:00 2001
b971b8
Message-Id: <6c139a45537d021f6fd4287bd3c74cba06e6a264@dist-git>
b971b8
From: Peter Krempa <pkrempa@redhat.com>
b971b8
Date: Tue, 23 Jun 2020 12:23:47 +0200
b971b8
Subject: [PATCH] qemu: checkpoint: Don't chain bitmaps for checkpoints
b971b8
MIME-Version: 1.0
b971b8
Content-Type: text/plain; charset=UTF-8
b971b8
Content-Transfer-Encoding: 8bit
b971b8
b971b8
Chaining bitmaps for checkpoints (disabling the active one and creating
b971b8
a new) severely overcomplicated all operations in regards to bitmaps.
b971b8
b971b8
Specifically it requires us re-matching the on-disk state to the
b971b8
internal metadata and in case of merging during block jobs it makes it
b971b8
almost impossible to cover all corner cases.
b971b8
b971b8
Since the checkpoints and incremental backups were not yet enabled,
b971b8
let's change the design to keep one bitmap per checkpoint. In case of
b971b8
layered snapshots this will be filled in by using dirty-bitmap-populate.
b971b8
b971b8
Finally the main reason for this unnecessary complexity was the fear
b971b8
that qemu's performance could degrade. In the end I think that
b971b8
addressing the performance issue will be better done in qemu (e.g by
b971b8
keeping an internal bitmap updated with changes and merging it
b971b8
periodically back to the real bitmaps. QEMU writes out changes to disk
b971b8
at shutdown so consistency is not a problem).
b971b8
b971b8
Removing the relationships between bitmaps frees us from complex
b971b8
handling and also makes all the surrounding code more robust as one
b971b8
broken bitmap doesn't necessarily invalidate whole chains of backups.
b971b8
b971b8
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
b971b8
Reviewed-by: Eric Blake <eblake@redhat.com>
b971b8
(cherry picked from commit 1f92aa454aa3b04ece9f7479d517bf08ba547f0a)
b971b8
https://bugzilla.redhat.com/show_bug.cgi?id=1804593
b971b8
Message-Id: <a863b2015f72690ebd90fd518e8163e194909214.1592906423.git.pkrempa@redhat.com>
b971b8
Reviewed-by: Ján Tomko <jtomko@redhat.com>
b971b8
---
b971b8
 src/qemu/qemu_checkpoint.c | 21 +--------------------
b971b8
 1 file changed, 1 insertion(+), 20 deletions(-)
b971b8
b971b8
diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c
b971b8
index 34cf122eb3..9762a3eb9d 100644
b971b8
--- a/src/qemu/qemu_checkpoint.c
b971b8
+++ b/src/qemu/qemu_checkpoint.c
b971b8
@@ -460,7 +460,6 @@ qemuCheckpointPrepare(virQEMUDriverPtr driver,
b971b8
 static int
b971b8
 qemuCheckpointAddActions(virDomainObjPtr vm,
b971b8
                          virJSONValuePtr actions,
b971b8
-                         virDomainMomentObjPtr old_current,
b971b8
                          virDomainCheckpointDefPtr def)
b971b8
 {
b971b8
     size_t i;
b971b8
@@ -468,7 +467,6 @@ qemuCheckpointAddActions(virDomainObjPtr vm,
b971b8
     for (i = 0; i < def->ndisks; i++) {
b971b8
         virDomainCheckpointDiskDef *chkdisk = &def->disks[i];
b971b8
         virDomainDiskDefPtr domdisk = virDomainDiskByTarget(vm->def, chkdisk->name);
b971b8
-        virDomainCheckpointDiskDef *parentchkdisk = NULL;
b971b8
 
b971b8
         /* checkpoint definition validator mandates that the corresponding
b971b8
          * domdisk should exist */
b971b8
@@ -479,23 +477,6 @@ qemuCheckpointAddActions(virDomainObjPtr vm,
b971b8
         if (qemuMonitorTransactionBitmapAdd(actions, domdisk->src->nodeformat,
b971b8
                                             chkdisk->bitmap, true, false, 0) < 0)
b971b8
             return -1;
b971b8
-
b971b8
-        /* We only want one active bitmap for a disk along the
b971b8
-         * checkpoint chain, then later differential backups will
b971b8
-         * merge the bitmaps (only one active) between the bounding
b971b8
-         * checkpoint and the leaf checkpoint.  If the same disks are
b971b8
-         * involved in each checkpoint, this search terminates in one
b971b8
-         * iteration; but it is also possible to have to search
b971b8
-         * further than the immediate parent to find another
b971b8
-         * checkpoint with a bitmap on the same disk.  */
b971b8
-        if ((parentchkdisk = qemuCheckpointFindActiveDiskInParent(vm, old_current,
b971b8
-                                                                  chkdisk->name))) {
b971b8
-
b971b8
-            if (qemuMonitorTransactionBitmapDisable(actions,
b971b8
-                                                    domdisk->src->nodeformat,
b971b8
-                                                    parentchkdisk->bitmap) < 0)
b971b8
-                return -1;
b971b8
-        }
b971b8
     }
b971b8
     return 0;
b971b8
 }
b971b8
@@ -544,7 +525,7 @@ qemuCheckpointCreateCommon(virQEMUDriverPtr driver,
b971b8
 
b971b8
     tmpactions = virJSONValueNewArray();
b971b8
 
b971b8
-    if (qemuCheckpointAddActions(vm, tmpactions, parent, *def) < 0)
b971b8
+    if (qemuCheckpointAddActions(vm, tmpactions, *def) < 0)
b971b8
         return -1;
b971b8
 
b971b8
     if (!(*chk = virDomainCheckpointAssignDef(vm->checkpoints, *def)))
b971b8
-- 
b971b8
2.27.0
b971b8