"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "heartbeat/config.c" between
Heartbeat-3-0-STABLE-3.0.5.tar.gz and Heartbeat-3-0-STABLE-3.0.6.tar.gz

About: Heartbeat (Linux-HA) provides a heartbeat and IP address takeover functions for a high-availability Linux cluster.

config.c  (Heartbeat-3-0-STABLE-3.0.5):config.c  (Heartbeat-3-0-STABLE-3.0.6)
skipping to change at line 108 skipping to change at line 108
static int set_realtime(const char *); static int set_realtime(const char *);
static int set_debuglevel(const char *); static int set_debuglevel(const char *);
static int set_api_authorization(const char *); static int set_api_authorization(const char *);
static int set_msgfmt(const char*); static int set_msgfmt(const char*);
static int set_logdaemon(const char*); static int set_logdaemon(const char*);
static int set_logdconntime(const char *); static int set_logdconntime(const char *);
static int set_register_to_apphbd(const char *); static int set_register_to_apphbd(const char *);
static int set_badpack_warn(const char*); static int set_badpack_warn(const char*);
static int set_coredump(const char*); static int set_coredump(const char*);
static int set_corerootdir(const char*); static int set_corerootdir(const char*);
static int set_crm_daemon_dir(const char*);
static int set_pengine_by_crm(const char*);
static int set_release2mode(const char*); static int set_release2mode(const char*);
static int set_pcmk_support(const char*); static int set_pcmk_support(const char*);
static int set_autojoin(const char*); static int set_autojoin(const char*);
static int set_uuidfrom(const char*); static int set_uuidfrom(const char*);
static int ha_config_check_boolean(const char *); static int ha_config_check_boolean(const char *);
static int set_memreserve(const char *); static int set_memreserve(const char *);
static int set_quorum_server(const char * value); static int set_quorum_server(const char * value);
static int set_syslog_logfilefmt(const char * value); static int set_syslog_logfilefmt(const char * value);
#ifdef ALLOWPOLLCHOICE #ifdef ALLOWPOLLCHOICE
static int set_normalpoll(const char *); static int set_normalpoll(const char *);
skipping to change at line 165 skipping to change at line 167
, {KEY_NORMALPOLL,set_normalpoll, TRUE, "true", "Use system poll(2) function?"} , {KEY_NORMALPOLL,set_normalpoll, TRUE, "true", "Use system poll(2) function?"}
#endif #endif
, {KEY_MSGFMT, set_msgfmt, TRUE, "classic", "message format in the wire"} , {KEY_MSGFMT, set_msgfmt, TRUE, "classic", "message format in the wire"}
, {KEY_LOGDAEMON, set_logdaemon, TRUE, NULL, "use logging daemon"} , {KEY_LOGDAEMON, set_logdaemon, TRUE, NULL, "use logging daemon"}
, {KEY_CONNINTVAL,set_logdconntime, TRUE, "60", "the interval to reconnect to lo gd"} , {KEY_CONNINTVAL,set_logdconntime, TRUE, "60", "the interval to reconnect to lo gd"}
, {KEY_REGAPPHBD, set_register_to_apphbd, FALSE, NULL, "register with apphbd"} , {KEY_REGAPPHBD, set_register_to_apphbd, FALSE, NULL, "register with apphbd"}
, {KEY_BADPACK, set_badpack_warn, TRUE, "true", "warn about bad packets"} , {KEY_BADPACK, set_badpack_warn, TRUE, "true", "warn about bad packets"}
, {KEY_SYSLOGFMT, set_syslog_logfilefmt, TRUE, "true", "log to files in syslog f ormat"} , {KEY_SYSLOGFMT, set_syslog_logfilefmt, TRUE, "true", "log to files in syslog f ormat"}
, {KEY_COREDUMP, set_coredump, TRUE, "true", "enable Linux-HA core dumps"} , {KEY_COREDUMP, set_coredump, TRUE, "true", "enable Linux-HA core dumps"}
, {KEY_COREROOTDIR,set_corerootdir, TRUE, NULL, "set root directory of core dump area"} , {KEY_COREROOTDIR,set_corerootdir, TRUE, NULL, "set root directory of core dump area"}
, {KEY_CRM_DAEMON_DIR, set_crm_daemon_dir, TRUE, NULL, "location for Pacemaker d
aemons"}
, {KEY_PENGINE_BY_CRM, set_pengine_by_crm, TRUE, NULL, "should pengine be spawne
d directly by heartbeat"}
, {KEY_REL2, set_release2mode, FALSE, NULL, "historical alias for '"KEY_PAC EMAKER"'"} , {KEY_REL2, set_release2mode, FALSE, NULL, "historical alias for '"KEY_PAC EMAKER"'"}
, {KEY_PACEMAKER, set_pcmk_support, TRUE, "false", "enable Pacemaker resource ma nagement"} , {KEY_PACEMAKER, set_pcmk_support, TRUE, "false", "enable Pacemaker resource ma nagement"}
, {KEY_AUTOJOIN, set_autojoin, TRUE, "none" , "set automatic join mode/style"} , {KEY_AUTOJOIN, set_autojoin, TRUE, "none" , "set automatic join mode/style"}
, {KEY_UUIDFROM, set_uuidfrom, TRUE, "file" , "set the source for uuid"} , {KEY_UUIDFROM, set_uuidfrom, TRUE, "file" , "set the source for uuid"}
,{KEY_COMPRESSION, set_compression, TRUE ,"zlib", "set compression module"} ,{KEY_COMPRESSION, set_compression, TRUE ,"zlib", "set compression module"}
,{KEY_COMPRESSION_THRESHOLD, set_compression_threshold, TRUE, "2", "set compress ion threshold"} ,{KEY_COMPRESSION_THRESHOLD, set_compression_threshold, TRUE, "2", "set compress ion threshold"}
,{KEY_TRADITIONAL_COMPRESSION, set_traditional_compression, TRUE, "no", "set tra ditional_compression"} ,{KEY_TRADITIONAL_COMPRESSION, set_traditional_compression, TRUE, "no", "set tra ditional_compression"}
,{KEY_ENV, set_env, FALSE, NULL, "set environment variable for respawn clients"} ,{KEY_ENV, set_env, FALSE, NULL, "set environment variable for respawn clients"}
,{KEY_MAX_REXMIT_DELAY, set_max_rexmit_delay, TRUE,"250", "set the maximum rexmi t delay time"} ,{KEY_MAX_REXMIT_DELAY, set_max_rexmit_delay, TRUE,"250", "set the maximum rexmi t delay time"}
,{KEY_LOG_CONFIG_CHANGES, ha_config_check_boolean, TRUE,"on", "record changes to the cib (valid only with: "KEY_PACEMAKER" on)"} ,{KEY_LOG_CONFIG_CHANGES, ha_config_check_boolean, TRUE,"on", "record changes to the cib (valid only with: "KEY_PACEMAKER" on)"}
skipping to change at line 500 skipping to change at line 504
if (!nice_failback && DoManageResources) { if (!nice_failback && DoManageResources) {
ha_log(LOG_WARNING ha_log(LOG_WARNING
, "Deprecated 'legacy' auto_failback option selected."); , "Deprecated 'legacy' auto_failback option selected.");
ha_log(LOG_WARNING ha_log(LOG_WARNING
, "Please convert to 'auto_failback on'."); , "Please convert to 'auto_failback on'.");
ha_log(LOG_WARNING ha_log(LOG_WARNING
, "See documentation for conversion details."); , "See documentation for conversion details.");
} }
if (*(config->logfile) == EOS) { check_logd_usage(&errcount);
if (config->log_facility > 0) {
/* /*
* Set to DEVNULL in case a stray script outputs logs * If we are supposed to use syslog,
*/ * and no logfiles have been set,
strncpy(config->logfile, DEVNULL * implicitly set to DEVNULL,
, sizeof(config->logfile)); * to override any default-if-unset
config->use_logfile=0; * some stray script may have.
} */
} if (config->log_facility > 0) {
if (*(config->dbgfile) == EOS) { if (*(config->logfile) == EOS)
if (config->log_facility > 0) { SetParameterValue(KEY_LOGFILE, DEVNULL);
/* if (*(config->dbgfile) == EOS)
* Set to DEVNULL in case a stray script outputs errors SetParameterValue(KEY_DBGFILE, DEVNULL);
*/
strncpy(config->dbgfile, DEVNULL
, sizeof(config->dbgfile));
config->use_dbgfile=0;
}
} }
check_logd_usage(&errcount);
if ( !r1_style_valid()){ if ( !r1_style_valid()){
errcount++; errcount++;
} }
if (!RestartRequested && errcount == 0 && !parse_only) { if (!RestartRequested && errcount == 0 && !parse_only) {
ha_log(LOG_INFO, "**************************"); ha_log(LOG_INFO, "**************************");
ha_log(LOG_INFO, "Configuration validated." ha_log(LOG_INFO, "Configuration validated."
" Starting heartbeat %s", VERSION); " Starting heartbeat %s", VERSION);
} }
for (j=0; j < config->nodecount; ++j) { for (j=0; j < config->nodecount; ++j) {
skipping to change at line 700 skipping to change at line 698
int i; int i;
struct stat sbuf; struct stat sbuf;
struct DefServices { struct DefServices {
const char * name; const char * name;
const char * authspec; const char * authspec;
} defserv[] = } defserv[] =
{ {"ipfail", "uid=" HA_CCMUSER} { {"ipfail", "uid=" HA_CCMUSER}
, {"ccm", "uid=" HA_CCMUSER} , {"ccm", "uid=" HA_CCMUSER}
, {"ping", "gid=" HA_APIGROUP} , {"ping", "gid=" HA_APIGROUP}
, {"lha-snmpagent","uid=root"} , {"lha-snmpagent","uid=root"}
, {"anon", "gid=" HA_APIGROUP} , {"anon", "uid=root gid=" HA_APIGROUP}
}; };
if ((f = fopen(cfgfile, "r")) == NULL) { if ((f = fopen(cfgfile, "r")) == NULL) {
ha_log(LOG_ERR, "Cannot open config file [%s]", cfgfile); ha_log(LOG_ERR, "Cannot open config file [%s]", cfgfile);
ha_log(LOG_INFO ha_log(LOG_INFO
, "An annotated sample %s file is provided in" , "An annotated sample %s file is provided in"
" the documentation." " the documentation."
, cfgfile); , cfgfile);
ha_log(LOG_INFO ha_log(LOG_INFO
, "Please copy it to %s, read it, customize it" , "Please copy it to %s, read it, customize it"
skipping to change at line 1343 skipping to change at line 1341
return(HA_FAIL); return(HA_FAIL);
} }
remove_from_dellist(value); remove_from_dellist(value);
hip = &config->nodes[config->nodecount]; hip = &config->nodes[config->nodecount];
memset(hip, 0, sizeof(*hip)); memset(hip, 0, sizeof(*hip));
++config->nodecount; ++config->nodecount;
strncpy(hip->status, INITSTATUS, sizeof(hip->status)); strncpy(hip->status, INITSTATUS, sizeof(hip->status));
strncpy(hip->nodename, value, sizeof(hip->nodename)); strncpy(hip->nodename, value, sizeof(hip->nodename));
g_strdown(hip->nodename); inplace_ascii_strdown(hip->nodename);
cl_uuid_clear(&hip->uuid); cl_uuid_clear(&hip->uuid);
hip->rmt_lastupdate = 0L; hip->rmt_lastupdate = 0L;
hip->has_resources = TRUE; hip->has_resources = TRUE;
hip->anypacketsyet = 0; hip->anypacketsyet = 0;
hip->local_lastupdate = time_longclock(); hip->local_lastupdate = time_longclock();
hip->track.nmissing = 0; hip->track.nmissing = 0;
hip->track.last_seq = NOSEQUENCE; hip->track.last_seq = NOSEQUENCE;
hip->track.ackseq = 0; hip->track.ackseq = 0;
hip->weight = 100; hip->weight = 100;
/* srand() done in init_config() already, /* srand() done in init_config() already,
skipping to change at line 1698 skipping to change at line 1696
return(HA_FAIL); return(HA_FAIL);
} }
} }
/* set syslog facility config variable */ /* set syslog facility config variable */
static int static int
set_dbgfile(const char * value) set_dbgfile(const char * value)
{ {
strncpy(config->dbgfile, value, PATH_MAX); strncpy(config->dbgfile, value, PATH_MAX);
cl_log_set_debugfile(config->dbgfile); cl_log_set_debugfile(config->dbgfile);
config->use_dbgfile=1; config->use_dbgfile = strcmp(value, DEVNULL);
return(HA_OK); return(HA_OK);
} }
/* set syslog facility config variable */ /* set syslog facility config variable */
static int static int
set_logfile(const char * value) set_logfile(const char * value)
{ {
strncpy(config->logfile, value, PATH_MAX); strncpy(config->logfile, value, PATH_MAX);
cl_log_set_logfile(config->logfile); cl_log_set_logfile(config->logfile);
config->use_logfile=1; config->use_logfile = strcmp(value, DEVNULL);
return(HA_OK); return(HA_OK);
} }
/* sets nice_failback behavior on/off */ /* sets nice_failback behavior on/off */
static int static int
set_nice_failback(const char * value) set_nice_failback(const char * value)
{ {
int rc; int rc;
int failback = 0; int failback = 0;
skipping to change at line 1885 skipping to change at line 1883
if (tlen < 1) { if (tlen < 1) {
ha_log(LOG_ERR, "No Stonith hostname argument given"); ha_log(LOG_ERR, "No Stonith hostname argument given");
return(HA_FAIL); return(HA_FAIL);
} }
if (tlen >= sizeof(StonithHost)) { if (tlen >= sizeof(StonithHost)) {
ha_log(LOG_ERR, "Stonith hostname too long"); ha_log(LOG_ERR, "Stonith hostname too long");
return(HA_FAIL); return(HA_FAIL);
} }
strncpy(StonithHost, vp, tlen); strncpy(StonithHost, vp, tlen);
StonithHost[tlen] = EOS; StonithHost[tlen] = EOS;
g_strdown(StonithHost); inplace_ascii_strdown(StonithHost);
/* Verify that this host is valid to create this stonith /* Verify that this host is valid to create this stonith
* object. Expect the hostname listed to match this host or '*' * object. Expect the hostname listed to match this host or '*'
*/ */
if (strcmp ("*", StonithHost) != 0 if (strcmp ("*", StonithHost) != 0
&& strcmp (localnodename, StonithHost)) { && strcmp (localnodename, StonithHost)) {
/* This directive is not valid for this host */ /* This directive is not valid for this host */
return HA_OK; return HA_OK;
} }
skipping to change at line 2108 skipping to change at line 2106
const char * cmdp; const char * cmdp;
char chuid[64]; char chuid[64];
size_t uidlen; size_t uidlen;
size_t cmdlen; size_t cmdlen;
size_t pathlen; size_t pathlen;
char* command; char* command;
char* path; char* path;
struct passwd* pw; struct passwd* pw;
if (ANYDEBUG) { if (ANYDEBUG) {
ha_log(LOG_INFO, "respawn directive: %s", directive); ha_log(LOG_INFO, "%s %s",
failfast ? KEY_FAILFAST : KEY_CLIENT_CHILD,
directive);
} }
/* Skip over initial white space, so we can get the uid */ /* Skip over initial white space, so we can get the uid */
uidp = directive; uidp = directive;
uidp += strspn(uidp, WHITESPACE); uidp += strspn(uidp, WHITESPACE);
uidlen = strcspn(uidp, WHITESPACE); uidlen = strcspn(uidp, WHITESPACE);
cmdp = uidp + uidlen+1; cmdp = uidp + uidlen+1;
/* Skip over white space, find the command */ /* Skip over white space, find the command */
skipping to change at line 2439 skipping to change at line 2439
, "Missing uid or gid in " KEY_APIPERM); , "Missing uid or gid in " KEY_APIPERM);
goto baddirective; goto baddirective;
} }
} }
if (uidlist == NULL && gidlist == NULL) { if (uidlist == NULL && gidlist == NULL) {
goto baddirective; goto baddirective;
} }
if (ANYDEBUG) { if (ANYDEBUG) {
cl_log(LOG_DEBUG, "uid=%s, gid=%s" cl_log(LOG_DEBUG, "%s %s uid=%s, gid=%s"
, KEY_APIPERM, clname
, (uidlist == NULL ? "<null>" : uidlist) , (uidlist == NULL ? "<null>" : uidlist)
, (gidlist == NULL ? "<null>" : gidlist)); , (gidlist == NULL ? "<null>" : gidlist));
} }
auth = ipc_str_to_auth(uidlist, uidlen, gidlist, gidlen); auth = ipc_str_to_auth(uidlist, uidlen, gidlist, gidlen);
if (auth == NULL){ if (auth == NULL){
goto baddirective; goto baddirective;
} }
if (g_hash_table_lookup(APIAuthorization, clname) != NULL) { if (g_hash_table_lookup(APIAuthorization, clname) != NULL) {
cl_log(LOG_ERR cl_log(LOG_ERR
skipping to change at line 2526 skipping to change at line 2527
static int static int
set_corerootdir(const char* value) set_corerootdir(const char* value)
{ {
if (cl_set_corerootdir(value) < 0) { if (cl_set_corerootdir(value) < 0) {
cl_perror("Invalid core directory [%s]", value); cl_perror("Invalid core directory [%s]", value);
return HA_FAIL; return HA_FAIL;
} }
return HA_OK; return HA_OK;
} }
static int fail_if_after_pacemaker(const char *directive)
{
if (GetParameterValue(KEY_PACEMAKER)) {
cl_log(LOG_ERR, "If you specify %s, it must come before the %s di
rective\n",
directive, KEY_PACEMAKER);
return HA_FAIL;
}
return HA_OK;
}
static int
set_crm_daemon_dir(const char* value)
{
if (fail_if_after_pacemaker(value))
return HA_FAIL;
/* Nothing more to do here; add_option() will add it
* to the parameters hash table, that is good enough. */
return HA_OK;
}
static int set_pengine_by_crm(const char* value)
{
if (HA_OK != fail_if_after_pacemaker(value))
return HA_FAIL;
return ha_config_check_boolean(value);
}
/* /*
* Enable all these flags when KEY_PACEMAKER is enabled... * Enable all these flags when KEY_PACEMAKER is enabled...
* apiauth lrmd uid=root * apiauth lrmd uid=root
* apiauth stonithd uid=root * apiauth stonithd uid=root
* apiauth stonith-ng uid=root * apiauth stonith-ng uid=root
* apiauth crmd uid=hacluster * apiauth crmd uid=hacluster
* apiauth cib uid=hacluster * apiauth cib uid=hacluster
* respawn root /usr/lib/heartbeat/lrmd * respawn root /usr/lib/heartbeat/lrmd
* respawn root /usr/lib/heartbeat/stonithd * respawn root /usr/lib/heartbeat/stonithd
* respawn hacluster /usr/lib/heartbeat/ccm * respawn hacluster /usr/lib/heartbeat/ccm
* respawn hacluster /usr/lib/heartbeat/cib * respawn hacluster /usr/lib/heartbeat/cib
* respawn hacluster /usr/lib/heartbeat/crmd * respawn hacluster /usr/lib/heartbeat/crmd
*/ */
enum pcmk_directive_value { OFF = 0, AUTO = 1, MINIMAL, RESPAWN, VALGRIND, CCM_O
NLY };
struct pcmk_child {
const gboolean skip_if_minimal;
const gboolean use_valgrind_on_request;
const gboolean failfast[5];
const char *user;
const gboolean try_crm_daemon_dir_first;
const char *command;
const char *hb_args;
/* const char *pcmk_args; */
};
static char *path_command_ok(const char *path, const char *basename)
{
char *command;
int c;
ha_log(LOG_DEBUG, "Checking access of: %s/%s", path, basename);
c = asprintf(&command, "%s/%s", path, basename);
if (c < 0)
return NULL;
if (access(command, X_OK) < 0) {
free(command);
command = NULL;
}
return command;
}
static int add_pcmk_client_child(struct pcmk_child *p, enum pcmk_directive_value
onoff)
{
char *fake_directive = NULL;
char *command = NULL;
const char *args = NULL;
const char *valgrind = NULL;
const char *crm_daemon_dir;
int failfast_index = onoff - 1;
int c;
if (failfast_index >= DIMOF(p->failfast))
return HA_FAIL;
crm_daemon_dir = GetParameterValue(KEY_CRM_DAEMON_DIR) ?: CRM_DAEMON_DIR;
if (p->try_crm_daemon_dir_first)
command = path_command_ok(crm_daemon_dir, p->command);
if (!command) {
/* Not started from pacemaker directory, use the "hb_args".
* Right now only used for lrmd. */
args = p->hb_args;
command = path_command_ok(HA_DAEMON_DIR, p->command);
/* lrmd may still not be found. Try the historical location as we
ll. */
if (!command)
command = path_command_ok(HA_LIBHBDIR, p->command);
if (!command) {
ha_log(LOG_ERR, "Failed to add pacemaker client child \"%
s\"", p->command);
return HA_FAIL;
}
}
if (p->use_valgrind_on_request && onoff == VALGRIND)
valgrind = VALGRIND_BIN;
c = asprintf(&fake_directive,
"%s %s %s%s%s", p->user,
valgrind ?: "",
command,
args ? " " : "", args ?: "");
free(command);
command = NULL;
if (c < 0)
return HA_FAIL;
c = add_client_child_base(fake_directive, p->failfast[failfast_index]);
free(fake_directive);
return c;
}
static int static int
set_release2mode(const char* value) set_release2mode(const char* value)
{ {
/* alias KEY_REL2 to KEY_PACEMAKER */ /* alias KEY_REL2 to KEY_PACEMAKER */
return add_option(KEY_PACEMAKER, value); return add_option(KEY_PACEMAKER, value);
} }
static int static int
set_pcmk_support(const char* value) set_pcmk_support(const char *value)
{ {
struct do_directive { /* CCM apiauth already implicit elsewhere.
const char * dname; * LRMd is not a heartbeat API client.
const char * dval; * Stonith "NG" registered (for some pacemaker versions) as stonith-ng,
}; * but the name of the binary is still the same: stonithd. */
struct do_directive *r2dirs; const char *api_auth[] = {
"cib uid=" HA_CCMUSER,
struct do_directive r2auto_dirs[] = "crmd uid=" HA_CCMUSER,
/*
* To whom it may concern: Please keep the apiauth and respawn /* break if minimal */
* lines in the same order to make auditing the two against each "stonithd uid=root",
* other easier. "stonith-ng uid=root",
* Thank you. "attrd uid=" HA_CCMUSER,
*/ "pingd uid=root"
{ /* CCM apiauth already implicit elsewhere */
{"apiauth", "cib uid=" HA_CCMUSER}
/* LRMd is not a heartbeat API client */
, {"apiauth", "stonithd uid=root" }
/* "NG" registers as stonith-ng, but the name of the binary
* is still the same: stonithd */
, {"apiauth", "stonith-ng uid=root" }
, {"apiauth", "attrd uid=" HA_CCMUSER}
, {"apiauth", "crmd uid=" HA_CCMUSER}
, {"apiauth", "pingd uid=root"}
, {"failfast"," "HA_CCMUSER " " HA_LIBHBDIR "/ccm"}
, {"failfast"," "HA_CCMUSER " " HA_LIBHBDIR "/cib" }
, {"respawn", "root " HA_LIBHBDIR "/lrmd -r"}
, {"respawn", "root " HA_LIBHBDIR "/stonithd"}
, {"respawn", " "HA_CCMUSER " " HA_LIBHBDIR "/attrd" }
, {"failfast"," "HA_CCMUSER " " HA_LIBHBDIR "/crmd" }
/* Don't 'respawn' pingd - it's a resource agent */
}; };
struct do_directive r2respawn_dirs[] = /* Note: order matters. Started in order, stopped in reverse.
/* * CRMD must be last, which means it will be stopped first.
* To whom it may concern: Please keep the apiauth and respawn * For "best practices" start order,
* lines in the same order to make auditing the two against each * see pacemaker:mcp/pacemaker.c, pcmk_children[]
* other easier.
* Thank you.
*/ */
struct pcmk_child pcmk_children[] = {
{ 0, 0, { 1, 1, 0, 0, 0 }, HA_CCMUSER, FALSE, "ccm", },
{ /* CCM apiauth already implicit elsewhere */ { 0, 1, { 1, 1, 0, 0, 0 }, HA_CCMUSER, TRUE, "cib", },
{"apiauth", "cib uid=" HA_CCMUSER} { 1, 0, { 0, 0, 0, 0, 0 }, "root", TRUE, "stonithd", },
/* LRMd is not a heartbeat API client */ { 0, 0, { 0, 0, 0, 0, 0 }, "root", TRUE, "lrmd", "-r" },
, {"apiauth", "stonithd uid=root" } { 1, 1, { 0, 0, 0, 0, 0 }, HA_CCMUSER, TRUE, "attrd", },
, {"apiauth", "stonith-ng uid=root" } { 1, 1, { 1, 1, 0, 0, 0 }, HA_CCMUSER, TRUE, "pengine", },
, {"apiauth", "attrd uid=" HA_CCMUSER} { 0, 1, { 1, 1, 0, 0, 0 }, HA_CCMUSER, TRUE, "crmd", },
, {"apiauth", "crmd uid=" HA_CCMUSER}
, {"apiauth", "pingd uid=root"}
, {"respawn", " "HA_CCMUSER " " HA_LIBHBDIR "/ccm"}
, {"respawn", " "HA_CCMUSER " " HA_LIBHBDIR "/cib" }
, {"respawn", "root " HA_LIBHBDIR "/lrmd -r"}
, {"respawn", "root " HA_LIBHBDIR "/stonithd"}
, {"respawn", " "HA_CCMUSER " " HA_LIBHBDIR "/attrd" }
, {"respawn", " "HA_CCMUSER " " HA_LIBHBDIR "/crmd" }
/* Don't 'respawn' pingd - it's a resource agent */ /* Don't 'respawn' pingd - it's a resource agent */
}; };
const int pengine_idx = 5; /* see above */
struct do_directive r2minimal_dirs[] = enum pcmk_directive_value pcmk_directive;
{ /* CCM apiauth already implicit elsewhere */ int rc;
{"apiauth", "cib uid=" HA_CCMUSER} int j;
, {"apiauth", "crmd uid=" HA_CCMUSER} gboolean crmd_spawns_pengine = TRUE;
gboolean pacemaker_on;
, {"failfast"," "HA_CCMUSER " " HA_LIBHBDIR "/ccm"}
, {"failfast"," "HA_CCMUSER " " HA_LIBHBDIR "/cib"}
, {"respawn", "root " HA_LIBHBDIR "/lrmd"}
, {"failfast"," "HA_CCMUSER " " HA_LIBHBDIR "/crmd"}
/* Don't 'respawn' pingd - it's a resource agent */
};
struct do_directive r2valgrind_dirs[] = static gboolean already_called = FALSE;
{ /* CCM apiauth already implicit elsewhere */
{"apiauth", "cib uid=" HA_CCMUSER}
, {"apiauth", "stonithd uid=root" }
, {"apiauth", "stonith-ng uid=root" }
, {"apiauth", "attrd uid=" HA_CCMUSER}
, {"apiauth", "crmd uid=" HA_CCMUSER}
, {"respawn"," "HA_CCMUSER " "HA_LIBHBDIR"/ccm"}
, {"respawn"," "HA_CCMUSER " "VALGRIND_BIN" "HA_LIBHBDIR"/cib"}
, {"respawn", "root " HA_LIBHBDIR"/lrmd -r"}
, {"respawn", "root " HA_LIBHBDIR"/stonithd"}
, {"respawn", " "HA_CCMUSER " "VALGRIND_BIN" "HA_LIBHBDIR"/attrd" }
, {"respawn"," "HA_CCMUSER " "VALGRIND_BIN" "HA_LIBHBDIR"/crmd"}
/* Don't 'respawn' pingd - it's a resource agent */
};
gboolean dorel2; if (already_called) {
int rc; /* pacemaker directive can appear only *once* */
int j, r2size; cl_log(LOG_ERR, "pacemaker/crm directive used multiple times!");
int rc2 = HA_OK; return HA_FAIL;
}
already_called = TRUE;
r2dirs = &r2auto_dirs[0];
r2size = DIMOF(r2auto_dirs);
cl_log(LOG_INFO, "Pacemaker support: %s", value); cl_log(LOG_INFO, "Pacemaker support: %s", value);
if (0 == strcasecmp("minimal", value) if (!strcasecmp("minimal", value) || !strcasecmp("manual", value)) {
|| 0 == strcasecmp("manual", value)) { pcmk_directive = MINIMAL;
r2dirs = &r2minimal_dirs[0]; } else if (!strcasecmp("respawn", value)) {
r2size = DIMOF(r2minimal_dirs); pcmk_directive = RESPAWN;
} else if (!strcasecmp("ccm-only", value)) {
} else if (0 == strcasecmp("respawn", value)) { pcmk_directive = CCM_ONLY;
r2dirs = &r2respawn_dirs[0]; } else if (!strcasecmp("valgrind", value)) {
r2size = DIMOF(r2respawn_dirs); pcmk_directive = VALGRIND;
} else if (0 == strcasecmp("valgrind", value)) {
r2dirs = &r2valgrind_dirs[0];
r2size = DIMOF(r2valgrind_dirs);
setenv("HA_VALGRIND_ENABLED", "1", 1); setenv("HA_VALGRIND_ENABLED", "1", 1);
cl_log(LOG_INFO, "Enabling Valgrind on selected components"); cl_log(LOG_INFO, "Enabling Valgrind on selected components");
} else if ((rc = cl_str_to_boolean(value, &dorel2)) == HA_OK) { } else if ((rc = cl_str_to_boolean(value, &pacemaker_on)) == HA_OK) {
if (!dorel2) { if (!pacemaker_on)
return HA_OK; return HA_OK;
} pcmk_directive = AUTO;
} else { } else {
return rc; return rc;
} }
DoManageResources = FALSE; DoManageResources = FALSE;
if (cl_file_exists(RESOURCE_CFG)){ setenv("HA_cluster_type", "heartbeat", 1);
if (cl_file_exists(RESOURCE_CFG)) {
cl_log(LOG_WARNING, "File %s exists.", RESOURCE_CFG); cl_log(LOG_WARNING, "File %s exists.", RESOURCE_CFG);
cl_log(LOG_WARNING, "This file is not used because "KEY_PACEMAKER " is enabled"); cl_log(LOG_WARNING, "This file is not used because "KEY_PACEMAKER " is enabled");
} }
/* Enable Pacemaker cluster management */ for (j = 0; j < DIMOF(api_auth); j++) {
for (j=0; j < r2size ; ++j) { if (pcmk_directive == MINIMAL && j == 2)
int k; break;
for (k=0; k < DIMOF(WLdirectives); ++k) { if (set_api_authorization(api_auth[j]) == HA_OK)
if (0 != strcmp(r2dirs->dname, WLdirectives[k].type)) { continue;
continue; cl_log(LOG_ERR, "failed: apiauth %s", api_auth[j]);
} return HA_FAIL;
if (ANYDEBUG) {
cl_log(LOG_DEBUG, "Implicit directive: %s %s"
, r2dirs->dname
, r2dirs->dval);
}
if (HA_OK
!= (rc2 = WLdirectives[k].parse(r2dirs->dval))) {
cl_log(LOG_ERR, "Directive %s %s failed"
, r2dirs->dname, r2dirs->dval);
}
}
r2dirs++;
} }
return rc2; cl_str_to_boolean(GetParameterValue(KEY_PENGINE_BY_CRM), &crmd_spawns_pen
gine);
for (j = 0; j < DIMOF(pcmk_children); ++j) {
struct pcmk_child *p = &pcmk_children[j];
/* In CCM_ONLY mode, pacemakerd is supposed to be started from it
s
* own init script, and will then start all of its daemons
* itself.
* (Or you may specify explicit failfast/respawn directives) */
if (pcmk_directive == CCM_ONLY && j > 0)
break;
if (pcmk_directive == MINIMAL && p->skip_if_minimal)
continue;
if (j == pengine_idx && crmd_spawns_pengine)
continue;
if (HA_OK != add_pcmk_client_child(p, pcmk_directive))
return HA_FAIL;
}
return HA_OK;
} }
static int static int
set_autojoin(const char* value) set_autojoin(const char* value)
{ {
if (strcasecmp(value, "none") == 0) { if (strcasecmp(value, "none") == 0) {
config->rtjoinconfig = HB_JOIN_NONE; config->rtjoinconfig = HB_JOIN_NONE;
return HA_OK; return HA_OK;
} }
if (strcasecmp(value, "other") == 0) { if (strcasecmp(value, "other") == 0) {
 End of changes. 29 change blocks. 
154 lines changed or deleted 223 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS