From 45ba9f9c2f5ace6200728579e154ae2b61350693 Mon Sep 17 00:00:00 2001 From: Petr Rockai Date: Wed, 2 Mar 2011 12:49:13 +0000 Subject: [PATCH] As requested in BZ 454618: - dmeventd -R will continue to start up even if no dmeventd is currently running + a test for this behaviour - add -R to dmeventd manpage --- daemons/dmeventd/dmeventd.c | 9 +++++---- man/dmeventd.8.in | 6 ++++++ test/t-dmeventd-restart.sh | 8 ++++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c index 32c69da5c..28e492eff 100644 --- a/daemons/dmeventd/dmeventd.c +++ b/daemons/dmeventd/dmeventd.c @@ -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)) { diff --git a/man/dmeventd.8.in b/man/dmeventd.8.in index cc5a74106..2931f2dd0 100644 --- a/man/dmeventd.8.in +++ b/man/dmeventd.8.in @@ -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 information. .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 diff --git a/test/t-dmeventd-restart.sh b/test/t-dmeventd-restart.sh index 5d26b66ec..fb85612e2 100644 --- a/test/t-dmeventd-restart.sh +++ b/test/t-dmeventd-restart.sh @@ -30,3 +30,11 @@ lvchange --monitor y --verbose $vg/3way 2>&1 | tee lvchange.out 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 -- 2.43.5