[PATCH 32/41] admin: add ability to connect to the per-driver daemon sockets

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

 



The admin client now supports addressing the per-driver daemons using
the obvious URI schemes for each daemon. eg virtqemud:///system
virtqemud:///session, etc.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 src/libvirt-admin.c | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/src/libvirt-admin.c b/src/libvirt-admin.c
index 74dedf64d8..97290b337f 100644
--- a/src/libvirt-admin.c
+++ b/src/libvirt-admin.c
@@ -36,10 +36,6 @@
 
 #define VIR_FROM_THIS VIR_FROM_ADMIN
 
-#define LIBVIRTD_ADMIN_SOCK_NAME "libvirt-admin-sock"
-#define VIRTLOGD_ADMIN_SOCK_NAME "virtlogd-admin-sock"
-#define VIRTLOCKD_ADMIN_SOCK_NAME "virtlockd-admin-sock"
-
 
 VIR_LOG_INIT("libvirt-admin");
 
@@ -101,6 +97,7 @@ virAdmInitialize(void)
     return 0;
 }
 
+
 static char *
 getSocketPath(virURIPtr uri)
 {
@@ -127,27 +124,28 @@ getSocketPath(virURIPtr uri)
     }
 
     if (!sock_path) {
-        const char *sockbase = NULL;
-        if (STREQ_NULLABLE(uri->scheme, "libvirtd")) {
-            sockbase = LIBVIRTD_ADMIN_SOCK_NAME;
-        } else if (STREQ_NULLABLE(uri->scheme, "virtlogd")) {
-            sockbase = VIRTLOGD_ADMIN_SOCK_NAME;
-        } else if (STREQ_NULLABLE(uri->scheme, "virtlockd")) {
-            sockbase = VIRTLOCKD_ADMIN_SOCK_NAME;
-        } else {
+        bool legacy = false;
+        if (!uri->scheme) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           "%s", _("No URI scheme specified"));
+            goto error;
+        }
+        if (STREQ(uri->scheme, "libvirtd")) {
+            legacy = true;
+        } else if (!STRPREFIX(uri->scheme, "virt")) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("Unsupported URI scheme '%s'"),
-                           NULLSTR(uri->scheme));
+                           uri->scheme);
             goto error;
         }
 
         if (STREQ_NULLABLE(uri->path, "/system")) {
-            if (virAsprintf(&sock_path, LOCALSTATEDIR "/run/libvirt/%s",
-                            sockbase) < 0)
+            if (virAsprintf(&sock_path, LOCALSTATEDIR "/run/libvirt/%s-admin-sock",
+                            legacy ? "libvirt" : uri->scheme) < 0)
                 goto error;
         } else if (STREQ_NULLABLE(uri->path, "/session")) {
-            if (!rundir || virAsprintf(&sock_path, "%s/%s", rundir,
-                                       sockbase) < 0)
+            if (!rundir || virAsprintf(&sock_path, "%s/%s-admin-sock", rundir,
+                                       legacy ? "libvirt" : uri->scheme) < 0)
                 goto error;
         } else {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-- 
2.21.0

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