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. And we'd really love to
have an event without having to poll for the transition between
pull and mirroring, but that will have to wait for qemu.
* 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.
---
was 10/18 in v4
no real change
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 582eafa..e1584c6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11712,6 +11712,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 disk-mirror
+info-cur == info-end info-type == VIR_DOMAIN_BLOCK_JOB_TYPE_COPY)
+disk-mirroring = true;
+
/* With synchronous block cancel, we must synthesize an event, and
* we silently ignore the ABORT_ASYNC flag. With asynchronous
* block cancel, the event will come from qemu, but without the
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index e0ea505..6bce701 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -797,6 +797,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 ((virConnectDomainEventBlockJobStatus) event) {
case VIR_DOMAIN_BLOCK_JOB_COMPLETED:
@@ -3415,6 +3417,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
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list