95 lines
4.0 KiB
Diff
95 lines
4.0 KiB
Diff
From 4187eb187649c95038325b39a5132c578d8ab820 Mon Sep 17 00:00:00 2001
|
|
From: Peter Krempa <pkrempa@redhat.com>
|
|
Date: Fri, 31 Jul 2020 15:23:56 +0200
|
|
Subject: [PATCH 041/108] qemu: snapshot: Collect 'query-named-block-nodes'
|
|
prior to memory migration
|
|
|
|
When doing an external snapshot we migrate memory to a file as a form of
|
|
taking the memory state. This creates a problem as qemu deactivates all
|
|
active bitmaps after a successful migration. This means that calling
|
|
'query-named-block-nodes' will return an empty list of bitmaps for
|
|
devices. We use the bitmap list to propagate the active bitmaps into the
|
|
overlay files being created which is required for backups to work after
|
|
a snapshot. Since we wouldn't propagate anything a subsequent backup
|
|
will fail with:
|
|
|
|
invalid argument: missing or broken bitmap 'testchck' for disk 'vda'
|
|
|
|
To fix this, we can simply collect the bitmap list prior to the
|
|
migration.
|
|
|
|
https://bugzilla.redhat.com/show_bug.cgi?id=1862472
|
|
|
|
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
(cherry picked from commit 00bb850eb065eca0c65dda212c039bc76774453f)
|
|
---
|
|
src/qemu/qemu_driver.c | 17 +++++++++++------
|
|
1 file changed, 11 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
index e53ba2bc93..508d246146 100644
|
|
--- a/src/qemu/qemu_driver.c
|
|
+++ b/src/qemu/qemu_driver.c
|
|
@@ -15416,6 +15416,7 @@ static int
|
|
qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
|
|
virDomainObjPtr vm,
|
|
virDomainMomentObjPtr snap,
|
|
+ virHashTablePtr blockNamedNodeData,
|
|
unsigned int flags,
|
|
virQEMUDriverConfigPtr cfg,
|
|
qemuDomainAsyncJob asyncJob)
|
|
@@ -15429,17 +15430,12 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
|
|
qemuDomainSnapshotDiskDataPtr diskdata = NULL;
|
|
size_t ndiskdata = 0;
|
|
bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
|
|
- g_autoptr(virHashTable) blockNamedNodeData = NULL;
|
|
|
|
if (virDomainObjCheckActive(vm) < 0)
|
|
return -1;
|
|
|
|
actions = virJSONValueNewArray();
|
|
|
|
- if (blockdev &&
|
|
- !(blockNamedNodeData = qemuBlockGetNamedNodeData(vm, asyncJob)))
|
|
- return -1;
|
|
-
|
|
/* prepare a list of objects to use in the vm definition so that we don't
|
|
* have to roll back later */
|
|
if (qemuDomainSnapshotDiskPrepare(driver, vm, snap, cfg, reuse, blockdev,
|
|
@@ -15506,6 +15502,7 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver,
|
|
int compressed;
|
|
g_autoptr(virCommand) compressor = NULL;
|
|
virQEMUSaveDataPtr data = NULL;
|
|
+ g_autoptr(virHashTable) blockNamedNodeData = NULL;
|
|
|
|
/* If quiesce was requested, then issue a freeze command, and a
|
|
* counterpart thaw command when it is actually sent to agent.
|
|
@@ -15560,6 +15557,13 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver,
|
|
}
|
|
}
|
|
|
|
+ /* We need to collect reply from 'query-named-block-nodes' prior to the
|
|
+ * migration step as qemu deactivates bitmaps after migration so the result
|
|
+ * would be wrong */
|
|
+ if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) &&
|
|
+ !(blockNamedNodeData = qemuBlockGetNamedNodeData(vm, QEMU_ASYNC_JOB_SNAPSHOT)))
|
|
+ goto cleanup;
|
|
+
|
|
/* do the memory snapshot if necessary */
|
|
if (memory) {
|
|
/* check if migration is possible */
|
|
@@ -15604,7 +15608,8 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver,
|
|
|
|
/* the domain is now paused if a memory snapshot was requested */
|
|
|
|
- if ((ret = qemuDomainSnapshotCreateDiskActive(driver, vm, snap, flags, cfg,
|
|
+ if ((ret = qemuDomainSnapshotCreateDiskActive(driver, vm, snap,
|
|
+ blockNamedNodeData, flags, cfg,
|
|
QEMU_ASYNC_JOB_SNAPSHOT)) < 0)
|
|
goto cleanup;
|
|
|
|
--
|
|
2.33.0
|
|
|