Re: [RFC PATCH] conf: check for migration job during domain start

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 31, 2024 at 11:46:48AM +0000, Sergey Dyasli wrote:
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).


There's probably more which could happen, or there will be and the
message will never be perfect.  On the other hand it does not hurt to
make it a bit more nicer for someone with just a few lines.

Reviewed-by: Martin Kletzander <mkletzan@xxxxxxxxxx>

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@xxxxxxxxxxx>
---
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 bb5807d00b42..166bbc5cfd57 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;
            }
        }
--
2.22.3

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux