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

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