|
|
a41c76 |
From e735d0f163806b34f9e65dacdf5e10b52c0478fd Mon Sep 17 00:00:00 2001
|
|
|
a41c76 |
Message-Id: <e735d0f163806b34f9e65dacdf5e10b52c0478fd@dist-git>
|
|
|
a41c76 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
a41c76 |
Date: Mon, 16 Mar 2020 22:12:29 +0100
|
|
|
a41c76 |
Subject: [PATCH] qemuDomainBlockCommit: Handle bitmaps on start of commit
|
|
|
a41c76 |
MIME-Version: 1.0
|
|
|
a41c76 |
Content-Type: text/plain; charset=UTF-8
|
|
|
a41c76 |
Content-Transfer-Encoding: 8bit
|
|
|
a41c76 |
|
|
|
a41c76 |
On start of the commit job, we need to disable any active bitmap in the
|
|
|
a41c76 |
base. Use qemuBlockBitmapsHandleCommitStart to calculate which and call
|
|
|
a41c76 |
the appropriate QMP APIs. We use blockdev-reopen to make the 'base'
|
|
|
a41c76 |
writable to disable the bitmaps.
|
|
|
a41c76 |
|
|
|
a41c76 |
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
a41c76 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
a41c76 |
(cherry picked from commit 2b9091f089279a7bac523095a2ccd146fa20800b)
|
|
|
a41c76 |
https://bugzilla.redhat.com/show_bug.cgi?id=1799013
|
|
|
a41c76 |
Message-Id: <2aca5706f8412d27ff38da69582c522aca058054.1584391727.git.pkrempa@redhat.com>
|
|
|
a41c76 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
a41c76 |
---
|
|
|
a41c76 |
src/qemu/qemu_driver.c | 43 +++++++++++++++++++++++++++++++++++++++++-
|
|
|
a41c76 |
1 file changed, 42 insertions(+), 1 deletion(-)
|
|
|
a41c76 |
|
|
|
a41c76 |
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
|
a41c76 |
index 5c2b3cddf1..2f8fee2ef0 100644
|
|
|
a41c76 |
--- a/src/qemu/qemu_driver.c
|
|
|
a41c76 |
+++ b/src/qemu/qemu_driver.c
|
|
|
a41c76 |
@@ -18724,6 +18724,8 @@ qemuDomainBlockCommit(virDomainPtr dom,
|
|
|
a41c76 |
const char *nodebase = NULL;
|
|
|
a41c76 |
bool persistjob = false;
|
|
|
a41c76 |
bool blockdev = false;
|
|
|
a41c76 |
+ g_autoptr(virJSONValue) bitmapDisableActions = NULL;
|
|
|
a41c76 |
+ VIR_AUTOSTRINGLIST bitmapDisableList = NULL;
|
|
|
a41c76 |
|
|
|
a41c76 |
virCheckFlags(VIR_DOMAIN_BLOCK_COMMIT_SHALLOW |
|
|
|
a41c76 |
VIR_DOMAIN_BLOCK_COMMIT_ACTIVE |
|
|
|
a41c76 |
@@ -18880,8 +18882,29 @@ qemuDomainBlockCommit(virDomainPtr dom,
|
|
|
a41c76 |
goto endjob;
|
|
|
a41c76 |
}
|
|
|
a41c76 |
|
|
|
a41c76 |
+ if (blockdev &&
|
|
|
a41c76 |
+ virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN)) {
|
|
|
a41c76 |
+ g_autoptr(virHashTable) blockNamedNodeData = NULL;
|
|
|
a41c76 |
+ if (!(blockNamedNodeData = qemuBlockGetNamedNodeData(vm, QEMU_ASYNC_JOB_NONE)))
|
|
|
a41c76 |
+ goto endjob;
|
|
|
a41c76 |
+
|
|
|
a41c76 |
+ if (qemuBlockBitmapsHandleCommitStart(topSource, baseSource,
|
|
|
a41c76 |
+ blockNamedNodeData,
|
|
|
a41c76 |
+ &bitmapDisableActions,
|
|
|
a41c76 |
+ &bitmapDisableList) < 0)
|
|
|
a41c76 |
+ goto endjob;
|
|
|
a41c76 |
+
|
|
|
a41c76 |
+ /* if we don't have terminator on 'base' we can't reopen it */
|
|
|
a41c76 |
+ if (bitmapDisableActions && !baseSource->backingStore) {
|
|
|
a41c76 |
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
|
|
|
a41c76 |
+ _("can't handle bitmaps on unterminated backing image '%s'"),
|
|
|
a41c76 |
+ base);
|
|
|
a41c76 |
+ goto endjob;
|
|
|
a41c76 |
+ }
|
|
|
a41c76 |
+ }
|
|
|
a41c76 |
+
|
|
|
a41c76 |
if (!(job = qemuBlockJobDiskNewCommit(vm, disk, top_parent, topSource,
|
|
|
a41c76 |
- baseSource, NULL,
|
|
|
a41c76 |
+ baseSource, &bitmapDisableList,
|
|
|
a41c76 |
flags & VIR_DOMAIN_BLOCK_COMMIT_DELETE,
|
|
|
a41c76 |
flags)))
|
|
|
a41c76 |
goto endjob;
|
|
|
a41c76 |
@@ -18903,6 +18926,24 @@ qemuDomainBlockCommit(virDomainPtr dom,
|
|
|
a41c76 |
if (!backingPath && top_parent &&
|
|
|
a41c76 |
!(backingPath = qemuBlockGetBackingStoreString(baseSource)))
|
|
|
a41c76 |
goto endjob;
|
|
|
a41c76 |
+
|
|
|
a41c76 |
+ if (bitmapDisableActions) {
|
|
|
a41c76 |
+ int rc;
|
|
|
a41c76 |
+
|
|
|
a41c76 |
+ if (qemuBlockReopenReadWrite(vm, baseSource, QEMU_ASYNC_JOB_NONE) < 0)
|
|
|
a41c76 |
+ goto endjob;
|
|
|
a41c76 |
+
|
|
|
a41c76 |
+ qemuDomainObjEnterMonitor(driver, vm);
|
|
|
a41c76 |
+ rc = qemuMonitorTransaction(priv->mon, &bitmapDisableActions);
|
|
|
a41c76 |
+ if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
|
|
a41c76 |
+ goto endjob;
|
|
|
a41c76 |
+
|
|
|
a41c76 |
+ if (qemuBlockReopenReadOnly(vm, baseSource, QEMU_ASYNC_JOB_NONE) < 0)
|
|
|
a41c76 |
+ goto endjob;
|
|
|
a41c76 |
+
|
|
|
a41c76 |
+ if (rc < 0)
|
|
|
a41c76 |
+ goto endjob;
|
|
|
a41c76 |
+ }
|
|
|
a41c76 |
} else {
|
|
|
a41c76 |
device = job->name;
|
|
|
a41c76 |
}
|
|
|
a41c76 |
--
|
|
|
a41c76 |
2.25.1
|
|
|
a41c76 |
|