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