[PATCH v3 10/10] multipathd: honor MULTIPATH_SOCKET_NAME environment variable

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

 



If multipathd is started via socket activation, it will obtain
sockets from systemd. The names of these sockets, and whether
the abstract and / or pathname socket is created, is configurable
in the systemd unit file.

Add support for passing a socket name via the environment, so that
it's possible to configure the socket name at runtime even without
socket activation. In this case, only this single socket will be created.
If creating the socket fails, multipathd startup will fail, too.

Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
---
 multipathd/main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/multipathd/main.c b/multipathd/main.c
index b41c181..3468b21 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1895,11 +1895,16 @@ uxlsnrloop (void * ap)
 {
 	long ux_sock[2] = {-1, -1};
 	int num;
+	const char *env_name = getenv("MULTIPATH_SOCKET_NAME");
 
 	pthread_cleanup_push(rcu_unregister, NULL);
 	rcu_register_thread();
 
 	num = get_systemd_sockets(ux_sock);
+	if (num < 1 && env_name != NULL) {
+		ux_sock[0] = ux_socket_listen(env_name);
+		num = 1;
+	}
 	if (num < 1) {
 		ux_sock[0] = ux_socket_listen(ABSTRACT_SOCKET);
 		ux_sock[1] = ux_socket_listen(PATHNAME_SOCKET);
-- 
2.48.1





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux