]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Replace qemuDomainCheckMonitor with qemuMigrationJobCheckStatus
authorJiri Denemark <jdenemar@redhat.com>
Thu, 12 Dec 2024 09:45:38 +0000 (10:45 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 19 Dec 2024 14:21:21 +0000 (15:21 +0100)
The function is only used during incoming migration in the beginning of
Finish phase to detect if QEMU already died but EOF handler haven't had
a chance to do its job yet. It calls query-status QMP command, but
ignores the result. By calling query-migrate instead we can achieve the
same functionality if QEMU is dead and even get meaningful error from
"error-desc" in case the incoming migration failed and QEMU is still
running.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_domain.c
src/qemu/qemu_domain.h
src/qemu/qemu_migration.c
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h

index 3366346624ca322b19ac530560b73a9963e97648..f15ba5817923b804e3366c4b2732ed6b4efa7923 100644 (file)
@@ -9007,24 +9007,6 @@ qemuDomainVcpuPersistOrder(virDomainDef *def)
 }
 
 
-int
-qemuDomainCheckMonitor(virDomainObj *vm,
-                       virDomainAsyncJob asyncJob)
-{
-    qemuDomainObjPrivate *priv = vm->privateData;
-    int ret;
-
-    if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0)
-        return -1;
-
-    ret = qemuMonitorCheck(priv->mon);
-
-    qemuDomainObjExitMonitor(vm);
-
-    return ret;
-}
-
-
 bool
 qemuDomainSupportsVideoVga(const virDomainVideoDef *video,
                            virQEMUCaps *qemuCaps)
index e810f7959940fc2dfff2e96e88a8bc939e6fabe1..86e24ad54b3d2bc6d4881668de6d441d55492e83 100644 (file)
@@ -968,9 +968,6 @@ bool qemuDomainVcpuHotplugIsInOrder(virDomainDef *def)
 void qemuDomainVcpuPersistOrder(virDomainDef *def)
     ATTRIBUTE_NONNULL(1);
 
-int qemuDomainCheckMonitor(virDomainObj *vm,
-                           virDomainAsyncJob asyncJob);
-
 bool qemuDomainSupportsVideoVga(const virDomainVideoDef *video,
                                 virQEMUCaps *qemuCaps);
 
index 26a92d8ee21b9e62ec732e2eb4f6f6efe95689e5..f9f40a2b03973d36a554d3c943531d20dcf74fad 100644 (file)
@@ -6850,10 +6850,11 @@ qemuMigrationDstFinishActive(virQEMUDriver *driver,
         goto error;
 
     if (retcode != 0) {
-        /* Check for a possible error on the monitor in case Finish was called
-         * earlier than monitor EOF handler got a chance to process the error
+        /* Checking the migration status will read the migration error if
+         * set and QEMU is still alive. If the process died and EOF handler
+         * was not run yet, the appropriate monitor error will be set.
          */
-        qemuDomainCheckMonitor(vm, VIR_ASYNC_JOB_MIGRATION_IN);
+        qemuMigrationJobCheckStatus(vm, VIR_ASYNC_JOB_MIGRATION_IN);
         goto error;
     }
 
index df7e0d89978f389ce016a125c001f63dd271cf59..c198ddb6257044ce0544f68ba2a69f9a511f371d 100644 (file)
@@ -1430,14 +1430,6 @@ qemuMonitorStopCPUs(qemuMonitor *mon)
 }
 
 
-int
-qemuMonitorCheck(qemuMonitor *mon)
-{
-    bool running;
-    return qemuMonitorGetStatus(mon, &running, NULL);
-}
-
-
 int
 qemuMonitorGetStatus(qemuMonitor *mon,
                      bool *running,
index d4d9b98ba78d97761b4a7ff7899e2dcc7ad57654..ac3a7b6db3bfd03da78faa9bb875a43cd8ad39ab 100644 (file)
@@ -558,7 +558,6 @@ typedef enum {
 VIR_ENUM_DECL(qemuMonitorVMStatus);
 int qemuMonitorVMStatusToPausedReason(const char *status);
 
-int qemuMonitorCheck(qemuMonitor *mon);
 int qemuMonitorGetStatus(qemuMonitor *mon,
                          bool *running,
                          virDomainPausedReason *reason)