Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a command-line option -A for enabling start delay (SBD_DELAY_START) #8

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions man/sbd.8.pod
Original file line number Diff line number Diff line change
Expand Up @@ -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<Warning: this is unsafe for production, use at your
Expand Down
1 change: 1 addition & 0 deletions src/sbd-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ usage(void)
" (default is 5, set to 0 to disable)\n"
"-F <N> # 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"
Expand Down
5 changes: 4 additions & 1 deletion src/sbd-inquisitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/sbd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ 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
if ! $SBD_BIN -d $SBD_DEVICE $SBD_OPTS watch ; then
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
Expand Down