[libvirt PATCH 00/10] remote: various refactoring & bugs for remote driver

This is in prep for switching to use the modular daemons by default. In testing that setup I hit a couple of minor bugs. Daniel P. Berrangé (10): remote: use absolute path to check for daemons remote: stop checking for errors from socket allocations remote: move open flags enum to sockets header remote: consistently use flags for passing ro/user/autostart props remote: change socket helper to return full daemon path remote: don't populate daemon path if autostart is not required rpc: remove "spawnDaemon" parameter remote: move proxy/mode defaults after URI parsing remote: fix regression connecting to remote session daemon remote: use virtproxyd if no URI is given src/admin/admin_remote.c | 2 +- src/locking/lock_driver_lockd.c | 1 - src/logging/log_manager.c | 1 - src/lxc/lxc_monitor.c | 2 +- src/qemu/qemu_migration.c | 3 +- src/remote/remote_daemon_dispatch.c | 4 +- src/remote/remote_driver.c | 135 ++++++++++++---------------- src/remote/remote_sockets.c | 95 +++++++++++++------- src/remote/remote_sockets.h | 15 ++-- src/remote/remote_ssh_helper.c | 16 ++-- src/rpc/virnetclient.c | 5 +- src/rpc/virnetclient.h | 3 +- src/rpc/virnetsocket.c | 26 ++---- src/rpc/virnetsocket.h | 3 +- tests/virnetsockettest.c | 4 +- 15 files changed, 157 insertions(+), 158 deletions(-) -- 2.31.1

virFileFindResource needs to be given the absolute build path otherwise its results will vary according to the CWD, leading to spurious failures in dev testing. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/remote/remote_daemon_dispatch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c index 1b4f5256c3..13f76cc685 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -2001,7 +2001,9 @@ remoteDispatchProbeURI(bool readonly, daemonname = g_strdup_printf("virt%sd", drivers[i]); - if (!(daemonpath = virFileFindResource(daemonname, "src", SBINDIR))) + if (!(daemonpath = virFileFindResource(daemonname, + abs_top_builddir "/src", + SBINDIR))) return -1; if (!virFileExists(daemonpath)) { -- 2.31.1

The remoteGetUNIXSocketHelper method always returns a non-NULL string. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/remote/remote_sockets.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/remote/remote_sockets.c b/src/remote/remote_sockets.c index 43f78023fe..e9d865213f 100644 --- a/src/remote/remote_sockets.c +++ b/src/remote/remote_sockets.c @@ -155,12 +155,10 @@ remoteGetUNIXSocket(remoteDriverTransport transport, legacy_daemon = g_strdup("libvirtd"); - if (driver && - !(direct_sock_name = remoteGetUNIXSocketHelper(transport, direct_daemon, ro, session))) - return NULL; + if (driver) + direct_sock_name = remoteGetUNIXSocketHelper(transport, direct_daemon, ro, session); - if (!(legacy_sock_name = remoteGetUNIXSocketHelper(transport, "libvirt", ro, session))) - return NULL; + legacy_sock_name = remoteGetUNIXSocketHelper(transport, "libvirt", ro, session); if (mode == REMOTE_DRIVER_MODE_AUTO) { if (transport == REMOTE_DRIVER_TRANSPORT_UNIX) { -- 2.31.1

This enum will shortly be used by the remote driver sockets helper methods too. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/remote/remote_driver.c | 28 +++++++++++----------------- src/remote/remote_sockets.h | 7 +++++++ 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 0bacd0bc4b..6b615b9286 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -650,12 +650,6 @@ static virNetClientProgramEvent qemuEvents[] = { (xdrproc_t)xdr_qemu_domain_monitor_event_msg }, }; -enum virDrvOpenRemoteFlags { - VIR_DRV_OPEN_REMOTE_RO = (1 << 0), - VIR_DRV_OPEN_REMOTE_USER = (1 << 1), /* Use the per-user socket path */ - VIR_DRV_OPEN_REMOTE_AUTOSTART = (1 << 2), /* Autostart a per-user daemon */ -}; - static void remoteClientCloseFunc(virNetClient *client G_GNUC_UNUSED, @@ -789,7 +783,7 @@ doRemoteOpen(virConnectPtr conn, /* Historically we didn't allow ssh tunnel with session mode, * since we can't construct the accurate path remotely, * so we can default to modern virt-ssh-helper */ - if (flags & VIR_DRV_OPEN_REMOTE_USER) + if (flags & REMOTE_DRIVER_OPEN_USER) proxy = VIR_NET_CLIENT_PROXY_NATIVE; else proxy = VIR_NET_CLIENT_PROXY_AUTO; @@ -923,8 +917,8 @@ doRemoteOpen(virConnectPtr conn, case REMOTE_DRIVER_TRANSPORT_LIBSSH2: if (!sockname && !(sockname = remoteGetUNIXSocket(transport, mode, driver_str, - flags & VIR_DRV_OPEN_REMOTE_RO, - flags & VIR_DRV_OPEN_REMOTE_USER, + flags & REMOTE_DRIVER_OPEN_RO, + flags & REMOTE_DRIVER_OPEN_USER, &daemon_name))) goto failed; break; @@ -986,7 +980,7 @@ doRemoteOpen(virConnectPtr conn, netcat, sockname, name, - flags & VIR_DRV_OPEN_REMOTE_RO, + flags & REMOTE_DRIVER_OPEN_RO, auth, conn->uri); if (!priv->client) @@ -1010,7 +1004,7 @@ doRemoteOpen(virConnectPtr conn, netcat, sockname, name, - flags & VIR_DRV_OPEN_REMOTE_RO, + flags & REMOTE_DRIVER_OPEN_RO, auth, conn->uri); if (!priv->client) @@ -1021,7 +1015,7 @@ doRemoteOpen(virConnectPtr conn, #ifndef WIN32 case REMOTE_DRIVER_TRANSPORT_UNIX: - if (flags & VIR_DRV_OPEN_REMOTE_AUTOSTART) { + if (flags & REMOTE_DRIVER_OPEN_AUTOSTART) { const char *env_name = remoteGetDaemonPathEnv(); if (!(daemonPath = virFileFindResourceFull(daemon_name, NULL, NULL, @@ -1032,7 +1026,7 @@ doRemoteOpen(virConnectPtr conn, } if (!(priv->client = virNetClientNewUNIX(sockname, - flags & VIR_DRV_OPEN_REMOTE_AUTOSTART, + flags & REMOTE_DRIVER_OPEN_AUTOSTART, daemonPath))) goto failed; @@ -1054,7 +1048,7 @@ doRemoteOpen(virConnectPtr conn, netcat, sockname, name, - flags & VIR_DRV_OPEN_REMOTE_RO))) + flags & REMOTE_DRIVER_OPEN_RO))) goto failed; priv->is_secure = 1; @@ -1277,13 +1271,13 @@ remoteConnectOpen(virConnectPtr conn, goto cleanup; if (flags & VIR_CONNECT_RO) - rflags |= VIR_DRV_OPEN_REMOTE_RO; + rflags |= REMOTE_DRIVER_OPEN_RO; remoteGetURIDaemonInfo(conn->uri, transport, &user, &autostart); if (user) - rflags |= VIR_DRV_OPEN_REMOTE_USER; + rflags |= REMOTE_DRIVER_OPEN_USER; if (autostart) - rflags |= VIR_DRV_OPEN_REMOTE_AUTOSTART; + rflags |= REMOTE_DRIVER_OPEN_AUTOSTART; ret = doRemoteOpen(conn, priv, driver, transport, auth, conf, rflags); if (ret != VIR_DRV_OPEN_SUCCESS) { diff --git a/src/remote/remote_sockets.h b/src/remote/remote_sockets.h index b3e0ce7da4..749389700e 100644 --- a/src/remote/remote_sockets.h +++ b/src/remote/remote_sockets.h @@ -48,6 +48,13 @@ typedef enum { REMOTE_DRIVER_MODE_LAST } remoteDriverMode; +typedef enum { + REMOTE_DRIVER_OPEN_RO = (1 << 0), /* Use the read-only socket path */ + REMOTE_DRIVER_OPEN_USER = (1 << 1), /* Use the per-user socket path */ + REMOTE_DRIVER_OPEN_AUTOSTART = (1 << 2), /* Autostart a per-user daemon */ +} remoteDriverOpenFlags; + + VIR_ENUM_DECL(remoteDriverMode); int -- 2.31.1

We have helper methods that return boolans for ro/user/autostart properties. We then pack them into a flags parameter, and later unpack them again. This makes te code consistently use flags throughout. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/remote/remote_driver.c | 16 ++++----------- src/remote/remote_sockets.c | 37 ++++++++++++++++------------------ src/remote/remote_sockets.h | 6 ++---- src/remote/remote_ssh_helper.c | 13 ++++++------ 4 files changed, 30 insertions(+), 42 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 6b615b9286..d03369b168 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -917,9 +917,7 @@ doRemoteOpen(virConnectPtr conn, case REMOTE_DRIVER_TRANSPORT_LIBSSH2: if (!sockname && !(sockname = remoteGetUNIXSocket(transport, mode, driver_str, - flags & REMOTE_DRIVER_OPEN_RO, - flags & REMOTE_DRIVER_OPEN_USER, - &daemon_name))) + flags, &daemon_name))) goto failed; break; @@ -1232,9 +1230,7 @@ remoteConnectOpen(virConnectPtr conn, { struct private_data *priv; int ret = VIR_DRV_OPEN_ERROR; - int rflags = 0; - bool user; - bool autostart; + unsigned int rflags = 0; char *driver = NULL; remoteDriverTransport transport; @@ -1270,15 +1266,11 @@ remoteConnectOpen(virConnectPtr conn, if (!(priv = remoteAllocPrivateData())) goto cleanup; + + remoteGetURIDaemonInfo(conn->uri, transport, &rflags); if (flags & VIR_CONNECT_RO) rflags |= REMOTE_DRIVER_OPEN_RO; - remoteGetURIDaemonInfo(conn->uri, transport, &user, &autostart); - if (user) - rflags |= REMOTE_DRIVER_OPEN_USER; - if (autostart) - rflags |= REMOTE_DRIVER_OPEN_AUTOSTART; - ret = doRemoteOpen(conn, priv, driver, transport, auth, conf, rflags); if (ret != VIR_DRV_OPEN_SUCCESS) { conn->privateData = NULL; diff --git a/src/remote/remote_sockets.c b/src/remote/remote_sockets.c index e9d865213f..06315fe9c0 100644 --- a/src/remote/remote_sockets.c +++ b/src/remote/remote_sockets.c @@ -101,13 +101,12 @@ remoteSplitURIScheme(virURI *uri, static char * remoteGetUNIXSocketHelper(remoteDriverTransport transport, const char *sock_prefix, - bool ro, - bool session) + unsigned int flags) { char *sockname = NULL; g_autofree char *userdir = NULL; - if (session) { + if (flags & REMOTE_DRIVER_OPEN_USER) { userdir = virGetUserRuntimeDirectory(); sockname = g_strdup_printf("%s/%s-sock", userdir, sock_prefix); @@ -120,13 +119,14 @@ remoteGetUNIXSocketHelper(remoteDriverTransport transport, */ sockname = g_strdup_printf("%s/run/libvirt/%s-%s", LOCALSTATEDIR, sock_prefix, - ro ? "sock-ro" : "sock"); + flags & REMOTE_DRIVER_OPEN_RO ? + "sock-ro" : "sock"); } VIR_DEBUG("Built UNIX sockname=%s for transport=%s " - "prefix=%s ro=%d session=%d", + "prefix=%s flags=0x%x", sockname, remoteDriverTransportTypeToString(transport), - sock_prefix, ro, session); + sock_prefix, flags); return sockname; } @@ -135,8 +135,7 @@ char * remoteGetUNIXSocket(remoteDriverTransport transport, remoteDriverMode mode, const char *driver, - bool ro, - bool session, + unsigned int flags, char **daemon) { char *sock_name = NULL; @@ -145,10 +144,10 @@ remoteGetUNIXSocket(remoteDriverTransport transport, g_autofree char *direct_sock_name = NULL; g_autofree char *legacy_sock_name = NULL; - VIR_DEBUG("Choosing remote socket for transport=%s mode=%s driver=%s ro=%d session=%d", + VIR_DEBUG("Choosing remote socket for transport=%s mode=%s driver=%s flags=0x%x", remoteDriverTransportTypeToString(transport), remoteDriverModeTypeToString(mode), - driver, ro, session); + driver, flags); if (driver) direct_daemon = g_strdup_printf("virt%sd", driver); @@ -156,9 +155,9 @@ remoteGetUNIXSocket(remoteDriverTransport transport, legacy_daemon = g_strdup("libvirtd"); if (driver) - direct_sock_name = remoteGetUNIXSocketHelper(transport, direct_daemon, ro, session); + direct_sock_name = remoteGetUNIXSocketHelper(transport, direct_daemon, flags); - legacy_sock_name = remoteGetUNIXSocketHelper(transport, "libvirt", ro, session); + legacy_sock_name = remoteGetUNIXSocketHelper(transport, "libvirt", flags); if (mode == REMOTE_DRIVER_MODE_AUTO) { if (transport == REMOTE_DRIVER_TRANSPORT_UNIX) { @@ -221,13 +220,11 @@ remoteGetUNIXSocket(remoteDriverTransport transport, void remoteGetURIDaemonInfo(virURI *uri, remoteDriverTransport transport, - bool *session, - bool *autostart) + unsigned int *flags) { const char *autostart_str = getenv("LIBVIRT_AUTOSTART"); - *session = false; - *autostart = false; + *flags = 0; /* * User session daemon is used for @@ -244,7 +241,7 @@ remoteGetURIDaemonInfo(virURI *uri, STRPREFIX(uri->scheme, "test+")) && geteuid() > 0) { VIR_DEBUG("User session daemon required"); - *session = true; + *flags |= REMOTE_DRIVER_OPEN_USER; /* * Furthermore if no servername is given, @@ -256,7 +253,7 @@ remoteGetURIDaemonInfo(virURI *uri, (!autostart_str || STRNEQ(autostart_str, "0"))) { VIR_DEBUG("Try daemon autostart"); - *autostart = true; + *flags |= REMOTE_DRIVER_OPEN_AUTOSTART; } } @@ -268,10 +265,10 @@ remoteGetURIDaemonInfo(virURI *uri, VIR_DEBUG("Auto-probe remote URI"); if (geteuid() > 0) { VIR_DEBUG("Auto-spawn user daemon instance"); - *session = true; + *flags |= REMOTE_DRIVER_OPEN_USER; if (!autostart_str || STRNEQ(autostart_str, "0")) - *autostart = true; + *flags |= REMOTE_DRIVER_OPEN_AUTOSTART; } } } diff --git a/src/remote/remote_sockets.h b/src/remote/remote_sockets.h index 749389700e..2331f81425 100644 --- a/src/remote/remote_sockets.h +++ b/src/remote/remote_sockets.h @@ -66,12 +66,10 @@ char * remoteGetUNIXSocket(remoteDriverTransport transport, remoteDriverMode mode, const char *driver, - bool ro, - bool session, + unsigned int flags, /* remoteDriverOpenFlags */ char **daemon); void remoteGetURIDaemonInfo(virURI *uri, remoteDriverTransport transport, - bool *session, - bool *autostart); + unsigned int *flags); /* remoteDriverOpenFlags */ diff --git a/src/remote/remote_ssh_helper.c b/src/remote/remote_ssh_helper.c index 7934e14509..7123fc6d00 100644 --- a/src/remote/remote_ssh_helper.c +++ b/src/remote/remote_ssh_helper.c @@ -355,8 +355,6 @@ int main(int argc, char **argv) g_autoptr(virURI) uri = NULL; g_autofree char *driver = NULL; remoteDriverTransport transport; - bool user = false; - bool autostart = false; gboolean version = false; gboolean readonly = false; g_autofree char *sock_path = NULL; @@ -369,6 +367,7 @@ int main(int argc, char **argv) { "version", 'V', 0, G_OPTION_ARG_NONE, &version, "Display version information", NULL }, { NULL, '\0', 0, 0, NULL, NULL, NULL } }; + unsigned int flags; context = g_option_context_new("- libvirt socket proxy"); g_option_context_add_main_entries(context, entries, PACKAGE); @@ -422,16 +421,18 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } - remoteGetURIDaemonInfo(uri, transport, &user, &autostart); + remoteGetURIDaemonInfo(uri, transport, &flags); + if (readonly) + flags |= REMOTE_DRIVER_OPEN_RO; sock_path = remoteGetUNIXSocket(transport, REMOTE_DRIVER_MODE_AUTO, driver, - !!readonly, - user, + flags, &daemon_name); - if (virNetSocketNewConnectUNIX(sock_path, autostart, daemon_name, &sock) < 0) { + if (virNetSocketNewConnectUNIX(sock_path, flags & REMOTE_DRIVER_OPEN_AUTOSTART, + daemon_name, &sock) < 0) { g_printerr(_("%s: cannot connect to '%s': %s\n"), argv[0], sock_path, virGetLastErrorMessage()); exit(EXIT_FAILURE); -- 2.31.1

On a Wednesday in 2021, Daniel P. Berrangé wrote:
We have helper methods that return boolans for ro/user/autostart properties. We then pack them into a flags parameter, and later unpack them again. This makes te code consistently use flags
*the Jano
throughout.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/remote/remote_driver.c | 16 ++++----------- src/remote/remote_sockets.c | 37 ++++++++++++++++------------------ src/remote/remote_sockets.h | 6 ++---- src/remote/remote_ssh_helper.c | 13 ++++++------ 4 files changed, 30 insertions(+), 42 deletions(-)

On 5/26/21 11:16 AM, Ján Tomko wrote:
On a Wednesday in 2021, Daniel P. Berrangé wrote:
We have helper methods that return boolans for ro/user/autostart
booleans (or bools if you want to be pedantic)
properties. We then pack them into a flags parameter, and later unpack them again. This makes te code consistently use flags
*the
Jano
throughout.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/remote/remote_driver.c | 16 ++++----------- src/remote/remote_sockets.c | 37 ++++++++++++++++------------------ src/remote/remote_sockets.h | 6 ++---- src/remote/remote_ssh_helper.c | 13 ++++++------ 4 files changed, 30 insertions(+), 42 deletions(-)

The remoteGetUNIXSocket method currently just returns the daemon name and the caller then converts this to a path. Except the SSH helper didn't do this, so it was relying on later code expanding $PATH, and this doesn't allow for build root overrides. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/remote/remote_driver.c | 33 +++------------------------- src/remote/remote_sockets.c | 39 +++++++++++++++++++++++++++++----- src/remote/remote_sockets.h | 2 +- src/remote/remote_ssh_helper.c | 6 +++--- 4 files changed, 41 insertions(+), 39 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index d03369b168..e4e412dd01 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -700,23 +700,6 @@ remoteConnectSupportsFeatureUnlocked(virConnectPtr conn, } -#ifndef WIN32 -static const char * -remoteGetDaemonPathEnv(void) -{ - /* We prefer a VIRTD_PATH env var to use for all daemons, - * but if it is not set we will fallback to LIBVIRTD_PATH - * for previous behaviour - */ - if (getenv("VIRTD_PATH") != NULL) { - return "VIRTD_PATH"; - } else { - return "LIBVIRTD_PATH"; - } -} -#endif /* WIN32 */ - - /* * URIs that this driver needs to handle: * @@ -763,7 +746,7 @@ doRemoteOpen(virConnectPtr conn, g_autofree char *knownHostsVerify = NULL; g_autofree char *knownHosts = NULL; g_autofree char *mode_str = NULL; - g_autofree char *daemon_name = NULL; + g_autofree char *daemon_path = NULL; g_autofree char *proxy_str = NULL; bool sanity = true; bool verify = true; @@ -917,7 +900,7 @@ doRemoteOpen(virConnectPtr conn, case REMOTE_DRIVER_TRANSPORT_LIBSSH2: if (!sockname && !(sockname = remoteGetUNIXSocket(transport, mode, driver_str, - flags, &daemon_name))) + flags, &daemon_path))) goto failed; break; @@ -1013,19 +996,9 @@ doRemoteOpen(virConnectPtr conn, #ifndef WIN32 case REMOTE_DRIVER_TRANSPORT_UNIX: - if (flags & REMOTE_DRIVER_OPEN_AUTOSTART) { - const char *env_name = remoteGetDaemonPathEnv(); - if (!(daemonPath = virFileFindResourceFull(daemon_name, - NULL, NULL, - abs_top_builddir "/src", - SBINDIR, - env_name))) - goto failed; - } - if (!(priv->client = virNetClientNewUNIX(sockname, flags & REMOTE_DRIVER_OPEN_AUTOSTART, - daemonPath))) + daemon_path))) goto failed; priv->is_secure = 1; diff --git a/src/remote/remote_sockets.c b/src/remote/remote_sockets.c index 06315fe9c0..6d33b69467 100644 --- a/src/remote/remote_sockets.c +++ b/src/remote/remote_sockets.c @@ -47,6 +47,22 @@ VIR_ENUM_IMPL(remoteDriverMode, "legacy", "direct"); +#ifndef WIN32 +static const char * +remoteGetDaemonPathEnv(void) +{ + /* We prefer a VIRTD_PATH env var to use for all daemons, + * but if it is not set we will fallback to LIBVIRTD_PATH + * for previous behaviour + */ + if (getenv("VIRTD_PATH") != NULL) { + return "VIRTD_PATH"; + } else { + return "LIBVIRTD_PATH"; + } +} +#endif /* WIN32 */ + int remoteSplitURIScheme(virURI *uri, @@ -136,13 +152,19 @@ remoteGetUNIXSocket(remoteDriverTransport transport, remoteDriverMode mode, const char *driver, unsigned int flags, - char **daemon) + char **daemon_path) { char *sock_name = NULL; g_autofree char *direct_daemon = NULL; g_autofree char *legacy_daemon = NULL; + g_autofree char *daemon_name = NULL; g_autofree char *direct_sock_name = NULL; g_autofree char *legacy_sock_name = NULL; +#ifndef WIN32 + const char *env_name = remoteGetDaemonPathEnv(); +#else + const char *env_path = NULL; +#endif VIR_DEBUG("Choosing remote socket for transport=%s mode=%s driver=%s flags=0x%x", remoteDriverTransportTypeToString(transport), @@ -182,7 +204,7 @@ remoteGetUNIXSocket(remoteDriverTransport transport, switch ((remoteDriverMode)mode) { case REMOTE_DRIVER_MODE_LEGACY: sock_name = g_steal_pointer(&legacy_sock_name); - *daemon = g_steal_pointer(&legacy_daemon); + daemon_name = g_steal_pointer(&legacy_daemon); break; case REMOTE_DRIVER_MODE_DIRECT: @@ -200,7 +222,7 @@ remoteGetUNIXSocket(remoteDriverTransport transport, } sock_name = g_steal_pointer(&direct_sock_name); - *daemon = g_steal_pointer(&direct_daemon); + daemon_name = g_steal_pointer(&direct_daemon); break; case REMOTE_DRIVER_MODE_AUTO: @@ -210,8 +232,15 @@ remoteGetUNIXSocket(remoteDriverTransport transport, return NULL; } - VIR_DEBUG("Chosen UNIX sockname=%s daemon=%s with mode=%s", - sock_name, NULLSTR(*daemon), + if (!(*daemon_path = virFileFindResourceFull(daemon_name, + NULL, NULL, + abs_top_builddir "/src", + SBINDIR, + env_name))) + return NULL; + + VIR_DEBUG("Chosen UNIX sockname=%s daemon_path=%s with mode=%s", + sock_name, NULLSTR(*daemon_path), remoteDriverModeTypeToString(mode)); return sock_name; } diff --git a/src/remote/remote_sockets.h b/src/remote/remote_sockets.h index 2331f81425..11934dbf70 100644 --- a/src/remote/remote_sockets.h +++ b/src/remote/remote_sockets.h @@ -67,7 +67,7 @@ remoteGetUNIXSocket(remoteDriverTransport transport, remoteDriverMode mode, const char *driver, unsigned int flags, /* remoteDriverOpenFlags */ - char **daemon); + char **daemon_path); void remoteGetURIDaemonInfo(virURI *uri, diff --git a/src/remote/remote_ssh_helper.c b/src/remote/remote_ssh_helper.c index 7123fc6d00..2a24f2df96 100644 --- a/src/remote/remote_ssh_helper.c +++ b/src/remote/remote_ssh_helper.c @@ -358,7 +358,7 @@ int main(int argc, char **argv) gboolean version = false; gboolean readonly = false; g_autofree char *sock_path = NULL; - g_autofree char *daemon_name = NULL; + g_autofree char *daemon_path = NULL; g_autoptr(virNetSocket) sock = NULL; GError *error = NULL; g_autoptr(GOptionContext) context = NULL; @@ -429,10 +429,10 @@ int main(int argc, char **argv) REMOTE_DRIVER_MODE_AUTO, driver, flags, - &daemon_name); + &daemon_path); if (virNetSocketNewConnectUNIX(sock_path, flags & REMOTE_DRIVER_OPEN_AUTOSTART, - daemon_name, &sock) < 0) { + daemon_path, &sock) < 0) { g_printerr(_("%s: cannot connect to '%s': %s\n"), argv[0], sock_path, virGetLastErrorMessage()); exit(EXIT_FAILURE); -- 2.31.1

On a Wednesday in 2021, Daniel P. Berrangé wrote:
The remoteGetUNIXSocket method currently just returns the daemon name and the caller then converts this to a path. Except the SSH helper didn't do this, so it was relying on later code expanding $PATH, and this doesn't allow for build root overrides.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/remote/remote_driver.c | 33 +++------------------------- src/remote/remote_sockets.c | 39 +++++++++++++++++++++++++++++----- src/remote/remote_sockets.h | 2 +- src/remote/remote_ssh_helper.c | 6 +++--- 4 files changed, 41 insertions(+), 39 deletions(-)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index d03369b168..e4e412dd01 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -1013,19 +996,9 @@ doRemoteOpen(virConnectPtr conn,
#ifndef WIN32 case REMOTE_DRIVER_TRANSPORT_UNIX: - if (flags & REMOTE_DRIVER_OPEN_AUTOSTART) { - const char *env_name = remoteGetDaemonPathEnv(); - if (!(daemonPath = virFileFindResourceFull(daemon_name, - NULL, NULL, - abs_top_builddir "/src", - SBINDIR, - env_name))) - goto failed; - } - if (!(priv->client = virNetClientNewUNIX(sockname, flags & REMOTE_DRIVER_OPEN_AUTOSTART, - daemonPath))) + daemon_path)))
This removes the last usage of daemonPath in this function: src/remote/remote_driver.c:733:22: error: unused variable 'daemonPath' [-Werror,-Wunused-variable] g_autofree char *daemonPath = NULL; Jano
goto failed;
priv->is_secure = 1;

When deciding what socket to connect to, we build the daemon path that we need to autostart. This path only needs to be populated if we actually intend to use autostart. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/remote/remote_sockets.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/remote/remote_sockets.c b/src/remote/remote_sockets.c index 6d33b69467..cce6703e75 100644 --- a/src/remote/remote_sockets.c +++ b/src/remote/remote_sockets.c @@ -232,12 +232,16 @@ remoteGetUNIXSocket(remoteDriverTransport transport, return NULL; } - if (!(*daemon_path = virFileFindResourceFull(daemon_name, - NULL, NULL, - abs_top_builddir "/src", - SBINDIR, - env_name))) - return NULL; + if (flags & REMOTE_DRIVER_OPEN_AUTOSTART) { + if (!(*daemon_path = virFileFindResourceFull(daemon_name, + NULL, NULL, + abs_top_builddir "/src", + SBINDIR, + env_name))) + return NULL; + } else { + *daemon_path = NULL; + } VIR_DEBUG("Chosen UNIX sockname=%s daemon_path=%s with mode=%s", sock_name, NULLSTR(*daemon_path), -- 2.31.1

The "spawnDaemon" and "binary" parameters are co-dependant, with the latter non-NULL, if-and-only-if the former is true. Getting rid of the "spawnDaemon" parameter simplifies life for the callers and eliminates an error checking scenario. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/admin/admin_remote.c | 2 +- src/locking/lock_driver_lockd.c | 1 - src/logging/log_manager.c | 1 - src/lxc/lxc_monitor.c | 2 +- src/qemu/qemu_migration.c | 3 +-- src/remote/remote_driver.c | 1 - src/remote/remote_ssh_helper.c | 3 +-- src/rpc/virnetclient.c | 5 ++--- src/rpc/virnetclient.h | 3 +-- src/rpc/virnetsocket.c | 26 +++++++------------------- src/rpc/virnetsocket.h | 3 +-- tests/virnetsockettest.c | 4 ++-- 12 files changed, 17 insertions(+), 37 deletions(-) diff --git a/src/admin/admin_remote.c b/src/admin/admin_remote.c index 55ac81c5de..83a6be2b97 100644 --- a/src/admin/admin_remote.c +++ b/src/admin/admin_remote.c @@ -222,7 +222,7 @@ remoteAdminPrivNew(const char *sock_path) if (!(priv = virObjectLockableNew(remoteAdminPrivClass))) goto error; - if (!(priv->client = virNetClientNewUNIX(sock_path, false, NULL))) + if (!(priv->client = virNetClientNewUNIX(sock_path, NULL))) goto error; if (!(priv->program = virNetClientProgramNew(ADMIN_PROGRAM, diff --git a/src/locking/lock_driver_lockd.c b/src/locking/lock_driver_lockd.c index 823b918db3..3a7386af30 100644 --- a/src/locking/lock_driver_lockd.c +++ b/src/locking/lock_driver_lockd.c @@ -208,7 +208,6 @@ static virNetClient *virLockManagerLockDaemonConnectionNew(bool privileged, goto error; if (!(client = virNetClientNewUNIX(lockdpath, - daemonPath != NULL, daemonPath))) goto error; diff --git a/src/logging/log_manager.c b/src/logging/log_manager.c index f66ebda495..e605ed9930 100644 --- a/src/logging/log_manager.c +++ b/src/logging/log_manager.c @@ -79,7 +79,6 @@ virLogManagerConnect(bool privileged, goto error; if (!(client = virNetClientNewUNIX(logdpath, - daemonPath != NULL, daemonPath))) goto error; diff --git a/src/lxc/lxc_monitor.c b/src/lxc/lxc_monitor.c index 445bea281d..d8ef489a01 100644 --- a/src/lxc/lxc_monitor.c +++ b/src/lxc/lxc_monitor.c @@ -151,7 +151,7 @@ virLXCMonitor *virLXCMonitorNew(virDomainObj *vm, sockpath = g_strdup_printf("%s/%s.sock", socketdir, vm->def->name); - if (!(mon->client = virNetClientNewUNIX(sockpath, false, NULL))) + if (!(mon->client = virNetClientNewUNIX(sockpath, NULL))) goto error; if (virNetClientRegisterAsyncIO(mon->client) < 0) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 3b0026a28e..a199758feb 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3761,8 +3761,7 @@ qemuMigrationSrcConnect(virQEMUDriver *driver, break; case MIGRATION_DEST_CONNECT_SOCKET: if (virNetSocketNewConnectUNIX(spec->dest.socket.path, - false, NULL, - &sock) == 0) { + NULL, &sock) == 0) { fd_qemu = virNetSocketDupFD(sock, true); virObjectUnref(sock); } diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index e4e412dd01..9ca4348f6f 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -997,7 +997,6 @@ doRemoteOpen(virConnectPtr conn, #ifndef WIN32 case REMOTE_DRIVER_TRANSPORT_UNIX: if (!(priv->client = virNetClientNewUNIX(sockname, - flags & REMOTE_DRIVER_OPEN_AUTOSTART, daemon_path))) goto failed; diff --git a/src/remote/remote_ssh_helper.c b/src/remote/remote_ssh_helper.c index 2a24f2df96..0945b90331 100644 --- a/src/remote/remote_ssh_helper.c +++ b/src/remote/remote_ssh_helper.c @@ -431,8 +431,7 @@ int main(int argc, char **argv) flags, &daemon_path); - if (virNetSocketNewConnectUNIX(sock_path, flags & REMOTE_DRIVER_OPEN_AUTOSTART, - daemon_path, &sock) < 0) { + if (virNetSocketNewConnectUNIX(sock_path, daemon_path, &sock) < 0) { g_printerr(_("%s: cannot connect to '%s': %s\n"), argv[0], sock_path, virGetLastErrorMessage()); exit(EXIT_FAILURE); diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index 3797a6097b..ffe2f343f9 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -366,12 +366,11 @@ virNetClientFindDefaultSshKey(const char *homedir, char **retPath) virNetClient *virNetClientNewUNIX(const char *path, - bool spawnDaemon, - const char *binary) + const char *spawnDaemonPath) { virNetSocket *sock; - if (virNetSocketNewConnectUNIX(path, spawnDaemon, binary, &sock) < 0) + if (virNetSocketNewConnectUNIX(path, spawnDaemonPath, &sock) < 0) return NULL; return virNetClientNew(sock, NULL); diff --git a/src/rpc/virnetclient.h b/src/rpc/virnetclient.h index c6ad59cf0d..5048033325 100644 --- a/src/rpc/virnetclient.h +++ b/src/rpc/virnetclient.h @@ -48,8 +48,7 @@ virNetClientSSHHelperCommand(virNetClientProxy proxy, bool readonly); virNetClient *virNetClientNewUNIX(const char *path, - bool spawnDaemon, - const char *binary); + const char *spawnDaemonPath); virNetClient *virNetClientNewTCP(const char *nodename, const char *service, diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c index c762b605a5..c3fae8b626 100644 --- a/src/rpc/virnetsocket.c +++ b/src/rpc/virnetsocket.c @@ -664,8 +664,7 @@ int virNetSocketNewConnectTCP(const char *nodename, #ifndef WIN32 int virNetSocketNewConnectUNIX(const char *path, - bool spawnDaemon, - const char *binary, + const char *spawnDaemonPath, virNetSocket **retsock) { char *lockpath = NULL; @@ -678,25 +677,15 @@ int virNetSocketNewConnectUNIX(const char *path, int ret = -1; bool daemonLaunched = false; - VIR_DEBUG("path=%s spawnDaemon=%d binary=%s", path, spawnDaemon, - NULLSTR(binary)); + VIR_DEBUG("path=%s spawnDaemonPath=%s", path, NULLSTR(spawnDaemonPath)); memset(&localAddr, 0, sizeof(localAddr)); memset(&remoteAddr, 0, sizeof(remoteAddr)); remoteAddr.len = sizeof(remoteAddr.data.un); - if (spawnDaemon) { - g_autofree char *binname = NULL; - - if (!binary) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Auto-spawn of daemon requested, " - "but no binary specified")); - goto cleanup; - } - - binname = g_path_get_basename(binary); + if (spawnDaemonPath) { + g_autofree char *binname = g_path_get_basename(spawnDaemonPath); rundir = virGetUserRuntimeDirectory(); if (g_mkdir_with_parents(rundir, 0700) < 0) { @@ -741,7 +730,7 @@ int virNetSocketNewConnectUNIX(const char *path, VIR_DEBUG("connect() failed: retries=%d errno=%d", retries, errno); retries--; - if (!spawnDaemon || + if (!spawnDaemonPath || retries == 0 || (errno != ENOENT && errno != ECONNREFUSED)) { virReportSystemError(errno, _("Failed to connect socket to '%s'"), @@ -750,7 +739,7 @@ int virNetSocketNewConnectUNIX(const char *path, } if (!daemonLaunched) { - if (virNetSocketForkDaemon(binary) < 0) + if (virNetSocketForkDaemon(spawnDaemonPath) < 0) goto cleanup; daemonLaunched = true; @@ -785,8 +774,7 @@ int virNetSocketNewConnectUNIX(const char *path, } #else int virNetSocketNewConnectUNIX(const char *path G_GNUC_UNUSED, - bool spawnDaemon G_GNUC_UNUSED, - const char *binary G_GNUC_UNUSED, + const char *spawnDaemonPath, virNetSocket **retsock G_GNUC_UNUSED) { virReportSystemError(ENOSYS, "%s", diff --git a/src/rpc/virnetsocket.h b/src/rpc/virnetsocket.h index 2dc4d06f42..6fef8d30b3 100644 --- a/src/rpc/virnetsocket.h +++ b/src/rpc/virnetsocket.h @@ -65,8 +65,7 @@ int virNetSocketNewConnectTCP(const char *nodename, virNetSocket **addr); int virNetSocketNewConnectUNIX(const char *path, - bool spawnDaemon, - const char *binary, + const char *spawnDaemonPath, virNetSocket **addr); int virNetSocketNewConnectCommand(virCommand *cmd, diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c index 6afdcbdbc7..8059c6cbb0 100644 --- a/tests/virnetsockettest.c +++ b/tests/virnetsockettest.c @@ -131,7 +131,7 @@ testSocketClient(void *opaque) virNetSocket *csock = NULL; if (data->path) { - if (virNetSocketNewConnectUNIX(data->path, false, + if (virNetSocketNewConnectUNIX(data->path, NULL, &csock) < 0) return; } else { @@ -339,7 +339,7 @@ static int testSocketUNIXAddrs(const void *data G_GNUC_UNUSED) if (virNetSocketListen(lsock, 0) < 0) goto cleanup; - if (virNetSocketNewConnectUNIX(path, false, NULL, &csock) < 0) + if (virNetSocketNewConnectUNIX(path, NULL, &csock) < 0) goto cleanup; if (STRNEQ(virNetSocketLocalAddrStringSASL(csock), "127.0.0.1;0")) { -- 2.31.1

Currently the defaults for the proxy/mode settings are set before parsing URI parameters. A following commit will introduce a dependancy on the URI parsing for the defaults, so they need to move. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/remote/remote_driver.c | 50 ++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 9ca4348f6f..6a881fff28 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -757,20 +757,6 @@ doRemoteOpen(virConnectPtr conn, size_t i; int proxy; - if (inside_daemon && !conn->uri->server) { - mode = REMOTE_DRIVER_MODE_DIRECT; - } else { - mode = REMOTE_DRIVER_MODE_AUTO; - } - - /* Historically we didn't allow ssh tunnel with session mode, - * since we can't construct the accurate path remotely, - * so we can default to modern virt-ssh-helper */ - if (flags & REMOTE_DRIVER_OPEN_USER) - proxy = VIR_NET_CLIENT_PROXY_NATIVE; - else - proxy = VIR_NET_CLIENT_PROXY_AUTO; - /* We handle *ALL* URIs here. The caller has rejected any * URIs we don't care about */ @@ -857,22 +843,38 @@ doRemoteOpen(virConnectPtr conn, virConfGetValueString(conf, "remote_mode", &mode_str) < 0) goto failed; - if (mode_str && - (mode = remoteDriverModeTypeFromString(mode_str)) < 0) { - virReportError(VIR_ERR_INVALID_ARG, - _("Unknown remote mode '%s'"), mode_str); - goto failed; + if (mode_str) { + if ((mode = remoteDriverModeTypeFromString(mode_str)) < 0) { + virReportError(VIR_ERR_INVALID_ARG, + _("Unknown remote mode '%s'"), mode_str); + goto failed; + } + } else { + if (inside_daemon && !conn->uri->server) { + mode = REMOTE_DRIVER_MODE_DIRECT; + } else { + mode = REMOTE_DRIVER_MODE_AUTO; + } } if (conf && !proxy_str && virConfGetValueString(conf, "remote_proxy", &proxy_str) < 0) goto failed; - if (proxy_str && - (proxy = virNetClientProxyTypeFromString(proxy_str)) < 0) { - virReportError(VIR_ERR_INVALID_ARG, - _("Unnkown proxy type '%s'"), proxy_str); - goto failed; + if (proxy_str) { + if ((proxy = virNetClientProxyTypeFromString(proxy_str)) < 0) { + virReportError(VIR_ERR_INVALID_ARG, + _("Unnkown proxy type '%s'"), proxy_str); + goto failed; + } + } else { + /* Historically we didn't allow ssh tunnel with session mode, + * since we can't construct the accurate path remotely, + * so we can default to modern virt-ssh-helper */ + if (flags & REMOTE_DRIVER_OPEN_USER) + proxy = VIR_NET_CLIENT_PROXY_NATIVE; + else + proxy = VIR_NET_CLIENT_PROXY_AUTO; } /* Sanity check that nothing requested !direct mode by mistake */ -- 2.31.1

While we couldn't historically connect to the remote session daemon automatically, we do allow the user to set an explicit socket path to enable the connections to work. This ability was accidentally lost in commit f8ec7c842df9e40c6607eae9b0223766cb226336 Author: Daniel P. Berrangé <berrange@redhat.com> Date: Wed Jul 8 17:03:38 2020 +0100 rpc: use new virt-ssh-helper binary for remote tunnelling We need to force use of 'netcat' when a 'socket' path is given in the URI parameters. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/remote/remote_driver.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 6a881fff28..da672b0d00 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -868,10 +868,33 @@ doRemoteOpen(virConnectPtr conn, goto failed; } } else { - /* Historically we didn't allow ssh tunnel with session mode, - * since we can't construct the accurate path remotely, - * so we can default to modern virt-ssh-helper */ - if (flags & REMOTE_DRIVER_OPEN_USER) + /* + * Goal is to maximise usage of virt-ssh-helper + * + * Historically tunnelling access for the session mode + * daemon did not automatically work, since we can't + * construct the accurate path remotely. Users could, + * however, specify the 'socket' URI parameter explicitly. + * + * If we see a 'socket' path we must always use netcat, + * since virt-ssh-helper won't handle an explicit socket. + * Autostart won't work for session mode, so we assume + * user started it manually on the remote host in this + * case. + * + * If we have a 'session' URI without explicit socket, + * we can just assume the use of virt-ssh-helper, since + * logic for constructing socket paths relies on env + * envs whose values have no guarantee of matching those + * on the remote host. It was explicitly blocked with an + * error check before virt-ssh-helper was introduced. + * + * For 'system' URIs, we need to try virt-ssh-helper but + * with fallback to netcat for back compat. + */ + if (sockname) + proxy = VIR_NET_CLIENT_PROXY_NETCAT; + else if (flags & REMOTE_DRIVER_OPEN_USER) proxy = VIR_NET_CLIENT_PROXY_NATIVE; else proxy = VIR_NET_CLIENT_PROXY_AUTO; -- 2.31.1

When the default driver mode requests the modular daemons, we still defaulted to spawning libvirtd if the URI was NULL, because we don't know which driver specific daemon to spawn. virtproxyd has logic that can handle this as it is used for compatibility when accepting incoming TCP connections with a NULL URI. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/remote/remote_sockets.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/remote/remote_sockets.c b/src/remote/remote_sockets.c index cce6703e75..ed4e4a329c 100644 --- a/src/remote/remote_sockets.c +++ b/src/remote/remote_sockets.c @@ -171,14 +171,15 @@ remoteGetUNIXSocket(remoteDriverTransport transport, remoteDriverModeTypeToString(mode), driver, flags); - if (driver) + if (driver) { direct_daemon = g_strdup_printf("virt%sd", driver); - - legacy_daemon = g_strdup("libvirtd"); - - if (driver) direct_sock_name = remoteGetUNIXSocketHelper(transport, direct_daemon, flags); + } else { + direct_daemon = g_strdup("virtproxyd"); + direct_sock_name = remoteGetUNIXSocketHelper(transport, "libvirt", flags); + } + legacy_daemon = g_strdup("libvirtd"); legacy_sock_name = remoteGetUNIXSocketHelper(transport, "libvirt", flags); if (mode == REMOTE_DRIVER_MODE_AUTO) { @@ -187,14 +188,12 @@ remoteGetUNIXSocket(remoteDriverTransport transport, mode = REMOTE_DRIVER_MODE_DIRECT; } else if (virFileExists(legacy_sock_name)) { mode = REMOTE_DRIVER_MODE_LEGACY; - } else if (driver) { + } else { /* * This constant comes from the configure script and * maps to either the direct or legacy mode constant */ mode = REMOTE_DRIVER_MODE_DEFAULT; - } else { - mode = REMOTE_DRIVER_MODE_LEGACY; } } else { mode = REMOTE_DRIVER_MODE_LEGACY; -- 2.31.1

On a Wednesday in 2021, Daniel P. Berrangé wrote:
This is in prep for switching to use the modular daemons by default. In testing that setup I hit a couple of minor bugs.
Daniel P. Berrangé (10): remote: use absolute path to check for daemons remote: stop checking for errors from socket allocations remote: move open flags enum to sockets header remote: consistently use flags for passing ro/user/autostart props remote: change socket helper to return full daemon path remote: don't populate daemon path if autostart is not required rpc: remove "spawnDaemon" parameter remote: move proxy/mode defaults after URI parsing remote: fix regression connecting to remote session daemon remote: use virtproxyd if no URI is given
src/admin/admin_remote.c | 2 +- src/locking/lock_driver_lockd.c | 1 - src/logging/log_manager.c | 1 - src/lxc/lxc_monitor.c | 2 +- src/qemu/qemu_migration.c | 3 +- src/remote/remote_daemon_dispatch.c | 4 +- src/remote/remote_driver.c | 135 ++++++++++++---------------- src/remote/remote_sockets.c | 95 +++++++++++++------- src/remote/remote_sockets.h | 15 ++-- src/remote/remote_ssh_helper.c | 16 ++-- src/rpc/virnetclient.c | 5 +- src/rpc/virnetclient.h | 3 +- src/rpc/virnetsocket.c | 26 ++---- src/rpc/virnetsocket.h | 3 +- tests/virnetsockettest.c | 4 +- 15 files changed, 157 insertions(+), 158 deletions(-)
With the unused variable fixed: Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

On Wed, May 26, 2021 at 05:26:42PM +0200, Ján Tomko wrote:
On a Wednesday in 2021, Daniel P. Berrangé wrote:
This is in prep for switching to use the modular daemons by default. In testing that setup I hit a couple of minor bugs.
Daniel P. Berrangé (10): remote: use absolute path to check for daemons remote: stop checking for errors from socket allocations remote: move open flags enum to sockets header remote: consistently use flags for passing ro/user/autostart props remote: change socket helper to return full daemon path remote: don't populate daemon path if autostart is not required rpc: remove "spawnDaemon" parameter remote: move proxy/mode defaults after URI parsing remote: fix regression connecting to remote session daemon remote: use virtproxyd if no URI is given
src/admin/admin_remote.c | 2 +- src/locking/lock_driver_lockd.c | 1 - src/logging/log_manager.c | 1 - src/lxc/lxc_monitor.c | 2 +- src/qemu/qemu_migration.c | 3 +- src/remote/remote_daemon_dispatch.c | 4 +- src/remote/remote_driver.c | 135 ++++++++++++---------------- src/remote/remote_sockets.c | 95 +++++++++++++------- src/remote/remote_sockets.h | 15 ++-- src/remote/remote_ssh_helper.c | 16 ++-- src/rpc/virnetclient.c | 5 +- src/rpc/virnetclient.h | 3 +- src/rpc/virnetsocket.c | 26 ++---- src/rpc/virnetsocket.h | 3 +- tests/virnetsockettest.c | 4 +- 15 files changed, 157 insertions(+), 158 deletions(-)
With the unused variable fixed: Reviewed-by: Ján Tomko <jtomko@redhat.com>
Since it is freeze time, i've only pushed the strict bug fix patches 1, 8, 9. The other refactoring will wait. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
participants (3)
-
Daniel P. Berrangé
-
Ján Tomko
-
Laine Stump