d89b3e
From 137ba6bfafefe50b85f7c099dd1472f2fe69c127 Mon Sep 17 00:00:00 2001
d89b3e
Message-Id: <137ba6bfafefe50b85f7c099dd1472f2fe69c127@dist-git>
d89b3e
From: Michal Privoznik <mprivozn@redhat.com>
d89b3e
Date: Tue, 17 Mar 2015 13:13:50 +0100
d89b3e
Subject: [PATCH] qemuProcessHandleBlockJob: Take status into account
d89b3e
d89b3e
https://bugzilla.redhat.com/show_bug.cgi?id=1202719
d89b3e
d89b3e
Upon BLOCK_JOB_COMPLETED event delivery, we check if the job has
d89b3e
completed (in qemuMonitorJSONHandleBlockJobImpl()). For better image,
d89b3e
the event looks something like this:
d89b3e
d89b3e
"timestamp": {"seconds": 1423582694, "microseconds": 372666}, "event":
d89b3e
"BLOCK_JOB_COMPLETED", "data": {"device": "drive-virtio-disk0", "len":
d89b3e
8412790784, "offset": 409993216, "speed": 8796093022207, "type":
d89b3e
"mirror", "error": "No space left on device"}}
d89b3e
d89b3e
If "len" does not equal "offset" it's considered an error, and we can
d89b3e
clearly see "error" field filled in. However, later in the event
d89b3e
processing this case was handled no differently to case of job being
d89b3e
aborted via separate API. It's time that we start differentiate these
d89b3e
two because of the future work.
d89b3e
d89b3e
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
d89b3e
(cherry picked from commit 76c61cdca20c106960af033e5d0f5da70177af0f)
d89b3e
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
d89b3e
---
d89b3e
 src/qemu/qemu_process.c | 3 ++-
d89b3e
 1 file changed, 2 insertions(+), 1 deletion(-)
d89b3e
d89b3e
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
d89b3e
index 63cb198..b9e7280 100644
d89b3e
--- a/src/qemu/qemu_process.c
d89b3e
+++ b/src/qemu/qemu_process.c
d89b3e
@@ -1110,7 +1110,8 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
d89b3e
         case VIR_DOMAIN_BLOCK_JOB_CANCELED:
d89b3e
             virStorageSourceFree(disk->mirror);
d89b3e
             disk->mirror = NULL;
d89b3e
-            disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_NONE;
d89b3e
+            disk->mirrorState = status == VIR_DOMAIN_BLOCK_JOB_FAILED ?
d89b3e
+                VIR_DOMAIN_DISK_MIRROR_STATE_ABORT : VIR_DOMAIN_DISK_MIRROR_STATE_NONE;
d89b3e
             disk->mirrorJob = VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN;
d89b3e
             save = true;
d89b3e
             break;
d89b3e
-- 
d89b3e
2.3.3
d89b3e