[PATCH 06/10] virt-ssh-helper: Accept ?mode= in connection URI

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

 



When split daemons were introduced, we also made connection URI
accept new parameter: mode={auto,legacy,direct} so that a client
can force connecting to either old, monolithic daemon, or to
split daemon (see v5.7.0-rc1~257 for more info).

Now, the change was done to the remote driver, but not to
virt-ssh-helper. True, our remote driver code still does not pass
the 'mode' parameter, but that will be addressed in next commits.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/remote/remote_ssh_helper.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/remote/remote_ssh_helper.c b/src/remote/remote_ssh_helper.c
index b4735027be..3b4de7f214 100644
--- a/src/remote/remote_ssh_helper.c
+++ b/src/remote/remote_ssh_helper.c
@@ -354,6 +354,8 @@ int main(int argc, char **argv)
     g_autoptr(virURI) uri = NULL;
     g_autofree char *driver = NULL;
     remoteDriverTransport transport;
+    int mode = REMOTE_DRIVER_MODE_AUTO;
+    g_autofree char *mode_str = NULL;
     gboolean version = false;
     gboolean readonly = false;
     g_autofree char *sock_path = NULL;
@@ -367,6 +369,7 @@ int main(int argc, char **argv)
         { NULL, '\0', 0, 0, NULL, NULL, NULL }
     };
     unsigned int flags;
+    size_t i;
 
     context = g_option_context_new("URI - libvirt socket proxy");
     g_option_context_set_summary(context,
@@ -429,8 +432,20 @@ int main(int argc, char **argv)
     if (readonly)
         flags |= REMOTE_DRIVER_OPEN_RO;
 
+    for (i = 0; i < uri->paramsCount; i++) {
+        virURIParam *var = &uri->params[i];
+
+        VIR_EXTRACT_URI_ARG_STR("mode", mode_str);
+    }
+
+    if (mode_str &&
+        (mode = remoteDriverModeTypeFromString(mode_str)) < 0) {
+        g_printerr(_("%s: unknown remote mode '%s'"), argv[0], mode_str);
+        exit(EXIT_FAILURE);
+    }
+
     sock_path = remoteGetUNIXSocket(transport,
-                                    REMOTE_DRIVER_MODE_AUTO,
+                                    mode,
                                     driver,
                                     flags,
                                     &daemon_path);
-- 
2.39.1




[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