render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
032100
From 25fe3cf8990b654fd568f580b8885102b3f92789 Mon Sep 17 00:00:00 2001
032100
Message-Id: <25fe3cf8990b654fd568f580b8885102b3f92789@dist-git>
032100
From: Jiri Denemark <jdenemar@redhat.com>
032100
Date: Thu, 21 Jul 2022 15:00:28 +0200
032100
Subject: [PATCH] qemu_migration: Use EnterMonitorAsync in
032100
 qemuDomainGetMigrationBlockers
032100
MIME-Version: 1.0
032100
Content-Type: text/plain; charset=UTF-8
032100
Content-Transfer-Encoding: 8bit
032100
032100
The code is run with an async job and thus needs to make sure a nested
032100
job is acquired before entering the monitor.
032100
032100
While touching the code in qemuMigrationSrcIsAllowed I also fixed the
032100
grammar which was accidentally broken by v8.5.0-140-g2103807e33.
032100
032100
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
032100
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
032100
(cherry picked from commit 62627524607f214e724a48fcac575737f49a271c)
032100
Resolves: https://bugzilla.redhat.com/2092833
032100
Signed-off-by: Eugenio PĂ©rez <eperezma@redhat.com>
032100
---
032100
 src/qemu/qemu_migration.c | 11 ++++++++---
032100
 1 file changed, 8 insertions(+), 3 deletions(-)
032100
032100
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
032100
index 2f77e45abf..735eb02673 100644
032100
--- a/src/qemu/qemu_migration.c
032100
+++ b/src/qemu/qemu_migration.c
032100
@@ -1418,12 +1418,15 @@ qemuMigrationSrcIsAllowedHostdev(const virDomainDef *def)
032100
 static int
032100
 qemuDomainGetMigrationBlockers(virQEMUDriver *driver,
032100
                                virDomainObj *vm,
032100
+                               int asyncJob,
032100
                                char ***blockers)
032100
 {
032100
     qemuDomainObjPrivate *priv = vm->privateData;
032100
     int rc;
032100
 
032100
-    qemuDomainObjEnterMonitor(driver, vm);
032100
+    if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
032100
+        return -1;
032100
+
032100
     rc = qemuMonitorGetMigrationBlockers(priv->mon, blockers);
032100
     qemuDomainObjExitMonitor(vm);
032100
 
032100
@@ -1458,10 +1461,12 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
032100
     bool blockedReasonsCap = virQEMUCapsGet(priv->qemuCaps,
032100
                                             QEMU_CAPS_MIGRATION_BLOCKED_REASONS);
032100
 
032100
-    /* Ask qemu if it have a migration blocker */
032100
+    /* Ask qemu if it has a migration blocker */
032100
     if (blockedReasonsCap) {
032100
         g_auto(GStrv) blockers = NULL;
032100
-        if (qemuDomainGetMigrationBlockers(driver, vm, &blockers) < 0)
032100
+        if (qemuDomainGetMigrationBlockers(driver, vm,
032100
+                                           VIR_ASYNC_JOB_MIGRATION_OUT,
032100
+                                           &blockers) < 0)
032100
             return false;
032100
 
032100
         if (blockers && blockers[0]) {
032100
-- 
032100
2.35.1
032100