Merge the bitmaps when finalizing a block pull job so that backups work
properly afterwards.
https://bugzilla.redhat.com/show_bug.cgi?id=1799010
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_blockjob.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 7e4530f48b..435c945b78 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -936,6 +936,41 @@ qemuBlockJobClearConfigChain(virDomainObjPtr vm,
}
+static int
+qemuBlockJobProcessEventCompletedPullBitmaps(virDomainObjPtr vm,
+ qemuBlockJobDataPtr job,
+ qemuDomainAsyncJob asyncJob)
+{
+ qemuDomainObjPrivatePtr priv = vm->privateData;
+ g_autoptr(virHashTable) blockNamedNodeData = NULL;
+ g_autoptr(virJSONValue) actions = NULL;
+
+ if (!(blockNamedNodeData = qemuBlockGetNamedNodeData(vm, asyncJob)))
+ return -1;
+
+ if (qemuBlockGetBitmapMergeActions(job->disk->src,
+ job->data.pull.base,
+ job->disk->src,
+ NULL, NULL, NULL,
+ &actions,
+ blockNamedNodeData) < 0)
+ return -1;
+
+ if (!actions)
+ return 0;
+
+ if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0)
+ return -1;
+
+ qemuMonitorTransaction(priv->mon, &actions);
+
+ if (qemuDomainObjExitMonitor(priv->driver, vm) < 0)
+ return -1;
+
+ return 0;
+}
+
+
/**
* qemuBlockJobProcessEventCompletedPull:
* @driver: qemu driver object
@@ -976,6 +1011,8 @@ qemuBlockJobProcessEventCompletedPull(virQEMUDriverPtr driver,
if (!cfgdisk)
qemuBlockJobClearConfigChain(vm, job->disk);
+ qemuBlockJobProcessEventCompletedPullBitmaps(vm, job, asyncJob);
+
/* when pulling if 'base' is right below the top image we don't have to
modify it */
if (job->disk->src->backingStore == job->data.pull.base)
return;
--
2.26.2