[PATCH] virsh: use the same connection URI for reconnect

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

 



When for some reason virsh looses connection and then tries to
reconnection, it uses the default URI instead of the one that was used
for the previous connection it got disconnected from.

In order to make it reconnect using the same URI, copy URI of the
current (disconnected) connection to vshControl 'connname' attribute.
---
 tools/virsh.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/virsh.c b/tools/virsh.c
index 5a61189..07097aa 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -359,6 +359,14 @@ virshConnectionHandler(vshControl *ctl)
 {
     virshControlPtr priv = ctl->privData;
 
+    if (disconnected && priv->conn) {
+        if (!ctl->connname) {
+            char *uri = virConnectGetURI(priv->conn);
+            ctl->connname = vshStrdup(ctl, uri);
+            VIR_FREE(uri);
+        }
+    }
+
     if (!priv->conn || disconnected)
         virshReconnect(ctl);
 
-- 
2.7.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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]