]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_migration: Unregister close callback only if connection still exists
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 20 Jul 2021 15:21:34 +0000 (17:21 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 21 Jul 2021 08:24:09 +0000 (10:24 +0200)
When doing a peer-to-peer migration it may happen that the
connection to the destination disappears. If that happens,
there's no point in trying to unregister the close callback
because the connection is closed already. It results only in
polluting logs with this message:

  error : virNetSocketReadWire:1814 : End of file while reading data: : Input/output error

and the reason for that is unregistering a connection callback
results in RPC (among other things).

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1918211
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_migration.c

index a4f44b465db84e2659905c93a461aca8907ed15e..4d651aeb1a317643a5811a76bc239e5d58c6f9d3 100644 (file)
@@ -5214,9 +5214,11 @@ qemuMigrationSrcPerformPeer2Peer(virQEMUDriver *driver,
 
  cleanup:
     virErrorPreserveLast(&orig_err);
-    qemuDomainObjEnterRemote(vm);
-    virConnectUnregisterCloseCallback(dconn, qemuMigrationSrcConnectionClosed);
-    ignore_value(qemuDomainObjExitRemote(vm, false));
+    if (dconn && virConnectIsAlive(dconn) == 1) {
+        qemuDomainObjEnterRemote(vm);
+        virConnectUnregisterCloseCallback(dconn, qemuMigrationSrcConnectionClosed);
+        ignore_value(qemuDomainObjExitRemote(vm, false));
+    }
     virErrorRestore(&orig_err);
     return ret;
 }