From 87c3fa1cde1e75295e45f00cb9a1963d9c9c8628 Mon Sep 17 00:00:00 2001 From: Sergey Dyasli Date: Wed, 31 Jul 2024 11:46:48 +0000 Subject: [PATCH] conf: check for migration job during domain start It's possible to hit the following situation during qemu p2p live migration: 1. qemu has live migrated and exited (making virDomainObjIsActive() return false) 2. the live migration job is still in progress, waiting for a confirmation from the remote libvirt daemon. This may last for a while with a presence of networking issues (up to keepalive timeout). Any attempt to start the domain again would fail with "domain is already being started" message which is misleading in this situation as it doesn't reflect what's really happening. Add a check for the migration job and report a different error message if the migration job is still running. Signed-off-by: Sergey Dyasli Reviewed-by: Martin Kletzander --- src/conf/virdomainobjlist.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/conf/virdomainobjlist.c b/src/conf/virdomainobjlist.c index bb5807d00b..166bbc5cfd 100644 --- a/src/conf/virdomainobjlist.c +++ b/src/conf/virdomainobjlist.c @@ -301,9 +301,15 @@ virDomainObjListAddLocked(virDomainObjList *doms, goto error; } if (!vm->persistent) { - virReportError(VIR_ERR_OPERATION_INVALID, - _("domain '%1$s' is already being started"), - vm->def->name); + if (vm->job->asyncJob == VIR_ASYNC_JOB_MIGRATION_OUT) { + virReportError(VIR_ERR_OPERATION_INVALID, + _("domain '%1$s' is being migrated out"), + vm->def->name); + } else { + virReportError(VIR_ERR_OPERATION_INVALID, + _("domain '%1$s' is already being started"), + vm->def->name); + } goto error; } }