|
|
fbe740 |
From 85658fdaaf7b24f64c31950f4bf710c0dcdafacd Mon Sep 17 00:00:00 2001
|
|
|
fbe740 |
Message-Id: <85658fdaaf7b24f64c31950f4bf710c0dcdafacd@dist-git>
|
|
|
fbe740 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
fbe740 |
Date: Tue, 4 Feb 2020 15:08:27 +0100
|
|
|
fbe740 |
Subject: [PATCH] qemuDomainBlockPivot: Copy bitmaps backing checkpoints for
|
|
|
fbe740 |
virDomainBlockCopy
|
|
|
fbe740 |
MIME-Version: 1.0
|
|
|
fbe740 |
Content-Type: text/plain; charset=UTF-8
|
|
|
fbe740 |
Content-Transfer-Encoding: 8bit
|
|
|
fbe740 |
|
|
|
fbe740 |
Use qemuBlockBitmapsHandleBlockcopy to calculate bitmaps to copy over
|
|
|
fbe740 |
for a block-copy job.
|
|
|
fbe740 |
|
|
|
fbe740 |
We copy them when pivoting to the new image as at that point we are
|
|
|
fbe740 |
certain that we don't dirty any bitmap unnecessarily.
|
|
|
fbe740 |
|
|
|
fbe740 |
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
(cherry picked from commit 54030892f5122ef120c1e8ffb6e0546871030272)
|
|
|
fbe740 |
|
|
|
fbe740 |
https://bugzilla.redhat.com/show_bug.cgi?id=1207659
|
|
|
fbe740 |
Message-Id: <c60a7a567a634836370fc9c0c38317569fa5a22d.1580824112.git.pkrempa@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
---
|
|
|
fbe740 |
src/qemu/qemu_driver.c | 28 +++++++++++++++++++++++++---
|
|
|
fbe740 |
1 file changed, 25 insertions(+), 3 deletions(-)
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
|
fbe740 |
index 71c75b25a6..caeb76a20c 100644
|
|
|
fbe740 |
--- a/src/qemu/qemu_driver.c
|
|
|
fbe740 |
+++ b/src/qemu/qemu_driver.c
|
|
|
fbe740 |
@@ -17552,6 +17552,7 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
|
|
|
fbe740 |
int ret = -1;
|
|
|
fbe740 |
qemuDomainObjPrivatePtr priv = vm->privateData;
|
|
|
fbe740 |
bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
|
|
|
fbe740 |
+ g_autoptr(virJSONValue) actions = NULL;
|
|
|
fbe740 |
|
|
|
fbe740 |
switch ((qemuBlockJobType) job->type) {
|
|
|
fbe740 |
case QEMU_BLOCKJOB_TYPE_NONE:
|
|
|
fbe740 |
@@ -17572,6 +17573,20 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
|
|
|
fbe740 |
return -1;
|
|
|
fbe740 |
|
|
|
fbe740 |
case QEMU_BLOCKJOB_TYPE_COPY:
|
|
|
fbe740 |
+ if (blockdev && !job->jobflagsmissing) {
|
|
|
fbe740 |
+ g_autoptr(virHashTable) blockNamedNodeData = NULL;
|
|
|
fbe740 |
+ bool shallow = job->jobflags & VIR_DOMAIN_BLOCK_COPY_SHALLOW;
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ if (!(blockNamedNodeData = qemuBlockGetNamedNodeData(vm, QEMU_ASYNC_JOB_NONE)))
|
|
|
fbe740 |
+ return -1;
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ if (qemuBlockBitmapsHandleBlockcopy(disk->src, disk->mirror,
|
|
|
fbe740 |
+ blockNamedNodeData,
|
|
|
fbe740 |
+ shallow, &actions) < 0)
|
|
|
fbe740 |
+ return -1;
|
|
|
fbe740 |
+ }
|
|
|
fbe740 |
+ break;
|
|
|
fbe740 |
+
|
|
|
fbe740 |
case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT:
|
|
|
fbe740 |
break;
|
|
|
fbe740 |
}
|
|
|
fbe740 |
@@ -17584,10 +17599,17 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
|
|
|
fbe740 |
}
|
|
|
fbe740 |
|
|
|
fbe740 |
qemuDomainObjEnterMonitor(driver, vm);
|
|
|
fbe740 |
- if (blockdev)
|
|
|
fbe740 |
- ret = qemuMonitorJobComplete(priv->mon, job->name);
|
|
|
fbe740 |
- else
|
|
|
fbe740 |
+ if (blockdev) {
|
|
|
fbe740 |
+ int rc = 0;
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ if (actions)
|
|
|
fbe740 |
+ rc = qemuMonitorTransaction(priv->mon, &actions);
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ if (rc == 0)
|
|
|
fbe740 |
+ ret = qemuMonitorJobComplete(priv->mon, job->name);
|
|
|
fbe740 |
+ } else {
|
|
|
fbe740 |
ret = qemuMonitorDrivePivot(priv->mon, job->name);
|
|
|
fbe740 |
+ }
|
|
|
fbe740 |
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
|
|
fbe740 |
return -1;
|
|
|
fbe740 |
|
|
|
fbe740 |
--
|
|
|
fbe740 |
2.25.0
|
|
|
fbe740 |
|