]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: check for migration job during domain start
authorSergey Dyasli <sergey.dyasli@nutanix.com>
Wed, 31 Jul 2024 11:46:48 +0000 (11:46 +0000)
committerMartin Kletzander <mkletzan@redhat.com>
Tue, 27 Aug 2024 08:44:58 +0000 (10:44 +0200)
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 <sergey.dyasli@nutanix.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/conf/virdomainobjlist.c

index bb5807d00b426ea4fab1b1adf995275f07e444ba..166bbc5cfd57e46c7c386b6ebc0bcf23ba204a3b 100644 (file)
@@ -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;
             }
         }