[PATCH] virsh: Honour --readonly with cmdConnect and no name

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

 



Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 tools/virsh.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index 94bb7ff6c93a..9883e87df2b5 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -218,7 +218,13 @@ virshReconnect(vshControl *ctl, const char *name, bool readonly, bool force)
 {
     bool connected = false;
     virshControlPtr priv = ctl->privData;
-    bool ro = name ? readonly : priv->readonly;
+
+    /* If the flag was not specified, then it depends on whether we are
+     * reconnecting to the default URI (in which case we want to keep the
+     * readonly flag as it was) or to a specified URI in which case it
+     * should stay false */
+    if (!readonly && !name)
+        readonly = priv->readonly;
 
     if (priv->conn) {
         int ret;
@@ -233,7 +239,7 @@ virshReconnect(vshControl *ctl, const char *name, bool readonly, bool force)
                                   "disconnect from the hypervisor"));
     }
 
-    priv->conn = virshConnect(ctl, name ? name : ctl->connname, ro);
+    priv->conn = virshConnect(ctl, name ? name : ctl->connname, readonly);
 
     if (!priv->conn) {
         if (disconnected)
-- 
2.14.1

--
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]
  Powered by Linux