|
|
a41c76 |
From 629629bccbaef81ab1e187fbf5aab4e07d49f350 Mon Sep 17 00:00:00 2001
|
|
|
a41c76 |
Message-Id: <629629bccbaef81ab1e187fbf5aab4e07d49f350@dist-git>
|
|
|
a41c76 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
a41c76 |
Date: Mon, 16 Mar 2020 22:12:31 +0100
|
|
|
a41c76 |
Subject: [PATCH] qemu: blockjob: Handle bitmaps after finish of normal
|
|
|
a41c76 |
block-commit
|
|
|
a41c76 |
MIME-Version: 1.0
|
|
|
a41c76 |
Content-Type: text/plain; charset=UTF-8
|
|
|
a41c76 |
Content-Transfer-Encoding: 8bit
|
|
|
a41c76 |
|
|
|
a41c76 |
Merge the bitmaps into base of the block commit after the job finishes.
|
|
|
a41c76 |
|
|
|
a41c76 |
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
a41c76 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
a41c76 |
(cherry picked from commit db450a742224fb96d8f4d45fde3d0c19faeabfdb)
|
|
|
a41c76 |
https://bugzilla.redhat.com/show_bug.cgi?id=1799013
|
|
|
a41c76 |
Message-Id: <dcf1a67be965850ccd4b35f3ef4587dee5c77151.1584391727.git.pkrempa@redhat.com>
|
|
|
a41c76 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
a41c76 |
---
|
|
|
a41c76 |
src/qemu/qemu_blockjob.c | 52 ++++++++++++++++++++++++++++++++++++++++
|
|
|
a41c76 |
1 file changed, 52 insertions(+)
|
|
|
a41c76 |
|
|
|
a41c76 |
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
|
|
|
a41c76 |
index 63f1cc79c3..0b7e1403e6 100644
|
|
|
a41c76 |
--- a/src/qemu/qemu_blockjob.c
|
|
|
a41c76 |
+++ b/src/qemu/qemu_blockjob.c
|
|
|
a41c76 |
@@ -1049,6 +1049,55 @@ qemuBlockJobDeleteImages(virQEMUDriverPtr driver,
|
|
|
a41c76 |
}
|
|
|
a41c76 |
}
|
|
|
a41c76 |
|
|
|
a41c76 |
+
|
|
|
a41c76 |
+/**
|
|
|
a41c76 |
+ * qemuBlockJobProcessEventCompletedCommitBitmaps:
|
|
|
a41c76 |
+ *
|
|
|
a41c76 |
+ * Handles the bitmap changes after commit. This returns -1 on monitor failures.
|
|
|
a41c76 |
+ */
|
|
|
a41c76 |
+static int
|
|
|
a41c76 |
+qemuBlockJobProcessEventCompletedCommitBitmaps(virDomainObjPtr vm,
|
|
|
a41c76 |
+ qemuBlockJobDataPtr job,
|
|
|
a41c76 |
+ qemuDomainAsyncJob asyncJob)
|
|
|
a41c76 |
+{
|
|
|
a41c76 |
+ qemuDomainObjPrivatePtr priv = vm->privateData;
|
|
|
a41c76 |
+ g_autoptr(virHashTable) blockNamedNodeData = NULL;
|
|
|
a41c76 |
+ g_autoptr(virJSONValue) actions = NULL;
|
|
|
a41c76 |
+
|
|
|
a41c76 |
+ if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN))
|
|
|
a41c76 |
+ return 0;
|
|
|
a41c76 |
+
|
|
|
a41c76 |
+ if (!(blockNamedNodeData = qemuBlockGetNamedNodeData(vm, asyncJob)))
|
|
|
a41c76 |
+ return -1;
|
|
|
a41c76 |
+
|
|
|
a41c76 |
+ if (qemuBlockBitmapsHandleCommitFinish(job->data.commit.top,
|
|
|
a41c76 |
+ job->data.commit.base,
|
|
|
a41c76 |
+ blockNamedNodeData,
|
|
|
a41c76 |
+ &actions,
|
|
|
a41c76 |
+ job->data.commit.disabledBitmapsBase) < 0)
|
|
|
a41c76 |
+ return 0;
|
|
|
a41c76 |
+
|
|
|
a41c76 |
+ if (!actions)
|
|
|
a41c76 |
+ return 0;
|
|
|
a41c76 |
+
|
|
|
a41c76 |
+ if (qemuBlockReopenReadWrite(vm, job->data.commit.base, asyncJob) < 0)
|
|
|
a41c76 |
+ return -1;
|
|
|
a41c76 |
+
|
|
|
a41c76 |
+ if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0)
|
|
|
a41c76 |
+ return -1;
|
|
|
a41c76 |
+
|
|
|
a41c76 |
+ qemuMonitorTransaction(priv->mon, &actions);
|
|
|
a41c76 |
+
|
|
|
a41c76 |
+ if (qemuDomainObjExitMonitor(priv->driver, vm) < 0)
|
|
|
a41c76 |
+ return -1;
|
|
|
a41c76 |
+
|
|
|
a41c76 |
+ if (qemuBlockReopenReadOnly(vm, job->data.commit.base, asyncJob) < 0)
|
|
|
a41c76 |
+ return -1;
|
|
|
a41c76 |
+
|
|
|
a41c76 |
+ return 0;
|
|
|
a41c76 |
+}
|
|
|
a41c76 |
+
|
|
|
a41c76 |
+
|
|
|
a41c76 |
/**
|
|
|
a41c76 |
* qemuBlockJobProcessEventCompletedCommit:
|
|
|
a41c76 |
* @driver: qemu driver object
|
|
|
a41c76 |
@@ -1106,6 +1155,9 @@ qemuBlockJobProcessEventCompletedCommit(virQEMUDriverPtr driver,
|
|
|
a41c76 |
if (!n)
|
|
|
a41c76 |
return;
|
|
|
a41c76 |
|
|
|
a41c76 |
+ if (qemuBlockJobProcessEventCompletedCommitBitmaps(vm, job, asyncJob) < 0)
|
|
|
a41c76 |
+ return;
|
|
|
a41c76 |
+
|
|
|
a41c76 |
/* revert access to images */
|
|
|
a41c76 |
qemuDomainStorageSourceAccessAllow(driver, vm, job->data.commit.base,
|
|
|
a41c76 |
true, false, false);
|
|
|
a41c76 |
--
|
|
|
a41c76 |
2.25.1
|
|
|
a41c76 |
|