Handle the new type of block copy event and info. Of course,
this patch does nothing until a later patch actually allows the
creation/abort of a block copy job.
* src/qemu/qemu_monitor_json.c (qemuMonitorJSONHandleBlockJobImpl)
(qemuMonitorJSONGetBlockJobInfoOne): Translate new job type.
* src/qemu/qemu_driver.c (qemuDomainBlockJobImpl): Snoop a successful
info query to save effort on a pivot request.
---
src/qemu/qemu_driver.c | 6 ++++++
src/qemu/qemu_monitor_json.c | 4 ++++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4421506..5dc263c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11676,6 +11676,12 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const
char *base,
if (ret < 0)
goto endjob;
+ /* Snoop block copy operations, so future cancel operations can
+ * avoid checking if pivot is safe. */
+ if (mode == BLOCK_JOB_INFO && ret == 1 &&
vm->def->disks[idx]->mirror &&
+ info->cur == info->end && info->type ==
VIR_DOMAIN_BLOCK_JOB_TYPE_COPY)
+ vm->def->disks[idx]->mirroring = true;
+
/* Qemu provides asynchronous block job cancellation, but without
* the VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC flag libvirt guarantees a
* synchronous operation. Provide this behavior by waiting here,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index ffa6c0c..bb080e5 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -788,6 +788,8 @@ qemuMonitorJSONHandleBlockJobImpl(qemuMonitorPtr mon,
if (STREQ(type_str, "stream"))
type = VIR_DOMAIN_BLOCK_JOB_TYPE_PULL;
+ else if (STREQ(type_str, "mirror"))
+ type = VIR_DOMAIN_BLOCK_JOB_TYPE_COPY;
switch (event) {
case VIR_DOMAIN_BLOCK_JOB_COMPLETED:
@@ -3411,6 +3413,8 @@ static int qemuMonitorJSONGetBlockJobInfoOne(virJSONValuePtr entry,
}
if (STREQ(type, "stream"))
info->type = VIR_DOMAIN_BLOCK_JOB_TYPE_PULL;
+ else if (STREQ(type, "mirror"))
+ info->type = VIR_DOMAIN_BLOCK_JOB_TYPE_COPY;
else
info->type = VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN;
--
1.7.7.6