9119d9
From a42824549d45c014773f7f83a177d4d4f173a9a0 Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <a42824549d45c014773f7f83a177d4d4f173a9a0@dist-git>
9119d9
From: Erik Skultety <eskultet@redhat.com>
9119d9
Date: Thu, 4 Dec 2014 09:53:16 +0100
9119d9
Subject: [PATCH] qemu: Fix virsh freeze when blockcopy storage file is removed
9119d9
9119d9
If someone removes blockcopy storage file when still in mirroring phase
9119d9
and then requesting blockjob abort using pivot, virsh cmd freezes. This
9119d9
is not an issue with older qemu versions which did not support
9119d9
asynchronous jobs (which we prefer by default).
9119d9
As we have reached the mirroring phase successfully, polling monitor for
9119d9
blockjob info always returns 1 and the loop never ends.
9119d9
This fix introduces a check for qemuDomainBlockPivot return code, possibly
9119d9
skipping the asynchronous waiting completely, if an error occurred and
9119d9
asynchronous waiting was the preferred method.
9119d9
9119d9
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1139567
9119d9
(cherry picked from commit fe3691f66348d55e88c9811fd79ff9314e053977)
9119d9
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 src/qemu/qemu_driver.c | 2 ++
9119d9
 1 file changed, 2 insertions(+)
9119d9
9119d9
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
9119d9
index a9a7d30..fe5fe88 100644
9119d9
--- a/src/qemu/qemu_driver.c
9119d9
+++ b/src/qemu/qemu_driver.c
9119d9
@@ -15527,6 +15527,8 @@ qemuDomainBlockJobImpl(virDomainObjPtr vm,
9119d9
 
9119d9
         if (disk->mirror && (flags & VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT)) {
9119d9
             ret = qemuDomainBlockPivot(conn, driver, vm, device, disk);
9119d9
+            if (ret < 0 && async)
9119d9
+                goto endjob;
9119d9
             goto waitjob;
9119d9
         }
9119d9
         if (disk->mirror) {
9119d9
-- 
9119d9
2.2.0
9119d9