[PATCH 1/3] tools: read default connection uri from env later

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

 



Postpone filling out the default connection in ctl->connname
after calling virshInit.

This allows printing help without a connection to the daemon.
---
 tools/virsh.c      | 6 +++---
 tools/virt-admin.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index 57b4ff3..8c616d6 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -968,9 +968,6 @@ main(int argc, char **argv)
 
     virFileActivateDirOverride(argv[0]);
 
-    if ((defaultConn = virGetEnvBlockSUID("VIRSH_DEFAULT_CONNECT_URI")))
-        ctl->connname = vshStrdup(ctl, defaultConn);
-
     if (!vshInit(ctl, cmdGroups, NULL))
         exit(EXIT_FAILURE);
 
@@ -980,6 +977,9 @@ main(int argc, char **argv)
         exit(EXIT_FAILURE);
     }
 
+    if ((defaultConn = virGetEnvBlockSUID("VIRSH_DEFAULT_CONNECT_URI")))
+        ctl->connname = vshStrdup(ctl, defaultConn);
+
     if (!ctl->imode) {
         ret = vshCommandRun(ctl, ctl->cmd);
     } else {
diff --git a/tools/virt-admin.c b/tools/virt-admin.c
index edb8690..da847d2 100644
--- a/tools/virt-admin.c
+++ b/tools/virt-admin.c
@@ -719,9 +719,6 @@ main(int argc, char **argv)
 
     virFileActivateDirOverride(argv[0]);
 
-    if ((defaultConn = virGetEnvBlockSUID("LIBVIRT_DEFAULT_ADMIN_URI")))
-        ctl->connname = vshStrdup(ctl, defaultConn);
-
     if (!vshInit(ctl, cmdGroups, NULL))
         exit(EXIT_FAILURE);
 
@@ -731,6 +728,9 @@ main(int argc, char **argv)
         exit(EXIT_FAILURE);
     }
 
+    if ((defaultConn = virGetEnvBlockSUID("LIBVIRT_DEFAULT_ADMIN_URI")))
+        ctl->connname = vshStrdup(ctl, defaultConn);
+
     if (!ctl->imode) {
         ret = vshCommandRun(ctl, ctl->cmd);
     } else {
-- 
2.4.10

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