From f596a91dc4cf1f0a33b6ef261dcd58a541e8ee22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20Gr=C3=B6nlund?= Date: Tue, 17 May 2016 16:28:06 +0200 Subject: [PATCH 1/2] Add a command line option to enable SBD_DELAY_START --- man/sbd.8.pod | 7 +++++++ src/sbd-common.c | 1 + src/sbd-inquisitor.c | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/man/sbd.8.pod b/man/sbd.8.pod index fd1efad..40b1f4f 100644 --- a/man/sbd.8.pod +++ b/man/sbd.8.pod @@ -289,6 +289,13 @@ present yet. This allows to set a timeout for waiting for devices to appear on start-up. If set to 0, start-up will be aborted immediately if no devices are available. +=item B<-A> + +If enabled, sbd will delay on boot for "msgwait" seconds. +This may be necessary if your cluster nodes reboot so fast that the +other nodes are still waiting in the fence acknowledgement phase. +This is an occasional issue with virtual machines. + =item B<-Z> Enable trace mode. B # of failures before a servant is considered faulty (optional)\n" " (default is 1, set to 0 to disable)\n" +"-A Enable start delay (wait for msgwait seconds at start) (optional)\n" "-P Check Pacemaker quorum and node health (optional, watch only)\n" "-Z Enable trace mode. WARNING: UNSAFE FOR PRODUCTION!\n" "Commands:\n" diff --git a/src/sbd-inquisitor.c b/src/sbd-inquisitor.c index 3206973..ba91eba 100644 --- a/src/sbd-inquisitor.c +++ b/src/sbd-inquisitor.c @@ -877,10 +877,13 @@ int main(int argc, char **argv, char **envp) } cl_log(LOG_DEBUG, "Start delay: %d (%s)", (int)start_delay, value?value:"default"); - while ((c = getopt(argc, argv, "czC:DPRTWZhvw:d:n:p:1:2:3:4:5:t:I:F:S:s:")) != -1) { + while ((c = getopt(argc, argv, "czC:DPRTAWZhvw:d:n:p:1:2:3:4:5:t:I:F:S:s:")) != -1) { switch (c) { case 'D': break; + case 'A': + start_delay = 1; + break; case 'Z': debug_mode++; cl_log(LOG_INFO, "Debug mode now at level %d", (int)debug_mode); From b20d1dd17ef716193d62afd942362061b540e168 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20Gr=C3=B6nlund?= Date: Tue, 17 May 2016 16:30:28 +0200 Subject: [PATCH 2/2] Use command line option for SBD_DELAY_START in sbd.sh --- src/sbd-common.c | 2 +- src/sbd.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sbd-common.c b/src/sbd-common.c index 604569b..0a31967 100644 --- a/src/sbd-common.c +++ b/src/sbd-common.c @@ -89,7 +89,7 @@ usage(void) " (default is 5, set to 0 to disable)\n" "-F # of failures before a servant is considered faulty (optional)\n" " (default is 1, set to 0 to disable)\n" -"-A Enable start delay (wait for msgwait seconds at start) (optional)\n" +"-A Enable start delay (wait for msgwait seconds at start) (optional)\n" "-P Check Pacemaker quorum and node health (optional, watch only)\n" "-Z Enable trace mode. WARNING: UNSAFE FOR PRODUCTION!\n" "Commands:\n" diff --git a/src/sbd.sh b/src/sbd.sh index 91f49a3..3911f5d 100644 --- a/src/sbd.sh +++ b/src/sbd.sh @@ -59,6 +59,9 @@ always) SBD_OPTS+=" -S 0" ;; clean) SBD_OPTS+=" -S 1" ;; esac : ${SBD_DELAY_START:="no"} +if ocf_is_true "$SBD_DELAY_START" ; then + SBD_OPTS+=" -A" +fi start() { if ! pidofproc -p $SBD_PIDFILE $SBD_BIN >/dev/null 2>&1 ; then @@ -66,9 +69,6 @@ start() { echo "SBD failed to start; aborting." exit 1 fi - if ocf_is_true ${SBD_DELAY_START} ; then - sleep $(sbd -d "$SBD_DEVICE" dump | grep -m 1 msgwait | awk '{print $4}') 2>/dev/null - fi else return 0 fi