render / rpms / libvirt

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