From 090a2f27c21b6a919dd72b21d852989b1942bb3a Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Thu, 12 Dec 2024 10:45:38 +0100 Subject: [PATCH] qemu: Replace qemuDomainCheckMonitor with qemuMigrationJobCheckStatus 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 Reviewed-by: Michal Privoznik --- src/qemu/qemu_domain.c | 18 ------------------ src/qemu/qemu_domain.h | 3 --- src/qemu/qemu_migration.c | 7 ++++--- src/qemu/qemu_monitor.c | 8 -------- src/qemu/qemu_monitor.h | 1 - 5 files changed, 4 insertions(+), 33 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 3366346624..f15ba58179 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -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) diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index e810f79599..86e24ad54b 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -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); diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 26a92d8ee2..f9f40a2b03 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -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; } diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index df7e0d8997..c198ddb625 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1430,14 +1430,6 @@ qemuMonitorStopCPUs(qemuMonitor *mon) } -int -qemuMonitorCheck(qemuMonitor *mon) -{ - bool running; - return qemuMonitorGetStatus(mon, &running, NULL); -} - - int qemuMonitorGetStatus(qemuMonitor *mon, bool *running, diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index d4d9b98ba7..ac3a7b6db3 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -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)