]> xenbits.xensource.com Git - people/aperard/libvirt.git/commitdiff
virshCatchDisconnect: Don't probe connection URI
authorPeter Krempa <pkrempa@redhat.com>
Thu, 14 Dec 2023 16:13:08 +0000 (17:13 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 15 Jan 2024 13:05:20 +0000 (14:05 +0100)
virsh already stores the connection URI in 'ctl->connname', use that
instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tools/virsh.c

index 18a8c32f537d51570de4443ba5a5bd37f488efd1..95ff63baebc70b4eafcf7555a26200a0dfc7cf55 100644 (file)
@@ -67,18 +67,13 @@ static int disconnected; /* we may have been disconnected */
  * handler, just save the fact it was raised.
  */
 static void
-virshCatchDisconnect(virConnectPtr conn,
+virshCatchDisconnect(virConnectPtr conn G_GNUC_UNUSED,
                      int reason,
                      void *opaque)
 {
     if (reason != VIR_CONNECT_CLOSE_REASON_CLIENT) {
         vshControl *ctl = opaque;
         const char *str = "unknown reason";
-        virErrorPtr error;
-        g_autofree char *uri = NULL;
-
-        virErrorPreserveLast(&error);
-        uri = virConnectGetURI(conn);
 
         switch ((virConnectCloseReason) reason) {
         case VIR_CONNECT_CLOSE_REASON_ERROR:
@@ -94,9 +89,8 @@ virshCatchDisconnect(virConnectPtr conn,
         case VIR_CONNECT_CLOSE_REASON_LAST:
             break;
         }
-        vshError(ctl, _(str), NULLSTR(uri));
+        vshError(ctl, _(str), NULLSTR(ctl->connname));
 
-        virErrorRestore(&error);
         disconnected++;
         vshEventDone(ctl);
     }