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 <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Jiri Denemark 2024-12-12 10:45:38 +01:00
parent 3100f43a1d
commit 090a2f27c2
5 changed files with 4 additions and 33 deletions

View 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 bool
qemuDomainSupportsVideoVga(const virDomainVideoDef *video, qemuDomainSupportsVideoVga(const virDomainVideoDef *video,
virQEMUCaps *qemuCaps) virQEMUCaps *qemuCaps)

View File

@ -968,9 +968,6 @@ bool qemuDomainVcpuHotplugIsInOrder(virDomainDef *def)
void qemuDomainVcpuPersistOrder(virDomainDef *def) void qemuDomainVcpuPersistOrder(virDomainDef *def)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
int qemuDomainCheckMonitor(virDomainObj *vm,
virDomainAsyncJob asyncJob);
bool qemuDomainSupportsVideoVga(const virDomainVideoDef *video, bool qemuDomainSupportsVideoVga(const virDomainVideoDef *video,
virQEMUCaps *qemuCaps); virQEMUCaps *qemuCaps);

View File

@ -6850,10 +6850,11 @@ qemuMigrationDstFinishActive(virQEMUDriver *driver,
goto error; goto error;
if (retcode != 0) { if (retcode != 0) {
/* Check for a possible error on the monitor in case Finish was called /* Checking the migration status will read the migration error if
* earlier than monitor EOF handler got a chance to process the error * 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; goto error;
} }

View File

@ -1430,14 +1430,6 @@ qemuMonitorStopCPUs(qemuMonitor *mon)
} }
int
qemuMonitorCheck(qemuMonitor *mon)
{
bool running;
return qemuMonitorGetStatus(mon, &running, NULL);
}
int int
qemuMonitorGetStatus(qemuMonitor *mon, qemuMonitorGetStatus(qemuMonitor *mon,
bool *running, bool *running,

View File

@ -558,7 +558,6 @@ typedef enum {
VIR_ENUM_DECL(qemuMonitorVMStatus); VIR_ENUM_DECL(qemuMonitorVMStatus);
int qemuMonitorVMStatusToPausedReason(const char *status); int qemuMonitorVMStatusToPausedReason(const char *status);
int qemuMonitorCheck(qemuMonitor *mon);
int qemuMonitorGetStatus(qemuMonitor *mon, int qemuMonitorGetStatus(qemuMonitor *mon,
bool *running, bool *running,
virDomainPausedReason *reason) virDomainPausedReason *reason)