Skip to contentSkip to conversation

master - configure: run directory configuration cleanup

PATCH Peter Rajnoha 1 participant 1 message Jun 27, 2012 Kbuild

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9a96f930a762418f1014f6a9da9546cb1f501f04
Commit:        9a96f930a762418f1014f6a9da9546cb1f501f04
Parent:        c8591b2ac7c99ea43e7f94f3dfb183019c2fed6e
Author:        Peter Rajnoha <[email protected]>
AuthorDate:    Thu Jun 21 08:41:52 2012 -0400
Committer:     Peter Rajnoha <[email protected]>
CommitterDate: Wed Jun 27 12:11:47 2012 +0200

configure: run directory configuration cleanup

There were several hard-coded values for run directory around the code. Also, some tools are DM specific only, others are LVM specific and there was no distinction made here before. With this patch applied, we have this cleaned up a bit (subsystem in brackets, defaults in parentheses):

[common] configurable PID_DIR (/var/run)

lvm [lvm] configurable RUN_DIR (/var/run/lvm)
configurable locking dir (/var/lock/lvm)

clvmd [lvm] configurable pid file (PID_DIR/clvmd.pid)
socket (RUN_DIR/clvmd.sock)

lvmetad [lvm] configurable pid file (PID_DIR/lvmetad.pid)
socket (RUN_DIR/lvmetad.socket)

dm [dm] configurable DM_RUN_DIR (/var/run)

cmirrord [dm] configurable pid file (PID_DIR/cmirrord.pid)

 dmeventd [dm]     configurable pid file    (PID_DIR/dmeventd.pid)
                   server fifo              (DM_RUN_DIR/dmeventd-server)
                   client fifo              (DM_RUN_DIR/dmeventd-client)

The changes briefly:
- added configure --with-default-pid-dir
- added configure --with-default-dm-run-dir
- added configure --with-lvmetad-pidfile
- by default, using one common pid directory for everything (only lvmetad was not following this before)

---
 WHATS_NEW_DM                                    |    4 ++
 configure.in                                    |   56 +++++++++++++++++-----
 daemons/dmeventd/dmeventd.h                     |    4 +-
 daemons/lvmetad/lvmetad-core.c                  |    2 +-
 lib/misc/configure.h.in                         |   11 ++++-
 scripts/Makefile.in                             |    8 ++-
 scripts/dm_event_systemd_red_hat.socket         |   12 -----
 scripts/dm_event_systemd_red_hat.socket.in      |   11 +++++
 scripts/lvm2_lvmetad_init_red_hat.in            |    2 +-
 scripts/lvm2_lvmetad_systemd_red_hat.service.in |    2 +-
 10 files changed, 78 insertions(+), 34 deletions(-)
WHATS_NEW_DM +4 -0
index 33f8515..f6596c1 100644
@@ -1,5 +1,9 @@
 Version 1.02.76 - 
 ===============================
+  Remove hard-coded paths for dmeventd fifos and use default-dm-run-dir.
+  Add configure --with-lvmetad-pidfile to remove hard-coded value.
+  Add configure --with-default-pid-dir for common directory with pid files.
+  Add configure --with-default-dm-run-dir to set run directory for dm tools.
   Add documentation references in systemd units.
   Remove veritysetup.  Now maintained with cryptsetup.
 
configure.in +43 -13

113 lines not on this page · raw message

daemons/dmeventd/dmeventd.h +2 -2
index 81056e9..e21cf45 100644
@@ -17,8 +17,8 @@
 
 /* FIXME This stuff must be configurable. */
 
-#define	DM_EVENT_FIFO_CLIENT	"/var/run/dmeventd-client"
-#define	DM_EVENT_FIFO_SERVER	"/var/run/dmeventd-server"
+#define	DM_EVENT_FIFO_CLIENT	DEFAULT_DM_RUN_DIR "/dmeventd-client"
+#define	DM_EVENT_FIFO_SERVER	DEFAULT_DM_RUN_DIR "/dmeventd-server"
 
 #define DM_EVENT_DEFAULT_TIMEOUT 10
 
daemons/lvmetad/lvmetad-core.c +1 -1
index 5b34e21..d41a905 100644
@@ -1094,7 +1094,7 @@ int main(int argc, char *argv[])
 	s.socket_path = getenv("LVM_LVMETAD_SOCKET");
 	if (!s.socket_path)
 		s.socket_path = DEFAULT_RUN_DIR "/lvmetad.socket";
-	s.pidfile = DEFAULT_RUN_DIR "/lvmetad.pid";
+	s.pidfile = LVMETAD_PIDFILE;
         s.log_level = 0;
 	s.protocol = "lvmetad";
 	s.protocol_version = 1;
lib/misc/configure.h.in +10 -1
index 6d904f2..c1d1218 100644
@@ -44,10 +44,16 @@
 /* Define default name mangling behaviour */
 #undef DEFAULT_DM_NAME_MANGLING
 
+/* Default DM run directory. */
+#undef DEFAULT_DM_RUN_DIR
+
 /* Name of default locking directory. */
 #undef DEFAULT_LOCK_DIR
 
-/* Name of default run directory. */
+/* Default directory to keep PID files in. */
+#undef DEFAULT_PID_DIR
+
+/* Default LVM run directory. */
 #undef DEFAULT_RUN_DIR
 
 /* Define to 0 to reinstate the pre-2.02.54 handling of unit suffixes. */
@@ -455,6 +461,9 @@
 /* Define to 1 to include built-in support for LVM1 metadata. */
 #undef LVM1_INTERNAL
 
+/* Path to lvmetad pidfile. */
+#undef LVMETAD_PIDFILE
+
 /* Define to 1 to include code that uses lvmetad. */
 #undef LVMETAD_SUPPORT
 
scripts/Makefile.in +5 -3
index be012d6..53c85f5 100644
@@ -75,7 +75,9 @@ install_tmpfiles_configuration:
 	$(INSTALL_DIR) $(tmpfiles_dir)
 	$(INSTALL_DATA) lvm2_tmpfiles_red_hat.conf $(tmpfiles_dir)/lvm2.conf
 
-DISTCLEAN_TARGETS += clvmd_init_red_hat cmirrord_init_red_hat lvm2_monitoring_init_red_hat \
-		     dm_event_systemd_red_hat.service lvm2_monitoring_systemd_red_hat.service \
+DISTCLEAN_TARGETS += clvmd_init_red_hat cmirrord_init_red_hat \
+		     lvm2_monitoring_init_red_hat lvm2_lvmetad_init_red_hat \
+		     dm_event_systemd_red_hat.socket dm_event_systemd_red_hat.service \
+		     lvm2_monitoring_systemd_red_hat.service \
 		     lvm2_lvmetad_systemd_red_hat.socket lvm2_lvmetad_systemd_red_hat.service \
-		     lvm2_lvmetad_init_red_hat lvm2_tmpfiles_red_hat.conf
+		     lvm2_tmpfiles_red_hat.conf
scripts/dm_event_systemd_red_hat.socket deleted +0 -12
deleted file mode 100644
index bfc8ea1..0000000
@@ -1,12 +0,0 @@
-[Unit]
-Description=Device-mapper event daemon FIFOs
-Documentation=man:dmeventd(8)
-DefaultDependencies=no
-
-[Socket]
-ListenFIFO=/var/run/dmeventd-server
-ListenFIFO=/var/run/dmeventd-client
-SocketMode=0600
-
-[Install]
-WantedBy=sockets.target
scripts/dm_event_systemd_red_hat.socket.in new file +11 -0
new file mode 100644
index 0000000..c6c480c
@@ -0,0 +1,11 @@
+[Unit]
+Description=Device-mapper event daemon FIFOs
+DefaultDependencies=no
+
+[Socket]
+ListenFIFO=@DEFAULT_DM_RUN_DIR@/dmeventd-server
+ListenFIFO=@DEFAULT_DM_RUN_DIR@/dmeventd-client
+SocketMode=0600
+
+[Install]
+WantedBy=sockets.target
scripts/lvm2_lvmetad_init_red_hat.in +1 -1
index 886944e..888c730 100644
@@ -41,7 +41,7 @@ sbindir=@sbindir@
 lvm_pvscan="${sbindir}/lvm pvscan --cache"
 
 LOCK_FILE="/var/lock/subsys/$DAEMON"
-PID_FILE="@DEFAULT_RUN_DIR@/${DAEMON}.pid"
+PID_FILE="@LVMETAD_PIDFILE@"
 
 
 rh_status() {
scripts/lvm2_lvmetad_systemd_red_hat.service.in +1 -1
index 7552240..e527369 100644
@@ -14,7 +14,7 @@ ExecStartPost=@sbindir@/lvm pvscan --cache
 ExecReload=@sbindir@/lvmetad -R
 Environment=SD_ACTIVATION=1
 Restart=on-abort
-PIDFile=@DEFAULT_RUN_DIR@/lvmetad.pid
+PIDFile=@LVMETAD_PIDFILE@
 
 [Install]
 WantedBy=sysinit.target