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

[lvm-devel] [PATCH] dmeventd -R updates



Hi!

As requested by Milan in BZ 454618:

- dmeventd -R will continue to start up even if no dmeventd is currently
  running; I have added a test for this behaviour
- add -R to dmeventd manpage

Petr

Index: daemons/dmeventd/dmeventd.c
===================================================================
RCS file: /cvs/lvm2/LVM2/daemons/dmeventd/dmeventd.c,v
retrieving revision 1.75
diff -u -p -r1.75 dmeventd.c
--- daemons/dmeventd/dmeventd.c	28 Feb 2011 19:47:22 -0000	1.75
+++ daemons/dmeventd/dmeventd.c	2 Mar 2011 12:02:40 -0000
@@ -1708,13 +1708,14 @@ static void restart(void)
 	/* Get the list of registrations from the running daemon. */
 
 	if (!init_fifos(&fifos)) {
-		fprintf(stderr, "Could not initiate communication with existing dmeventd.\n");
-		exit(EXIT_FAILURE);
+		fprintf(stderr, "WARNING: Could not initiate communication with existing dmeventd.\n");
+		return;
 	}
 
 	if (daemon_talk(&fifos, &msg, DM_EVENT_CMD_HELLO, NULL, NULL, 0, 0)) {
-		fprintf(stderr, "Could not communicate with existing dmeventd.\n");
-		exit(EXIT_FAILURE);
+		fprintf(stderr, "WARNING: Could not communicate with existing dmeventd.\n");
+		fini_fifos(&fifos);
+		return;
 	}
 
 	if (daemon_talk(&fifos, &msg, DM_EVENT_CMD_GET_STATUS, "-", "-", 0, 0)) {
Index: man/dmeventd.8.in
===================================================================
RCS file: /cvs/lvm2/LVM2/man/dmeventd.8.in,v
retrieving revision 1.3
diff -u -p -r1.3 dmeventd.8.in
--- man/dmeventd.8.in	22 Jun 2010 07:34:34 -0000	1.3
+++ man/dmeventd.8.in	2 Mar 2011 12:02:40 -0000
@@ -5,6 +5,7 @@ dmeventd \- Device-mapper event daemon
 .B dmeventd
 [\-d]
 [\-f]
+[\-R]
 [\-h]
 [\-V]
 [\-?]
@@ -33,6 +34,11 @@ Each extra d adds more debugging informa
 .I \-f
 Don't fork, run in the foreground.
 .TP
+.I \-R
+Replace a running dmeventd instance. The running dmeventd must be version
+2.02.77 or newer. The new dmeventd instance will obtain a list of devices and
+events to monitor from the currently running daemon.
+.TP
 .I \-h, \-?
 Show help information.
 .TP
Index: test/t-dmeventd-restart.sh
===================================================================
RCS file: /cvs/lvm2/LVM2/test/t-dmeventd-restart.sh,v
retrieving revision 1.2
diff -u -p -r1.2 t-dmeventd-restart.sh
--- test/t-dmeventd-restart.sh	5 Jan 2011 00:16:20 -0000	1.2
+++ test/t-dmeventd-restart.sh	2 Mar 2011 12:02:40 -0000
@@ -30,3 +30,11 @@ lvchange --monitor y --verbose $vg/3way 
 grep 'already monitored' lvchange.out
 lvchange --monitor y --verbose $vg/4way 2>&1 | tee lvchange.out
 grep 'already monitored' lvchange.out
+
+# now try what happens if no dmeventd is running
+kill -9 `cat LOCAL_DMEVENTD`
+dmeventd -R -f &
+echo "$!" > LOCAL_DMEVENTD
+sleep 3
+lvchange --monitor y --verbose $vg/3way 2>&1 | tee lvchange.out
+not grep 'already monitored' lvchange.out
-- 
id' Ash = Ash; id' Dust = Dust; id' _ = undefined

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