From 830d5044f0069e3e34e826d27478c9a19503adcf Mon Sep 17 00:00:00 2001
Message-Id: <830d5044f0069e3e34e826d27478c9a19503adcf@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 4 Feb 2020 15:07:36 +0100
Subject: [PATCH] qemu: blockcopy: Actually unplug unused images when mirror
job fails to start
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
If a mirror job fails to start in -blockdev mode we'd not unplug the
backing files we added first because the code on the error path checked
the wrong value. 'rc' is used as status of the code which added the
images, but the state of the 'block(dev)-mirror' call is stored in 'ret'
at that point.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit 623366d13066174e60067fa763ddc2c3d1db20ef)
https://bugzilla.redhat.com/show_bug.cgi?id=1792195
Message-Id: <5e9e1dd3db0f3137079f2fb29974778f8cf32879.1580824112.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6163b13e91..83f24d7231 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18415,7 +18415,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
qemuBlockJobStarted(job, vm);
endjob:
- if (rc < 0 &&
+ if (ret < 0 &&
virDomainObjIsActive(vm) &&
(data || crdata)) {
qemuDomainObjEnterMonitor(driver, vm);
--
2.25.0