mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
admin: add ability to connect to the per-driver daemon sockets
The admin client now supports addressing the per-driver daemons using the obvious URI schemes for each daemon. eg virtqemud:///system virtqemud:///session, etc. Reviewed-by: Andrea Bolognani <abologna@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
b28fd43a5e
commit
fe7d392c85
@ -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");
|
||||
|
||||
@ -127,20 +123,31 @@ 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 {
|
||||
VIR_AUTOFREE(char *) sockbase = NULL;
|
||||
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 (legacy) {
|
||||
if (VIR_STRDUP(sockbase, "libvirt-admin-sock") < 0)
|
||||
goto error;
|
||||
} else {
|
||||
if (virAsprintf(&sockbase, "%s-admin-sock", uri->scheme) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (STREQ_NULLABLE(uri->path, "/system")) {
|
||||
if (virAsprintf(&sock_path, LOCALSTATEDIR "/run/libvirt/%s",
|
||||
sockbase) < 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user