 |
pacemaker
2.0.3-4b1f869f0f
Scalable High-Availability cluster resource manager
|
Go to the documentation of this file.
13 #include <sys/ioctl.h>
14 #include <sys/reboot.h>
16 #include <sys/types.h>
24 # include <sys/mman.h>
27 static int sbd_pid = 0;
44 procf = fopen(
"/proc/sysrq-trigger",
"a");
46 crm_perror(LOG_WARNING,
"Opening sysrq-trigger failed");
50 fprintf(procf,
"%c\n", t);
52 #endif // SUPPORT_PROCFS
58 pcmk_panic_local(
void)
61 uid_t uid = geteuid();
62 pid_t ppid = getppid();
64 if(uid != 0 && ppid > 1) {
75 }
else if (uid != 0) {
81 union sigval signal_value;
83 memset(&signal_value, 0,
sizeof(signal_value));
87 if(ppid > 1 && sigqueue(ppid, SIGQUIT, signal_value) < 0) {
88 crm_perror(LOG_EMERG,
"Cannot signal pacemakerd(%d) to panic", ppid);
90 #endif // SUPPORT_PROCFS
99 if (
safe_str_eq(
"crash", getenv(
"PCMK_panic_action"))) {
122 union sigval signal_value;
123 pid_t ppid = getppid();
127 memset(&signal_value, 0,
sizeof(signal_value));
129 if(sigqueue(sbd_pid, SIGKILL, signal_value) < 0) {
130 crm_perror(LOG_EMERG,
"Cannot signal SBD(%d) to terminate", sbd_pid);
146 static struct qb_log_callsite *panic_cs = NULL;
148 if (panic_cs == NULL) {
155 if (panic_cs && panic_cs->targets) {
158 "Shutting down instead of panicking the node: origin=%s, sbd=%d, parent=%d",
159 origin, sbd_pid, getppid());
165 do_crm_log_always(LOG_EMERG,
"Signaling sbd(%d) to panic the system: %s", sbd_pid, origin);
177 char *pidfile = NULL;
178 char *sbd_path = NULL;
193 crm_trace(
"SBD detected at pid=%d (file)", sbd_pid);
199 crm_trace(
"SBD detected at pid=%d (proc)", sbd_pid);
200 #endif // SUPPORT_PROCFS
217 static long sbd_timeout = -2;
219 if (sbd_timeout == -2) {
220 sbd_timeout =
crm_get_msec(getenv(
"SBD_WATCHDOG_TIMEOUT"));
230 return (sbd_timeout <= 0)? 0 : (2 * sbd_timeout);
238 if (st_timeout < 0) {
240 crm_debug(
"Using calculated value %ld for stonith-watchdog-timeout (%s)",
244 if (st_timeout == 0) {
245 crm_debug(
"Watchdog may be enabled but stonith-watchdog-timeout is disabled (%s)",
246 value? value :
"default");
250 "Shutting down: stonith-watchdog-timeout configured (%s) but SBD not active",
251 (value? value :
"auto"));
258 if (st_timeout < sbd_timeout) {
260 "Shutting down: stonith-watchdog-timeout (%s) too short (must be >%ldms)",
265 crm_info(
"Watchdog configured with stonith-watchdog-timeout %s and SBD timeout %ldms",
gboolean check_sbd_timeout(const char *value)
#define do_crm_log_always(level, fmt, args...)
Log a message using constant severity.
const char * pcmk_strerror(int rc)
#define crm_trace(fmt, args...)
#define safe_str_eq(a, b)
unsigned int crm_trace_nonlog
int crm_procfs_pid_of(const char *name)
void pcmk_panic(const char *origin)
#define crm_info(fmt, args...)
long crm_auto_watchdog_timeout()
pid_t pcmk_locate_sbd(void)
char * crm_strdup_printf(char const *format,...) __attribute__((__format__(__printf__
long crm_get_sbd_timeout(void)
#define crm_debug(fmt, args...)
long crm_pidfile_inuse(const char *filename, long mypid, const char *daemon)
#define crm_perror(level, fmt, args...)
Log a system error message.
long long crm_get_msec(const char *input)
_Noreturn crm_exit_t crm_exit(crm_exit_t rc)