Skip to content

Commit

Permalink
Refactor: crmd: Simplify the logic for resetting node status in the C…
Browse files Browse the repository at this point in the history
…IB after fencing events
  • Loading branch information
beekhof committed May 2, 2013
1 parent a0db7ab commit f30e1e4
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions crmd/te_utils.c
Expand Up @@ -154,26 +154,26 @@ tengine_stonith_notify(stonith_t * st, stonith_event_t * st_event)
}
#endif

if (AM_I_DC
&& st_event->client_origin
&& safe_str_neq(st_event->client_origin, client_id)) {
const char *uuid = get_uuid(st_event->target);

/* If a remote process outside of pacemaker, or a
* previous/different DC, invoked stonith to fence
* someone, report the fencing result to the cib and abort
* the transition graph.
*/
crm_info("External fencing operation from %s fenced %s", st_event->client_origin,
st_event->target);
send_stonith_update(NULL, st_event->target, uuid);
abort_transition(INFINITY, tg_restart, "External Fencing Operation", NULL);

} else if (st_event->result == pcmk_ok) {
if (st_event->result == pcmk_ok) {
const char *uuid = get_uuid(st_event->target);
gboolean we_are_executioner = safe_str_eq(st_event->executioner, fsa_our_uname);

crm_trace("target=%s dc=%s", st_event->target, fsa_our_dc);
if (fsa_our_dc == NULL || safe_str_eq(fsa_our_dc, st_event->target)) {
if(AM_I_DC) {
/* The DC always sends updates */
send_stonith_update(NULL, st_event->target, uuid);

if (st_event->client_origin && safe_str_neq(st_event->client_origin, client_id)) {

/* Abort the current transition graph if it wasn't us
* that invoked stonith to fence someone
*/
crm_info("External fencing operation from %s fenced %s", st_event->client_origin, st_event->target);
abort_transition(INFINITY, tg_restart, "External Fencing Operation", NULL);
}

/* Assume it was our leader if we dont currently have one */
} else if (fsa_our_dc == NULL || safe_str_eq(fsa_our_dc, st_event->target)) {
crm_notice("Target %s our leader %s (recorded: %s)",
fsa_our_dc ? "was" : "may have been", st_event->target,
fsa_our_dc ? fsa_our_dc : "<unset>");
Expand All @@ -183,14 +183,12 @@ tengine_stonith_notify(stonith_t * st, stonith_event_t * st_event)
* have them do so too after the election
*/
if (we_are_executioner) {
const char *uuid = get_uuid(st_event->target);

send_stonith_update(NULL, st_event->target, uuid);
}
stonith_cleanup_list = g_list_append(stonith_cleanup_list, strdup(st_event->target));

}
}
}
}

gboolean
Expand Down

0 comments on commit f30e1e4

Please sign in to comment.