Blame SOURCES/libvirt-qemuDomainBlockPivot-Move-check-prior-to-executing-the-pivot-steps.patch

d76c62
From 5e36101be25d8e80eb14635d9e3eccccaba43550 Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <5e36101be25d8e80eb14635d9e3eccccaba43550@dist-git>
d76c62
From: Peter Krempa <pkrempa@redhat.com>
d76c62
Date: Mon, 16 Mar 2020 22:11:36 +0100
d76c62
Subject: [PATCH] qemuDomainBlockPivot: Move check prior to executing the pivot
d76c62
 steps
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
Move the check whether the job is already synchronised to the beginning
d76c62
of the function so that we don't try to do some of the steps necessary
d76c62
for pivoting prior to actually wanting to pivot.
d76c62
d76c62
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
d76c62
Reviewed-by: Eric Blake <eblake@redhat.com>
d76c62
(cherry picked from commit a89ba6524c01473f3e5272dc787f01f806df32bb)
d76c62
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1803092
d76c62
Message-Id: <17682fad2c82b2f48505b3f8776bb75201eb2d89.1584391726.git.pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 src/qemu/qemu_driver.c | 14 +++++++-------
d76c62
 1 file changed, 7 insertions(+), 7 deletions(-)
d76c62
d76c62
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
d76c62
index 0bdb2851ec..bedd69ea2b 100644
d76c62
--- a/src/qemu/qemu_driver.c
d76c62
+++ b/src/qemu/qemu_driver.c
d76c62
@@ -17561,6 +17561,13 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
d76c62
     bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
d76c62
     g_autoptr(virJSONValue) actions = NULL;
d76c62
 
d76c62
+    if (job->state != QEMU_BLOCKJOB_STATE_READY) {
d76c62
+        virReportError(VIR_ERR_BLOCK_COPY_ACTIVE,
d76c62
+                       _("block job '%s' not ready for pivot yet"),
d76c62
+                       job->name);
d76c62
+        return -1;
d76c62
+    }
d76c62
+
d76c62
     switch ((qemuBlockJobType) job->type) {
d76c62
     case QEMU_BLOCKJOB_TYPE_NONE:
d76c62
     case QEMU_BLOCKJOB_TYPE_LAST:
d76c62
@@ -17598,13 +17605,6 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
d76c62
         break;
d76c62
     }
d76c62
 
d76c62
-    if (job->state != QEMU_BLOCKJOB_STATE_READY) {
d76c62
-        virReportError(VIR_ERR_BLOCK_COPY_ACTIVE,
d76c62
-                       _("block job '%s' not ready for pivot yet"),
d76c62
-                       job->name);
d76c62
-        return -1;
d76c62
-    }
d76c62
-
d76c62
     qemuDomainObjEnterMonitor(driver, vm);
d76c62
     if (blockdev) {
d76c62
         int rc = 0;
d76c62
-- 
d76c62
2.25.1
d76c62