Skip to content
Merged
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
5 changes: 4 additions & 1 deletion man/sbd.8.pod
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,10 @@ If set to zero, processes will be restarted indefinitely and immediately.

=item B<-P>

Check Pacemaker quorum and node health.
Enable Pacemaker integration which checks Pacemaker quorum and node health.
Specify this once to enable, twice to disable.

Defaults to I<enabled>.

=item B<-S> I<N>

Expand Down
43 changes: 33 additions & 10 deletions src/sbd-inquisitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
static struct servants_list_item *servants_leader = NULL;

int disk_priority = 1;
int check_pcmk = 0;
int check_cluster = 0;
int check_pcmk = 1;
int check_cluster = 1;
int disk_count = 0;
int servant_count = 0;
int servant_restart_interval = 5;
Expand Down Expand Up @@ -799,11 +799,19 @@ parse_device_line(const char *line)
return found;
}

int
arg_enabled(int arg_count)
{
return arg_count % 2;
}

int main(int argc, char **argv, char **envp)
{
int exit_status = 0;
int c;
int w = 0;
int W_count = 0;
int c_count = 0;
int P_count = 0;
int qb_facility;
const char *value = NULL;
int start_delay = 0;
Expand Down Expand Up @@ -862,6 +870,13 @@ int main(int argc, char **argv, char **envp)
watchdogdev = strdup(value);
}

/* SBD_WATCHDOG has been dropped from sbd.sysconfig example.
* This is for backward compatibility. */
value = getenv("SBD_WATCHDOG");
if(value) {
watchdog_use = crm_is_true(value);
}

value = getenv("SBD_WATCHDOG_TIMEOUT");
if(value) {
timeout_watchdog = crm_get_msec(value) / 1000;
Expand Down Expand Up @@ -921,7 +936,7 @@ int main(int argc, char **argv, char **envp)
cl_log(LOG_INFO, "Setting watchdog timeout disabled; using defaults.");
break;
case 'W':
w++;
W_count++;
break;
case 'w':
cl_log(LOG_NOTICE, "Using watchdog device '%s'", watchdogdev);
Expand All @@ -938,10 +953,10 @@ int main(int argc, char **argv, char **envp)
#endif
break;
case 'c':
check_cluster = 1;
c_count++;
break;
case 'P':
check_pcmk = 1;
P_count++;
break;
case 'z':
disk_priority = 0;
Expand Down Expand Up @@ -1004,11 +1019,11 @@ int main(int argc, char **argv, char **envp)
}
}

if (w > 0) {
watchdog_use = w % 2;

} else if(watchdogdev == NULL || strcmp(watchdogdev, "/dev/null") == 0) {
if (watchdogdev == NULL || strcmp(watchdogdev, "/dev/null") == 0) {
watchdog_use = 0;

} else if (W_count > 0) {
watchdog_use = arg_enabled(W_count);
}

if (watchdog_use) {
Expand All @@ -1017,6 +1032,14 @@ int main(int argc, char **argv, char **envp)
cl_log(LOG_INFO, "Watchdog disabled.");
}

if (c_count > 0) {
check_cluster = arg_enabled(c_count);
}

if (P_count > 0) {
check_pcmk = arg_enabled(P_count);
}

if ((disk_count > 0) && (strlen(local_uname) > SECTOR_NAME_MAX)) {
fprintf(stderr, "Node name mustn't be longer than %d chars.\n",
SECTOR_NAME_MAX);
Expand Down