]> xenbits.xensource.com Git - people/aperard/libvirt.git/commitdiff
virshReconnect: Preserve current URI if not explicitly set in ctl->connname
authorPeter Krempa <pkrempa@redhat.com>
Thu, 14 Dec 2023 16:11:08 +0000 (17:11 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 15 Jan 2024 13:05:20 +0000 (14:05 +0100)
Probe the current URI so that other places don't need to do that.

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

index 7b71131db33f0317238bce7da9b689c5f4651bf1..18a8c32f537d51570de4443ba5a5bd37f488efd1 100644 (file)
@@ -225,6 +225,9 @@ virshReconnect(vshControl *ctl, const char *name, bool readonly, bool force)
             ctl->connname = g_strdup(name);
         }
 
+        if (!ctl->connname)
+            ctl->connname = virConnectGetURI(priv->conn);
+
         priv->readonly = readonly;
 
         if (virConnectRegisterCloseCallback(priv->conn, virshCatchDisconnect,