diff --git a/crmd/fsa.c b/crmd/fsa.c index 502dfa5c2c..ab5deccfab 100644 --- a/crmd/fsa.c +++ b/crmd/fsa.c @@ -1,674 +1,676 @@ /* * Copyright (C) 2004 Andrew Beekhof * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include char *fsa_our_dc = NULL; cib_t *fsa_cib_conn = NULL; char *fsa_our_dc_version = NULL; ll_lrm_t *fsa_lrm_conn; char *fsa_our_uuid = NULL; char *fsa_our_uname = NULL; #if SUPPORT_HEARTBEAT ll_cluster_t *fsa_cluster_conn; #endif fsa_timer_t *wait_timer = NULL; fsa_timer_t *recheck_timer = NULL; fsa_timer_t *election_trigger = NULL; fsa_timer_t *election_timeout = NULL; fsa_timer_t *transition_timer = NULL; fsa_timer_t *integration_timer = NULL; fsa_timer_t *finalization_timer = NULL; fsa_timer_t *shutdown_escalation_timer = NULL; volatile gboolean do_fsa_stall = FALSE; volatile long long fsa_input_register = 0; volatile long long fsa_actions = A_NOTHING; volatile enum crmd_fsa_state fsa_state = S_STARTING; extern uint highest_born_on; extern uint num_join_invites; extern GHashTable *welcomed_nodes; extern GHashTable *finalized_nodes; extern GHashTable *confirmed_nodes; extern GHashTable *integrated_nodes; extern void initialize_join(gboolean before); #define DOT_PREFIX "actions:trace: " #define do_dot_log(fmt, args...) crm_trace( fmt, ##args) long long do_state_transition(long long actions, enum crmd_fsa_state cur_state, enum crmd_fsa_state next_state, fsa_data_t * msg_data); void dump_rsc_info(void); void dump_rsc_info_callback(const xmlNode * msg, int call_id, int rc, xmlNode * output, void *user_data); void ghash_print_node(gpointer key, gpointer value, gpointer user_data); void s_crmd_fsa_actions(fsa_data_t * fsa_data); void log_fsa_input(fsa_data_t * stored_msg); void init_dotfile(void); void init_dotfile(void) { do_dot_log(DOT_PREFIX "digraph \"g\" {"); do_dot_log(DOT_PREFIX " size = \"30,30\""); do_dot_log(DOT_PREFIX " graph ["); do_dot_log(DOT_PREFIX " fontsize = \"12\""); do_dot_log(DOT_PREFIX " fontname = \"Times-Roman\""); do_dot_log(DOT_PREFIX " fontcolor = \"black\""); do_dot_log(DOT_PREFIX " bb = \"0,0,398.922306,478.927856\""); do_dot_log(DOT_PREFIX " color = \"black\""); do_dot_log(DOT_PREFIX " ]"); do_dot_log(DOT_PREFIX " node ["); do_dot_log(DOT_PREFIX " fontsize = \"12\""); do_dot_log(DOT_PREFIX " fontname = \"Times-Roman\""); do_dot_log(DOT_PREFIX " fontcolor = \"black\""); do_dot_log(DOT_PREFIX " shape = \"ellipse\""); do_dot_log(DOT_PREFIX " color = \"black\""); do_dot_log(DOT_PREFIX " ]"); do_dot_log(DOT_PREFIX " edge ["); do_dot_log(DOT_PREFIX " fontsize = \"12\""); do_dot_log(DOT_PREFIX " fontname = \"Times-Roman\""); do_dot_log(DOT_PREFIX " fontcolor = \"black\""); do_dot_log(DOT_PREFIX " color = \"black\""); do_dot_log(DOT_PREFIX " ]"); do_dot_log(DOT_PREFIX "// special nodes"); do_dot_log(DOT_PREFIX " \"S_PENDING\" "); do_dot_log(DOT_PREFIX " ["); do_dot_log(DOT_PREFIX " color = \"blue\""); do_dot_log(DOT_PREFIX " fontcolor = \"blue\""); do_dot_log(DOT_PREFIX " ]"); do_dot_log(DOT_PREFIX " \"S_TERMINATE\" "); do_dot_log(DOT_PREFIX " ["); do_dot_log(DOT_PREFIX " color = \"red\""); do_dot_log(DOT_PREFIX " fontcolor = \"red\""); do_dot_log(DOT_PREFIX " ]"); do_dot_log(DOT_PREFIX "// DC only nodes"); do_dot_log(DOT_PREFIX " \"S_INTEGRATION\" [ fontcolor = \"green\" ]"); do_dot_log(DOT_PREFIX " \"S_POLICY_ENGINE\" [ fontcolor = \"green\" ]"); do_dot_log(DOT_PREFIX " \"S_TRANSITION_ENGINE\" [ fontcolor = \"green\" ]"); do_dot_log(DOT_PREFIX " \"S_RELEASE_DC\" [ fontcolor = \"green\" ]"); do_dot_log(DOT_PREFIX " \"S_IDLE\" [ fontcolor = \"green\" ]"); } static void do_fsa_action(fsa_data_t * fsa_data, long long an_action, void (*function) (long long action, enum crmd_fsa_cause cause, enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data)) { fsa_actions &= ~an_action; crm_trace(DOT_PREFIX "\t// %s", fsa_action2string(an_action)); function(an_action, fsa_data->fsa_cause, fsa_state, fsa_data->fsa_input, fsa_data); } static long long startup_actions = A_STARTUP | A_CIB_START | A_LRM_CONNECT | A_CCM_CONNECT | A_HA_CONNECT | A_READCONFIG | A_STARTED | A_CL_JOIN_QUERY; enum crmd_fsa_state s_crmd_fsa(enum crmd_fsa_cause cause) { fsa_data_t *fsa_data = NULL; long long register_copy = fsa_input_register; long long new_actions = A_NOTHING; enum crmd_fsa_state last_state = fsa_state; crm_trace("FSA invoked with Cause: %s\tState: %s", fsa_cause2string(cause), fsa_state2string(fsa_state)); do_fsa_stall = FALSE; if (is_message() == FALSE && fsa_actions != A_NOTHING) { /* fake the first message so we can get into the loop */ crm_malloc0(fsa_data, sizeof(fsa_data_t)); fsa_data->fsa_input = I_NULL; fsa_data->fsa_cause = C_FSA_INTERNAL; fsa_data->origin = __FUNCTION__; fsa_data->data_type = fsa_dt_none; fsa_message_queue = g_list_append(fsa_message_queue, fsa_data); fsa_data = NULL; } while (is_message() && do_fsa_stall == FALSE) { crm_trace("Checking messages (%d remaining)", g_list_length(fsa_message_queue)); fsa_data = get_message(); CRM_CHECK(fsa_data != NULL, continue); log_fsa_input(fsa_data); /* add any actions back to the queue */ fsa_actions |= fsa_data->actions; /* get the next batch of actions */ new_actions = crmd_fsa_actions[fsa_data->fsa_input][fsa_state]; fsa_actions |= new_actions; if (fsa_data->fsa_input != I_NULL && fsa_data->fsa_input != I_ROUTER) { crm_debug("Processing %s: [ state=%s cause=%s origin=%s ]", fsa_input2string(fsa_data->fsa_input), fsa_state2string(fsa_state), fsa_cause2string(fsa_data->fsa_cause), fsa_data->origin); } #ifdef FSA_TRACE if (new_actions != A_NOTHING) { crm_trace("Adding FSA actions %.16llx for %s/%s", new_actions, fsa_input2string(fsa_data->fsa_input), fsa_state2string(fsa_state)); fsa_dump_actions(new_actions, "\tFSA scheduled"); } else if (fsa_data->fsa_input != I_NULL && new_actions == A_NOTHING) { crm_debug("No action specified for input,state (%s,%s)", fsa_input2string(fsa_data->fsa_input), fsa_state2string(fsa_state)); } if (fsa_data->actions != A_NOTHING) { crm_trace("Adding input actions %.16llx for %s/%s", new_actions, fsa_input2string(fsa_data->fsa_input), fsa_state2string(fsa_state)); fsa_dump_actions(fsa_data->actions, "\tInput scheduled"); } #endif /* logging : *before* the state is changed */ if (is_set(fsa_actions, A_ERROR)) { do_fsa_action(fsa_data, A_ERROR, do_log); } if (is_set(fsa_actions, A_WARN)) { do_fsa_action(fsa_data, A_WARN, do_log); } if (is_set(fsa_actions, A_LOG)) { do_fsa_action(fsa_data, A_LOG, do_log); } /* update state variables */ last_state = fsa_state; fsa_state = crmd_fsa_state[fsa_data->fsa_input][fsa_state]; /* * Remove certain actions during shutdown */ if (fsa_state == S_STOPPING || ((fsa_input_register & R_SHUTDOWN) == R_SHUTDOWN)) { clear_bit_inplace(fsa_actions, startup_actions); } /* * Hook for change of state. * Allows actions to be added or removed when entering a state */ if (last_state != fsa_state) { fsa_actions = do_state_transition(fsa_actions, last_state, fsa_state, fsa_data); } else { do_dot_log(DOT_PREFIX "\t// FSA input: State=%s \tCause=%s" " \tInput=%s \tOrigin=%s() \tid=%d", fsa_state2string(fsa_state), fsa_cause2string(fsa_data->fsa_cause), fsa_input2string(fsa_data->fsa_input), fsa_data->origin, fsa_data->id); } /* start doing things... */ s_crmd_fsa_actions(fsa_data); delete_fsa_input(fsa_data); fsa_data = NULL; } if (g_list_length(fsa_message_queue) > 0 || fsa_actions != A_NOTHING || do_fsa_stall) { crm_debug("Exiting the FSA: queue=%d, fsa_actions=0x%llx, stalled=%s", g_list_length(fsa_message_queue), fsa_actions, do_fsa_stall ? "true" : "false"); } else { crm_trace("Exiting the FSA"); } /* cleanup inputs? */ if (register_copy != fsa_input_register) { long long same = register_copy & fsa_input_register; fsa_dump_inputs(LOG_DEBUG, "Added input:", fsa_input_register ^ same); fsa_dump_inputs(LOG_DEBUG, "Removed input:", register_copy ^ same); } fsa_dump_queue(LOG_DEBUG); return fsa_state; } void s_crmd_fsa_actions(fsa_data_t * fsa_data) { /* * Process actions in order of priority but do only one * action at a time to avoid complicating the ordering. */ CRM_CHECK(fsa_data != NULL, return); while (fsa_actions != A_NOTHING && do_fsa_stall == FALSE) { /* regular action processing in order of action priority * * Make sure all actions that connect to required systems * are performed first */ if (fsa_actions & A_ERROR) { do_fsa_action(fsa_data, A_ERROR, do_log); } else if (fsa_actions & A_WARN) { do_fsa_action(fsa_data, A_WARN, do_log); } else if (fsa_actions & A_LOG) { do_fsa_action(fsa_data, A_LOG, do_log); /* get out of here NOW! before anything worse happens */ } else if (fsa_actions & A_EXIT_1) { do_fsa_action(fsa_data, A_EXIT_1, do_exit); + /* sub-system restart */ + } else if ((fsa_actions & O_LRM_RECONNECT) == O_LRM_RECONNECT) { + do_fsa_action(fsa_data, O_LRM_RECONNECT, do_lrm_control); + } else if ((fsa_actions & O_CIB_RESTART) == O_CIB_RESTART) { + do_fsa_action(fsa_data, O_CIB_RESTART, do_cib_control); + } else if ((fsa_actions & O_PE_RESTART) == O_PE_RESTART) { + do_fsa_action(fsa_data, O_PE_RESTART, do_pe_control); + } else if ((fsa_actions & O_TE_RESTART) == O_TE_RESTART) { + do_fsa_action(fsa_data, O_TE_RESTART, do_te_control); + /* essential start tasks */ } else if (fsa_actions & A_STARTUP) { do_fsa_action(fsa_data, A_STARTUP, do_startup); } else if (fsa_actions & A_CIB_START) { do_fsa_action(fsa_data, A_CIB_START, do_cib_control); } else if (fsa_actions & A_HA_CONNECT) { do_fsa_action(fsa_data, A_HA_CONNECT, do_ha_control); } else if (fsa_actions & A_READCONFIG) { do_fsa_action(fsa_data, A_READCONFIG, do_read_config); /* sub-system start/connect */ } else if (fsa_actions & A_LRM_CONNECT) { do_fsa_action(fsa_data, A_LRM_CONNECT, do_lrm_control); } else if (fsa_actions & A_CCM_CONNECT) { #if SUPPORT_HEARTBEAT if (is_heartbeat_cluster()) { do_fsa_action(fsa_data, A_CCM_CONNECT, do_ccm_control); } #endif fsa_actions &= ~A_CCM_CONNECT; } else if (fsa_actions & A_TE_START) { do_fsa_action(fsa_data, A_TE_START, do_te_control); } else if (fsa_actions & A_PE_START) { do_fsa_action(fsa_data, A_PE_START, do_pe_control); - /* sub-system restart */ - } else if ((fsa_actions & O_CIB_RESTART) == O_CIB_RESTART) { - do_fsa_action(fsa_data, O_CIB_RESTART, do_cib_control); - } else if ((fsa_actions & O_PE_RESTART) == O_PE_RESTART) { - do_fsa_action(fsa_data, O_PE_RESTART, do_pe_control); - } else if ((fsa_actions & O_TE_RESTART) == O_TE_RESTART) { - do_fsa_action(fsa_data, O_TE_RESTART, do_te_control); - /* Timers */ /* else if(fsa_actions & O_DC_TIMER_RESTART) { do_fsa_action(fsa_data, O_DC_TIMER_RESTART, do_timer_control) */ ; } else if (fsa_actions & A_DC_TIMER_STOP) { do_fsa_action(fsa_data, A_DC_TIMER_STOP, do_timer_control); } else if (fsa_actions & A_INTEGRATE_TIMER_STOP) { do_fsa_action(fsa_data, A_INTEGRATE_TIMER_STOP, do_timer_control); } else if (fsa_actions & A_INTEGRATE_TIMER_START) { do_fsa_action(fsa_data, A_INTEGRATE_TIMER_START, do_timer_control); } else if (fsa_actions & A_FINALIZE_TIMER_STOP) { do_fsa_action(fsa_data, A_FINALIZE_TIMER_STOP, do_timer_control); } else if (fsa_actions & A_FINALIZE_TIMER_START) { do_fsa_action(fsa_data, A_FINALIZE_TIMER_START, do_timer_control); /* * Highest priority actions */ } else if (fsa_actions & A_MSG_ROUTE) { do_fsa_action(fsa_data, A_MSG_ROUTE, do_msg_route); } else if (fsa_actions & A_RECOVER) { do_fsa_action(fsa_data, A_RECOVER, do_recover); } else if (fsa_actions & A_CL_JOIN_RESULT) { do_fsa_action(fsa_data, A_CL_JOIN_RESULT, do_cl_join_finalize_respond); } else if (fsa_actions & A_CL_JOIN_REQUEST) { do_fsa_action(fsa_data, A_CL_JOIN_REQUEST, do_cl_join_offer_respond); } else if (fsa_actions & A_SHUTDOWN_REQ) { do_fsa_action(fsa_data, A_SHUTDOWN_REQ, do_shutdown_req); } else if (fsa_actions & A_ELECTION_VOTE) { do_fsa_action(fsa_data, A_ELECTION_VOTE, do_election_vote); } else if (fsa_actions & A_ELECTION_COUNT) { do_fsa_action(fsa_data, A_ELECTION_COUNT, do_election_count_vote); } else if (fsa_actions & A_LRM_EVENT) { do_fsa_action(fsa_data, A_LRM_EVENT, do_lrm_event); /* * High priority actions */ } else if (fsa_actions & A_STARTED) { do_fsa_action(fsa_data, A_STARTED, do_started); } else if (fsa_actions & A_CL_JOIN_QUERY) { do_fsa_action(fsa_data, A_CL_JOIN_QUERY, do_cl_join_query); } else if (fsa_actions & A_DC_TIMER_START) { do_fsa_action(fsa_data, A_DC_TIMER_START, do_timer_control); /* * Medium priority actions */ } else if (fsa_actions & A_DC_TAKEOVER) { do_fsa_action(fsa_data, A_DC_TAKEOVER, do_dc_takeover); } else if (fsa_actions & A_DC_RELEASE) { do_fsa_action(fsa_data, A_DC_RELEASE, do_dc_release); } else if (fsa_actions & A_DC_JOIN_FINAL) { do_fsa_action(fsa_data, A_DC_JOIN_FINAL, do_dc_join_final); } else if (fsa_actions & A_ELECTION_CHECK) { do_fsa_action(fsa_data, A_ELECTION_CHECK, do_election_check); } else if (fsa_actions & A_ELECTION_START) { do_fsa_action(fsa_data, A_ELECTION_START, do_election_vote); } else if (fsa_actions & A_TE_HALT) { do_fsa_action(fsa_data, A_TE_HALT, do_te_invoke); } else if (fsa_actions & A_TE_CANCEL) { do_fsa_action(fsa_data, A_TE_CANCEL, do_te_invoke); } else if (fsa_actions & A_DC_JOIN_OFFER_ALL) { do_fsa_action(fsa_data, A_DC_JOIN_OFFER_ALL, do_dc_join_offer_all); } else if (fsa_actions & A_DC_JOIN_OFFER_ONE) { do_fsa_action(fsa_data, A_DC_JOIN_OFFER_ONE, do_dc_join_offer_all); } else if (fsa_actions & A_DC_JOIN_PROCESS_REQ) { do_fsa_action(fsa_data, A_DC_JOIN_PROCESS_REQ, do_dc_join_filter_offer); } else if (fsa_actions & A_DC_JOIN_PROCESS_ACK) { do_fsa_action(fsa_data, A_DC_JOIN_PROCESS_ACK, do_dc_join_ack); /* * Low(er) priority actions * Make sure the CIB is always updated before invoking the * PE, and the PE before the TE */ } else if (fsa_actions & A_DC_JOIN_FINALIZE) { do_fsa_action(fsa_data, A_DC_JOIN_FINALIZE, do_dc_join_finalize); } else if (fsa_actions & A_LRM_INVOKE) { do_fsa_action(fsa_data, A_LRM_INVOKE, do_lrm_invoke); } else if (fsa_actions & A_PE_INVOKE) { do_fsa_action(fsa_data, A_PE_INVOKE, do_pe_invoke); } else if (fsa_actions & A_TE_INVOKE) { do_fsa_action(fsa_data, A_TE_INVOKE, do_te_invoke); } else if (fsa_actions & A_CL_JOIN_ANNOUNCE) { do_fsa_action(fsa_data, A_CL_JOIN_ANNOUNCE, do_cl_join_announce); /* sub-system stop */ } else if (fsa_actions & A_DC_RELEASED) { do_fsa_action(fsa_data, A_DC_RELEASED, do_dc_release); } else if (fsa_actions & A_PE_STOP) { do_fsa_action(fsa_data, A_PE_STOP, do_pe_control); } else if (fsa_actions & A_TE_STOP) { do_fsa_action(fsa_data, A_TE_STOP, do_te_control); } else if (fsa_actions & A_SHUTDOWN) { do_fsa_action(fsa_data, A_SHUTDOWN, do_shutdown); } else if (fsa_actions & A_LRM_DISCONNECT) { do_fsa_action(fsa_data, A_LRM_DISCONNECT, do_lrm_control); } else if (fsa_actions & A_CCM_DISCONNECT) { #if SUPPORT_HEARTBEAT if (is_heartbeat_cluster()) { do_fsa_action(fsa_data, A_CCM_DISCONNECT, do_ccm_control); } #endif fsa_actions &= ~A_CCM_DISCONNECT; } else if (fsa_actions & A_HA_DISCONNECT) { do_fsa_action(fsa_data, A_HA_DISCONNECT, do_ha_control); } else if (fsa_actions & A_CIB_STOP) { do_fsa_action(fsa_data, A_CIB_STOP, do_cib_control); } else if (fsa_actions & A_STOP) { do_fsa_action(fsa_data, A_STOP, do_stop); /* exit gracefully */ } else if (fsa_actions & A_EXIT_0) { do_fsa_action(fsa_data, A_EXIT_0, do_exit); /* Error checking and reporting */ } else { crm_err("Action %s (0x%llx) not supported ", fsa_action2string(fsa_actions), fsa_actions); register_fsa_error_adv(C_FSA_INTERNAL, I_ERROR, fsa_data, NULL, __FUNCTION__); } } } void log_fsa_input(fsa_data_t * stored_msg) { crm_trace("Processing queued input %d", stored_msg->id); if (stored_msg->fsa_cause == C_CCM_CALLBACK) { crm_trace("FSA processing CCM callback from %s", stored_msg->origin); } else if (stored_msg->fsa_cause == C_LRM_OP_CALLBACK) { crm_trace("FSA processing LRM callback from %s", stored_msg->origin); } else if (stored_msg->data == NULL) { crm_trace("FSA processing input from %s", stored_msg->origin); } else { ha_msg_input_t *ha_input = fsa_typed_data_adv(stored_msg, fsa_dt_ha_msg, __FUNCTION__); crm_trace("FSA processing XML message from %s", stored_msg->origin); crm_log_xml_trace(ha_input->xml, "FSA message data"); } } long long do_state_transition(long long actions, enum crmd_fsa_state cur_state, enum crmd_fsa_state next_state, fsa_data_t * msg_data) { long long tmp = actions; gboolean clear_recovery_bit = TRUE; enum crmd_fsa_cause cause = msg_data->fsa_cause; enum crmd_fsa_input current_input = msg_data->fsa_input; const char *state_from = fsa_state2string(cur_state); const char *state_to = fsa_state2string(next_state); const char *input = fsa_input2string(current_input); CRM_LOG_ASSERT(cur_state != next_state); do_dot_log(DOT_PREFIX "\t%s -> %s [ label=%s cause=%s origin=%s ]", state_from, state_to, input, fsa_cause2string(cause), msg_data->origin); crm_notice("State transition %s -> %s [ input=%s cause=%s origin=%s ]", state_from, state_to, input, fsa_cause2string(cause), msg_data->origin); /* the last two clauses might cause trouble later */ if (election_timeout != NULL && next_state != S_ELECTION && cur_state != S_RELEASE_DC) { crm_timer_stop(election_timeout); /* } else { */ /* crm_timer_start(election_timeout); */ } #if 0 if ((fsa_input_register & R_SHUTDOWN)) { set_bit_inplace(tmp, A_DC_TIMER_STOP); } #endif if (next_state == S_INTEGRATION) { set_bit_inplace(tmp, A_INTEGRATE_TIMER_START); } else { set_bit_inplace(tmp, A_INTEGRATE_TIMER_STOP); } if (next_state == S_FINALIZE_JOIN) { set_bit_inplace(tmp, A_FINALIZE_TIMER_START); } else { set_bit_inplace(tmp, A_FINALIZE_TIMER_STOP); } if (next_state != S_PENDING) { set_bit_inplace(tmp, A_DC_TIMER_STOP); } if (next_state != S_ELECTION) { highest_born_on = 0; } if (next_state != S_IDLE) { crm_timer_stop(recheck_timer); } if (cur_state == S_FINALIZE_JOIN && next_state == S_POLICY_ENGINE) { populate_cib_nodes(FALSE); do_update_cib_nodes(TRUE, __FUNCTION__); } switch (next_state) { case S_PENDING: fsa_cib_conn->cmds->set_slave(fsa_cib_conn, cib_scope_local); /* fall through */ case S_ELECTION: crm_trace("Resetting our DC to NULL on transition to %s", fsa_state2string(next_state)); update_dc(NULL); break; case S_NOT_DC: election_trigger->counter = 0; if (is_set(fsa_input_register, R_SHUTDOWN)) { crm_info("(Re)Issuing shutdown request now" " that we have a new DC"); set_bit_inplace(tmp, A_SHUTDOWN_REQ); } CRM_LOG_ASSERT(fsa_our_dc != NULL); if (fsa_our_dc == NULL) { crm_err("Reached S_NOT_DC without a DC" " being recorded"); } break; case S_RECOVERY: clear_recovery_bit = FALSE; break; case S_FINALIZE_JOIN: CRM_LOG_ASSERT(AM_I_DC); if (cause == C_TIMER_POPPED) { crm_warn("Progressed to state %s after %s", fsa_state2string(next_state), fsa_cause2string(cause)); } if (g_hash_table_size(welcomed_nodes) > 0) { char *msg = crm_strdup(" Welcome reply not received from"); crm_warn("%u cluster nodes failed to respond" " to the join offer.", g_hash_table_size(welcomed_nodes)); g_hash_table_foreach(welcomed_nodes, ghash_print_node, msg); crm_free(msg); } else { crm_debug("All %d cluster nodes " "responded to the join offer.", g_hash_table_size(integrated_nodes)); } break; case S_POLICY_ENGINE: election_trigger->counter = 0; CRM_LOG_ASSERT(AM_I_DC); if (cause == C_TIMER_POPPED) { crm_info("Progressed to state %s after %s", fsa_state2string(next_state), fsa_cause2string(cause)); } if (g_hash_table_size(finalized_nodes) > 0) { char *msg = crm_strdup(" Confirm not received from"); crm_err("%u cluster nodes failed to confirm" " their join.", g_hash_table_size(finalized_nodes)); g_hash_table_foreach(finalized_nodes, ghash_print_node, msg); crm_free(msg); } else if (g_hash_table_size(confirmed_nodes) == crm_active_peers()) { crm_debug("All %u cluster nodes are" " eligible to run resources.", crm_active_peers()); } else if (g_hash_table_size(confirmed_nodes) > crm_active_peers()) { crm_err("We have more confirmed nodes than our membership does: %d vs. %d", g_hash_table_size(confirmed_nodes), crm_active_peers()); register_fsa_input(C_FSA_INTERNAL, I_ELECTION, NULL); } else if (saved_ccm_membership_id != crm_peer_seq) { crm_info("Membership changed: %llu -> %llu - join restart", saved_ccm_membership_id, crm_peer_seq); register_fsa_input_before(C_FSA_INTERNAL, I_NODE_JOIN, NULL); } else { crm_warn("Only %u of %u cluster " "nodes are eligible to run resources - continue %d", g_hash_table_size(confirmed_nodes), crm_active_peers(), g_hash_table_size(welcomed_nodes)); } /* initialize_join(FALSE); */ break; case S_STOPPING: case S_TERMINATE: /* possibly redundant */ set_bit_inplace(fsa_input_register, R_SHUTDOWN); break; case S_IDLE: CRM_LOG_ASSERT(AM_I_DC); dump_rsc_info(); if (is_set(fsa_input_register, R_SHUTDOWN)) { crm_info("(Re)Issuing shutdown request now" " that we are the DC"); set_bit_inplace(tmp, A_SHUTDOWN_REQ); } if (recheck_timer->period_ms > 0) { crm_debug("Starting %s", get_timer_desc(recheck_timer)); crm_timer_start(recheck_timer); } break; default: break; } if (clear_recovery_bit && next_state != S_PENDING) { tmp &= ~A_RECOVER; } else if (clear_recovery_bit == FALSE) { tmp |= A_RECOVER; } if (tmp != actions) { /* fsa_dump_actions(actions ^ tmp, "New actions"); */ actions = tmp; } return actions; } void dump_rsc_info(void) { } void ghash_print_node(gpointer key, gpointer value, gpointer user_data) { const char *text = user_data; const char *uname = key; const char *value_s = value; crm_info("%s: %s %s", text, uname, value_s); } diff --git a/crmd/fsa_defines.h b/crmd/fsa_defines.h index 0efefc3668..1d90e69be0 100644 --- a/crmd/fsa_defines.h +++ b/crmd/fsa_defines.h @@ -1,492 +1,493 @@ /* * Copyright (C) 2004 Andrew Beekhof * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef FSA_DEFINES__H # define FSA_DEFINES__H /*====================================== * States the DC/CRMd can be in *======================================*/ enum crmd_fsa_state { S_IDLE = 0, /* Nothing happening */ S_ELECTION, /* Take part in the election algorithm as * described below */ S_INTEGRATION, /* integrate that status of new nodes (which is * all of them if we have just been elected DC) * to form a complete and up-to-date picture of * the CIB */ S_FINALIZE_JOIN, /* integrate that status of new nodes (which is * all of them if we have just been elected DC) * to form a complete and up-to-date picture of * the CIB */ S_NOT_DC, /* we are in crmd/slave mode */ S_POLICY_ENGINE, /* Determin the next stable state of the cluster */ S_RECOVERY, /* Something bad happened, check everything is ok * before continuing and attempt to recover if * required */ S_RELEASE_DC, /* we were the DC, but now we arent anymore, * possibly by our own request, and we should * release all unnecessary sub-systems, finish * any pending actions, do general cleanup and * unset anything that makes us think we are * special :) */ S_STARTING, /* we are just starting out */ S_PENDING, /* we are not a full/active member yet */ S_STOPPING, /* We are in the final stages of shutting down */ S_TERMINATE, /* We are going to shutdown, this is the equiv of * "Sending TERM signal to all processes" in Linux * and in worst case scenarios could be considered * a self STONITH */ S_TRANSITION_ENGINE, /* Attempt to make the calculated next stable * state of the cluster a reality */ S_HALT, /* Freeze - dont do anything * Something ad happened that needs the admin to fix * Wait for I_ELECTION */ /* ----------- Last input found in table is above ---------- */ S_ILLEGAL /* This is an illegal FSA state */ /* (must be last) */ }; # define MAXSTATE S_ILLEGAL /* A state diagram can be constructed from the dc_fsa.dot with the following command: dot -Tpng crmd_fsa.dot > crmd_fsa.png Description: Once we start and do some basic sanity checks, we go into the S_NOT_DC state and await instructions from the DC or input from the CCM which indicates the election algorithm needs to run. If the election algorithm is triggered we enter the S_ELECTION state from where we can either go back to the S_NOT_DC state or progress to the S_INTEGRATION state (or S_RELEASE_DC if we used to be the DC but arent anymore). The election algorithm has been adapted from http://www.cs.indiana.edu/cgi-bin/techreports/TRNNN.cgi?trnum=TR521 Loosly known as the Bully Algorithm, its major points are: - Election is initiated by any node (N) notices that the coordinator is no longer responding - Concurrent multiple elections are possible - Algorithm + N sends ELECTION messages to all nodes that occur earlier in the CCM's membership list. + If no one responds, N wins and becomes coordinator + N sends out COORDINATOR messages to all other nodes in the partition + If one of higher-ups answers, it takes over. N is done. Once the election is complete, if we are the DC, we enter the S_INTEGRATION state which is a DC-in-waiting style state. We are the DC, but we shouldnt do anything yet because we may not have an up-to-date picture of the cluster. There may of course be times when this fails, so we should go back to the S_RECOVERY stage and check everything is ok. We may also end up here if a new node came online, since each node is authorative on itself and we would want to incorporate its information into the CIB. Once we have the latest CIB, we then enter the S_POLICY_ENGINE state where invoke the Policy Engine. It is possible that between invoking the Policy Engine and recieving an answer, that we recieve more input. In this case we would discard the orginal result and invoke it again. Once we are satisfied with the output from the Policy Engine we enter S_TRANSITION_ENGINE and feed the Policy Engine's output to the Transition Engine who attempts to make the Policy Engine's calculation a reality. If the transition completes successfully, we enter S_IDLE, otherwise we go back to S_POLICY_ENGINE with the current unstable state and try again. Of course we may be asked to shutdown at any time, however we must progress to S_NOT_DC before doing so. Once we have handed over DC duties to another node, we can then shut down like everyone else, that is by asking the DC for permission and waiting it to take all our resources away. The case where we are the DC and the only node in the cluster is a special case and handled as an escalation which takes us to S_SHUTDOWN. Similarly if any other point in the shutdown fails or stalls, this is escalated and we end up in S_TERMINATE. At any point, the CRMd/DC can relay messages for its sub-systems, but outbound messages (from sub-systems) should probably be blocked until S_INTEGRATION (for the DC case) or the join protocol has completed (for the CRMd case) */ /*====================================== * * Inputs/Events/Stimuli to be given to the finite state machine * * Some of these a true events, and others a synthesised based on * the "register" (see below) and the contents or source of messages. * * At this point, my plan is to have a loop of some sort that keeps * going until recieving I_NULL * *======================================*/ enum crmd_fsa_input { /* 0 */ I_NULL, /* Nothing happened */ /* 1 */ I_CIB_OP, /* An update to the CIB occurred */ I_CIB_UPDATE, /* An update to the CIB occurred */ I_DC_TIMEOUT, /* We have lost communication with the DC */ I_ELECTION, /* Someone started an election */ I_PE_CALC, /* The Policy Engine needs to be invoked */ I_RELEASE_DC, /* The election completed and we were not * elected, but we were the DC beforehand */ I_ELECTION_DC, /* The election completed and we were (re-)elected * DC */ I_ERROR, /* Something bad happened (more serious than * I_FAIL) and may not have been due to the action * being performed. For example, we may have lost * our connection to the CIB. */ /* 9 */ I_FAIL, /* The action failed to complete successfully */ I_INTEGRATED, I_FINALIZED, I_NODE_JOIN, /* A node has entered the cluster */ I_NOT_DC, /* We are not and were not the DC before or after * the current operation or state */ I_RECOVERED, /* The recovery process completed successfully */ I_RELEASE_FAIL, /* We could not give up DC status for some reason */ I_RELEASE_SUCCESS, /* We are no longer the DC */ I_RESTART, /* The current set of actions needs to be * restarted */ I_TE_SUCCESS, /* Some non-resource, non-ccm action is required * of us, eg. ping */ /* 20 */ I_ROUTER, /* Do our job as router and forward this to the * right place */ I_SHUTDOWN, /* We are asking to shutdown */ I_STOP, /* We have been told to shutdown */ I_TERMINATE, /* Actually exit */ I_STARTUP, I_PE_SUCCESS, /* The action completed successfully */ I_JOIN_OFFER, /* The DC is offering membership */ I_JOIN_REQUEST, /* The client is requesting membership */ I_JOIN_RESULT, /* If not the DC: The result of a join request * Else: A client is responding with its local state info */ I_WAIT_FOR_EVENT, /* we may be waiting for an async task to "happen" * and until it does, we cant do anything else */ I_DC_HEARTBEAT, /* The DC is telling us that it is alive and well */ I_LRM_EVENT, /* 30 */ I_PENDING, I_HALT, /* ------------ Last input found in table is above ----------- */ I_ILLEGAL /* This is an illegal value for an FSA input */ /* (must be last) */ }; # define MAXINPUT I_ILLEGAL # define I_MESSAGE I_ROUTER /*====================================== * * actions * * Some of the actions below will always occur together for now, but I can * forsee that this may not always be the case. So I've spilt them up so * that if they ever do need to be called independantly in the future, it * wont be a problem. * * For example, separating A_LRM_CONNECT from A_STARTUP might be useful * if we ever try to recover from a faulty or disconnected LRM. * *======================================*/ /* Dont do anything */ # define A_NOTHING 0x0000000000000000ULL /* -- Startup actions -- */ /* Hook to perform any actions (other than starting the CIB, * connecting to HA or the CCM) that might be needed as part * of the startup. */ # define A_STARTUP 0x0000000000000001ULL /* Hook to perform any actions that might be needed as part * after startup is successful. */ # define A_STARTED 0x0000000000000002ULL /* Connect to Heartbeat */ # define A_HA_CONNECT 0x0000000000000004ULL # define A_HA_DISCONNECT 0x0000000000000008ULL # define A_INTEGRATE_TIMER_START 0x0000000000000010ULL # define A_INTEGRATE_TIMER_STOP 0x0000000000000020ULL # define A_FINALIZE_TIMER_START 0x0000000000000040ULL # define A_FINALIZE_TIMER_STOP 0x0000000000000080ULL /* -- Election actions -- */ # define A_DC_TIMER_START 0x0000000000000100ULL # define A_DC_TIMER_STOP 0x0000000000000200ULL # define A_ELECTION_COUNT 0x0000000000000400ULL # define A_ELECTION_VOTE 0x0000000000000800ULL # define A_ELECTION_START 0x0000000000001000ULL /* -- Message processing -- */ /* Process the queue of requests */ # define A_MSG_PROCESS 0x0000000000002000ULL /* Send the message to the correct recipient */ # define A_MSG_ROUTE 0x0000000000004000ULL /* Send a welcome message to new node(s) */ # define A_DC_JOIN_OFFER_ONE 0x0000000000008000ULL /* -- Server Join protocol actions -- */ /* Send a welcome message to all nodes */ # define A_DC_JOIN_OFFER_ALL 0x0000000000010000ULL /* Process the remote node's ack of our join message */ # define A_DC_JOIN_PROCESS_REQ 0x0000000000020000ULL /* Send out the reults of the Join phase */ # define A_DC_JOIN_FINALIZE 0x0000000000040000ULL /* Send out the reults of the Join phase */ # define A_DC_JOIN_PROCESS_ACK 0x0000000000080000ULL /* -- Client Join protocol actions -- */ # define A_CL_JOIN_QUERY 0x0000000000100000ULL # define A_CL_JOIN_ANNOUNCE 0x0000000000200000ULL /* Request membership to the DC list */ # define A_CL_JOIN_REQUEST 0x0000000000400000ULL /* Did the DC accept or reject the request */ # define A_CL_JOIN_RESULT 0x0000000000800000ULL /* -- Recovery, DC start/stop -- */ /* Something bad happened, try to recover */ # define A_RECOVER 0x0000000001000000ULL /* Hook to perform any actions (apart from starting, the TE, PE * and gathering the latest CIB) that might be necessary before * giving up the responsibilities of being the DC. */ # define A_DC_RELEASE 0x0000000002000000ULL /* */ # define A_DC_RELEASED 0x0000000004000000ULL /* Hook to perform any actions (apart from starting, the TE, PE * and gathering the latest CIB) that might be necessary before * taking over the responsibilities of being the DC. */ # define A_DC_TAKEOVER 0x0000000008000000ULL /* -- Shutdown actions -- */ # define A_SHUTDOWN 0x0000000010000000ULL # define A_STOP 0x0000000020000000ULL # define A_EXIT_0 0x0000000040000000ULL # define A_EXIT_1 0x0000000080000000ULL # define A_SHUTDOWN_REQ 0x0000000100000000ULL # define A_ELECTION_CHECK 0x0000000200000000ULL # define A_DC_JOIN_FINAL 0x0000000400000000ULL /* -- CCM actions -- */ # define A_CCM_CONNECT 0x0000001000000000ULL # define A_CCM_DISCONNECT 0x0000002000000000ULL /* -- CIB actions -- */ # define A_CIB_START 0x0000020000000000ULL # define A_CIB_STOP 0x0000040000000000ULL /* -- Transition Engine actions -- */ /* Attempt to reach the newly calculated cluster state. This is * only called once per transition (except if it is asked to * stop the transition or start a new one). * Once given a cluster state to reach, the TE will determin * tasks that can be performed in parallel, execute them, wait * for replies and then determin the next set until the new * state is reached or no further tasks can be taken. */ # define A_TE_INVOKE 0x0000100000000000ULL # define A_TE_START 0x0000200000000000ULL # define A_TE_STOP 0x0000400000000000ULL # define A_TE_CANCEL 0x0000800000000000ULL # define A_TE_HALT 0x0001000000000000ULL /* -- Policy Engine actions -- */ /* Calculate the next state for the cluster. This is only * invoked once per needed calculation. */ # define A_PE_INVOKE 0x0002000000000000ULL # define A_PE_START 0x0004000000000000ULL # define A_PE_STOP 0x0008000000000000ULL /* -- Misc actions -- */ /* Add a system generate "block" so that resources arent moved * to or are activly moved away from the affected node. This * way we can return quickly even if busy with other things. */ # define A_NODE_BLOCK 0x0010000000000000ULL /* Update our information in the local CIB */ # define A_UPDATE_NODESTATUS 0x0020000000000000ULL # define A_CIB_BUMPGEN 0x0040000000000000ULL # define A_READCONFIG 0x0080000000000000ULL /* -- LRM Actions -- */ /* Connect to the Local Resource Manager */ # define A_LRM_CONNECT 0x0100000000000000ULL /* Disconnect from the Local Resource Manager */ # define A_LRM_DISCONNECT 0x0200000000000000ULL # define A_LRM_INVOKE 0x0400000000000000ULL # define A_LRM_EVENT 0x0800000000000000ULL /* -- Logging actions -- */ # define A_LOG 0x1000000000000000ULL # define A_ERROR 0x2000000000000000ULL # define A_WARN 0x4000000000000000ULL # define O_EXIT (A_SHUTDOWN|A_STOP|A_CCM_DISCONNECT|A_LRM_DISCONNECT|A_HA_DISCONNECT|A_EXIT_0|A_CIB_STOP) # define O_RELEASE (A_DC_TIMER_STOP|A_DC_RELEASE|A_PE_STOP|A_TE_STOP|A_DC_RELEASED) # define O_PE_RESTART (A_PE_START|A_PE_STOP) # define O_TE_RESTART (A_TE_START|A_TE_STOP) # define O_CIB_RESTART (A_CIB_START|A_CIB_STOP) +# define O_LRM_RECONNECT (A_LRM_CONNECT|A_LRM_DISCONNECT) # define O_DC_TIMER_RESTART (A_DC_TIMER_STOP|A_DC_TIMER_START) /*====================================== * * "register" contents * * Things we may want to remember regardless of which state we are in. * * These also count as inputs for synthesizing I_* * *======================================*/ # define R_THE_DC 0x00000001ULL /* Are we the DC? */ # define R_STARTING 0x00000002ULL /* Are we starting up? */ # define R_SHUTDOWN 0x00000004ULL /* Are we trying to shut down? */ # define R_STAYDOWN 0x00000008ULL /* Should we restart? */ # define R_JOIN_OK 0x00000010ULL /* Have we completed the join process */ # define R_READ_CONFIG 0x00000040ULL # define R_INVOKE_PE 0x00000080ULL /* Does the PE needed to be invoked at the next appropriate point? */ # define R_CIB_CONNECTED 0x00000100ULL /* Is the CIB connected? */ # define R_PE_CONNECTED 0x00000200ULL /* Is the Policy Engine connected? */ # define R_TE_CONNECTED 0x00000400ULL /* Is the Transition Engine connected? */ # define R_LRM_CONNECTED 0x00000800ULL /* Is the Local Resource Manager connected? */ # define R_CIB_REQUIRED 0x00001000ULL /* Is the CIB required? */ # define R_PE_REQUIRED 0x00002000ULL /* Is the Policy Engine required? */ # define R_TE_REQUIRED 0x00004000ULL /* Is the Transition Engine required? */ # define R_ST_REQUIRED 0x00008000ULL /* Is the Stonith daemon required? */ # define R_CIB_DONE 0x00010000ULL /* Have we calculated the CIB? */ # define R_HAVE_CIB 0x00020000ULL /* Do we have an up-to-date CIB */ # define R_CIB_ASKED 0x00040000ULL /* Have we asked for an up-to-date CIB */ # define R_MEMBERSHIP 0x00100000ULL /* Have we got CCM data yet */ # define R_PEER_DATA 0x00200000ULL /* Have we got T_CL_STATUS data yet */ # define R_HA_DISCONNECTED 0x00400000ULL /* did we sign out of our own accord */ # define R_CCM_DISCONNECTED 0x00800000ULL /* did we sign out of our own accord */ # define R_REQ_PEND 0x01000000ULL /* Are there Requests waiting for processing? */ # define R_PE_PEND 0x02000000ULL /* Has the PE been invoked and we're awaiting a reply? */ # define R_TE_PEND 0x04000000ULL /* Has the TE been invoked and we're awaiting completion? */ # define R_RESP_PEND 0x08000000ULL /* Do we have clients waiting on a response? if so perhaps we shouldnt stop yet */ # define R_IN_TRANSITION 0x10000000ULL /* */ # define R_SENT_RSC_STOP 0x20000000ULL /* Have we sent a stop action to all * resources in preparation for * shutting down */ # define R_IN_RECOVERY 0x80000000ULL enum crmd_fsa_cause { C_UNKNOWN = 0, C_STARTUP, C_IPC_MESSAGE, C_HA_MESSAGE, C_CCM_CALLBACK, C_CRMD_STATUS_CALLBACK, C_LRM_OP_CALLBACK, C_LRM_MONITOR_CALLBACK, C_TIMER_POPPED, C_SHUTDOWN, C_HEARTBEAT_FAILED, C_SUBSYSTEM_CONNECT, C_HA_DISCONNECT, C_FSA_INTERNAL, C_ILLEGAL }; extern const char *fsa_input2string(enum crmd_fsa_input input); extern const char *fsa_state2string(enum crmd_fsa_state state); extern const char *fsa_cause2string(enum crmd_fsa_cause cause); extern const char *fsa_action2string(long long action); #endif diff --git a/crmd/fsa_matrix.h b/crmd/fsa_matrix.h index fbfcaad8ee..0316cd0bd4 100644 --- a/crmd/fsa_matrix.h +++ b/crmd/fsa_matrix.h @@ -1,1231 +1,1231 @@ /* * Copyright (C) 2004 Andrew Beekhof * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef XML_FSA_MATRIX__H # define XML_FSA_MATRIX__H /* * The state transition table. The rows are inputs, and * the columns are states. */ const enum crmd_fsa_state crmd_fsa_state[MAXINPUT][MAXSTATE] = { /* Got an I_NULL */ { /* S_IDLE ==> */ S_IDLE, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_INTEGRATION, /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, /* S_NOT_DC ==> */ S_NOT_DC, /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_STARTING, /* S_PENDING ==> */ S_PENDING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, /* S_HALT ==> */ S_HALT, }, /* Got an I_CIB_OP */ { /* S_IDLE ==> */ S_IDLE, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_INTEGRATION, /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, /* S_NOT_DC ==> */ S_NOT_DC, /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_STARTING, /* S_PENDING ==> */ S_PENDING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, /* S_HALT ==> */ S_HALT, }, /* Got an I_CIB_UPDATE */ { /* S_IDLE ==> */ S_IDLE, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_INTEGRATION, /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, /* S_NOT_DC ==> */ S_RECOVERY, /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_RECOVERY, /* S_PENDING ==> */ S_RECOVERY, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, /* S_HALT ==> */ S_HALT, }, /* Got an I_DC_TIMEOUT */ { /* S_IDLE ==> */ S_RECOVERY, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_RECOVERY, /* S_FINALIZE_JOIN ==> */ S_RECOVERY, /* S_NOT_DC ==> */ S_ELECTION, /* S_POLICY_ENGINE ==> */ S_RECOVERY, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RECOVERY, /* S_STARTING ==> */ S_STARTING, /* S_PENDING ==> */ S_ELECTION, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_RECOVERY, /* S_HALT ==> */ S_ELECTION, }, /* Got an I_ELECTION */ { /* S_IDLE ==> */ S_ELECTION, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_ELECTION, /* S_FINALIZE_JOIN ==> */ S_ELECTION, /* S_NOT_DC ==> */ S_ELECTION, /* S_POLICY_ENGINE ==> */ S_ELECTION, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_STARTING, /* S_PENDING ==> */ S_ELECTION, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_ELECTION, /* S_HALT ==> */ S_HALT, }, /* Got an I_PE_CALC */ { /* S_IDLE ==> */ S_POLICY_ENGINE, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_INTEGRATION, /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, /* S_NOT_DC ==> */ S_NOT_DC, /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_RECOVERY, /* S_PENDING ==> */ S_PENDING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_POLICY_ENGINE, /* S_HALT ==> */ S_HALT, }, /* Got an I_RELEASE_DC */ { /* S_IDLE ==> */ S_RELEASE_DC, /* S_ELECTION ==> */ S_RELEASE_DC, /* S_INTEGRATION ==> */ S_RELEASE_DC, /* S_FINALIZE_JOIN ==> */ S_RELEASE_DC, /* S_NOT_DC ==> */ S_NOT_DC, /* S_POLICY_ENGINE ==> */ S_RELEASE_DC, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_RECOVERY, /* S_PENDING ==> */ S_PENDING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_RELEASE_DC, /* S_HALT ==> */ S_HALT, }, /* Got an I_ELECTION_DC */ { /* S_IDLE ==> */ S_INTEGRATION, /* S_ELECTION ==> */ S_INTEGRATION, /* S_INTEGRATION ==> */ S_INTEGRATION, /* S_FINALIZE_JOIN ==> */ S_INTEGRATION, /* S_NOT_DC ==> */ S_INTEGRATION, /* S_POLICY_ENGINE ==> */ S_INTEGRATION, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_RECOVERY, /* S_PENDING ==> */ S_PENDING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_INTEGRATION, /* S_HALT ==> */ S_HALT, }, /* Got an I_ERROR */ { /* S_IDLE ==> */ S_RECOVERY, /* S_ELECTION ==> */ S_RECOVERY, /* S_INTEGRATION ==> */ S_RECOVERY, /* S_FINALIZE_JOIN ==> */ S_RECOVERY, /* S_NOT_DC ==> */ S_RECOVERY, /* S_POLICY_ENGINE ==> */ S_RECOVERY, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RECOVERY, /* S_STARTING ==> */ S_RECOVERY, /* S_PENDING ==> */ S_RECOVERY, /* S_STOPPING ==> */ S_TERMINATE, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_RECOVERY, /* S_HALT ==> */ S_RECOVERY, }, /* Got an I_FAIL */ { /* S_IDLE ==> */ S_RECOVERY, /* S_ELECTION ==> */ S_RELEASE_DC, /* S_INTEGRATION ==> */ S_INTEGRATION, /* S_FINALIZE_JOIN ==> */ S_INTEGRATION, /* S_NOT_DC ==> */ S_RECOVERY, /* S_POLICY_ENGINE ==> */ S_INTEGRATION, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_STOPPING, /* S_PENDING ==> */ S_STOPPING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_POLICY_ENGINE, /* S_HALT ==> */ S_RELEASE_DC, }, /* Got an I_INTEGRATED */ { /* S_IDLE ==> */ S_IDLE, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_FINALIZE_JOIN, /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, /* S_NOT_DC ==> */ S_NOT_DC, /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_RECOVERY, /* S_PENDING ==> */ S_RECOVERY, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, /* S_HALT ==> */ S_HALT, }, /* Got an I_FINALIZED */ { /* S_IDLE ==> */ S_IDLE, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_INTEGRATION, /* S_FINALIZE_JOIN ==> */ S_POLICY_ENGINE, /* S_NOT_DC ==> */ S_NOT_DC, /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_RECOVERY, /* S_PENDING ==> */ S_RECOVERY, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, /* S_HALT ==> */ S_HALT, }, /* Got an I_NODE_JOIN */ { /* S_IDLE ==> */ S_INTEGRATION, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_INTEGRATION, /* S_FINALIZE_JOIN ==> */ S_INTEGRATION, /* S_NOT_DC ==> */ S_NOT_DC, /* S_POLICY_ENGINE ==> */ S_INTEGRATION, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_RECOVERY, /* S_PENDING ==> */ S_PENDING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_INTEGRATION, /* S_HALT ==> */ S_HALT, }, /* Got an I_NOT_DC */ { /* S_IDLE ==> */ S_RECOVERY, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_RECOVERY, /* S_FINALIZE_JOIN ==> */ S_RECOVERY, /* S_NOT_DC ==> */ S_NOT_DC, /* S_POLICY_ENGINE ==> */ S_RECOVERY, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_RECOVERY, /* S_PENDING ==> */ S_NOT_DC, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_RECOVERY, /* S_HALT ==> */ S_HALT, }, /* Got an I_RECOVERED */ { /* S_IDLE ==> */ S_IDLE, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_INTEGRATION, /* S_FINALIZE_JOIN ==> */ S_INTEGRATION, /* S_NOT_DC ==> */ S_NOT_DC, /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, /* S_RECOVERY ==> */ S_PENDING, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_STARTING, /* S_PENDING ==> */ S_PENDING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, /* S_HALT ==> */ S_HALT, }, /* Got an I_RELEASE_FAIL */ { /* S_IDLE ==> */ S_STOPPING, /* S_ELECTION ==> */ S_STOPPING, /* S_INTEGRATION ==> */ S_STOPPING, /* S_FINALIZE_JOIN ==> */ S_STOPPING, /* S_NOT_DC ==> */ S_NOT_DC, /* S_POLICY_ENGINE ==> */ S_STOPPING, /* S_RECOVERY ==> */ S_STOPPING, /* S_RELEASE_DC ==> */ S_STOPPING, /* S_STARTING ==> */ S_RECOVERY, /* S_PENDING ==> */ S_PENDING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_STOPPING, /* S_HALT ==> */ S_HALT, }, /* Got an I_RELEASE_SUCCESS */ { /* S_IDLE ==> */ S_RECOVERY, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_RECOVERY, /* S_FINALIZE_JOIN ==> */ S_RECOVERY, /* S_NOT_DC ==> */ S_NOT_DC, /* S_POLICY_ENGINE ==> */ S_RECOVERY, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_PENDING, /* S_STARTING ==> */ S_RECOVERY, /* S_PENDING ==> */ S_PENDING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_RECOVERY, /* S_HALT ==> */ S_HALT, }, /* Got an I_RESTART */ { /* S_IDLE ==> */ S_IDLE, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_INTEGRATION, /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, /* S_NOT_DC ==> */ S_NOT_DC, /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_STARTING, /* S_PENDING ==> */ S_PENDING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, /* S_HALT ==> */ S_HALT, }, /* Got an I_TE_SUCCESS */ { /* S_IDLE ==> */ S_IDLE, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_INTEGRATION, /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, /* S_NOT_DC ==> */ S_NOT_DC, /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_RECOVERY, /* S_PENDING ==> */ S_PENDING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_IDLE, /* S_HALT ==> */ S_HALT, }, /* Got an I_ROUTER */ { /* S_IDLE ==> */ S_IDLE, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_INTEGRATION, /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, /* S_NOT_DC ==> */ S_NOT_DC, /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_STARTING, /* S_PENDING ==> */ S_PENDING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, /* S_HALT ==> */ S_HALT, }, /* Got an I_SHUTDOWN */ { /* S_IDLE ==> */ S_POLICY_ENGINE, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_INTEGRATION, /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, /* S_NOT_DC ==> */ S_NOT_DC, /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, /* S_RECOVERY ==> */ S_STOPPING, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_STOPPING, /* S_PENDING ==> */ S_PENDING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_POLICY_ENGINE, /* S_HALT ==> */ S_ELECTION, }, /* Got an I_STOP */ { /* S_IDLE ==> */ S_STOPPING, /* S_ELECTION ==> */ S_STOPPING, /* S_INTEGRATION ==> */ S_STOPPING, /* S_FINALIZE_JOIN ==> */ S_STOPPING, /* S_NOT_DC ==> */ S_STOPPING, /* S_POLICY_ENGINE ==> */ S_STOPPING, /* S_RECOVERY ==> */ S_STOPPING, /* S_RELEASE_DC ==> */ S_STOPPING, /* S_STARTING ==> */ S_STOPPING, /* S_PENDING ==> */ S_STOPPING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_STOPPING, /* S_HALT ==> */ S_STOPPING, }, /* Got an I_TERMINATE */ { /* S_IDLE ==> */ S_TERMINATE, /* S_ELECTION ==> */ S_TERMINATE, /* S_INTEGRATION ==> */ S_TERMINATE, /* S_FINALIZE_JOIN ==> */ S_TERMINATE, /* S_NOT_DC ==> */ S_TERMINATE, /* S_POLICY_ENGINE ==> */ S_TERMINATE, /* S_RECOVERY ==> */ S_TERMINATE, /* S_RELEASE_DC ==> */ S_TERMINATE, /* S_STARTING ==> */ S_TERMINATE, /* S_PENDING ==> */ S_TERMINATE, /* S_STOPPING ==> */ S_TERMINATE, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_TERMINATE, /* S_HALT ==> */ S_TERMINATE, }, /* Got an I_STARTUP */ { /* S_IDLE ==> */ S_RECOVERY, /* S_ELECTION ==> */ S_RECOVERY, /* S_INTEGRATION ==> */ S_RECOVERY, /* S_FINALIZE_JOIN ==> */ S_RECOVERY, /* S_NOT_DC ==> */ S_RECOVERY, /* S_POLICY_ENGINE ==> */ S_RECOVERY, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_STARTING, /* S_PENDING ==> */ S_PENDING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_RECOVERY, /* S_HALT ==> */ S_HALT, }, /* Got an I_PE_SUCCESS */ { /* S_IDLE ==> */ S_IDLE, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_INTEGRATION, /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, /* S_NOT_DC ==> */ S_NOT_DC, /* S_POLICY_ENGINE ==> */ S_TRANSITION_ENGINE, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_RECOVERY, /* S_PENDING ==> */ S_PENDING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, /* S_HALT ==> */ S_HALT, }, /* Got an I_JOIN_OFFER */ { /* S_IDLE ==> */ S_IDLE, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_INTEGRATION, /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, /* S_NOT_DC ==> */ S_PENDING, /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_STARTING, /* S_PENDING ==> */ S_PENDING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, /* S_HALT ==> */ S_HALT, }, /* Got an I_JOIN_REQUEST */ { /* S_IDLE ==> */ S_INTEGRATION, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_INTEGRATION, /* S_FINALIZE_JOIN ==> */ S_INTEGRATION, /* S_NOT_DC ==> */ S_NOT_DC, /* S_POLICY_ENGINE ==> */ S_INTEGRATION, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_STARTING, /* S_PENDING ==> */ S_PENDING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_INTEGRATION, /* S_HALT ==> */ S_HALT, }, /* Got an I_JOIN_RESULT */ { /* S_IDLE ==> */ S_INTEGRATION, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_INTEGRATION, /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, /* S_NOT_DC ==> */ S_PENDING, /* S_POLICY_ENGINE ==> */ S_INTEGRATION, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_RECOVERY, /* S_PENDING ==> */ S_PENDING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_INTEGRATION, /* S_HALT ==> */ S_HALT, }, /* Got an I_WAIT_FOR_EVENT */ { /* S_IDLE ==> */ S_IDLE, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_INTEGRATION, /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, /* S_NOT_DC ==> */ S_NOT_DC, /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_STARTING, /* S_PENDING ==> */ S_PENDING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, /* S_HALT ==> */ S_HALT, }, /* Got an I_DC_HEARTBEAT */ { /* S_IDLE ==> */ S_IDLE, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_INTEGRATION, /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, /* S_NOT_DC ==> */ S_NOT_DC, /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_STARTING, /* S_PENDING ==> */ S_PENDING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, /* S_HALT ==> */ S_HALT, }, /* Got an I_LRM_EVENT */ { /* S_IDLE ==> */ S_IDLE, /* S_ELECTION ==> */ S_ELECTION, /* S_INTEGRATION ==> */ S_INTEGRATION, /* S_FINALIZE_JOIN ==> */ S_FINALIZE_JOIN, /* S_NOT_DC ==> */ S_NOT_DC, /* S_POLICY_ENGINE ==> */ S_POLICY_ENGINE, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_STARTING, /* S_PENDING ==> */ S_PENDING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_TRANSITION_ENGINE, /* S_HALT ==> */ S_HALT, }, /* Got an I_PENDING */ { /* S_IDLE ==> */ S_PENDING, /* S_ELECTION ==> */ S_PENDING, /* S_INTEGRATION ==> */ S_PENDING, /* S_FINALIZE_JOIN ==> */ S_PENDING, /* S_NOT_DC ==> */ S_PENDING, /* S_POLICY_ENGINE ==> */ S_PENDING, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_PENDING, /* S_PENDING ==> */ S_PENDING, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_PENDING, /* S_HALT ==> */ S_HALT, }, /* Got an I_HALT */ { /* S_IDLE ==> */ S_HALT, /* S_ELECTION ==> */ S_HALT, /* S_INTEGRATION ==> */ S_HALT, /* S_FINALIZE_JOIN ==> */ S_HALT, /* S_NOT_DC ==> */ S_HALT, /* S_POLICY_ENGINE ==> */ S_HALT, /* S_RECOVERY ==> */ S_RECOVERY, /* S_RELEASE_DC ==> */ S_RELEASE_DC, /* S_STARTING ==> */ S_STARTING, /* S_PENDING ==> */ S_HALT, /* S_STOPPING ==> */ S_STOPPING, /* S_TERMINATE ==> */ S_TERMINATE, /* S_TRANSITION_ENGINE ==> */ S_HALT, /* S_HALT ==> */ S_HALT, }, }; /* * The action table. Each entry is a set of actions to take or-ed * together. Like the state table, the rows are inputs, and * the columns are states. */ /* NOTE: In the fsa, the actions are extracted then state is updated. */ const long long crmd_fsa_actions[MAXINPUT][MAXSTATE] = { /* Got an I_NULL */ { /* S_IDLE ==> */ A_NOTHING, /* S_ELECTION ==> */ A_NOTHING, /* S_INTEGRATION ==> */ A_NOTHING, /* S_FINALIZE_JOIN ==> */ A_NOTHING, /* S_NOT_DC ==> */ A_NOTHING, /* S_POLICY_ENGINE ==> */ A_NOTHING, /* S_RECOVERY ==> */ A_NOTHING, /* S_RELEASE_DC ==> */ A_NOTHING, /* S_STARTING ==> */ A_NOTHING, /* S_PENDING ==> */ A_NOTHING, /* S_STOPPING ==> */ A_NOTHING, /* S_TERMINATE ==> */ A_NOTHING, /* S_TRANSITION_ENGINE ==> */ A_NOTHING, /* S_HALT ==> */ A_NOTHING, }, /* Got an I_CIB_OP */ { /* S_IDLE ==> */ A_ERROR, /* S_ELECTION ==> */ A_ERROR, /* S_INTEGRATION ==> */ A_ERROR, /* S_FINALIZE_JOIN ==> */ A_ERROR, /* S_NOT_DC ==> */ A_ERROR, /* S_POLICY_ENGINE ==> */ A_ERROR, /* S_RECOVERY ==> */ A_ERROR, /* S_RELEASE_DC ==> */ A_ERROR, /* S_STARTING ==> */ A_ERROR, /* S_PENDING ==> */ A_ERROR, /* S_STOPPING ==> */ A_ERROR, /* S_TERMINATE ==> */ A_ERROR, /* S_TRANSITION_ENGINE ==> */ A_ERROR, /* S_HALT ==> */ A_ERROR, }, /* Got an I_CIB_UPDATE */ { /* S_IDLE ==> */ A_LOG, /* S_ELECTION ==> */ A_LOG, /* S_INTEGRATION ==> */ A_WARN, /* S_FINALIZE_JOIN ==> */ A_WARN, /* S_NOT_DC ==> */ A_WARN, /* S_POLICY_ENGINE ==> */ A_LOG, /* S_RECOVERY ==> */ A_WARN, /* S_RELEASE_DC ==> */ A_WARN, /* S_STARTING ==> */ A_WARN, /* S_PENDING ==> */ A_WARN, /* S_STOPPING ==> */ A_WARN, /* S_TERMINATE ==> */ A_WARN, /* S_TRANSITION_ENGINE ==> */ A_LOG, /* S_HALT ==> */ A_WARN, }, /* Got an I_DC_TIMEOUT */ { /* S_IDLE ==> */ A_WARN, /* S_ELECTION ==> */ A_ELECTION_VOTE, /* S_INTEGRATION ==> */ A_WARN, /* S_FINALIZE_JOIN ==> */ A_WARN, /* S_NOT_DC ==> */ A_ELECTION_VOTE | A_WARN, /* S_POLICY_ENGINE ==> */ A_WARN, /* S_RECOVERY ==> */ A_NOTHING, /* S_RELEASE_DC ==> */ A_WARN, /* S_STARTING ==> */ A_WARN, /* S_PENDING ==> */ A_ELECTION_VOTE | A_WARN, /* S_STOPPING ==> */ A_NOTHING, /* S_TERMINATE ==> */ A_NOTHING, /* S_TRANSITION_ENGINE ==> */ A_TE_CANCEL | A_WARN, /* S_HALT ==> */ A_WARN, }, /* Got an I_ELECTION */ { /* S_IDLE ==> */ A_ELECTION_VOTE, /* S_ELECTION ==> */ A_ELECTION_VOTE, /* S_INTEGRATION ==> */ A_ELECTION_VOTE, /* S_FINALIZE_JOIN ==> */ A_ELECTION_VOTE, /* S_NOT_DC ==> */ A_ELECTION_VOTE, /* S_POLICY_ENGINE ==> */ A_ELECTION_VOTE, /* S_RECOVERY ==> */ A_LOG, /* S_RELEASE_DC ==> */ A_LOG, /* S_STARTING ==> */ A_WARN, /* S_PENDING ==> */ A_ELECTION_VOTE, /* S_STOPPING ==> */ A_LOG, /* S_TERMINATE ==> */ A_LOG, /* S_TRANSITION_ENGINE ==> */ A_ELECTION_VOTE, /* S_HALT ==> */ A_ELECTION_VOTE, }, /* Got an I_PE_CALC */ { /* S_IDLE ==> */ A_PE_INVOKE, /* S_ELECTION ==> */ A_NOTHING, /* S_INTEGRATION ==> */ A_NOTHING, /* S_FINALIZE_JOIN ==> */ A_NOTHING, /* S_NOT_DC ==> */ A_WARN, /* S_POLICY_ENGINE ==> */ A_PE_INVOKE, /* S_RECOVERY ==> */ A_NOTHING, /* S_RELEASE_DC ==> */ A_NOTHING, /* S_STARTING ==> */ A_ERROR, /* S_PENDING ==> */ A_WARN, /* S_STOPPING ==> */ A_WARN, /* S_TERMINATE ==> */ A_ERROR, /* S_TRANSITION_ENGINE ==> */ A_PE_INVOKE, /* S_HALT ==> */ A_ERROR, }, /* Got an I_RELEASE_DC */ { /* S_IDLE ==> */ O_RELEASE, /* S_ELECTION ==> */ O_RELEASE, /* S_INTEGRATION ==> */ O_RELEASE | A_WARN, /* S_FINALIZE_JOIN ==> */ O_RELEASE | A_WARN, /* S_NOT_DC ==> */ A_WARN, /* S_POLICY_ENGINE ==> */ O_RELEASE | A_WARN, /* S_RECOVERY ==> */ O_RELEASE, /* S_RELEASE_DC ==> */ O_RELEASE | A_WARN, /* S_STARTING ==> */ A_ERROR, /* S_PENDING ==> */ A_WARN, /* S_STOPPING ==> */ A_WARN, /* S_TERMINATE ==> */ A_WARN, /* S_TRANSITION_ENGINE ==> */ O_RELEASE | A_WARN, /* S_HALT ==> */ A_WARN, }, /* Got an I_ELECTION_DC */ { /* S_IDLE ==> */ A_WARN | A_ELECTION_VOTE, /* S_ELECTION ==> */ A_LOG | A_DC_TAKEOVER | A_PE_START | A_TE_START | A_DC_JOIN_OFFER_ALL | A_DC_TIMER_STOP, /* S_INTEGRATION ==> */ A_WARN | A_ELECTION_VOTE | A_DC_JOIN_OFFER_ALL, /* S_FINALIZE_JOIN ==> */ A_WARN | A_ELECTION_VOTE | A_DC_JOIN_OFFER_ALL, /* S_NOT_DC ==> */ A_LOG | A_ELECTION_VOTE, /* S_POLICY_ENGINE ==> */ A_WARN | A_ELECTION_VOTE, /* S_RECOVERY ==> */ A_WARN, /* S_RELEASE_DC ==> */ A_WARN | A_ELECTION_VOTE, /* S_STARTING ==> */ A_LOG | A_WARN, /* S_PENDING ==> */ A_LOG | A_WARN, /* S_STOPPING ==> */ A_WARN, /* S_TERMINATE ==> */ A_WARN, /* S_TRANSITION_ENGINE ==> */ A_WARN | A_ELECTION_VOTE, /* S_HALT ==> */ A_WARN, }, /* Got an I_ERROR */ { /* S_IDLE ==> */ A_ERROR | A_RECOVER | O_RELEASE | A_ELECTION_START, /* S_ELECTION ==> */ A_ERROR | A_RECOVER | O_RELEASE, /* S_INTEGRATION ==> */ A_ERROR | A_RECOVER | O_RELEASE | A_ELECTION_START, /* S_FINALIZE_JOIN ==> */ A_ERROR | A_RECOVER | O_RELEASE | A_ELECTION_START, /* S_NOT_DC ==> */ A_ERROR | A_RECOVER, /* S_POLICY_ENGINE ==> */ A_ERROR | A_RECOVER | O_RELEASE | A_ELECTION_START, /* S_RECOVERY ==> */ A_ERROR | O_RELEASE, /* S_RELEASE_DC ==> */ A_ERROR | A_RECOVER, /* S_STARTING ==> */ A_ERROR | A_RECOVER, /* S_PENDING ==> */ A_ERROR | A_RECOVER, /* S_STOPPING ==> */ A_ERROR | A_EXIT_1, /* S_TERMINATE ==> */ A_ERROR | A_EXIT_1, /* S_TRANSITION_ENGINE ==> */ A_ERROR | A_RECOVER | O_RELEASE | A_ELECTION_START, /* S_HALT ==> */ A_ERROR | A_RECOVER | O_RELEASE | A_ELECTION_START, }, /* Got an I_FAIL */ { /* S_IDLE ==> */ A_WARN, /* S_ELECTION ==> */ A_WARN, /* S_INTEGRATION ==> */ A_WARN | A_DC_JOIN_OFFER_ALL, /* S_FINALIZE_JOIN ==> */ A_WARN | A_DC_JOIN_OFFER_ALL, /* S_NOT_DC ==> */ A_WARN, /* S_POLICY_ENGINE ==> */ A_WARN | A_DC_JOIN_OFFER_ALL | A_TE_CANCEL, /* S_RECOVERY ==> */ A_WARN | O_RELEASE, /* S_RELEASE_DC ==> */ A_WARN, /* S_STARTING ==> */ A_WARN, /* S_PENDING ==> */ A_WARN, /* S_STOPPING ==> */ A_WARN, /* S_TERMINATE ==> */ A_WARN | A_EXIT_1, - /* S_TRANSITION_ENGINE ==> */ A_WARN | O_TE_RESTART | A_RECOVER, + /* S_TRANSITION_ENGINE ==> */ A_WARN | O_LRM_RECONNECT, /* S_HALT ==> */ A_WARN, }, /* Got an I_INTEGRATED */ { /* S_IDLE ==> */ A_NOTHING, /* S_ELECTION ==> */ A_WARN, /* S_INTEGRATION ==> */ A_DC_JOIN_FINALIZE, /* S_FINALIZE_JOIN ==> */ A_WARN, /* S_NOT_DC ==> */ A_WARN, /* S_POLICY_ENGINE ==> */ A_NOTHING, /* S_RECOVERY ==> */ A_WARN, /* S_RELEASE_DC ==> */ A_WARN, /* S_STARTING ==> */ A_WARN, /* S_PENDING ==> */ A_WARN, /* S_STOPPING ==> */ A_WARN, /* S_TERMINATE ==> */ A_WARN, /* S_TRANSITION_ENGINE ==> */ A_NOTHING, /* S_HALT ==> */ A_WARN, }, /* Got an I_FINALIZED */ { /* S_IDLE ==> */ A_NOTHING, /* S_ELECTION ==> */ A_WARN, /* S_INTEGRATION ==> */ A_WARN, /* S_FINALIZE_JOIN ==> */ A_DC_JOIN_FINAL | A_TE_CANCEL, /* S_NOT_DC ==> */ A_WARN, /* S_POLICY_ENGINE ==> */ A_NOTHING, /* S_RECOVERY ==> */ A_WARN, /* S_RELEASE_DC ==> */ A_WARN, /* S_STARTING ==> */ A_WARN, /* S_PENDING ==> */ A_WARN, /* S_STOPPING ==> */ A_WARN, /* S_TERMINATE ==> */ A_WARN, /* S_TRANSITION_ENGINE ==> */ A_NOTHING, /* S_HALT ==> */ A_WARN, }, /* Got an I_NODE_JOIN */ { /* S_IDLE ==> */ A_TE_HALT | A_DC_JOIN_OFFER_ONE, /* S_ELECTION ==> */ A_WARN, /* S_INTEGRATION ==> */ A_DC_JOIN_OFFER_ONE, /* S_FINALIZE_JOIN ==> */ A_DC_JOIN_OFFER_ONE, /* S_NOT_DC ==> */ A_WARN, /* S_POLICY_ENGINE ==> */ A_DC_JOIN_OFFER_ONE, /* S_RECOVERY ==> */ A_WARN, /* S_RELEASE_DC ==> */ A_WARN, /* S_STARTING ==> */ A_WARN, /* S_PENDING ==> */ A_WARN, /* S_STOPPING ==> */ A_WARN, /* S_TERMINATE ==> */ A_WARN, /* S_TRANSITION_ENGINE ==> */ A_TE_HALT | A_DC_JOIN_OFFER_ONE, /* S_HALT ==> */ A_WARN, }, /* Got an I_NOT_DC */ { /* S_IDLE ==> */ A_WARN | O_RELEASE, /* S_ELECTION ==> */ A_ERROR | A_ELECTION_START | A_DC_TIMER_STOP, /* S_INTEGRATION ==> */ A_ERROR | O_RELEASE, /* S_FINALIZE_JOIN ==> */ A_ERROR | O_RELEASE, /* S_NOT_DC ==> */ A_LOG, /* S_POLICY_ENGINE ==> */ A_ERROR | O_RELEASE, /* S_RECOVERY ==> */ A_ERROR | O_RELEASE, /* S_RELEASE_DC ==> */ A_ERROR | O_RELEASE, /* S_STARTING ==> */ A_WARN, /* S_PENDING ==> */ A_LOG | A_DC_TIMER_STOP, /* S_STOPPING ==> */ A_WARN, /* S_TERMINATE ==> */ A_WARN, /* S_TRANSITION_ENGINE ==> */ A_ERROR | O_RELEASE, /* S_HALT ==> */ A_WARN, }, /* Got an I_RECOVERED */ { /* S_IDLE ==> */ A_WARN, /* S_ELECTION ==> */ A_ELECTION_VOTE, /* S_INTEGRATION ==> */ A_WARN, /* S_FINALIZE_JOIN ==> */ A_WARN, /* S_NOT_DC ==> */ A_WARN, /* S_POLICY_ENGINE ==> */ A_WARN, /* S_RECOVERY ==> */ A_LOG, /* S_RELEASE_DC ==> */ A_WARN, /* S_STARTING ==> */ A_WARN, /* S_PENDING ==> */ A_WARN, /* S_STOPPING ==> */ A_WARN, /* S_TERMINATE ==> */ A_WARN, /* S_TRANSITION_ENGINE ==> */ A_WARN, /* S_HALT ==> */ A_WARN, }, /* Got an I_RELEASE_FAIL */ { /* S_IDLE ==> */ A_WARN, /* S_ELECTION ==> */ A_WARN, /* S_INTEGRATION ==> */ A_WARN, /* S_FINALIZE_JOIN ==> */ A_WARN, /* S_NOT_DC ==> */ A_WARN, /* S_POLICY_ENGINE ==> */ A_NOTHING, /* S_RECOVERY ==> */ A_WARN | A_SHUTDOWN_REQ, /* S_RELEASE_DC ==> */ A_NOTHING, /* S_STARTING ==> */ A_WARN, /* S_PENDING ==> */ A_WARN, /* S_STOPPING ==> */ A_WARN, /* S_TERMINATE ==> */ A_WARN, /* S_TRANSITION_ENGINE ==> */ A_WARN, /* S_HALT ==> */ A_WARN, }, /* Got an I_RELEASE_SUCCESS */ { /* S_IDLE ==> */ A_WARN, /* S_ELECTION ==> */ A_WARN, /* S_INTEGRATION ==> */ A_WARN, /* S_FINALIZE_JOIN ==> */ A_WARN, /* S_NOT_DC ==> */ A_WARN, /* S_POLICY_ENGINE ==> */ A_WARN, /* S_RECOVERY ==> */ A_WARN, /* S_RELEASE_DC ==> */ A_LOG, /* S_STARTING ==> */ A_WARN, /* S_PENDING ==> */ A_LOG, /* S_STOPPING ==> */ A_WARN, /* S_TERMINATE ==> */ A_WARN, /* S_TRANSITION_ENGINE ==> */ A_WARN, /* S_HALT ==> */ A_WARN, }, /* Got an I_RESTART */ { /* S_IDLE ==> */ A_NOTHING, /* S_ELECTION ==> */ A_LOG | A_ELECTION_VOTE, /* S_INTEGRATION ==> */ A_LOG | A_DC_JOIN_OFFER_ALL, /* S_FINALIZE_JOIN ==> */ A_LOG | A_DC_JOIN_FINALIZE, /* S_NOT_DC ==> */ A_LOG | A_NOTHING, /* S_POLICY_ENGINE ==> */ A_LOG | A_PE_INVOKE, /* S_RECOVERY ==> */ A_LOG | A_RECOVER | O_RELEASE, /* S_RELEASE_DC ==> */ A_LOG | O_RELEASE, /* S_STARTING ==> */ A_LOG, /* S_PENDING ==> */ A_LOG, /* S_STOPPING ==> */ A_LOG, /* S_TERMINATE ==> */ A_LOG, /* S_TRANSITION_ENGINE ==> */ A_LOG | A_TE_INVOKE, /* S_HALT ==> */ A_WARN, }, /* Got an I_TE_SUCCESS */ { /* S_IDLE ==> */ A_LOG, /* S_ELECTION ==> */ A_WARN, /* S_INTEGRATION ==> */ A_WARN, /* S_FINALIZE_JOIN ==> */ A_WARN, /* S_NOT_DC ==> */ A_ERROR, /* S_POLICY_ENGINE ==> */ A_WARN, /* S_RECOVERY ==> */ A_RECOVER | A_WARN, /* S_RELEASE_DC ==> */ A_WARN, /* S_STARTING ==> */ A_ERROR, /* S_PENDING ==> */ A_ERROR, /* S_STOPPING ==> */ A_WARN, /* S_TERMINATE ==> */ A_WARN, /* S_TRANSITION_ENGINE ==> */ A_LOG, /* S_HALT ==> */ A_WARN, }, /* Got an I_ROUTER */ { /* S_IDLE ==> */ A_MSG_ROUTE, /* S_ELECTION ==> */ A_MSG_ROUTE, /* S_INTEGRATION ==> */ A_MSG_ROUTE, /* S_FINALIZE_JOIN ==> */ A_MSG_ROUTE, /* S_NOT_DC ==> */ A_MSG_ROUTE, /* S_POLICY_ENGINE ==> */ A_MSG_ROUTE, /* S_RECOVERY ==> */ A_MSG_ROUTE, /* S_RELEASE_DC ==> */ A_MSG_ROUTE, /* S_STARTING ==> */ A_MSG_ROUTE, /* S_PENDING ==> */ A_MSG_ROUTE, /* S_STOPPING ==> */ A_MSG_ROUTE, /* S_TERMINATE ==> */ A_MSG_ROUTE, /* S_TRANSITION_ENGINE ==> */ A_MSG_ROUTE, /* S_HALT ==> */ A_WARN | A_MSG_ROUTE, }, /* Got an I_SHUTDOWN */ { /* S_IDLE ==> */ A_LOG | A_SHUTDOWN_REQ, /* S_ELECTION ==> */ A_LOG | A_SHUTDOWN_REQ | A_ELECTION_VOTE, /* S_INTEGRATION ==> */ A_LOG | A_SHUTDOWN_REQ, /* S_FINALIZE_JOIN ==> */ A_LOG | A_SHUTDOWN_REQ, /* S_NOT_DC ==> */ A_SHUTDOWN_REQ, /* S_POLICY_ENGINE ==> */ A_LOG | A_SHUTDOWN_REQ, /* S_RECOVERY ==> */ A_WARN | O_EXIT | O_RELEASE, /* S_RELEASE_DC ==> */ A_WARN | A_SHUTDOWN_REQ, /* S_STARTING ==> */ A_WARN | O_EXIT, /* S_PENDING ==> */ A_SHUTDOWN_REQ, /* S_STOPPING ==> */ A_LOG, /* S_TERMINATE ==> */ A_LOG, /* S_TRANSITION_ENGINE ==> */ A_WARN | A_SHUTDOWN_REQ, /* S_HALT ==> */ A_WARN | A_ELECTION_START | A_SHUTDOWN_REQ, }, /* Got an I_STOP */ { /* S_IDLE ==> */ A_ERROR | O_RELEASE | O_EXIT, /* S_ELECTION ==> */ O_RELEASE | O_EXIT, /* S_INTEGRATION ==> */ A_WARN | O_RELEASE | O_EXIT, /* S_FINALIZE_JOIN ==> */ A_ERROR | O_RELEASE | O_EXIT, /* S_NOT_DC ==> */ O_EXIT, /* S_POLICY_ENGINE ==> */ A_WARN | O_RELEASE | O_EXIT, /* S_RECOVERY ==> */ A_ERROR | O_RELEASE | O_EXIT, /* S_RELEASE_DC ==> */ A_ERROR | O_RELEASE | O_EXIT, /* S_STARTING ==> */ O_EXIT, /* S_PENDING ==> */ O_EXIT, /* S_STOPPING ==> */ O_EXIT, /* S_TERMINATE ==> */ A_ERROR | A_EXIT_1, /* S_TRANSITION_ENGINE ==> */ A_LOG | O_RELEASE | O_EXIT, /* S_HALT ==> */ O_RELEASE | O_EXIT | A_WARN, }, /* Got an I_TERMINATE */ { /* S_IDLE ==> */ A_ERROR | O_EXIT, /* S_ELECTION ==> */ A_ERROR | O_EXIT, /* S_INTEGRATION ==> */ A_ERROR | O_EXIT, /* S_FINALIZE_JOIN ==> */ A_ERROR | O_EXIT, /* S_NOT_DC ==> */ A_ERROR | O_EXIT, /* S_POLICY_ENGINE ==> */ A_ERROR | O_EXIT, /* S_RECOVERY ==> */ A_ERROR | O_EXIT, /* S_RELEASE_DC ==> */ A_ERROR | O_EXIT, /* S_STARTING ==> */ O_EXIT, /* S_PENDING ==> */ A_ERROR | O_EXIT, /* S_STOPPING ==> */ O_EXIT, /* S_TERMINATE ==> */ O_EXIT, /* S_TRANSITION_ENGINE ==> */ A_ERROR | O_EXIT, /* S_HALT ==> */ A_ERROR | O_EXIT, }, /* Got an I_STARTUP */ { /* S_IDLE ==> */ A_WARN, /* S_ELECTION ==> */ A_WARN, /* S_INTEGRATION ==> */ A_WARN, /* S_FINALIZE_JOIN ==> */ A_WARN, /* S_NOT_DC ==> */ A_WARN, /* S_POLICY_ENGINE ==> */ A_WARN, /* S_RECOVERY ==> */ A_WARN, /* S_RELEASE_DC ==> */ A_WARN, /* S_STARTING ==> */ A_LOG | A_STARTUP | A_CIB_START | A_LRM_CONNECT | A_CCM_CONNECT | A_HA_CONNECT | A_READCONFIG | A_STARTED, /* S_PENDING ==> */ A_LOG, /* S_STOPPING ==> */ A_WARN, /* S_TERMINATE ==> */ A_WARN, /* S_TRANSITION_ENGINE ==> */ A_WARN, /* S_HALT ==> */ A_WARN, }, /* Got an I_PE_SUCCESS */ { /* S_IDLE ==> */ A_LOG, /* S_ELECTION ==> */ A_WARN, /* S_INTEGRATION ==> */ A_WARN, /* S_FINALIZE_JOIN ==> */ A_WARN, /* S_NOT_DC ==> */ A_NOTHING, /* S_POLICY_ENGINE ==> */ A_TE_INVOKE, /* S_RECOVERY ==> */ A_RECOVER | A_LOG, /* S_RELEASE_DC ==> */ A_LOG, /* S_STARTING ==> */ A_ERROR, /* S_PENDING ==> */ A_LOG, /* S_STOPPING ==> */ A_ERROR, /* S_TERMINATE ==> */ A_ERROR, /* S_TRANSITION_ENGINE ==> */ A_LOG, /* S_HALT ==> */ A_WARN, }, /* Got an I_JOIN_OFFER */ { /* S_IDLE ==> */ A_WARN | A_CL_JOIN_REQUEST, /* S_ELECTION ==> */ A_WARN | A_ELECTION_VOTE, /* S_INTEGRATION ==> */ A_CL_JOIN_REQUEST, /* S_FINALIZE_JOIN ==> */ A_CL_JOIN_REQUEST, /* S_NOT_DC ==> */ A_CL_JOIN_REQUEST | A_DC_TIMER_STOP, /* S_POLICY_ENGINE ==> */ A_WARN | A_CL_JOIN_REQUEST, /* S_RECOVERY ==> */ A_WARN | A_CL_JOIN_REQUEST | A_DC_TIMER_STOP, /* S_RELEASE_DC ==> */ A_WARN | A_CL_JOIN_REQUEST | A_DC_TIMER_STOP, /* S_STARTING ==> */ A_LOG, /* S_PENDING ==> */ A_CL_JOIN_REQUEST | A_DC_TIMER_STOP, /* S_STOPPING ==> */ A_LOG, /* S_TERMINATE ==> */ A_LOG, /* S_TRANSITION_ENGINE ==> */ A_WARN | A_CL_JOIN_REQUEST, /* S_HALT ==> */ A_WARN, }, /* Got an I_JOIN_REQUEST */ { /* S_IDLE ==> */ A_DC_JOIN_OFFER_ONE, /* S_ELECTION ==> */ A_WARN, /* S_INTEGRATION ==> */ A_DC_JOIN_PROCESS_REQ, /* S_FINALIZE_JOIN ==> */ A_DC_JOIN_OFFER_ONE, /* S_NOT_DC ==> */ A_WARN, /* S_POLICY_ENGINE ==> */ A_DC_JOIN_OFFER_ONE, /* S_RECOVERY ==> */ A_WARN, /* S_RELEASE_DC ==> */ A_WARN, /* S_STARTING ==> */ A_WARN, /* S_PENDING ==> */ A_WARN, /* S_STOPPING ==> */ A_WARN, /* S_TERMINATE ==> */ A_WARN, /* S_TRANSITION_ENGINE ==> */ A_DC_JOIN_OFFER_ONE, /* S_HALT ==> */ A_WARN, }, /* Got an I_JOIN_RESULT */ { /* S_IDLE ==> */ A_ERROR | A_TE_HALT | A_DC_JOIN_OFFER_ALL, /* S_ELECTION ==> */ A_LOG, /* S_INTEGRATION ==> */ A_LOG, /* S_FINALIZE_JOIN ==> */ A_CL_JOIN_RESULT | A_DC_JOIN_PROCESS_ACK, /* S_NOT_DC ==> */ A_ERROR | A_CL_JOIN_ANNOUNCE, /* S_POLICY_ENGINE ==> */ A_ERROR | A_TE_HALT | A_DC_JOIN_OFFER_ALL, /* S_RECOVERY ==> */ A_LOG, /* S_RELEASE_DC ==> */ A_LOG, /* S_STARTING ==> */ A_ERROR, /* S_PENDING ==> */ A_CL_JOIN_RESULT, /* S_STOPPING ==> */ A_ERROR, /* S_TERMINATE ==> */ A_ERROR, /* S_TRANSITION_ENGINE ==> */ A_ERROR | A_TE_HALT | A_DC_JOIN_OFFER_ALL, /* S_HALT ==> */ A_WARN, }, /* Got an I_WAIT_FOR_EVENT */ { /* S_IDLE ==> */ A_LOG, /* S_ELECTION ==> */ A_LOG, /* S_INTEGRATION ==> */ A_LOG, /* S_FINALIZE_JOIN ==> */ A_LOG, /* S_NOT_DC ==> */ A_LOG, /* S_POLICY_ENGINE ==> */ A_LOG, /* S_RECOVERY ==> */ A_LOG, /* S_RELEASE_DC ==> */ A_LOG, /* S_STARTING ==> */ A_LOG, /* S_PENDING ==> */ A_LOG, /* S_STOPPING ==> */ A_LOG, /* S_TERMINATE ==> */ A_LOG, /* S_TRANSITION_ENGINE ==> */ A_LOG, /* S_HALT ==> */ A_WARN, }, /* Got an I_DC_HEARTBEAT */ { /* S_IDLE ==> */ A_ERROR, /* S_ELECTION ==> */ A_WARN | A_ELECTION_VOTE, /* S_INTEGRATION ==> */ A_ERROR, /* S_FINALIZE_JOIN ==> */ A_ERROR, /* S_NOT_DC ==> */ A_NOTHING, /* S_POLICY_ENGINE ==> */ A_ERROR, /* S_RECOVERY ==> */ A_NOTHING, /* S_RELEASE_DC ==> */ A_LOG, /* S_STARTING ==> */ A_LOG, /* S_PENDING ==> */ A_LOG | A_CL_JOIN_ANNOUNCE, /* S_STOPPING ==> */ A_NOTHING, /* S_TERMINATE ==> */ A_NOTHING, /* S_TRANSITION_ENGINE ==> */ A_ERROR, /* S_HALT ==> */ A_WARN, }, /* Got an I_LRM_EVENT */ { /* S_IDLE ==> */ A_LRM_EVENT, /* S_ELECTION ==> */ A_LRM_EVENT, /* S_INTEGRATION ==> */ A_LRM_EVENT, /* S_FINALIZE_JOIN ==> */ A_LRM_EVENT, /* S_NOT_DC ==> */ A_LRM_EVENT, /* S_POLICY_ENGINE ==> */ A_LRM_EVENT, /* S_RECOVERY ==> */ A_LRM_EVENT, /* S_RELEASE_DC ==> */ A_LRM_EVENT, /* S_STARTING ==> */ A_LRM_EVENT, /* S_PENDING ==> */ A_LRM_EVENT, /* S_STOPPING ==> */ A_LRM_EVENT, /* S_TERMINATE ==> */ A_LRM_EVENT, /* S_TRANSITION_ENGINE ==> */ A_LRM_EVENT, /* S_HALT ==> */ A_WARN, }, /* For everyone ending up in S_PENDING, (re)start the DC timer and wait for I_JOIN_OFFER or I_NOT_DC */ /* Got an I_PENDING */ { /* S_IDLE ==> */ O_RELEASE | O_DC_TIMER_RESTART, /* S_ELECTION ==> */ O_RELEASE | O_DC_TIMER_RESTART, /* S_INTEGRATION ==> */ O_RELEASE | O_DC_TIMER_RESTART, /* S_FINALIZE_JOIN ==> */ O_RELEASE | O_DC_TIMER_RESTART, /* S_NOT_DC ==> */ A_LOG | O_DC_TIMER_RESTART, /* S_POLICY_ENGINE ==> */ O_RELEASE | O_DC_TIMER_RESTART, /* S_RECOVERY ==> */ A_WARN, /* S_RELEASE_DC ==> */ A_WARN | O_DC_TIMER_RESTART, /* S_STARTING ==> */ A_LOG | A_DC_TIMER_START | A_CL_JOIN_QUERY, /* S_PENDING ==> */ A_LOG | O_DC_TIMER_RESTART, /* S_STOPPING ==> */ A_WARN, /* S_TERMINATE ==> */ A_WARN, /* S_TRANSITION_ENGINE ==> */ O_RELEASE | O_DC_TIMER_RESTART, /* S_HALT ==> */ A_WARN, }, /* Got an I_HALT */ { /* S_IDLE ==> */ A_WARN, /* S_ELECTION ==> */ A_WARN, /* S_INTEGRATION ==> */ A_WARN, /* S_FINALIZE_JOIN ==> */ A_WARN, /* S_NOT_DC ==> */ A_WARN, /* S_POLICY_ENGINE ==> */ A_WARN, /* S_RECOVERY ==> */ A_WARN, /* S_RELEASE_DC ==> */ A_WARN, /* S_STARTING ==> */ A_WARN, /* S_PENDING ==> */ A_WARN, /* S_STOPPING ==> */ A_WARN, /* S_TERMINATE ==> */ A_WARN, /* S_TRANSITION_ENGINE ==> */ A_WARN, /* S_HALT ==> */ A_WARN, }, }; #endif diff --git a/crmd/lrm.c b/crmd/lrm.c index a3c9215639..d2698822d1 100644 --- a/crmd/lrm.c +++ b/crmd/lrm.c @@ -1,2081 +1,2093 @@ /* * Copyright (C) 2004 Andrew Beekhof * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define START_DELAY_THRESHOLD 5 * 60 * 1000 typedef struct resource_history_s { char *id; lrm_rsc_t rsc; lrm_op_t *last; lrm_op_t *failed; GList *recurring_op_list; } rsc_history_t; struct recurring_op_s { char *rsc_id; char *op_key; int call_id; int interval; gboolean remove; gboolean cancelled; }; struct pending_deletion_op_s { char *rsc; ha_msg_input_t *input; }; struct delete_event_s { int rc; const char *rsc; }; GHashTable *resource_history = NULL; GHashTable *pending_ops = NULL; GHashTable *deletion_ops = NULL; GCHSource *lrm_source = NULL; int num_lrm_register_fails = 0; int max_lrm_register_fails = 30; gboolean populate_history_cache(void); gboolean process_lrm_event(lrm_op_t * op); gboolean is_rsc_active(const char *rsc_id); gboolean build_active_RAs(xmlNode * rsc_list); static gboolean stop_recurring_actions(gpointer key, gpointer value, gpointer user_data); static int delete_rsc_status(const char *rsc_id, int call_options, const char *user_name); lrm_op_t *construct_op(xmlNode * rsc_op, const char *rsc_id, const char *operation); void do_lrm_rsc_op(lrm_rsc_t * rsc, const char *operation, xmlNode * msg, xmlNode * request); void send_direct_ack(const char *to_host, const char *to_sys, lrm_rsc_t * rsc, lrm_op_t * op, const char *rsc_id); void lrm_connection_destroy(gpointer user_data) { if (is_set(fsa_input_register, R_LRM_CONNECTED)) { crm_crit("LRM Connection failed"); register_fsa_input(C_FSA_INTERNAL, I_ERROR, NULL); clear_bit_inplace(fsa_input_register, R_LRM_CONNECTED); } else { crm_info("LRM Connection disconnected"); } lrm_source = NULL; } static void free_deletion_op(gpointer value) { struct pending_deletion_op_s *op = value; crm_free(op->rsc); delete_ha_msg_input(op->input); crm_free(op); } static void free_recurring_op(gpointer value) { struct recurring_op_s *op = (struct recurring_op_s *)value; crm_free(op->rsc_id); crm_free(op->op_key); crm_free(op); } static char * make_stop_id(const char *rsc, int call_id) { char *op_id = NULL; crm_malloc0(op_id, strlen(rsc) + 34); if (op_id != NULL) { snprintf(op_id, strlen(rsc) + 34, "%s:%d", rsc, call_id); } return op_id; } static void dup_attr(gpointer key, gpointer value, gpointer user_data) { g_hash_table_replace(user_data, crm_strdup(key), crm_strdup(value)); } static void history_cache_destroy(gpointer data) { rsc_history_t *entry = data; crm_free(entry->rsc.type); crm_free(entry->rsc.class); crm_free(entry->rsc.provider); free_lrm_op(entry->failed); free_lrm_op(entry->last); crm_free(entry->id); crm_free(entry); } static void update_history_cache(lrm_rsc_t * rsc, lrm_op_t * op) { int target_rc = 0; rsc_history_t *entry = NULL; #ifdef HAVE_LRM_OP_T_RSC_DELETED if (op->rsc_deleted) { crm_debug("Purged history for '%s' after %s", op->rsc_id, op->op_type); delete_rsc_status(op->rsc_id, cib_quorum_override, NULL); return; } #endif if (safe_str_eq(op->op_type, RSC_NOTIFY)) { return; } crm_debug("Appending %s op to history for '%s'", op->op_type, op->rsc_id); entry = g_hash_table_lookup(resource_history, op->rsc_id); if (entry == NULL && rsc) { crm_malloc0(entry, sizeof(rsc_history_t)); entry->id = crm_strdup(op->rsc_id); g_hash_table_insert(resource_history, entry->id, entry); entry->rsc.id = entry->id; entry->rsc.type = crm_strdup(rsc->type); entry->rsc.class = crm_strdup(rsc->class); if (rsc->provider) { entry->rsc.provider = crm_strdup(rsc->provider); } else { entry->rsc.provider = NULL; } } else if (entry == NULL) { crm_info("Resource %s no longer exists, not updating cache", op->rsc_id); return; } target_rc = rsc_op_expected_rc(op); if (op->op_status == LRM_OP_CANCELLED) { crm_trace("Skipping %s_%s_%d rc=%d, status=%d", op->rsc_id, op->op_type, op->interval, op->rc, op->op_status); } else if (did_rsc_op_fail(op, target_rc)) { /* We must store failed monitors here * - otherwise the block below will cause them to be forgetten them when a stop happens */ if (entry->failed) { free_lrm_op(entry->failed); } entry->failed = copy_lrm_op(op); } else if (op->interval == 0) { if (entry->last) { free_lrm_op(entry->last); } entry->last = copy_lrm_op(op); } if (op->interval > 0) { crm_trace("Adding recurring op: %s_%s_%d", op->rsc_id, op->op_type, op->interval); entry->recurring_op_list = g_list_prepend(entry->recurring_op_list, copy_lrm_op(op)); } else if (entry->recurring_op_list && safe_str_eq(op->op_type, RSC_STATUS) == FALSE) { GList *gIter = entry->recurring_op_list; crm_trace("Dropping %d recurring ops because of: %s_%s_%d", g_list_length(gIter), op->rsc_id, op->op_type, op->interval); for (; gIter != NULL; gIter = gIter->next) { free_lrm_op(gIter->data); } g_list_free(entry->recurring_op_list); entry->recurring_op_list = NULL; } } /* A_LRM_CONNECT */ void do_lrm_control(long long action, enum crmd_fsa_cause cause, enum crmd_fsa_state cur_state, enum crmd_fsa_input current_input, fsa_data_t * msg_data) { if (fsa_lrm_conn == NULL) { register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL); return; } if (action & A_LRM_DISCONNECT) { if (verify_stopped(cur_state, LOG_INFO) == FALSE) { - crmd_fsa_stall(NULL); - return; + if(action == A_LRM_DISCONNECT) { + crmd_fsa_stall(NULL); + return; + } } if (is_set(fsa_input_register, R_LRM_CONNECTED)) { clear_bit_inplace(fsa_input_register, R_LRM_CONNECTED); + + if (lrm_source) { + G_main_del_IPC_Channel(lrm_source); + lrm_source = NULL; + } fsa_lrm_conn->lrm_ops->signoff(fsa_lrm_conn); crm_info("Disconnected from the LRM"); } - /* TODO: Clean up the hashtable */ + g_hash_table_destroy(resource_history); + resource_history = NULL; + g_hash_table_destroy(deletion_ops); + deletion_ops = NULL; + g_hash_table_destroy(pending_ops); + pending_ops = NULL; } if (action & A_LRM_CONNECT) { int ret = HA_OK; deletion_ops = g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, free_deletion_op); pending_ops = g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, free_recurring_op); resource_history = g_hash_table_new_full(crm_str_hash, g_str_equal, NULL, history_cache_destroy); if (ret == HA_OK) { crm_debug("Connecting to the LRM"); ret = fsa_lrm_conn->lrm_ops->signon(fsa_lrm_conn, CRM_SYSTEM_CRMD); } if (ret != HA_OK) { if (++num_lrm_register_fails < max_lrm_register_fails) { crm_warn("Failed to sign on to the LRM %d" " (%d max) times", num_lrm_register_fails, max_lrm_register_fails); crm_timer_start(wait_timer); crmd_fsa_stall(NULL); return; } } if (ret == HA_OK) { crm_trace("LRM: set_lrm_callback..."); ret = fsa_lrm_conn->lrm_ops->set_lrm_callback(fsa_lrm_conn, lrm_op_callback); if (ret != HA_OK) { crm_err("Failed to set LRM callbacks"); } } if (ret != HA_OK) { crm_err("Failed to sign on to the LRM %d" " (max) times", num_lrm_register_fails); register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL); return; } populate_history_cache(); /* TODO: create a destroy handler that causes * some recovery to happen */ lrm_source = G_main_add_IPC_Channel(G_PRIORITY_LOW, fsa_lrm_conn->lrm_ops->ipcchan(fsa_lrm_conn), FALSE, lrm_dispatch, fsa_lrm_conn, lrm_connection_destroy); set_bit_inplace(fsa_input_register, R_LRM_CONNECTED); crm_debug("LRM connection established"); } if (action & ~(A_LRM_CONNECT | A_LRM_DISCONNECT)) { crm_err("Unexpected action %s in %s", fsa_action2string(action), __FUNCTION__); } } static void ghash_print_pending(gpointer key, gpointer value, gpointer user_data) { const char *stop_id = key; int *log_level = user_data; struct recurring_op_s *pending = value; do_crm_log(*log_level, "Pending action: %s (%s)", stop_id, pending->op_key); } static void ghash_print_pending_for_rsc(gpointer key, gpointer value, gpointer user_data) { const char *stop_id = key; char *rsc = user_data; struct recurring_op_s *pending = value; if (safe_str_eq(rsc, pending->rsc_id)) { crm_notice("%sction %s (%s) incomplete at shutdown", pending->interval == 0 ? "A" : "Recurring a", stop_id, pending->op_key); } } static void ghash_count_pending(gpointer key, gpointer value, gpointer user_data) { int *counter = user_data; struct recurring_op_s *pending = value; if (pending->interval > 0) { /* Ignore recurring actions in the shutdown calculations */ return; } (*counter)++; } gboolean verify_stopped(enum crmd_fsa_state cur_state, int log_level) { int counter = 0; gboolean rc = TRUE; GHashTableIter gIter; rsc_history_t *entry = NULL; crm_debug("Checking for active resources before exit"); if (cur_state == S_TERMINATE) { log_level = LOG_ERR; } if (pending_ops) { if (is_set(fsa_input_register, R_LRM_CONNECTED)) { /* Only log/complain about non-recurring actions */ g_hash_table_foreach_remove(pending_ops, stop_recurring_actions, NULL); } g_hash_table_foreach(pending_ops, ghash_count_pending, &counter); } if (counter > 0) { rc = FALSE; do_crm_log(log_level, "%d pending LRM operations at shutdown%s", counter, cur_state == S_TERMINATE ? "" : "... waiting"); if (cur_state == S_TERMINATE || !is_set(fsa_input_register, R_SENT_RSC_STOP)) { g_hash_table_foreach(pending_ops, ghash_print_pending, &log_level); } goto bail; } if (resource_history == NULL) { goto bail; } g_hash_table_iter_init(&gIter, resource_history); while (g_hash_table_iter_next(&gIter, NULL, (void **)&entry)) { if (is_rsc_active(entry->id) == FALSE) { continue; } crm_err("Resource %s was active at shutdown." " You may ignore this error if it is unmanaged.", entry->id); g_hash_table_foreach(pending_ops, ghash_print_pending_for_rsc, entry->id); } bail: set_bit_inplace(fsa_input_register, R_SENT_RSC_STOP); if (cur_state == S_TERMINATE) { rc = TRUE; } return rc; } static char * get_rsc_metadata(const char *type, const char *class, const char *provider) { char *metadata = NULL; CRM_CHECK(type != NULL, return NULL); CRM_CHECK(class != NULL, return NULL); if (provider == NULL) { provider = "heartbeat"; } crm_trace("Retreiving metadata for %s::%s:%s", type, class, provider); metadata = fsa_lrm_conn->lrm_ops->get_rsc_type_metadata(fsa_lrm_conn, class, type, provider); if (metadata) { /* copy the metadata because the LRM likes using * g_alloc instead of cl_malloc */ char *m_copy = crm_strdup(metadata); g_free(metadata); metadata = m_copy; } else { crm_warn("No metadata found for %s::%s:%s", type, class, provider); } return metadata; } typedef struct reload_data_s { char *key; char *metadata; time_t last_query; gboolean can_reload; GListPtr restart_list; } reload_data_t; static void g_hash_destroy_reload(gpointer data) { reload_data_t *reload = data; crm_free(reload->key); crm_free(reload->metadata); slist_basic_destroy(reload->restart_list); crm_free(reload); } GHashTable *reload_hash = NULL; static GListPtr get_rsc_restart_list(lrm_rsc_t * rsc, lrm_op_t * op) { int len = 0; char *key = NULL; char *copy = NULL; const char *value = NULL; const char *provider = NULL; xmlNode *param = NULL; xmlNode *params = NULL; xmlNode *actions = NULL; xmlNode *metadata = NULL; time_t now = time(NULL); reload_data_t *reload = NULL; if (reload_hash == NULL) { reload_hash = g_hash_table_new_full(crm_str_hash, g_str_equal, NULL, g_hash_destroy_reload); } provider = rsc->provider; if (provider == NULL) { provider = "heartbeat"; } len = strlen(rsc->type) + strlen(rsc->class) + strlen(provider) + 4; crm_malloc(key, len); snprintf(key, len, "%s::%s:%s", rsc->type, rsc->class, provider); reload = g_hash_table_lookup(reload_hash, key); if (reload && ((now - 9) > reload->last_query) && safe_str_eq(op->op_type, RSC_START)) { reload = NULL; /* re-query */ } if (reload == NULL) { xmlNode *action = NULL; crm_malloc0(reload, sizeof(reload_data_t)); g_hash_table_replace(reload_hash, key, reload); reload->last_query = now; reload->key = key; key = NULL; reload->metadata = get_rsc_metadata(rsc->type, rsc->class, provider); metadata = string2xml(reload->metadata); if (metadata == NULL) { crm_err("Metadata for %s::%s:%s is not valid XML", rsc->provider, rsc->class, rsc->type); goto cleanup; } actions = find_xml_node(metadata, "actions", TRUE); for (action = __xml_first_child(actions); action != NULL; action = __xml_next(action)) { if (crm_str_eq((const char *)action->name, "action", TRUE)) { value = crm_element_value(action, "name"); if (safe_str_eq("reload", value)) { reload->can_reload = TRUE; break; } } } if (reload->can_reload == FALSE) { goto cleanup; } params = find_xml_node(metadata, "parameters", TRUE); for (param = __xml_first_child(params); param != NULL; param = __xml_next(param)) { if (crm_str_eq((const char *)param->name, "parameter", TRUE)) { value = crm_element_value(param, "unique"); if (crm_is_true(value)) { value = crm_element_value(param, "name"); if (value == NULL) { crm_err("%s: NULL param", key); continue; } crm_debug("Attr %s is not reloadable", value); copy = crm_strdup(value); CRM_CHECK(copy != NULL, continue); reload->restart_list = g_list_append(reload->restart_list, copy); } } } } cleanup: crm_free(key); free_xml(metadata); return reload ? reload->restart_list : NULL; } static void append_restart_list(lrm_rsc_t * rsc, lrm_op_t * op, xmlNode * update, const char *version) { int len = 0; char *list = NULL; char *digest = NULL; const char *value = NULL; gboolean non_empty = FALSE; xmlNode *restart = NULL; GListPtr restart_list = NULL; GListPtr lpc = NULL; if (op->interval > 0) { /* monitors are not reloadable */ return; } else if (op->params == NULL) { crm_debug("%s has no parameters", ID(update)); return; } else if (rsc == NULL) { return; } else if (crm_str_eq(CRMD_ACTION_STOP, op->op_type, TRUE)) { /* Stopped resources don't need to be reloaded */ return; } else if (compare_version("1.0.8", version) > 0) { /* Caller version does not support reloads */ return; } restart_list = get_rsc_restart_list(rsc, op); if (restart_list == NULL) { /* Resource does not support reloads */ return; } restart = create_xml_node(NULL, XML_TAG_PARAMS); for (lpc = restart_list; lpc != NULL; lpc = lpc->next) { const char *param = (const char *)lpc->data; int start = len; CRM_CHECK(param != NULL, continue); value = g_hash_table_lookup(op->params, param); if (value != NULL) { non_empty = TRUE; crm_xml_add(restart, param, value); } len += strlen(param) + 2; crm_realloc(list, len + 1); sprintf(list + start, " %s ", param); } digest = calculate_operation_digest(restart, version); crm_xml_add(update, XML_LRM_ATTR_OP_RESTART, list); crm_xml_add(update, XML_LRM_ATTR_RESTART_DIGEST, digest); #if 0 crm_debug("%s: %s, %s", rsc->id, digest, list); if (non_empty) { crm_log_xml_debug(restart, "restart digest source"); } #endif free_xml(restart); crm_free(digest); crm_free(list); } static gboolean build_operation_update(xmlNode * parent, lrm_rsc_t * rsc, lrm_op_t * op, const char *src) { int target_rc = 0; xmlNode *xml_op = NULL; const char *caller_version = CRM_FEATURE_SET; if (op == NULL) { return FALSE; } else if (AM_I_DC) { } else if (fsa_our_dc_version != NULL) { caller_version = fsa_our_dc_version; } else if (op->params == NULL) { caller_version = fsa_our_dc_version; } else { /* there is a small risk in formerly mixed clusters that * it will be sub-optimal. * however with our upgrade policy, the update we send * should still be completely supported anyway */ caller_version = g_hash_table_lookup(op->params, XML_ATTR_CRM_VERSION); crm_warn("Falling back to operation originator version: %s", caller_version); } target_rc = rsc_op_expected_rc(op); xml_op = create_operation_update(parent, op, caller_version, target_rc, src, LOG_DEBUG); if (xml_op) { append_restart_list(rsc, op, xml_op, caller_version); } return TRUE; } gboolean is_rsc_active(const char *rsc_id) { rsc_history_t *entry = NULL; crm_trace("Processing lrm_rsc_t entry %s", rsc_id); entry = g_hash_table_lookup(resource_history, rsc_id); if (entry == NULL || entry->last == NULL) { return FALSE; } if (entry->last->rc == EXECRA_OK && safe_str_eq(entry->last->op_type, CRMD_ACTION_STOP)) { return FALSE; } else if (entry->last->rc == EXECRA_OK && safe_str_eq(entry->last->op_type, CRMD_ACTION_MIGRATE)) { /* a stricter check is too complex... * leave that to the PE */ return FALSE; } else if (entry->last->rc == EXECRA_NOT_RUNNING) { return FALSE; } else if (entry->last->interval == 0 && entry->last->rc == EXECRA_NOT_CONFIGURED) { /* Badly configured resources can't be reliably stopped */ return FALSE; } return TRUE; } gboolean build_active_RAs(xmlNode * rsc_list) { GHashTableIter iter; rsc_history_t *entry = NULL; g_hash_table_iter_init(&iter, resource_history); while (g_hash_table_iter_next(&iter, NULL, (void **)&entry)) { GList *gIter = NULL; xmlNode *xml_rsc = create_xml_node(rsc_list, XML_LRM_TAG_RESOURCE); crm_xml_add(xml_rsc, XML_ATTR_ID, entry->id); crm_xml_add(xml_rsc, XML_ATTR_TYPE, entry->rsc.type); crm_xml_add(xml_rsc, XML_AGENT_ATTR_CLASS, entry->rsc.class); crm_xml_add(xml_rsc, XML_AGENT_ATTR_PROVIDER, entry->rsc.provider); build_operation_update(xml_rsc, &(entry->rsc), entry->last, __FUNCTION__); build_operation_update(xml_rsc, &(entry->rsc), entry->failed, __FUNCTION__); for (gIter = entry->recurring_op_list; gIter != NULL; gIter = gIter->next) { build_operation_update(xml_rsc, &(entry->rsc), gIter->data, __FUNCTION__); } } return FALSE; } gboolean populate_history_cache(void) { GListPtr gIter = NULL; GListPtr gIter2 = NULL; GList *op_list = NULL; GList *rsc_list = NULL; state_flag_t cur_state = 0; rsc_list = fsa_lrm_conn->lrm_ops->get_all_rscs(fsa_lrm_conn); for (gIter = rsc_list; gIter != NULL; gIter = gIter->next) { char *rid = (char *)gIter->data; int max_call_id = -1; lrm_rsc_t *rsc = fsa_lrm_conn->lrm_ops->get_rsc(fsa_lrm_conn, rid); if (rsc == NULL) { crm_err("NULL resource returned from the LRM: %s", rid); continue; } op_list = rsc->ops->get_cur_state(rsc, &cur_state); for (gIter2 = op_list; gIter2 != NULL; gIter2 = gIter2->next) { lrm_op_t *op = (lrm_op_t *) gIter2->data; if (max_call_id < op->call_id) { update_history_cache(rsc, op); } else if (max_call_id > op->call_id) { crm_err("Bad call_id in list=%d. Previous call_id=%d", op->call_id, max_call_id); } else { crm_warn("lrm->get_cur_state() returned" " duplicate entries for call_id=%d", op->call_id); } max_call_id = op->call_id; lrm_free_op(op); } g_list_free(op_list); lrm_free_rsc(rsc); free(rid); } g_list_free(rsc_list); return TRUE; } xmlNode * do_lrm_query(gboolean is_replace) { gboolean shut_down = FALSE; xmlNode *xml_result = NULL; xmlNode *xml_state = NULL; xmlNode *xml_data = NULL; xmlNode *rsc_list = NULL; const char *exp_state = CRMD_STATE_ACTIVE; if (is_set(fsa_input_register, R_SHUTDOWN)) { exp_state = CRMD_STATE_INACTIVE; shut_down = TRUE; } xml_state = create_node_state(fsa_our_uname, ACTIVESTATUS, XML_BOOLEAN_TRUE, ONLINESTATUS, CRMD_JOINSTATE_MEMBER, exp_state, !shut_down, __FUNCTION__); xml_data = create_xml_node(xml_state, XML_CIB_TAG_LRM); crm_xml_add(xml_data, XML_ATTR_ID, fsa_our_uuid); rsc_list = create_xml_node(xml_data, XML_LRM_TAG_RESOURCES); /* Build a list of active (not always running) resources */ build_active_RAs(rsc_list); xml_result = create_cib_fragment(xml_state, XML_CIB_TAG_STATUS); crm_log_xml_trace(xml_state, "Current state of the LRM"); free_xml(xml_state); return xml_result; } static void notify_deleted(ha_msg_input_t * input, const char *rsc_id, int rc) { lrm_op_t *op = NULL; const char *from_sys = crm_element_value(input->msg, F_CRM_SYS_FROM); const char *from_host = crm_element_value(input->msg, F_CRM_HOST_FROM); crm_info("Notifying %s on %s that %s was%s deleted", from_sys, from_host, rsc_id, rc == HA_OK ? "" : " not"); op = construct_op(input->xml, rsc_id, CRMD_ACTION_DELETE); CRM_ASSERT(op != NULL); if (rc == HA_OK) { op->op_status = LRM_OP_DONE; op->rc = EXECRA_OK; } else { op->op_status = LRM_OP_ERROR; op->rc = EXECRA_UNKNOWN_ERROR; } send_direct_ack(from_host, from_sys, NULL, op, rsc_id); free_lrm_op(op); if (safe_str_neq(from_sys, CRM_SYSTEM_TENGINE)) { /* this isn't expected - trigger a new transition */ time_t now = time(NULL); char *now_s = crm_itoa(now); crm_debug("Triggering a refresh after %s deleted %s from the LRM", from_sys, rsc_id); update_attr(fsa_cib_conn, cib_none, XML_CIB_TAG_CRMCONFIG, NULL, NULL, NULL, NULL, "last-lrm-refresh", now_s, FALSE); crm_free(now_s); } } static gboolean lrm_remove_deleted_rsc(gpointer key, gpointer value, gpointer user_data) { struct delete_event_s *event = user_data; struct pending_deletion_op_s *op = value; if (safe_str_eq(event->rsc, op->rsc)) { notify_deleted(op->input, event->rsc, event->rc); return TRUE; } return FALSE; } static gboolean lrm_remove_deleted_op(gpointer key, gpointer value, gpointer user_data) { const char *rsc = user_data; struct recurring_op_s *pending = value; if (safe_str_eq(rsc, pending->rsc_id)) { crm_info("Removing op %s:%d for deleted resource %s", pending->op_key, pending->call_id, rsc); return TRUE; } return FALSE; } /* * Remove the rsc from the CIB * * Avoids refreshing the entire LRM section of this host */ #define rsc_template "//"XML_CIB_TAG_STATE"[@uname='%s']//"XML_LRM_TAG_RESOURCE"[@id='%s']" static int delete_rsc_status(const char *rsc_id, int call_options, const char *user_name) { char *rsc_xpath = NULL; int max = 0; int rc = cib_ok; CRM_CHECK(rsc_id != NULL, return cib_id_check); max = strlen(rsc_template) + strlen(rsc_id) + strlen(fsa_our_uname) + 1; crm_malloc0(rsc_xpath, max); snprintf(rsc_xpath, max, rsc_template, fsa_our_uname, rsc_id); rc = fsa_cib_conn->cmds->delegated_variant_op(fsa_cib_conn, CIB_OP_DELETE, NULL, rsc_xpath, NULL, NULL, call_options | cib_xpath, user_name); crm_free(rsc_xpath); return rc; } static void delete_rsc_entry(ha_msg_input_t * input, const char *rsc_id, GHashTableIter *rsc_gIter, int rc, const char *user_name) { struct delete_event_s event; CRM_CHECK(rsc_id != NULL, return); if (rc == HA_OK) { char *rsc_id_copy = crm_strdup(rsc_id); if (rsc_gIter) g_hash_table_iter_remove(rsc_gIter); else g_hash_table_remove(resource_history, rsc_id_copy); crm_debug("sync: Sending delete op for %s", rsc_id_copy); delete_rsc_status(rsc_id_copy, cib_quorum_override, user_name); g_hash_table_foreach_remove(pending_ops, lrm_remove_deleted_op, rsc_id_copy); crm_free(rsc_id_copy); } if (input) { notify_deleted(input, rsc_id, rc); } event.rc = rc; event.rsc = rsc_id; g_hash_table_foreach_remove(deletion_ops, lrm_remove_deleted_rsc, &event); } /* * Remove the op from the CIB * * Avoids refreshing the entire LRM section of this host */ #define op_template "//"XML_CIB_TAG_STATE"[@uname='%s']//"XML_LRM_TAG_RESOURCE"[@id='%s']/"XML_LRM_TAG_RSC_OP"[@id='%s']" #define op_call_template "//"XML_CIB_TAG_STATE"[@uname='%s']//"XML_LRM_TAG_RESOURCE"[@id='%s']/"XML_LRM_TAG_RSC_OP"[@id='%s' and @"XML_LRM_ATTR_CALLID"='%d']" static void delete_op_entry(lrm_op_t * op, const char *rsc_id, const char *key, int call_id) { xmlNode *xml_top = NULL; if (op != NULL) { xml_top = create_xml_node(NULL, XML_LRM_TAG_RSC_OP); crm_xml_add_int(xml_top, XML_LRM_ATTR_CALLID, op->call_id); crm_xml_add(xml_top, XML_ATTR_TRANSITION_KEY, op->user_data); if(op->interval > 0) { /* Avoid deleting last_failure too (if it was a result of this recurring op failing) */ crm_xml_add(xml_top, XML_ATTR_ID, op->user_data); } crm_debug("async: Sending delete op for %s_%s_%d (call=%d)", op->rsc_id, op->op_type, op->interval, op->call_id); fsa_cib_conn->cmds->delete(fsa_cib_conn, XML_CIB_TAG_STATUS, xml_top, cib_quorum_override); } else if (rsc_id != NULL && key != NULL) { int max = 0; char *op_xpath = NULL; if (call_id > 0) { max = strlen(op_call_template) + strlen(rsc_id) + strlen(fsa_our_uname) + strlen(key) + 10; crm_malloc0(op_xpath, max); snprintf(op_xpath, max, op_call_template, fsa_our_uname, rsc_id, key, call_id); } else { max = strlen(op_template) + strlen(rsc_id) + strlen(fsa_our_uname) + strlen(key) + 1; crm_malloc0(op_xpath, max); snprintf(op_xpath, max, op_template, fsa_our_uname, rsc_id, key); } crm_debug("sync: Sending delete op for %s (call=%d)", rsc_id, call_id); fsa_cib_conn->cmds->delete(fsa_cib_conn, op_xpath, NULL, cib_quorum_override | cib_xpath); crm_free(op_xpath); } else { crm_err("Not enough information to delete op entry: rsc=%p key=%p", rsc_id, key); return; } crm_log_xml_trace(xml_top, "op:cancel"); free_xml(xml_top); } void lrm_clear_last_failure(const char *rsc_id) { char *attr = NULL; GHashTableIter iter; rsc_history_t *entry = NULL; attr = generate_op_key(rsc_id, "last_failure", 0); delete_op_entry(NULL, rsc_id, attr, 0); crm_free(attr); if (!resource_history) { return; } g_hash_table_iter_init(&iter, resource_history); while (g_hash_table_iter_next(&iter, NULL, (void **)&entry)) { if (safe_str_eq(rsc_id, entry->id)) { free_lrm_op(entry->failed); entry->failed = NULL; } } } static gboolean cancel_op(lrm_rsc_t * rsc, const char *key, int op, gboolean remove) { int rc = HA_OK; struct recurring_op_s *pending = NULL; CRM_CHECK(op != 0, return FALSE); CRM_CHECK(rsc != NULL, return FALSE); if (key == NULL) { key = make_stop_id(rsc->id, op); } pending = g_hash_table_lookup(pending_ops, key); if (pending) { if (remove && pending->remove == FALSE) { pending->remove = TRUE; crm_debug("Scheduling %s for removal", key); } if (pending->cancelled) { crm_debug("Operation %s already cancelled", key); return TRUE; } pending->cancelled = TRUE; } else { crm_info("No pending op found for %s", key); } crm_debug("Cancelling op %d for %s (%s)", op, rsc->id, key); rc = rsc->ops->cancel_op(rsc, op); if (rc == HA_OK) { crm_debug("Op %d for %s (%s): cancelled", op, rsc->id, key); #ifdef HAVE_LRM_OP_T_RSC_DELETED } else if (rc == HA_RSCBUSY) { crm_debug("Op %d for %s (%s): cancelation pending", op, rsc->id, key); #endif } else { crm_debug("Op %d for %s (%s): Nothing to cancel", op, rsc->id, key); /* The caller needs to make sure the entry is * removed from the pending_ops list * * Usually by returning TRUE inside the worker function * supplied to g_hash_table_foreach_remove() * * Not removing the entry from pending_ops will block * the node from shutting down */ return FALSE; } return TRUE; } struct cancel_data { gboolean done; gboolean remove; const char *key; lrm_rsc_t *rsc; }; static gboolean cancel_action_by_key(gpointer key, gpointer value, gpointer user_data) { struct cancel_data *data = user_data; struct recurring_op_s *op = (struct recurring_op_s *)value; if (safe_str_eq(op->op_key, data->key)) { data->done = TRUE; if (cancel_op(data->rsc, key, op->call_id, data->remove) == FALSE) { return TRUE; } } return FALSE; } static gboolean cancel_op_key(lrm_rsc_t * rsc, const char *key, gboolean remove) { struct cancel_data data; CRM_CHECK(rsc != NULL, return FALSE); CRM_CHECK(key != NULL, return FALSE); data.key = key; data.rsc = rsc; data.done = FALSE; data.remove = remove; g_hash_table_foreach_remove(pending_ops, cancel_action_by_key, &data); return data.done; } static lrm_rsc_t * get_lrm_resource(xmlNode * resource, xmlNode * op_msg, gboolean do_create) { char rid[RID_LEN]; lrm_rsc_t *rsc = NULL; const char *short_id = ID(resource); const char *long_id = crm_element_value(resource, XML_ATTR_ID_LONG); crm_trace("Retrieving %s from the LRM.", short_id); CRM_CHECK(short_id != NULL, return NULL); if (rsc == NULL) { /* check if its already there (short name) */ strncpy(rid, short_id, RID_LEN); rid[RID_LEN - 1] = 0; rsc = fsa_lrm_conn->lrm_ops->get_rsc(fsa_lrm_conn, rid); } if (rsc == NULL && long_id != NULL) { /* try the long name instead */ strncpy(rid, long_id, RID_LEN); rid[RID_LEN - 1] = 0; rsc = fsa_lrm_conn->lrm_ops->get_rsc(fsa_lrm_conn, rid); } if (rsc == NULL && do_create) { /* add it to the LRM */ const char *type = crm_element_value(resource, XML_ATTR_TYPE); const char *class = crm_element_value(resource, XML_AGENT_ATTR_CLASS); const char *provider = crm_element_value(resource, XML_AGENT_ATTR_PROVIDER); GHashTable *params = xml2list(op_msg); CRM_CHECK(class != NULL, return NULL); CRM_CHECK(type != NULL, return NULL); crm_trace("Adding rsc %s before operation", short_id); strncpy(rid, short_id, RID_LEN); rid[RID_LEN - 1] = 0; if (g_hash_table_size(params) == 0) { crm_log_xml_warn(op_msg, "EmptyParams"); } if (params != NULL) { g_hash_table_remove(params, CRM_META "_op_target_rc"); } fsa_lrm_conn->lrm_ops->add_rsc(fsa_lrm_conn, rid, class, type, provider, params); rsc = fsa_lrm_conn->lrm_ops->get_rsc(fsa_lrm_conn, rid); g_hash_table_destroy(params); if (rsc == NULL) { fsa_data_t *msg_data = NULL; crm_err("Could not add resource %s to LRM", rid); register_fsa_error(C_FSA_INTERNAL, I_FAIL, NULL); } } return rsc; } static void delete_resource(const char *id, lrm_rsc_t * rsc, GHashTableIter *gIter, const char *sys, const char *host, const char *user, ha_msg_input_t * request) { int rc = HA_OK; crm_info("Removing resource %s for %s (%s) on %s", id, sys, user ? user : "internal", host); if (rsc) { rc = fsa_lrm_conn->lrm_ops->delete_rsc(fsa_lrm_conn, id); } if (rc == HA_OK) { crm_trace("Resource '%s' deleted", id); #ifdef HAVE_LRM_OP_T_RSC_DELETED } else if (rc == HA_RSCBUSY) { crm_info("Deletion of resource '%s' pending", id); if (request) { struct pending_deletion_op_s *op = NULL; char *ref = crm_element_value_copy(request->msg, XML_ATTR_REFERENCE); crm_malloc0(op, sizeof(struct pending_deletion_op_s)); op->rsc = crm_strdup(rsc->id); op->input = copy_ha_msg_input(request); g_hash_table_insert(deletion_ops, ref, op); } return; #endif } else { crm_warn("Deletion of resource '%s' for %s (%s) on %s failed: %d", id, sys, user ? user : "internal", host, rc); } delete_rsc_entry(request, id, gIter, rc, user); } /* A_LRM_INVOKE */ void do_lrm_invoke(long long action, enum crmd_fsa_cause cause, enum crmd_fsa_state cur_state, enum crmd_fsa_input current_input, fsa_data_t * msg_data) { gboolean done = FALSE; gboolean create_rsc = TRUE; const char *crm_op = NULL; const char *from_sys = NULL; const char *from_host = NULL; const char *operation = NULL; ha_msg_input_t *input = fsa_typed_data(fsa_dt_ha_msg); const char *user_name = NULL; #if ENABLE_ACL user_name = crm_element_value(input->msg, F_CRM_USER); crm_trace("LRM command from user '%s'", user_name); #endif crm_op = crm_element_value(input->msg, F_CRM_TASK); from_sys = crm_element_value(input->msg, F_CRM_SYS_FROM); if (safe_str_neq(from_sys, CRM_SYSTEM_TENGINE)) { from_host = crm_element_value(input->msg, F_CRM_HOST_FROM); } crm_trace("LRM command from: %s", from_sys); if (safe_str_eq(crm_op, CRM_OP_LRM_DELETE)) { operation = CRMD_ACTION_DELETE; } else if (safe_str_eq(operation, CRM_OP_LRM_REFRESH)) { crm_op = CRM_OP_LRM_REFRESH; } else if (safe_str_eq(crm_op, CRM_OP_LRM_FAIL)) { #if HAVE_STRUCT_LRM_OPS_FAIL_RSC int rc = HA_OK; lrm_op_t *op = NULL; lrm_rsc_t *rsc = NULL; xmlNode *xml_rsc = find_xml_node(input->xml, XML_CIB_TAG_RESOURCE, TRUE); CRM_CHECK(xml_rsc != NULL, return); op = construct_op(input->xml, ID(xml_rsc), "fail"); op->op_status = LRM_OP_ERROR; op->rc = EXECRA_UNKNOWN_ERROR; CRM_ASSERT(op != NULL); # if ENABLE_ACL if (user_name && is_privileged(user_name) == FALSE) { crm_err("%s does not have permission to fail %s", user_name, ID(xml_rsc)); send_direct_ack(from_host, from_sys, NULL, op, ID(xml_rsc)); free_lrm_op(op); return; } # endif rsc = get_lrm_resource(xml_rsc, input->xml, create_rsc); if (rsc) { crm_info("Failing resource %s...", rsc->id); rc = fsa_lrm_conn->lrm_ops->fail_rsc(fsa_lrm_conn, rsc->id, 1, "do_lrm_invoke: Async failure"); if (rc != HA_OK) { crm_err("Could not initiate an asynchronous failure for %s (%d)", rsc->id, rc); } else { op->op_status = LRM_OP_DONE; op->rc = EXECRA_OK; } lrm_free_rsc(rsc); } else { crm_info("Cannot find/create resource in order to fail it..."); crm_log_xml_warn(input->msg, "bad input"); } send_direct_ack(from_host, from_sys, NULL, op, ID(xml_rsc)); free_lrm_op(op); return; #else crm_info("Failing resource..."); operation = "fail"; #endif } else if (input->xml != NULL) { operation = crm_element_value(input->xml, XML_LRM_ATTR_TASK); } if (safe_str_eq(crm_op, CRM_OP_LRM_REFRESH)) { enum cib_errors rc = cib_ok; xmlNode *fragment = do_lrm_query(TRUE); crm_info("Forcing a local LRM refresh"); fsa_cib_update(XML_CIB_TAG_STATUS, fragment, cib_quorum_override, rc, user_name); free_xml(fragment); } else if (safe_str_eq(crm_op, CRM_OP_LRM_QUERY)) { xmlNode *data = do_lrm_query(FALSE); xmlNode *reply = create_reply(input->msg, data); if (relay_message(reply, TRUE) == FALSE) { crm_err("Unable to route reply"); crm_log_xml_err(reply, "reply"); } free_xml(reply); free_xml(data); } else if (safe_str_eq(operation, CRM_OP_PROBED)) { update_attrd(NULL, CRM_OP_PROBED, XML_BOOLEAN_TRUE, user_name); } else if (safe_str_eq(crm_op, CRM_OP_REPROBE)) { GHashTableIter gIter; rsc_history_t *entry = NULL; crm_notice("Forcing the status of all resources to be redetected"); g_hash_table_iter_init(&gIter, resource_history); while (g_hash_table_iter_next(&gIter, NULL, (void **)&entry)) { lrm_rsc_t *rsc = fsa_lrm_conn->lrm_ops->get_rsc(fsa_lrm_conn, entry->id); delete_resource(entry->id, rsc, &gIter, from_sys, from_host, user_name, NULL); lrm_free_rsc(rsc); } /* Now delete the copy in the CIB */ erase_status_tag(fsa_our_uname, XML_CIB_TAG_LRM, cib_scope_local); /* And finally, _delete_ the value in attrd * Setting it to FALSE results in the PE sending us back here again */ update_attrd(NULL, CRM_OP_PROBED, NULL, user_name); } else if (operation != NULL) { lrm_rsc_t *rsc = NULL; xmlNode *params = NULL; xmlNode *xml_rsc = find_xml_node(input->xml, XML_CIB_TAG_RESOURCE, TRUE); CRM_CHECK(xml_rsc != NULL, return); /* only the first 16 chars are used by the LRM */ params = find_xml_node(input->xml, XML_TAG_ATTRS, TRUE); if (safe_str_eq(operation, CRMD_ACTION_DELETE)) { create_rsc = FALSE; } rsc = get_lrm_resource(xml_rsc, input->xml, create_rsc); if (rsc == NULL && create_rsc) { crm_err("Invalid resource definition"); crm_log_xml_warn(input->msg, "bad input"); } else if (rsc == NULL) { lrm_op_t *op = NULL; crm_notice("Not creating resource for a %s event: %s", operation, ID(input->xml)); delete_rsc_entry(input, ID(xml_rsc), NULL, HA_OK, user_name); op = construct_op(input->xml, ID(xml_rsc), operation); op->op_status = LRM_OP_DONE; op->rc = EXECRA_OK; CRM_ASSERT(op != NULL); send_direct_ack(from_host, from_sys, NULL, op, ID(xml_rsc)); free_lrm_op(op); } else if (safe_str_eq(operation, CRMD_ACTION_CANCEL)) { lrm_op_t *op = NULL; char *op_key = NULL; char *meta_key = NULL; int call = 0; const char *call_id = NULL; const char *op_task = NULL; const char *op_interval = NULL; CRM_CHECK(params != NULL, crm_log_xml_warn(input->xml, "Bad command"); return); meta_key = crm_meta_name(XML_LRM_ATTR_INTERVAL); op_interval = crm_element_value(params, meta_key); crm_free(meta_key); meta_key = crm_meta_name(XML_LRM_ATTR_TASK); op_task = crm_element_value(params, meta_key); crm_free(meta_key); meta_key = crm_meta_name(XML_LRM_ATTR_CALLID); call_id = crm_element_value(params, meta_key); crm_free(meta_key); CRM_CHECK(op_task != NULL, crm_log_xml_warn(input->xml, "Bad command"); return); CRM_CHECK(op_interval != NULL, crm_log_xml_warn(input->xml, "Bad command"); return); op = construct_op(input->xml, rsc->id, op_task); CRM_ASSERT(op != NULL); op_key = generate_op_key(rsc->id, op_task, crm_parse_int(op_interval, "0")); crm_debug("PE requested op %s (call=%s) be cancelled", op_key, call_id ? call_id : "NA"); call = crm_parse_int(call_id, "0"); if (call == 0) { /* the normal case when the PE cancels a recurring op */ done = cancel_op_key(rsc, op_key, TRUE); } else { /* the normal case when the PE cancels an orphan op */ done = cancel_op(rsc, NULL, call, TRUE); } if (done == FALSE) { crm_debug("Nothing known about operation %d for %s", call, op_key); delete_op_entry(NULL, rsc->id, op_key, call); /* needed?? surely not otherwise the cancel_op_(_key) wouldn't * have failed in the first place */ g_hash_table_remove(pending_ops, op_key); } op->rc = EXECRA_OK; op->op_status = LRM_OP_DONE; send_direct_ack(from_host, from_sys, rsc, op, rsc->id); crm_free(op_key); free_lrm_op(op); } else if (safe_str_eq(operation, CRMD_ACTION_DELETE)) { int cib_rc = cib_ok; CRM_ASSERT(rsc != NULL); cib_rc = delete_rsc_status(rsc->id, cib_dryrun | cib_sync_call, user_name); if (cib_rc != cib_ok) { lrm_op_t *op = NULL; crm_err ("Attempt of deleting resource status '%s' from CIB for %s (user=%s) on %s failed: (rc=%d) %s", rsc->id, from_sys, user_name ? user_name : "unknown", from_host, cib_rc, cib_error2string(cib_rc)); op = construct_op(input->xml, rsc->id, operation); op->op_status = LRM_OP_ERROR; if (cib_rc == cib_permission_denied) { op->rc = EXECRA_INSUFFICIENT_PRIV; } else { op->rc = EXECRA_UNKNOWN_ERROR; } send_direct_ack(from_host, from_sys, NULL, op, rsc->id); free_lrm_op(op); return; } delete_resource(rsc->id, rsc, NULL, from_sys, from_host, user_name, input); } else if (rsc != NULL) { do_lrm_rsc_op(rsc, operation, input->xml, input->msg); } lrm_free_rsc(rsc); } else { crm_err("Operation was neither a lrm_query, nor a rsc op. %s", crm_str(crm_op)); register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL); } } static void copy_meta_keys(gpointer key, gpointer value, gpointer user_data) { if (strstr(key, CRM_META "_") != NULL) { g_hash_table_insert(user_data, strdup((const char *)key), strdup((const char *)value)); } } lrm_op_t * construct_op(xmlNode * rsc_op, const char *rsc_id, const char *operation) { lrm_op_t *op = NULL; const char *op_delay = NULL; const char *op_timeout = NULL; const char *op_interval = NULL; GHashTable *params = NULL; const char *transition = NULL; CRM_LOG_ASSERT(rsc_id != NULL); crm_malloc0(op, sizeof(lrm_op_t)); op->op_type = crm_strdup(operation); op->op_status = LRM_OP_PENDING; op->rc = -1; op->rsc_id = crm_strdup(rsc_id); op->interval = 0; op->timeout = 0; op->start_delay = 0; op->copyparams = 0; op->app_name = crm_strdup(CRM_SYSTEM_CRMD); if (rsc_op == NULL) { CRM_LOG_ASSERT(safe_str_eq(CRMD_ACTION_STOP, operation)); op->user_data = NULL; op->user_data_len = 0; /* the stop_all_resources() case * by definition there is no DC (or they'd be shutting * us down). * So we should put our version here. */ op->params = g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str); g_hash_table_insert(op->params, crm_strdup(XML_ATTR_CRM_VERSION), crm_strdup(CRM_FEATURE_SET)); crm_trace("Constructed %s op for %s", operation, rsc_id); return op; } params = xml2list(rsc_op); g_hash_table_remove(params, CRM_META "_op_target_rc"); op_delay = crm_meta_value(params, XML_OP_ATTR_START_DELAY); op_timeout = crm_meta_value(params, XML_ATTR_TIMEOUT); op_interval = crm_meta_value(params, XML_LRM_ATTR_INTERVAL); op->interval = crm_parse_int(op_interval, "0"); op->timeout = crm_parse_int(op_timeout, "0"); op->start_delay = crm_parse_int(op_delay, "0"); if (safe_str_neq(operation, RSC_STOP)) { op->params = params; } else { /* Create a blank parameter list so that we stop the resource * with the old attributes, not the new ones */ const char *version = g_hash_table_lookup(params, XML_ATTR_CRM_VERSION); op->params = g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str); if (version) { g_hash_table_insert(op->params, crm_strdup(XML_ATTR_CRM_VERSION), crm_strdup(version)); } g_hash_table_foreach(params, copy_meta_keys, op->params); g_hash_table_destroy(params); params = NULL; } /* sanity */ if (op->interval < 0) { op->interval = 0; } if (op->timeout <= 0) { op->timeout = op->interval; } if (op->start_delay < 0) { op->start_delay = 0; } transition = crm_element_value(rsc_op, XML_ATTR_TRANSITION_KEY); CRM_CHECK(transition != NULL, return op); op->user_data = crm_strdup(transition); op->user_data_len = 1 + strlen(op->user_data); if (op->interval != 0) { if (safe_str_eq(operation, CRMD_ACTION_START) || safe_str_eq(operation, CRMD_ACTION_STOP)) { crm_err("Start and Stop actions cannot have an interval: %d", op->interval); op->interval = 0; } } /* reset the resource's parameters? */ if (op->interval == 0) { if (safe_str_eq(CRMD_ACTION_START, operation) || safe_str_eq(CRMD_ACTION_STATUS, operation)) { op->copyparams = 1; } } crm_trace("Constructed %s op for %s: interval=%d", operation, rsc_id, op->interval); return op; } void send_direct_ack(const char *to_host, const char *to_sys, lrm_rsc_t * rsc, lrm_op_t * op, const char *rsc_id) { xmlNode *reply = NULL; xmlNode *update, *iter; xmlNode *fragment; CRM_CHECK(op != NULL, return); if (op->rsc_id == NULL) { CRM_LOG_ASSERT(rsc_id != NULL); op->rsc_id = crm_strdup(rsc_id); } if (to_sys == NULL) { to_sys = CRM_SYSTEM_TENGINE; } update = create_node_state(fsa_our_uname, NULL, NULL, NULL, NULL, NULL, FALSE, __FUNCTION__); iter = create_xml_node(update, XML_CIB_TAG_LRM); crm_xml_add(iter, XML_ATTR_ID, fsa_our_uuid); iter = create_xml_node(iter, XML_LRM_TAG_RESOURCES); iter = create_xml_node(iter, XML_LRM_TAG_RESOURCE); crm_xml_add(iter, XML_ATTR_ID, op->rsc_id); build_operation_update(iter, rsc, op, __FUNCTION__); fragment = create_cib_fragment(update, XML_CIB_TAG_STATUS); reply = create_request(CRM_OP_INVOKE_LRM, fragment, to_host, to_sys, CRM_SYSTEM_LRMD, NULL); crm_log_xml_trace(update, "ACK Update"); crm_debug("ACK'ing resource op %s_%s_%d from %s: %s", op->rsc_id, op->op_type, op->interval, op->user_data, crm_element_value(reply, XML_ATTR_REFERENCE)); if (relay_message(reply, TRUE) == FALSE) { crm_log_xml_err(reply, "Unable to route reply"); } free_xml(fragment); free_xml(update); free_xml(reply); } static gboolean stop_recurring_action_by_rsc(gpointer key, gpointer value, gpointer user_data) { lrm_rsc_t *rsc = user_data; struct recurring_op_s *op = (struct recurring_op_s *)value; if (op->interval != 0 && safe_str_eq(op->rsc_id, rsc->id)) { if (cancel_op(rsc, key, op->call_id, FALSE) == FALSE) { return TRUE; } } return FALSE; } static gboolean stop_recurring_actions(gpointer key, gpointer value, gpointer user_data) { gboolean remove = FALSE; struct recurring_op_s *op = (struct recurring_op_s *)value; if (op->interval != 0) { lrm_rsc_t *rsc = fsa_lrm_conn->lrm_ops->get_rsc(fsa_lrm_conn, op->rsc_id); if (rsc) { remove = cancel_op(rsc, key, op->call_id, FALSE); lrm_free_rsc(rsc); } } return remove; } void do_lrm_rsc_op(lrm_rsc_t * rsc, const char *operation, xmlNode * msg, xmlNode * request) { int call_id = 0; char *op_id = NULL; lrm_op_t *op = NULL; fsa_data_t *msg_data = NULL; const char *transition = NULL; CRM_CHECK(rsc != NULL, return); if (msg != NULL) { transition = crm_element_value(msg, XML_ATTR_TRANSITION_KEY); if (transition == NULL) { crm_log_xml_err(msg, "Missing transition number"); } } op = construct_op(msg, rsc->id, operation); /* stop the monitor before stopping the resource */ if (crm_str_eq(operation, CRMD_ACTION_STOP, TRUE) || crm_str_eq(operation, CRMD_ACTION_DEMOTE, TRUE) || crm_str_eq(operation, CRMD_ACTION_PROMOTE, TRUE) || crm_str_eq(operation, CRMD_ACTION_MIGRATE, TRUE)) { g_hash_table_foreach_remove(pending_ops, stop_recurring_action_by_rsc, rsc); } /* now do the op */ crm_debug("Performing key=%s op=%s_%s_%d", transition, rsc->id, operation, op->interval); if (fsa_state != S_NOT_DC && fsa_state != S_POLICY_ENGINE && fsa_state != S_TRANSITION_ENGINE) { if (safe_str_neq(operation, "fail") && safe_str_neq(operation, CRMD_ACTION_STOP)) { crm_info("Discarding attempt to perform action %s on %s" " in state %s", operation, rsc->id, fsa_state2string(fsa_state)); op->rc = 99; op->op_status = LRM_OP_ERROR; send_direct_ack(NULL, NULL, rsc, op, rsc->id); free_lrm_op(op); crm_free(op_id); return; } } op_id = generate_op_key(rsc->id, op->op_type, op->interval); if (op->interval > 0) { /* cancel it so we can then restart it without conflict */ cancel_op_key(rsc, op_id, FALSE); op->target_rc = CHANGED; } else { op->target_rc = EVERYTIME; } call_id = rsc->ops->perform_op(rsc, op); if (call_id <= 0) { crm_err("Operation %s on %s failed: %d", operation, rsc->id, call_id); register_fsa_error(C_FSA_INTERNAL, I_FAIL, NULL); } else { /* record all operations so we can wait * for them to complete during shutdown */ char *call_id_s = make_stop_id(rsc->id, call_id); struct recurring_op_s *pending = NULL; crm_malloc0(pending, sizeof(struct recurring_op_s)); crm_trace("Recording pending op: %d - %s %s", call_id, op_id, call_id_s); pending->call_id = call_id; pending->interval = op->interval; pending->op_key = crm_strdup(op_id); pending->rsc_id = crm_strdup(rsc->id); g_hash_table_replace(pending_ops, call_id_s, pending); if (op->interval > 0 && op->start_delay > START_DELAY_THRESHOLD) { char *uuid = NULL; int dummy = 0, target_rc = 0; crm_info("Faking confirmation of %s: execution postponed for over 5 minutes", op_id); decode_transition_key(op->user_data, &uuid, &dummy, &dummy, &target_rc); crm_free(uuid); op->rc = target_rc; op->op_status = LRM_OP_DONE; send_direct_ack(NULL, NULL, rsc, op, rsc->id); } } crm_free(op_id); free_lrm_op(op); return; } lrm_op_t * copy_lrm_op(const lrm_op_t * op) { lrm_op_t *op_copy = NULL; CRM_CHECK(op != NULL, return NULL); CRM_CHECK(op->rsc_id != NULL, return NULL); crm_malloc0(op_copy, sizeof(lrm_op_t)); op_copy->op_type = crm_strdup(op->op_type); /* input fields */ op_copy->params = g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str); if (op->params != NULL) { g_hash_table_foreach(op->params, dup_attr, op_copy->params); } op_copy->timeout = op->timeout; op_copy->interval = op->interval; op_copy->target_rc = op->target_rc; /* in the CRM, this is always a string */ if (op->user_data != NULL) { op_copy->user_data = crm_strdup(op->user_data); } /* output fields */ op_copy->op_status = op->op_status; op_copy->rc = op->rc; op_copy->call_id = op->call_id; op_copy->output = NULL; op_copy->rsc_id = crm_strdup(op->rsc_id); if (op->app_name != NULL) { op_copy->app_name = crm_strdup(op->app_name); } if (op->output != NULL) { op_copy->output = crm_strdup(op->output); } return op_copy; } lrm_rsc_t * copy_lrm_rsc(const lrm_rsc_t * rsc) { lrm_rsc_t *rsc_copy = NULL; if (rsc == NULL) { return NULL; } crm_malloc0(rsc_copy, sizeof(lrm_rsc_t)); rsc_copy->id = crm_strdup(rsc->id); rsc_copy->type = crm_strdup(rsc->type); rsc_copy->class = NULL; rsc_copy->provider = NULL; if (rsc->class != NULL) { rsc_copy->class = crm_strdup(rsc->class); } if (rsc->provider != NULL) { rsc_copy->provider = crm_strdup(rsc->provider); } /* GHashTable* params; */ rsc_copy->params = NULL; rsc_copy->ops = NULL; return rsc_copy; } static void cib_rsc_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, void *user_data) { switch (rc) { case cib_ok: case cib_diff_failed: case cib_diff_resync: crm_trace("Resource update %d complete: rc=%d", call_id, rc); break; default: crm_warn("Resource update %d failed: (rc=%d) %s", call_id, rc, cib_error2string(rc)); } } static int do_update_resource(lrm_rsc_t * rsc, lrm_op_t * op) { /* */ int rc = cib_ok; xmlNode *update, *iter = NULL; int call_opt = cib_quorum_override; CRM_CHECK(op != NULL, return 0); if (fsa_state == S_ELECTION || fsa_state == S_PENDING) { crm_info("Sending update to local CIB in state: %s", fsa_state2string(fsa_state)); call_opt |= cib_scope_local; } iter = create_xml_node(iter, XML_CIB_TAG_STATUS); update = iter; iter = create_xml_node(iter, XML_CIB_TAG_STATE); set_uuid(iter, XML_ATTR_UUID, fsa_our_uname); crm_xml_add(iter, XML_ATTR_UNAME, fsa_our_uname); crm_xml_add(iter, XML_ATTR_ORIGIN, __FUNCTION__); iter = create_xml_node(iter, XML_CIB_TAG_LRM); crm_xml_add(iter, XML_ATTR_ID, fsa_our_uuid); iter = create_xml_node(iter, XML_LRM_TAG_RESOURCES); iter = create_xml_node(iter, XML_LRM_TAG_RESOURCE); crm_xml_add(iter, XML_ATTR_ID, op->rsc_id); build_operation_update(iter, rsc, op, __FUNCTION__); if (rsc) { crm_xml_add(iter, XML_ATTR_TYPE, rsc->type); crm_xml_add(iter, XML_AGENT_ATTR_CLASS, rsc->class); crm_xml_add(iter, XML_AGENT_ATTR_PROVIDER, rsc->provider); CRM_CHECK(rsc->type != NULL, crm_err("Resource %s has no value for type", op->rsc_id)); CRM_CHECK(rsc->class != NULL, crm_err("Resource %s has no value for class", op->rsc_id)); } else { crm_warn("Resource %s no longer exists in the lrmd", op->rsc_id); goto cleanup; } /* make it an asyncronous call and be done with it * * Best case: * the resource state will be discovered during * the next signup or election. * * Bad case: * we are shutting down and there is no DC at the time, * but then why were we shutting down then anyway? * (probably because of an internal error) * * Worst case: * we get shot for having resources "running" when the really weren't * * the alternative however means blocking here for too long, which * isnt acceptable */ fsa_cib_update(XML_CIB_TAG_STATUS, update, call_opt, rc, NULL); /* the return code is a call number, not an error code */ crm_trace("Sent resource state update message: %d", rc); fsa_cib_conn->cmds->register_callback(fsa_cib_conn, rc, 60, FALSE, NULL, "cib_rsc_callback", cib_rsc_callback); cleanup: free_xml(update); return rc; } void do_lrm_event(long long action, enum crmd_fsa_cause cause, enum crmd_fsa_state cur_state, enum crmd_fsa_input cur_input, fsa_data_t * msg_data) { CRM_CHECK(FALSE, return); } gboolean process_lrm_event(lrm_op_t * op) { char *op_id = NULL; char *op_key = NULL; int update_id = 0; int log_level = LOG_ERR; gboolean removed = FALSE; lrm_rsc_t *rsc = NULL; struct recurring_op_s *pending = NULL; CRM_CHECK(op != NULL, return FALSE); CRM_CHECK(op->rsc_id != NULL, return FALSE); op_key = generate_op_key(op->rsc_id, op->op_type, op->interval); switch (op->op_status) { case LRM_OP_ERROR: case LRM_OP_PENDING: case LRM_OP_NOTSUPPORTED: break; case LRM_OP_CANCELLED: log_level = LOG_INFO; break; case LRM_OP_DONE: log_level = LOG_INFO; break; case LRM_OP_TIMEOUT: log_level = LOG_DEBUG_3; crm_err("LRM operation %s (%d) %s (timeout=%dms)", op_key, op->call_id, op_status2text(op->op_status), op->timeout); break; default: crm_err("Mapping unknown status (%d) to ERROR", op->op_status); op->op_status = LRM_OP_ERROR; } if (op->op_status == LRM_OP_ERROR && (op->rc == EXECRA_RUNNING_MASTER || op->rc == EXECRA_NOT_RUNNING)) { /* Leave it up to the TE/PE to decide if this is an error */ op->op_status = LRM_OP_DONE; log_level = LOG_INFO; } op_id = make_stop_id(op->rsc_id, op->call_id); pending = g_hash_table_lookup(pending_ops, op_id); rsc = fsa_lrm_conn->lrm_ops->get_rsc(fsa_lrm_conn, op->rsc_id); if (op->op_status != LRM_OP_CANCELLED) { if (safe_str_eq(op->op_type, RSC_NOTIFY)) { /* Keep notify ops out of the CIB */ send_direct_ack(NULL, NULL, NULL, op, op->rsc_id); } else { update_id = do_update_resource(rsc, op); } if (op->interval != 0) { goto out; } } else if (op->interval == 0) { /* This will occur when "crm resource cleanup" is called while actions are in-flight */ crm_err("Op %s (call=%d): Cancelled", op_key, op->call_id); send_direct_ack(NULL, NULL, NULL, op, op->rsc_id); } else if (pending == NULL) { crm_err("Op %s (call=%d): No 'pending' entry", op_key, op->call_id); } else if (op->user_data == NULL) { crm_err("Op %s (call=%d): No user data", op_key, op->call_id); } else if (pending->remove) { delete_op_entry(op, op->rsc_id, op_key, op->call_id); } else { /* Before a stop is called, no need to direct ack */ crm_trace("Op %s (call=%d): no delete event required", op_key, op->call_id); } if (g_hash_table_remove(pending_ops, op_id)) { removed = TRUE; crm_trace("Op %s (call=%d, stop-id=%s): Confirmed", op_key, op->call_id, op_id); } out: if (op->op_status == LRM_OP_DONE) { do_crm_log(log_level, "LRM operation %s (call=%d, rc=%d, cib-update=%d, confirmed=%s) %s", op_key, op->call_id, op->rc, update_id, removed ? "true" : "false", execra_code2string(op->rc)); } else { do_crm_log(log_level, "LRM operation %s (call=%d, status=%d, cib-update=%d, confirmed=%s) %s", op_key, op->call_id, op->op_status, update_id, removed ? "true" : "false", op_status2text(op->op_status)); } if (op->rc != 0 && op->output != NULL) { crm_info("Result: %s", op->output); } else if (op->output != NULL) { crm_debug("Result: %s", op->output); } #ifdef HAVE_LRM_OP_T_RSC_DELETED if (op->rsc_deleted) { crm_info("Deletion of resource '%s' complete after %s", op->rsc_id, op_key); delete_rsc_entry(NULL, op->rsc_id, NULL, HA_OK, NULL); } #endif /* If a shutdown was escalated while operations were pending, * then the FSA will be stalled right now... allow it to continue */ mainloop_set_trigger(fsa_source); update_history_cache(rsc, op); lrm_free_rsc(rsc); crm_free(op_key); crm_free(op_id); return TRUE; } diff --git a/crmd/utils.c b/crmd/utils.c index a4d0b27fc7..83a7350cdb 100644 --- a/crmd/utils.c +++ b/crmd/utils.c @@ -1,1214 +1,1217 @@ /* * Copyright (C) 2004 Andrew Beekhof * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include <../tools/attrd.h> /* A_DC_TIMER_STOP, A_DC_TIMER_START, * A_FINALIZE_TIMER_STOP, A_FINALIZE_TIMER_START * A_INTEGRATE_TIMER_STOP, A_INTEGRATE_TIMER_START */ void do_timer_control(long long action, enum crmd_fsa_cause cause, enum crmd_fsa_state cur_state, enum crmd_fsa_input current_input, fsa_data_t * msg_data) { gboolean timer_op_ok = TRUE; if (action & A_DC_TIMER_STOP) { timer_op_ok = crm_timer_stop(election_trigger); } else if (action & A_FINALIZE_TIMER_STOP) { timer_op_ok = crm_timer_stop(finalization_timer); } else if (action & A_INTEGRATE_TIMER_STOP) { timer_op_ok = crm_timer_stop(integration_timer); /* } else if(action & A_ELECTION_TIMEOUT_STOP) { */ /* timer_op_ok = crm_timer_stop(election_timeout); */ } /* dont start a timer that wasnt already running */ if (action & A_DC_TIMER_START && timer_op_ok) { crm_timer_start(election_trigger); if (AM_I_DC) { /* there can be only one */ register_fsa_input(cause, I_ELECTION, NULL); } } else if (action & A_FINALIZE_TIMER_START) { crm_timer_start(finalization_timer); } else if (action & A_INTEGRATE_TIMER_START) { crm_timer_start(integration_timer); /* } else if(action & A_ELECTION_TIMEOUT_START) { */ /* crm_timer_start(election_timeout); */ } } const char * get_timer_desc(fsa_timer_t * timer) { if (timer == election_trigger) { return "Election Trigger"; } else if (timer == election_timeout) { return "Election Timeout"; } else if (timer == shutdown_escalation_timer) { return "Shutdown Escalation"; } else if (timer == integration_timer) { return "Integration Timer"; } else if (timer == finalization_timer) { return "Finalization Timer"; } else if (timer == transition_timer) { return "New Transition Timer"; } else if (timer == wait_timer) { return "Wait Timer"; } else if (timer == recheck_timer) { return "PEngine Recheck Timer"; } return "Unknown Timer"; } gboolean crm_timer_popped(gpointer data) { fsa_timer_t *timer = (fsa_timer_t *) data; if (timer == wait_timer || timer == recheck_timer || timer == transition_timer || timer == finalization_timer || timer == election_trigger) { crm_info("%s (%s) just popped (%dms)", get_timer_desc(timer), fsa_input2string(timer->fsa_input), timer->period_ms); timer->counter++; } else { crm_err("%s (%s) just popped in state %s! (%dms)", get_timer_desc(timer), fsa_input2string(timer->fsa_input), fsa_state2string(fsa_state), timer->period_ms); } if(timer == election_trigger && election_trigger->counter > 5) { crm_notice("We appear to be in an election loop, something may be wrong"); election_trigger->counter = 0; } if (timer->repeat == FALSE) { crm_timer_stop(timer); /* make it _not_ go off again */ } if (timer->fsa_input == I_INTEGRATED) { crm_info("Welcomed: %d, Integrated: %d", g_hash_table_size(welcomed_nodes), g_hash_table_size(integrated_nodes)); if (g_hash_table_size(welcomed_nodes) == 0) { /* If we don't even have ourself, start again */ register_fsa_error_adv(C_FSA_INTERNAL, I_ELECTION, NULL, NULL, __FUNCTION__); } else { register_fsa_input_before(C_TIMER_POPPED, timer->fsa_input, NULL); } } else if (timer == recheck_timer && fsa_state != S_IDLE) { crm_debug("Discarding %s event in state: %s", fsa_input2string(timer->fsa_input), fsa_state2string(fsa_state)); } else if (timer == finalization_timer && fsa_state != S_FINALIZE_JOIN) { crm_debug("Discarding %s event in state: %s", fsa_input2string(timer->fsa_input), fsa_state2string(fsa_state)); } else if (timer->fsa_input != I_NULL) { register_fsa_input(C_TIMER_POPPED, timer->fsa_input, NULL); } crm_trace("Triggering FSA: %s", __FUNCTION__); mainloop_set_trigger(fsa_source); return TRUE; } gboolean crm_timer_start(fsa_timer_t * timer) { const char *timer_desc = get_timer_desc(timer); if (timer->source_id == 0 && timer->period_ms > 0) { timer->source_id = g_timeout_add(timer->period_ms, timer->callback, (void *)timer); CRM_ASSERT(timer->source_id != 0); crm_debug("Started %s (%s:%dms), src=%d", timer_desc, fsa_input2string(timer->fsa_input), timer->period_ms, timer->source_id); } else if (timer->period_ms < 0) { crm_err("Tried to start %s (%s:%dms) with a -ve period", timer_desc, fsa_input2string(timer->fsa_input), timer->period_ms); } else { crm_debug("%s (%s:%dms) already running: src=%d", timer_desc, fsa_input2string(timer->fsa_input), timer->period_ms, timer->source_id); return FALSE; } return TRUE; } gboolean crm_timer_stop(fsa_timer_t * timer) { const char *timer_desc = get_timer_desc(timer); if (timer == NULL) { crm_err("Attempted to stop NULL timer"); return FALSE; } else if (timer->source_id != 0) { crm_trace("Stopping %s (%s:%dms), src=%d", timer_desc, fsa_input2string(timer->fsa_input), timer->period_ms, timer->source_id); g_source_remove(timer->source_id); timer->source_id = 0; } else { crm_trace("%s (%s:%dms) already stopped", timer_desc, fsa_input2string(timer->fsa_input), timer->period_ms); return FALSE; } return TRUE; } const char * fsa_input2string(enum crmd_fsa_input input) { const char *inputAsText = NULL; switch (input) { case I_NULL: inputAsText = "I_NULL"; break; case I_CIB_OP: inputAsText = "I_CIB_OP (unused)"; break; case I_CIB_UPDATE: inputAsText = "I_CIB_UPDATE"; break; case I_DC_TIMEOUT: inputAsText = "I_DC_TIMEOUT"; break; case I_ELECTION: inputAsText = "I_ELECTION"; break; case I_PE_CALC: inputAsText = "I_PE_CALC"; break; case I_RELEASE_DC: inputAsText = "I_RELEASE_DC"; break; case I_ELECTION_DC: inputAsText = "I_ELECTION_DC"; break; case I_ERROR: inputAsText = "I_ERROR"; break; case I_FAIL: inputAsText = "I_FAIL"; break; case I_INTEGRATED: inputAsText = "I_INTEGRATED"; break; case I_FINALIZED: inputAsText = "I_FINALIZED"; break; case I_NODE_JOIN: inputAsText = "I_NODE_JOIN"; break; case I_JOIN_OFFER: inputAsText = "I_JOIN_OFFER"; break; case I_JOIN_REQUEST: inputAsText = "I_JOIN_REQUEST"; break; case I_JOIN_RESULT: inputAsText = "I_JOIN_RESULT"; break; case I_NOT_DC: inputAsText = "I_NOT_DC"; break; case I_RECOVERED: inputAsText = "I_RECOVERED"; break; case I_RELEASE_FAIL: inputAsText = "I_RELEASE_FAIL"; break; case I_RELEASE_SUCCESS: inputAsText = "I_RELEASE_SUCCESS"; break; case I_RESTART: inputAsText = "I_RESTART"; break; case I_PE_SUCCESS: inputAsText = "I_PE_SUCCESS"; break; case I_ROUTER: inputAsText = "I_ROUTER"; break; case I_SHUTDOWN: inputAsText = "I_SHUTDOWN"; break; case I_STARTUP: inputAsText = "I_STARTUP"; break; case I_TE_SUCCESS: inputAsText = "I_TE_SUCCESS"; break; case I_STOP: inputAsText = "I_STOP"; break; case I_DC_HEARTBEAT: inputAsText = "I_DC_HEARTBEAT"; break; case I_WAIT_FOR_EVENT: inputAsText = "I_WAIT_FOR_EVENT"; break; case I_LRM_EVENT: inputAsText = "I_LRM_EVENT"; break; case I_PENDING: inputAsText = "I_PENDING"; break; case I_HALT: inputAsText = "I_HALT"; break; case I_TERMINATE: inputAsText = "I_TERMINATE"; break; case I_ILLEGAL: inputAsText = "I_ILLEGAL"; break; } if (inputAsText == NULL) { crm_err("Input %d is unknown", input); inputAsText = ""; } return inputAsText; } const char * fsa_state2string(enum crmd_fsa_state state) { const char *stateAsText = NULL; switch (state) { case S_IDLE: stateAsText = "S_IDLE"; break; case S_ELECTION: stateAsText = "S_ELECTION"; break; case S_INTEGRATION: stateAsText = "S_INTEGRATION"; break; case S_FINALIZE_JOIN: stateAsText = "S_FINALIZE_JOIN"; break; case S_NOT_DC: stateAsText = "S_NOT_DC"; break; case S_POLICY_ENGINE: stateAsText = "S_POLICY_ENGINE"; break; case S_RECOVERY: stateAsText = "S_RECOVERY"; break; case S_RELEASE_DC: stateAsText = "S_RELEASE_DC"; break; case S_PENDING: stateAsText = "S_PENDING"; break; case S_STOPPING: stateAsText = "S_STOPPING"; break; case S_TERMINATE: stateAsText = "S_TERMINATE"; break; case S_TRANSITION_ENGINE: stateAsText = "S_TRANSITION_ENGINE"; break; case S_STARTING: stateAsText = "S_STARTING"; break; case S_HALT: stateAsText = "S_HALT"; break; case S_ILLEGAL: stateAsText = "S_ILLEGAL"; break; } if (stateAsText == NULL) { crm_err("State %d is unknown", state); stateAsText = ""; } return stateAsText; } const char * fsa_cause2string(enum crmd_fsa_cause cause) { const char *causeAsText = NULL; switch (cause) { case C_UNKNOWN: causeAsText = "C_UNKNOWN"; break; case C_STARTUP: causeAsText = "C_STARTUP"; break; case C_IPC_MESSAGE: causeAsText = "C_IPC_MESSAGE"; break; case C_HA_MESSAGE: causeAsText = "C_HA_MESSAGE"; break; case C_CCM_CALLBACK: causeAsText = "C_CCM_CALLBACK"; break; case C_TIMER_POPPED: causeAsText = "C_TIMER_POPPED"; break; case C_SHUTDOWN: causeAsText = "C_SHUTDOWN"; break; case C_HEARTBEAT_FAILED: causeAsText = "C_HEARTBEAT_FAILED"; break; case C_SUBSYSTEM_CONNECT: causeAsText = "C_SUBSYSTEM_CONNECT"; break; case C_LRM_OP_CALLBACK: causeAsText = "C_LRM_OP_CALLBACK"; break; case C_LRM_MONITOR_CALLBACK: causeAsText = "C_LRM_MONITOR_CALLBACK"; break; case C_CRMD_STATUS_CALLBACK: causeAsText = "C_CRMD_STATUS_CALLBACK"; break; case C_HA_DISCONNECT: causeAsText = "C_HA_DISCONNECT"; break; case C_FSA_INTERNAL: causeAsText = "C_FSA_INTERNAL"; break; case C_ILLEGAL: causeAsText = "C_ILLEGAL"; break; } if (causeAsText == NULL) { crm_err("Cause %d is unknown", cause); causeAsText = ""; } return causeAsText; } const char * fsa_action2string(long long action) { const char *actionAsText = NULL; switch (action) { case A_NOTHING: actionAsText = "A_NOTHING"; break; case A_ELECTION_START: actionAsText = "A_ELECTION_START"; break; case A_DC_JOIN_FINAL: actionAsText = "A_DC_JOIN_FINAL"; break; case A_READCONFIG: actionAsText = "A_READCONFIG"; break; case O_RELEASE: actionAsText = "O_RELEASE"; break; case A_STARTUP: actionAsText = "A_STARTUP"; break; case A_STARTED: actionAsText = "A_STARTED"; break; case A_HA_CONNECT: actionAsText = "A_HA_CONNECT"; break; case A_HA_DISCONNECT: actionAsText = "A_HA_DISCONNECT"; break; case A_LRM_CONNECT: actionAsText = "A_LRM_CONNECT"; break; case A_LRM_EVENT: actionAsText = "A_LRM_EVENT"; break; case A_LRM_INVOKE: actionAsText = "A_LRM_INVOKE"; break; case A_LRM_DISCONNECT: actionAsText = "A_LRM_DISCONNECT"; break; + case O_LRM_RECONNECT: + actionAsText = "O_LRM_RECONNECT"; + break; case A_CL_JOIN_QUERY: actionAsText = "A_CL_JOIN_QUERY"; break; case A_DC_TIMER_STOP: actionAsText = "A_DC_TIMER_STOP"; break; case A_DC_TIMER_START: actionAsText = "A_DC_TIMER_START"; break; case A_INTEGRATE_TIMER_START: actionAsText = "A_INTEGRATE_TIMER_START"; break; case A_INTEGRATE_TIMER_STOP: actionAsText = "A_INTEGRATE_TIMER_STOP"; break; case A_FINALIZE_TIMER_START: actionAsText = "A_FINALIZE_TIMER_START"; break; case A_FINALIZE_TIMER_STOP: actionAsText = "A_FINALIZE_TIMER_STOP"; break; case A_ELECTION_COUNT: actionAsText = "A_ELECTION_COUNT"; break; case A_ELECTION_VOTE: actionAsText = "A_ELECTION_VOTE"; break; case A_ELECTION_CHECK: actionAsText = "A_ELECTION_CHECK"; break; case A_CL_JOIN_ANNOUNCE: actionAsText = "A_CL_JOIN_ANNOUNCE"; break; case A_CL_JOIN_REQUEST: actionAsText = "A_CL_JOIN_REQUEST"; break; case A_CL_JOIN_RESULT: actionAsText = "A_CL_JOIN_RESULT"; break; case A_DC_JOIN_OFFER_ALL: actionAsText = "A_DC_JOIN_OFFER_ALL"; break; case A_DC_JOIN_OFFER_ONE: actionAsText = "A_DC_JOIN_OFFER_ONE"; break; case A_DC_JOIN_PROCESS_REQ: actionAsText = "A_DC_JOIN_PROCESS_REQ"; break; case A_DC_JOIN_PROCESS_ACK: actionAsText = "A_DC_JOIN_PROCESS_ACK"; break; case A_DC_JOIN_FINALIZE: actionAsText = "A_DC_JOIN_FINALIZE"; break; case A_MSG_PROCESS: actionAsText = "A_MSG_PROCESS"; break; case A_MSG_ROUTE: actionAsText = "A_MSG_ROUTE"; break; case A_RECOVER: actionAsText = "A_RECOVER"; break; case A_DC_RELEASE: actionAsText = "A_DC_RELEASE"; break; case A_DC_RELEASED: actionAsText = "A_DC_RELEASED"; break; case A_DC_TAKEOVER: actionAsText = "A_DC_TAKEOVER"; break; case A_SHUTDOWN: actionAsText = "A_SHUTDOWN"; break; case A_SHUTDOWN_REQ: actionAsText = "A_SHUTDOWN_REQ"; break; case A_STOP: actionAsText = "A_STOP "; break; case A_EXIT_0: actionAsText = "A_EXIT_0"; break; case A_EXIT_1: actionAsText = "A_EXIT_1"; break; case A_CCM_CONNECT: actionAsText = "A_CCM_CONNECT"; break; case A_CCM_DISCONNECT: actionAsText = "A_CCM_DISCONNECT"; break; case O_CIB_RESTART: actionAsText = "O_CIB_RESTART"; break; case A_CIB_START: actionAsText = "A_CIB_START"; break; case A_CIB_STOP: actionAsText = "A_CIB_STOP"; break; case A_TE_INVOKE: actionAsText = "A_TE_INVOKE"; break; case O_TE_RESTART: actionAsText = "O_TE_RESTART"; break; case A_TE_START: actionAsText = "A_TE_START"; break; case A_TE_STOP: actionAsText = "A_TE_STOP"; break; case A_TE_HALT: actionAsText = "A_TE_HALT"; break; case A_TE_CANCEL: actionAsText = "A_TE_CANCEL"; break; case A_PE_INVOKE: actionAsText = "A_PE_INVOKE"; break; case O_PE_RESTART: actionAsText = "O_PE_RESTART"; break; case A_PE_START: actionAsText = "A_PE_START"; break; case A_PE_STOP: actionAsText = "A_PE_STOP"; break; case A_NODE_BLOCK: actionAsText = "A_NODE_BLOCK"; break; case A_UPDATE_NODESTATUS: actionAsText = "A_UPDATE_NODESTATUS"; break; case A_LOG: actionAsText = "A_LOG "; break; case A_ERROR: actionAsText = "A_ERROR "; break; case A_WARN: actionAsText = "A_WARN "; break; /* Composite actions */ case A_DC_TIMER_START | A_CL_JOIN_QUERY: actionAsText = "A_DC_TIMER_START|A_CL_JOIN_QUERY"; break; } if (actionAsText == NULL) { crm_err("Action %.16llx is unknown", action); actionAsText = ""; } return actionAsText; } void fsa_dump_inputs(int log_level, const char *text, long long input_register) { if (input_register == A_NOTHING) { return; } if (text == NULL) { text = "Input register contents:"; } if (is_set(input_register, R_THE_DC)) { crm_trace( "%s %.16llx (R_THE_DC)", text, R_THE_DC); } if (is_set(input_register, R_STARTING)) { crm_trace( "%s %.16llx (R_STARTING)", text, R_STARTING); } if (is_set(input_register, R_SHUTDOWN)) { crm_trace( "%s %.16llx (R_SHUTDOWN)", text, R_SHUTDOWN); } if (is_set(input_register, R_STAYDOWN)) { crm_trace( "%s %.16llx (R_STAYDOWN)", text, R_STAYDOWN); } if (is_set(input_register, R_JOIN_OK)) { crm_trace( "%s %.16llx (R_JOIN_OK)", text, R_JOIN_OK); } if (is_set(input_register, R_READ_CONFIG)) { crm_trace( "%s %.16llx (R_READ_CONFIG)", text, R_READ_CONFIG); } if (is_set(input_register, R_INVOKE_PE)) { crm_trace( "%s %.16llx (R_INVOKE_PE)", text, R_INVOKE_PE); } if (is_set(input_register, R_CIB_CONNECTED)) { crm_trace( "%s %.16llx (R_CIB_CONNECTED)", text, R_CIB_CONNECTED); } if (is_set(input_register, R_PE_CONNECTED)) { crm_trace( "%s %.16llx (R_PE_CONNECTED)", text, R_PE_CONNECTED); } if (is_set(input_register, R_TE_CONNECTED)) { crm_trace( "%s %.16llx (R_TE_CONNECTED)", text, R_TE_CONNECTED); } if (is_set(input_register, R_LRM_CONNECTED)) { crm_trace( "%s %.16llx (R_LRM_CONNECTED)", text, R_LRM_CONNECTED); } if (is_set(input_register, R_CIB_REQUIRED)) { crm_trace( "%s %.16llx (R_CIB_REQUIRED)", text, R_CIB_REQUIRED); } if (is_set(input_register, R_PE_REQUIRED)) { crm_trace( "%s %.16llx (R_PE_REQUIRED)", text, R_PE_REQUIRED); } if (is_set(input_register, R_TE_REQUIRED)) { crm_trace( "%s %.16llx (R_TE_REQUIRED)", text, R_TE_REQUIRED); } if (is_set(input_register, R_REQ_PEND)) { crm_trace( "%s %.16llx (R_REQ_PEND)", text, R_REQ_PEND); } if (is_set(input_register, R_PE_PEND)) { crm_trace( "%s %.16llx (R_PE_PEND)", text, R_PE_PEND); } if (is_set(input_register, R_TE_PEND)) { crm_trace( "%s %.16llx (R_TE_PEND)", text, R_TE_PEND); } if (is_set(input_register, R_RESP_PEND)) { crm_trace( "%s %.16llx (R_RESP_PEND)", text, R_RESP_PEND); } if (is_set(input_register, R_CIB_DONE)) { crm_trace( "%s %.16llx (R_CIB_DONE)", text, R_CIB_DONE); } if (is_set(input_register, R_HAVE_CIB)) { crm_trace( "%s %.16llx (R_HAVE_CIB)", text, R_HAVE_CIB); } if (is_set(input_register, R_CIB_ASKED)) { crm_trace( "%s %.16llx (R_CIB_ASKED)", text, R_CIB_ASKED); } if (is_set(input_register, R_MEMBERSHIP)) { crm_trace( "%s %.16llx (R_MEMBERSHIP)", text, R_MEMBERSHIP); } if (is_set(input_register, R_PEER_DATA)) { crm_trace( "%s %.16llx (R_PEER_DATA)", text, R_PEER_DATA); } if (is_set(input_register, R_IN_RECOVERY)) { crm_trace( "%s %.16llx (R_IN_RECOVERY)", text, R_IN_RECOVERY); } } void fsa_dump_actions(long long action, const char *text) { if (is_set(action, A_READCONFIG)) { crm_trace( "Action %.16llx (A_READCONFIG) %s", A_READCONFIG, text); } if (is_set(action, A_STARTUP)) { crm_trace( "Action %.16llx (A_STARTUP) %s", A_STARTUP, text); } if (is_set(action, A_STARTED)) { crm_trace( "Action %.16llx (A_STARTED) %s", A_STARTED, text); } if (is_set(action, A_HA_CONNECT)) { crm_trace( "Action %.16llx (A_CONNECT) %s", A_HA_CONNECT, text); } if (is_set(action, A_HA_DISCONNECT)) { crm_trace( "Action %.16llx (A_DISCONNECT) %s", A_HA_DISCONNECT, text); } if (is_set(action, A_LRM_CONNECT)) { crm_trace( "Action %.16llx (A_LRM_CONNECT) %s", A_LRM_CONNECT, text); } if (is_set(action, A_LRM_EVENT)) { crm_trace( "Action %.16llx (A_LRM_EVENT) %s", A_LRM_EVENT, text); } if (is_set(action, A_LRM_INVOKE)) { crm_trace( "Action %.16llx (A_LRM_INVOKE) %s", A_LRM_INVOKE, text); } if (is_set(action, A_LRM_DISCONNECT)) { crm_trace( "Action %.16llx (A_LRM_DISCONNECT) %s", A_LRM_DISCONNECT, text); } if (is_set(action, A_DC_TIMER_STOP)) { crm_trace( "Action %.16llx (A_DC_TIMER_STOP) %s", A_DC_TIMER_STOP, text); } if (is_set(action, A_DC_TIMER_START)) { crm_trace( "Action %.16llx (A_DC_TIMER_START) %s", A_DC_TIMER_START, text); } if (is_set(action, A_INTEGRATE_TIMER_START)) { crm_trace( "Action %.16llx (A_INTEGRATE_TIMER_START) %s", A_INTEGRATE_TIMER_START, text); } if (is_set(action, A_INTEGRATE_TIMER_STOP)) { crm_trace( "Action %.16llx (A_INTEGRATE_TIMER_STOP) %s", A_INTEGRATE_TIMER_STOP, text); } if (is_set(action, A_FINALIZE_TIMER_START)) { crm_trace( "Action %.16llx (A_FINALIZE_TIMER_START) %s", A_FINALIZE_TIMER_START, text); } if (is_set(action, A_FINALIZE_TIMER_STOP)) { crm_trace( "Action %.16llx (A_FINALIZE_TIMER_STOP) %s", A_FINALIZE_TIMER_STOP, text); } if (is_set(action, A_ELECTION_COUNT)) { crm_trace( "Action %.16llx (A_ELECTION_COUNT) %s", A_ELECTION_COUNT, text); } if (is_set(action, A_ELECTION_VOTE)) { crm_trace( "Action %.16llx (A_ELECTION_VOTE) %s", A_ELECTION_VOTE, text); } if (is_set(action, A_ELECTION_CHECK)) { crm_trace( "Action %.16llx (A_ELECTION_CHECK) %s", A_ELECTION_CHECK, text); } if (is_set(action, A_CL_JOIN_ANNOUNCE)) { crm_trace( "Action %.16llx (A_CL_JOIN_ANNOUNCE) %s", A_CL_JOIN_ANNOUNCE, text); } if (is_set(action, A_CL_JOIN_REQUEST)) { crm_trace( "Action %.16llx (A_CL_JOIN_REQUEST) %s", A_CL_JOIN_REQUEST, text); } if (is_set(action, A_CL_JOIN_RESULT)) { crm_trace( "Action %.16llx (A_CL_JOIN_RESULT) %s", A_CL_JOIN_RESULT, text); } if (is_set(action, A_DC_JOIN_OFFER_ALL)) { crm_trace( "Action %.16llx (A_DC_JOIN_OFFER_ALL) %s", A_DC_JOIN_OFFER_ALL, text); } if (is_set(action, A_DC_JOIN_OFFER_ONE)) { crm_trace( "Action %.16llx (A_DC_JOIN_OFFER_ONE) %s", A_DC_JOIN_OFFER_ONE, text); } if (is_set(action, A_DC_JOIN_PROCESS_REQ)) { crm_trace( "Action %.16llx (A_DC_JOIN_PROCESS_REQ) %s", A_DC_JOIN_PROCESS_REQ, text); } if (is_set(action, A_DC_JOIN_PROCESS_ACK)) { crm_trace( "Action %.16llx (A_DC_JOIN_PROCESS_ACK) %s", A_DC_JOIN_PROCESS_ACK, text); } if (is_set(action, A_DC_JOIN_FINALIZE)) { crm_trace( "Action %.16llx (A_DC_JOIN_FINALIZE) %s", A_DC_JOIN_FINALIZE, text); } if (is_set(action, A_MSG_PROCESS)) { crm_trace( "Action %.16llx (A_MSG_PROCESS) %s", A_MSG_PROCESS, text); } if (is_set(action, A_MSG_ROUTE)) { crm_trace( "Action %.16llx (A_MSG_ROUTE) %s", A_MSG_ROUTE, text); } if (is_set(action, A_RECOVER)) { crm_trace( "Action %.16llx (A_RECOVER) %s", A_RECOVER, text); } if (is_set(action, A_DC_RELEASE)) { crm_trace( "Action %.16llx (A_DC_RELEASE) %s", A_DC_RELEASE, text); } if (is_set(action, A_DC_RELEASED)) { crm_trace( "Action %.16llx (A_DC_RELEASED) %s", A_DC_RELEASED, text); } if (is_set(action, A_DC_TAKEOVER)) { crm_trace( "Action %.16llx (A_DC_TAKEOVER) %s", A_DC_TAKEOVER, text); } if (is_set(action, A_SHUTDOWN)) { crm_trace( "Action %.16llx (A_SHUTDOWN) %s", A_SHUTDOWN, text); } if (is_set(action, A_SHUTDOWN_REQ)) { crm_trace( "Action %.16llx (A_SHUTDOWN_REQ) %s", A_SHUTDOWN_REQ, text); } if (is_set(action, A_STOP)) { crm_trace( "Action %.16llx (A_STOP ) %s", A_STOP, text); } if (is_set(action, A_EXIT_0)) { crm_trace( "Action %.16llx (A_EXIT_0) %s", A_EXIT_0, text); } if (is_set(action, A_EXIT_1)) { crm_trace( "Action %.16llx (A_EXIT_1) %s", A_EXIT_1, text); } if (is_set(action, A_CCM_CONNECT)) { crm_trace( "Action %.16llx (A_CCM_CONNECT) %s", A_CCM_CONNECT, text); } if (is_set(action, A_CCM_DISCONNECT)) { crm_trace( "Action %.16llx (A_CCM_DISCONNECT) %s", A_CCM_DISCONNECT, text); } if (is_set(action, A_CIB_START)) { crm_trace( "Action %.16llx (A_CIB_START) %s", A_CIB_START, text); } if (is_set(action, A_CIB_STOP)) { crm_trace( "Action %.16llx (A_CIB_STOP) %s", A_CIB_STOP, text); } if (is_set(action, A_TE_INVOKE)) { crm_trace( "Action %.16llx (A_TE_INVOKE) %s", A_TE_INVOKE, text); } if (is_set(action, A_TE_START)) { crm_trace( "Action %.16llx (A_TE_START) %s", A_TE_START, text); } if (is_set(action, A_TE_STOP)) { crm_trace( "Action %.16llx (A_TE_STOP) %s", A_TE_STOP, text); } if (is_set(action, A_TE_CANCEL)) { crm_trace( "Action %.16llx (A_TE_CANCEL) %s", A_TE_CANCEL, text); } if (is_set(action, A_PE_INVOKE)) { crm_trace( "Action %.16llx (A_PE_INVOKE) %s", A_PE_INVOKE, text); } if (is_set(action, A_PE_START)) { crm_trace( "Action %.16llx (A_PE_START) %s", A_PE_START, text); } if (is_set(action, A_PE_STOP)) { crm_trace( "Action %.16llx (A_PE_STOP) %s", A_PE_STOP, text); } if (is_set(action, A_NODE_BLOCK)) { crm_trace( "Action %.16llx (A_NODE_BLOCK) %s", A_NODE_BLOCK, text); } if (is_set(action, A_UPDATE_NODESTATUS)) { crm_trace( "Action %.16llx (A_UPDATE_NODESTATUS) %s", A_UPDATE_NODESTATUS, text); } if (is_set(action, A_LOG)) { crm_trace( "Action %.16llx (A_LOG ) %s", A_LOG, text); } if (is_set(action, A_ERROR)) { crm_trace( "Action %.16llx (A_ERROR ) %s", A_ERROR, text); } if (is_set(action, A_WARN)) { crm_trace( "Action %.16llx (A_WARN ) %s", A_WARN, text); } } void create_node_entry(const char *uuid, const char *uname, const char *type) { /* make sure a node entry exists for the new node * * this will add anyone except the first ever node in the cluster * since it will also be the DC which doesnt go through the * join process (with itself). We can include a special case * later if desired. */ xmlNode *tmp1 = create_xml_node(NULL, XML_CIB_TAG_NODE); crm_trace("Creating node entry for %s", uname); set_uuid(tmp1, XML_ATTR_UUID, uname); crm_xml_add(tmp1, XML_ATTR_UNAME, uname); crm_xml_add(tmp1, XML_ATTR_TYPE, type); fsa_cib_anon_update(XML_CIB_TAG_NODES, tmp1, cib_scope_local | cib_quorum_override | cib_can_create); free_xml(tmp1); } xmlNode * create_node_state(const char *uname, const char *ha_state, const char *ccm_state, const char *crmd_state, const char *join_state, const char *exp_state, gboolean clear_shutdown, const char *src) { xmlNode *node_state = create_xml_node(NULL, XML_CIB_TAG_STATE); crm_trace("%s Creating node state entry for %s", src, uname); set_uuid(node_state, XML_ATTR_UUID, uname); if (crm_element_value(node_state, XML_ATTR_UUID) == NULL) { crm_debug("Node %s is not a cluster member", uname); free_xml(node_state); return NULL; } crm_xml_add(node_state, XML_ATTR_UNAME, uname); crm_xml_add(node_state, XML_CIB_ATTR_HASTATE, ha_state); crm_xml_add(node_state, XML_CIB_ATTR_INCCM, ccm_state); crm_xml_add(node_state, XML_CIB_ATTR_CRMDSTATE, crmd_state); crm_xml_add(node_state, XML_CIB_ATTR_JOINSTATE, join_state); crm_xml_add(node_state, XML_CIB_ATTR_EXPSTATE, exp_state); crm_xml_add(node_state, XML_ATTR_ORIGIN, src); if (clear_shutdown) { crm_xml_add(node_state, XML_CIB_ATTR_SHUTDOWN, "0"); } crm_log_xml_trace(node_state, "created"); return node_state; } extern GHashTable *ipc_clients; void process_client_disconnect(crmd_client_t * curr_client) { struct crm_subsystem_s *the_subsystem = NULL; CRM_CHECK(curr_client != NULL, return); crm_trace("received HUP from %s", curr_client->table_key); if (curr_client->sub_sys == NULL) { crm_trace("Client hadn't registered with us yet"); } else if (strcasecmp(CRM_SYSTEM_PENGINE, curr_client->sub_sys) == 0) { the_subsystem = pe_subsystem; } else if (strcasecmp(CRM_SYSTEM_TENGINE, curr_client->sub_sys) == 0) { the_subsystem = te_subsystem; } else if (strcasecmp(CRM_SYSTEM_CIB, curr_client->sub_sys) == 0) { the_subsystem = cib_subsystem; } if (the_subsystem != NULL) { the_subsystem->ipc = NULL; the_subsystem->client = NULL; crm_info("Received HUP from %s:[%d]", the_subsystem->name, the_subsystem->pid); } else { /* else that was a transient client */ crm_trace("Received HUP from transient client"); } if (curr_client->table_key != NULL) { /* * Key is destroyed below as: * curr_client->table_key * Value is cleaned up by: * crmd_ipc_connection_destroy * which will also call: * G_main_del_IPC_Channel */ g_hash_table_remove(ipc_clients, curr_client->table_key); } } gboolean update_dc(xmlNode * msg) { char *last_dc = fsa_our_dc; const char *dc_version = NULL; const char *welcome_from = NULL; if (msg != NULL) { gboolean invalid = FALSE; dc_version = crm_element_value(msg, F_CRM_VERSION); welcome_from = crm_element_value(msg, F_CRM_HOST_FROM); CRM_CHECK(dc_version != NULL, return FALSE); CRM_CHECK(welcome_from != NULL, return FALSE); if (AM_I_DC && safe_str_neq(welcome_from, fsa_our_uname)) { invalid = TRUE; } else if (fsa_our_dc && safe_str_neq(welcome_from, fsa_our_dc)) { invalid = TRUE; } if (invalid) { CRM_CHECK(fsa_our_dc != NULL, crm_err("We have no DC")); if (AM_I_DC) { crm_err("Not updating DC to %s (%s): we are also a DC", welcome_from, dc_version); } else { crm_warn("New DC %s is not %s", welcome_from, fsa_our_dc); } register_fsa_action(A_CL_JOIN_QUERY | A_DC_TIMER_START); return FALSE; } } crm_free(fsa_our_dc_version); fsa_our_dc_version = NULL; fsa_our_dc = NULL; /* Free'd as last_dc */ if (welcome_from != NULL) { fsa_our_dc = crm_strdup(welcome_from); } if (dc_version != NULL) { fsa_our_dc_version = crm_strdup(dc_version); } if (safe_str_eq(fsa_our_dc, last_dc)) { /* do nothing */ } else if (fsa_our_dc != NULL) { crm_info("Set DC to %s (%s)", crm_str(fsa_our_dc), crm_str(fsa_our_dc_version)); } else if (last_dc != NULL) { crm_debug("Unset DC. Was %s", crm_str(last_dc)); } crm_free(last_dc); return TRUE; } #define STATUS_PATH_MAX 512 static void erase_xpath_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, void *user_data) { char *xpath = user_data; do_crm_log(rc == 0 ? LOG_DEBUG : LOG_NOTICE, "Deletion of \"%s\": %s (rc=%d)", xpath, cib_error2string(rc), rc); crm_free(xpath); } void erase_status_tag(const char *uname, const char *tag, int options) { int rc = cib_ok; char xpath[STATUS_PATH_MAX]; int cib_opts = cib_quorum_override | cib_xpath | options; if (fsa_cib_conn && uname) { snprintf(xpath, STATUS_PATH_MAX, "//node_state[@uname='%s']/%s", uname, tag); crm_info("Deleting xpath: %s", xpath); rc = fsa_cib_conn->cmds->delete(fsa_cib_conn, xpath, NULL, cib_opts); add_cib_op_callback(fsa_cib_conn, rc, FALSE, crm_strdup(xpath), erase_xpath_callback); } } static IPC_Channel *attrd = NULL; static gboolean attrd_dispatch(IPC_Channel * client, gpointer user_data) { xmlNode *msg = NULL; gboolean stay_connected = TRUE; while (IPC_ISRCONN(client)) { if (client->ops->is_message_pending(client) == 0) { break; } msg = xmlfromIPC(client, MAX_IPC_DELAY); if (msg != NULL) { crm_log_xml_err(msg, "attrd:msg"); free_xml(msg); } } if (client->ch_status != IPC_CONNECT) { stay_connected = FALSE; } return stay_connected; } static void attrd_connection_destroy(gpointer user_data) { crm_err("Lost connection to attrd"); attrd = NULL; return; } void update_attrd(const char *host, const char *name, const char *value, const char *user_name) { int retries = 0; gboolean rc = FALSE; do { rc = FALSE; if (attrd == NULL) { crm_info("Connecting to attrd..."); attrd = init_client_ipc_comms_nodispatch(T_ATTRD); if (attrd) { G_main_add_IPC_Channel(G_PRIORITY_LOW, attrd, FALSE, attrd_dispatch, NULL, attrd_connection_destroy); } } if (attrd != NULL) { rc = attrd_update_delegate(attrd, 'U', host, name, value, XML_CIB_TAG_STATUS, NULL, NULL, user_name); } else { crm_warn("Could not connect to %s", T_ATTRD); } if (rc == FALSE) { attrd = NULL; if (retries < 5) { retries++; sleep(retries); } } } while(rc == FALSE && retries < 5); if (rc == FALSE) { crm_err("Could not send %s %s %s (%d)", T_ATTRD, name ? "update" : "refresh", name?name:"", is_set(fsa_input_register, R_SHUTDOWN)); if(is_set(fsa_input_register, R_SHUTDOWN)) { register_fsa_input(C_FSA_INTERNAL, I_FAIL, NULL); } } else if(retries) { crm_debug("Needed %d retries to send %s %s %s", retries, T_ATTRD, name ? "update" : "refresh", name?name:""); } } diff --git a/doc/Pacemaker_Explained/en-US/Ap-Changes.xml b/doc/Pacemaker_Explained/en-US/Ap-Changes.xml index e8484763f5..4e7a3447fa 100644 --- a/doc/Pacemaker_Explained/en-US/Ap-Changes.xml +++ b/doc/Pacemaker_Explained/en-US/Ap-Changes.xml @@ -1,86 +1,86 @@ What Changed in 1.0
New - Failure timeouts. See - New section for resource and operation defaults. See and - Tool for making offline configuration changes. See - Rules, instance_attributes, meta_attributes and sets of operations can be defined once and referenced in multiple places. See - The CIB now accepts XPath-based create/modify/delete operations. See the cibadmin help text. - Multi-dimensional colocation and ordering constraints. See and - The ability to connect to the CIB from non-cluster machines. See - Allow recurring actions to be triggered at known times. See + Failure timeouts. See + New section for resource and operation defaults. See and + Tool for making offline configuration changes. See + Rules, instance_attributes, meta_attributes and sets of operations can be defined once and referenced in multiple places. See + The CIB now accepts XPath-based create/modify/delete operations. See the cibadmin help text. + Multi-dimensional colocation and ordering constraints. See and + The ability to connect to the CIB from non-cluster machines. See + Allow recurring actions to be triggered at known times. See
Changed - + Syntax - - All resource and cluster options now use dashes (-) instead of underscores (_) - master_slave was renamed to master - The attributes container tag was removed - The operation field pre-req has been renamed requires - All operations must have an interval, start/stop must have it set to zero - - + + All resource and cluster options now use dashes (-) instead of underscores (_) + master_slave was renamed to master + The attributes container tag was removed + The operation field pre-req has been renamed requires + All operations must have an interval, start/stop must have it set to zero + + The stonith-enabled option now defaults to true. - The cluster will refuse to start resources if stonith-enabled is true (or unset) and no STONITH resources have been defined - The attributes of colocation and ordering constraints were renamed for clarity. See and - resource-failure-stickiness has been replaced by migration-threshold. See - The parameters for command-line tools have been made consistent - + The cluster will refuse to start resources if stonith-enabled is true (or unset) and no STONITH resources have been defined + The attributes of colocation and ordering constraints were renamed for clarity. See and + resource-failure-stickiness has been replaced by migration-threshold. See + The parameters for command-line tools have been made consistent + Switched to RelaxNGRelaxNG schema validation and libxml2libxml2 parser - - - id fields are now XML IDs which have the following limitations: - - id's cannot contain colons (:) - id's cannot begin with a number - id's must be globally unique (not just unique for that tag) - - - - - Some fields (such as those in constraints that refer to resources) are IDREFs. - This means that they must reference existing resources or objects in order for the configuration to be valid. - Removing an object which is referenced elsewhere will therefore fail. - - - - - The CIB representation, from which a MD5 digest is calculated to verify CIBs on the nodes, has changed. - This means that every CIB update will require a full refresh on any upgraded nodes until the cluster is fully upgraded to 1.0. - This will result in significant performance degradation and it is therefore highly inadvisable to run a mixed 1.0/0.6 cluster for any longer than absolutely necessary. - - - - - + + + id fields are now XML IDs which have the following limitations: + + id's cannot contain colons (:) + id's cannot begin with a number + id's must be globally unique (not just unique for that tag) + + + + + Some fields (such as those in constraints that refer to resources) are IDREFs. + This means that they must reference existing resources or objects in order for the configuration to be valid. + Removing an object which is referenced elsewhere will therefore fail. + + + + + The CIB representation, from which a MD5 digest is calculated to verify CIBs on the nodes, has changed. + This means that every CIB update will require a full refresh on any upgraded nodes until the cluster is fully upgraded to 1.0. + This will result in significant performance degradation and it is therefore highly inadvisable to run a mixed 1.0/0.6 cluster for any longer than absolutely necessary. + + + + + Ping node information no longer needs to be added to ha.cf. Simply include the lists of hosts in your ping resource(s). - +
Removed - + Syntax - - - - It is no longer possible to set resource meta options as top-level attributes. Use meta attributes instead. - - - - - Resource and operation defaults are no longer read from crm_config. See and instead. - - - - + + + + It is no longer possible to set resource meta options as top-level attributes. Use meta attributes instead. + + + + + Resource and operation defaults are no longer read from crm_config. See and instead. + + + +
diff --git a/doc/Pacemaker_Explained/en-US/Ap-Debug.xml b/doc/Pacemaker_Explained/en-US/Ap-Debug.xml index 3a92e4f29e..246081a0fe 100644 --- a/doc/Pacemaker_Explained/en-US/Ap-Debug.xml +++ b/doc/Pacemaker_Explained/en-US/Ap-Debug.xml @@ -1,122 +1,122 @@ Debugging Cluster Startup
Corosync
- Prerequisites - - Minimum logging configuration - + Prerequisites + + Minimum logging configuration + # /etc/init.d/openais start - - + + logging { to_syslog: yes syslog_facility: daemon } - - - - Whatever other logging you have, these two lines are required for Pacemaker clusters - - + + + + Whatever other logging you have, these two lines are required for Pacemaker clusters + +
- Confirm Corosync Started -
- Expected output when starting openais - + Confirm Corosync Started +
+ Expected output when starting openais + # /etc/init.d/openais start - - + + Starting Corosync daemon (aisexec): starting... rc=0: OK - - -
- -
- Expected log messages - startup - + + +
+ +
+ Expected log messages - startup + # grep -e "openais.*network interface" -e "AIS Executive Service" /var/log/messages - - + + Aug 27 16:23:37 test1 openais[26337]: [MAIN ] AIS Executive Service RELEASE 'subrev 1152 version 0.80' Aug 27 16:23:38 test1 openais[26337]: [MAIN ] AIS Executive Service: started and ready to provide service. Aug 27 16:23:38 test1 openais[26337]: [TOTEM] The network interface [192.168.9.41] is now up. - - - - The versions may differ, but you should see Corosync indicate it started and sucessfully attached to the machine's network interface - -
- -
- Expected log messages - membership - + + + + The versions may differ, but you should see Corosync indicate it started and sucessfully attached to the machine's network interface + +
+ +
+ Expected log messages - membership + # grep CLM /var/log/messages - - + + Aug 27 16:53:15 test1 openais[2166]: [CLM ] CLM CONFIGURATION CHANGE Aug 27 16:53:15 test1 openais[2166]: [CLM ] New Configuration: Aug 27 16:53:15 test1 openais[2166]: [CLM ] Members Left: Aug 27 16:53:15 test1 openais[2166]: [CLM ] Members Joined: Aug 27 16:53:15 test1 openais[2166]: [CLM ] CLM CONFIGURATION CHANGE Aug 27 16:53:15 test1 openais[2166]: [CLM ] New Configuration: - Aug 27 16:53:15 test1 openais[2166]: [CLM ] r(0) ip(192.168.9.41) + Aug 27 16:53:15 test1 openais[2166]: [CLM ] r(0) ip(192.168.9.41) Aug 27 16:53:15 test1 openais[2166]: [CLM ] Members Left: Aug 27 16:53:15 test1 openais[2166]: [CLM ] Members Joined: - Aug 27 16:53:15 test1 openais[2166]: [CLM ] r(0) ip(192.168.9.41) + Aug 27 16:53:15 test1 openais[2166]: [CLM ] r(0) ip(192.168.9.41) Aug 27 16:53:15 test1 openais[2166]: [CLM ] got nodejoin message 192.168.9.41 - - - - The exact messages will differ, but you should see a new membership formed with the real IP address of your node - -
+ +
+ + The exact messages will differ, but you should see a new membership formed with the real IP address of your node + +
- Checking Pacemaker - Now that we have confirmed that Corosync is functional we can check the rest of the stack. + Checking Pacemaker + Now that we have confirmed that Corosync is functional we can check the rest of the stack. -
- Expected Pacemaker startup logging for Corosync - +
+ Expected Pacemaker startup logging for Corosync + # grep pcmk_plugin_init /var/log/messages - - + + Aug 27 16:53:15 test1 openais[2166]: [pcmk ] info: pcmk_plugin_init: CRM: Initialized Aug 27 16:53:15 test1 openais[2166]: [pcmk ] Logging: Initialized pcmk_plugin_init Aug 27 16:53:15 test1 openais[2166]: [pcmk ] info: pcmk_plugin_init: Service: 9 Aug 27 16:53:15 test1 openais[2166]: [pcmk ] info: pcmk_plugin_init: Local hostname: test1 - - - - If you don't see these messages, or some like them, there is likely a problem finding or loading the pacemaker plugin. - -
+ +
+ + If you don't see these messages, or some like them, there is likely a problem finding or loading the pacemaker plugin. + +
-
- Expected process listing on a 64-bit machine - +
+ Expected process listing on a 64-bit machine + # ps axf - - + + 3718 ? Ssl 0:05 /usr/sbin/aisexec 3723 ? SLs 0:00 \_ /usr/lib64/heartbeat/stonithd 3724 ? S 0:05 \_ /usr/lib64/heartbeat/cib 3725 ? S 0:21 \_ /usr/lib64/heartbeat/lrmd 3726 ? S 0:01 \_ /usr/lib64/heartbeat/attrd 3727 ? S 0:00 \_ /usr/lib64/heartbeat/pengine 3728 ? S 0:01 \_ /usr/lib64/heartbeat/crmd - - - - On 32-bit systems the exact path may differ, but all the above processes should be listed. - -
+ +
+ + On 32-bit systems the exact path may differ, but all the above processes should be listed. + +
diff --git a/doc/Pacemaker_Explained/en-US/Ap-FAQ.xml b/doc/Pacemaker_Explained/en-US/Ap-FAQ.xml index 0743f6c63e..9e6d69f4c3 100644 --- a/doc/Pacemaker_Explained/en-US/Ap-FAQ.xml +++ b/doc/Pacemaker_Explained/en-US/Ap-FAQ.xml @@ -1,95 +1,95 @@ FAQ - History - - + History + + Why is the Project Called PacemakernamingPacemaker? - - + + First of all, the reason its not called the CRM is because of the abundance of terms that are commonly abbreviated to those three letters. - + The Pacemaker name came from Kham, a good friend of mine, and was originally used by a Java GUI that I was prototyping in early 2007. - Alas other commitments have prevented the GUI from progressing much and, when it came time to choose a name for this project, Lars suggested it was an even better fit for an independent CRM. - - - The idea stems from the analogy between the role of this software and that of the little device that keeps the human heart pumping. - Pacemaker monitors the cluster and intervenes when necessary to ensure the smooth operation of the services it provides. - - There were a number of other names (and acronyms) tossed around, but suffice to say "Pacemaker" was the best - - - - - Why was the Pacemaker Project Created? - - - The decision was made to spin-off the CRM into its own project after the 2.1.3 Heartbeat release in order to - - support both the Corosync and Heartbeat cluster stacks equally - decouple the release cycles of two projects at very different stages of their life-cycles - foster the clearer package boundaries, thus leading to - better and more stable interfaces - - - + Alas other commitments have prevented the GUI from progressing much and, when it came time to choose a name for this project, Lars suggested it was an even better fit for an independent CRM. + + + The idea stems from the analogy between the role of this software and that of the little device that keeps the human heart pumping. + Pacemaker monitors the cluster and intervenes when necessary to ensure the smooth operation of the services it provides. + + There were a number of other names (and acronyms) tossed around, but suffice to say "Pacemaker" was the best + + + + + Why was the Pacemaker Project Created? + + + The decision was made to spin-off the CRM into its own project after the 2.1.3 Heartbeat release in order to + + support both the Corosync and Heartbeat cluster stacks equally + decouple the release cycles of two projects at very different stages of their life-cycles + foster the clearer package boundaries, thus leading to + better and more stable interfaces + + + - Setup - - + Setup + + What Messaging Layers Messaging Layers are Supported? - - - - Corosync () - Heartbeat () - - - - - - Can I Choose which Messaging Layer to use at Run Time? - - - Yes. The CRM will automatically detect which started it and behave accordingly. - - - - - Can I Have a Mixed Heartbeat-Corosync Cluster? - - - No. - - - - - Which Messaging Layer Should I Choose? - - - This is discussed in . - - - - - Where Can I Get Pre-built Packages? - - + + + + Corosync () + Heartbeat () + + + + + + Can I Choose which Messaging Layer to use at Run Time? + + + Yes. The CRM will automatically detect which started it and behave accordingly. + + + + + Can I Have a Mixed Heartbeat-Corosync Cluster? + + + No. + + + + + Which Messaging Layer Should I Choose? + + + This is discussed in . + + + + + Where Can I Get Pre-built Packages? + + Official packages for most major .rpm and based distributions are available from the ClusterLabs Website. For Debian packages, building from source and details on using the above repositories, see our installation page. - - - - - What Versions of Pacemaker Are Supported? - - + + + + + What Versions of Pacemaker Are Supported? + + Please refer to the Releases page for an up-to-date list of versions supported directly by the project. - When seeking assistance, please try to ensure you have one of these versions. - - + When seeking assistance, please try to ensure you have one of these versions. + + diff --git a/doc/Pacemaker_Explained/en-US/Ap-Install.xml b/doc/Pacemaker_Explained/en-US/Ap-Install.xml index 58571557b0..169bed1ad8 100644 --- a/doc/Pacemaker_Explained/en-US/Ap-Install.xml +++ b/doc/Pacemaker_Explained/en-US/Ap-Install.xml @@ -1,107 +1,107 @@ Installation
Choosing a <indexterm significance="preferred"><primary>Cluster Stack</primary><secondary>choosing one</secondary></indexterm>Cluster Stack Ultimately the choice of cluster stack is a personal decision that must be made in the context of you or your company's needs and strategic direction. Pacemaker currently functions equally well with both stacks. Here are some factors that may influence the decision: - + SUSE/Novell, Red Hat and Oracle are all putting their collective weight behind the Corosync cluster stack. - - + + Cluster StackCorosync CorosyncCorosync is an OSI Certified implementation of an industry standard (the Service Availability Forum Application Interface Specification). - - + + Using Corosync gives your applications access to the following additional cluster services - - - checkpoint service - - - distributed locking service - - - extended virtual synchronization service - - - cluster closed process group service - - - - + + + checkpoint service + + + distributed locking service + + + extended virtual synchronization service + + + cluster closed process group service + + + + It is likely that Pacemaker, at some point in the future, will make use of some of these additional services not provided by Heartbeat - - - To date, Pacemaker has received less real-world testing on Corosync than it has on + + + To date, Pacemaker has received less real-world testing on Corosync than it has on Cluster StackHeartbeat HeartbeatHeartbeat. - +
Enabling Pacemaker
- For Corosync - The Corosync configuration is normally located in /etc/corosync/corosync.conf and an example for a machine with an address of 1.2.3.4 in a cluster communicating on port 1234 (without peer authentication and message encryption) is shown below. - - An example Corosync configuration file - totem { + For Corosync + The Corosync configuration is normally located in /etc/corosync/corosync.conf and an example for a machine with an address of 1.2.3.4 in a cluster communicating on port 1234 (without peer authentication and message encryption) is shown below. + + An example Corosync configuration file + totem { version: 2 secauth: off threads: 0 interface { ringnumber: 0 bindnetaddr: 1.2.3.4 mcastaddr: 226.94.1.1 mcastport: 1234 } } logging { fileline: off to_syslog: yes syslog_facility: daemon } amf { mode: disabled } - - - The logging should be mostly obvious and the amf section refers to the Availability Management Framework and is not covered in this document. - The interesting part of the configuration is the totem section. This is where we define how the node can communicate with the rest of the cluster and what protocol version and options (including encryption + + + The logging should be mostly obvious and the amf section refers to the Availability Management Framework and is not covered in this document. + The interesting part of the configuration is the totem section. This is where we define how the node can communicate with the rest of the cluster and what protocol version and options (including encryption Please consult the Corosync website and documentation for details on enabling encryption and peer authentication for the cluster. - ) it should use. Beginners are encouraged to use the values shown and modify the interface section based on their network. - It is also possible to configure Corosync for an IPv6 based environment. Simply configure bindnetaddr and mcastaddr with their IPv6 equivalents, eg. - - Example options for an IPv6 environment - bindnetaddr: fec0::1:a800:4ff:fe00:20 + ) it should use. Beginners are encouraged to use the values shown and modify the interface section based on their network. + It is also possible to configure Corosync for an IPv6 based environment. Simply configure bindnetaddr and mcastaddr with their IPv6 equivalents, eg. + + Example options for an IPv6 environment + bindnetaddr: fec0::1:a800:4ff:fe00:20 mcastaddr: ff05::1 - - - To tell Corosync to use the Pacemaker cluster manager, add the following fragment to a functional Corosync configuration and restart the cluster. - - Configuration fragment for enabling Pacemaker under Corosync - aisexec { + + + To tell Corosync to use the Pacemaker cluster manager, add the following fragment to a functional Corosync configuration and restart the cluster. + + Configuration fragment for enabling Pacemaker under Corosync + aisexec { user: root group: root } service { name: pacemaker ver: 0 } - - - The cluster needs to be run as root so that its child processes (the lrmd in particular) have sufficient privileges to perform the actions requested of it. After all, a cluster manager that can't add an IP address or start apache is of little use. - The second directive is the one that actually instructs the cluster to run Pacemaker. + + + The cluster needs to be run as root so that its child processes (the lrmd in particular) have sufficient privileges to perform the actions requested of it. After all, a cluster manager that can't add an IP address or start apache is of little use. + The second directive is the one that actually instructs the cluster to run Pacemaker.
- For Heartbeat - Add the following to a functional ha.cf configuration file and restart Heartbeat: - - Configuration fragment for enabling Pacemaker under Heartbeat - crm respawn - - + For Heartbeat + Add the following to a functional ha.cf configuration file and restart Heartbeat: + + Configuration fragment for enabling Pacemaker under Heartbeat + crm respawn + +
diff --git a/doc/Pacemaker_Explained/en-US/Ap-LSB.xml b/doc/Pacemaker_Explained/en-US/Ap-LSB.xml index 2a7a5aed1c..4a267335be 100644 --- a/doc/Pacemaker_Explained/en-US/Ap-LSB.xml +++ b/doc/Pacemaker_Explained/en-US/Ap-LSB.xml @@ -1,62 +1,62 @@ init-Script LSB Compliance The relevant part of LSB init scriptsinit scriptscompatibilityLSB spec - + includes a description of all the return codes listed here. Assuming some_service is configured correctly and currently not active, the following sequence will help you determine if it is LSB compatible: - Start (stopped): - /etc/init.d/some_service start ; echo "result: $?" - - Did the service start? - Did the command print result: 0 (in addition to the regular output)? - + Start (stopped): + /etc/init.d/some_service start ; echo "result: $?" + + Did the service start? + Did the command print result: 0 (in addition to the regular output)? + - Status (running): + Status (running): /etc/init.d/some_service status ; echo "result: $?" - - Did the script accept the command? - Did the script indicate the service was running? - Did the command print result: 0 (in addition to the regular output)? - + + Did the script accept the command? + Did the script indicate the service was running? + Did the command print result: 0 (in addition to the regular output)? + Start (running): /etc/init.d/some_service start ; echo "result: $?" - - Is the service still running? - Did the command print result: 0 (in addition to the regular output)? - + + Is the service still running? + Did the command print result: 0 (in addition to the regular output)? + - Stop (running): + Stop (running): /etc/init.d/some_service stop ; echo "result: $?" - - Was the service stopped? - Did the command print result: 0 (in addition to the regular output)? - + + Was the service stopped? + Did the command print result: 0 (in addition to the regular output)? + Status (stopped): /etc/init.d/some_service status ; echo "result: $?" - - Did the script accept the command? - Did the script indicate the service was not running? - Did the command print result: 3 (in addition to the regular output)? - + + Did the script accept the command? + Did the script indicate the service was not running? + Did the command print result: 3 (in addition to the regular output)? + - Stop (stopped): + Stop (stopped): /etc/init.d/some_service stop ; echo "result: $?" - - Is the service still stopped? - Did the command print result: 0 (in addition to the regular output)? - + + Is the service still stopped? + Did the command print result: 0 (in addition to the regular output)? + - Status (failed): - This step is not readily testable and relies on manual inspection of the script. - The script can use one of the error codes (other than 3) listed in the LSB spec to indicate that it is active but failed. This tells the cluster that before moving the resource to another node, it needs to stop it on the existing one first. + Status (failed): + This step is not readily testable and relies on manual inspection of the script. + The script can use one of the error codes (other than 3) listed in the LSB spec to indicate that it is active but failed. This tells the cluster that before moving the resource to another node, it needs to stop it on the existing one first. If the answer to any of the above questions is no, then the script is not LSB compliant. Your options are then to either fix the script or write an OCF agent based on the existing script. diff --git a/doc/Pacemaker_Explained/en-US/Ap-OCF.xml b/doc/Pacemaker_Explained/en-US/Ap-OCF.xml index d4f2b3120c..0003466ff5 100644 --- a/doc/Pacemaker_Explained/en-US/Ap-OCF.xml +++ b/doc/Pacemaker_Explained/en-US/Ap-OCF.xml @@ -1,254 +1,254 @@ More About OCF Resource Agents
Location of Custom Scripts OCF Resource AgentsOCF Resource Agents are found in /usr/lib/ocf/resource.d/provider. - When creating your own agents, you are encouraged to create a new directory under /usr/lib/ocf/resource.d/ so that they are not confused with (or overwritten by) the agents shipped with Heartbeat. - So, for example, if you chose the provider name of bigCorp and wanted a new resource named bigApp, you would create a script called /usr/lib/ocf/resource.d/bigCorp/bigApp and define a resource: + When creating your own agents, you are encouraged to create a new directory under /usr/lib/ocf/resource.d/ so that they are not confused with (or overwritten by) the agents shipped with Heartbeat. + So, for example, if you chose the provider name of bigCorp and wanted a new resource named bigApp, you would create a script called /usr/lib/ocf/resource.d/bigCorp/bigApp and define a resource: <primitive id="custom-app" class="ocf" provider="bigCorp" type="bigApp"/>
Actions All OCF Resource Agents are required to implement the following actions - Required Actions for OCF Agents - + Required Actions for OCF Agents + Action Description Instructions - - + + start action actionstartstart Start the resource Return 0 on success and an appropriate error code otherwise. Must not report success until the resource is fully active. stop action actionstopstop Stop the resource Return 0 on success and an appropriate error code otherwise. Must not report success until the resource is fully stopped. monitor action actionmonitormonitor Check the resource's state - Exit 0 if the resource is running, 7 if it is stopped, and anything else if it is failed. - NOTE: The monitor script should test the state of the resource on the local machine only. + Exit 0 if the resource is running, 7 if it is stopped, and anything else if it is failed. + NOTE: The monitor script should test the state of the resource on the local machine only. meta-data action actionmeta-datameta-data Describe the resource - Provide information about this resource as an XML snippet. Exit with 0. - NOTE: This is not performed as root. + Provide information about this resource as an XML snippet. Exit with 0. + NOTE: This is not performed as root. validate-all action actionvalidate-allvalidate-all Verify the supplied parameters Exit with 0 if parameters are valid, 2 if not valid, 6 if resource is not configured.
Additional requirements (not part of the OCF specs) are placed on agents that will be used for advanced concepts like clones and multi-state resources. - Optional Actions for OCF Agents - + Optional Actions for OCF Agents + Action Description Instructions promote action actionpromotepromote Promote the local instance of a multi-state resource to the master/primary state. Return 0 on success. demote action actiondemotedemote Demote the local instance of a multi-state resource to the slave/secondary state. Return 0 on success. notify action actionnotifynotify Used by the cluster to send the agent pre and post notification events telling the resource what has happened and will happen. Must not fail. Must exit with 0.
One action specified in the OCF specs is not currently used by the cluster: - recover - a variant of the start action, this should try to recover a resource locally. + recover - a variant of the start action, this should try to recover a resource locally. Remember to use ocf-testerocf-tester to verify that your new agent complies with the OCF standard properly.
How are OCF Return Codes Interpreted? The first thing the cluster does is to check the return code against the expected result. If the result does not match the expected value, then the operation is considered to have failed and recovery action is initiated. There are three types of failure recovery: - Types of recovery performed by the cluster - + Types of recovery performed by the cluster + Type Description Action Taken by the Cluster soft error type error typesoftsoft A transient error occurred Restart the resource or move it to a new location hard error type error typehardhard A non-transient error that may be specific to the current node occurred Move the resource elsewhere and prevent it from being retried on the current node fatal error type error typefatalfatal A non-transient error that will be common to all cluster nodes (eg. a bad configuration was specified) Stop the resource and prevent it from being started on any cluster node
Assuming an action is considered to have failed, the following table outlines the different OCF return codes and the type of recovery the cluster will initiate when it is received. - OCF Return Codes and their Recovery Types - + OCF Return Codes and their Recovery Types + RC OCF Alias Description RT return code00 OCF_SUCCESS Environment VariableOCF_SUCCESS return codeOCF_SUCCESSOCF_SUCCESS Success. The command completed successfully. This is the expected result for all start, stop, promote and demote commands. soft return code11 OCF_ERR_GENERIC Environment VariableOCF_ERR_GENERIC return codeOCF_ERR_GENERIC OCF_ERR_GENERIC Generic "there was a problem" error code. soft return code22 OCF_ERR_ARGS Environment VariableOCF_ERR_ARGS return codeOCF_ERR_ARGSOCF_ERR_ARGS The resource's configuration is not valid on this machine. Eg. refers to a location/tool not found on the node. hard return code33 OCF_ERR_UNIMPLEMENTED Environment VariableOCF_ERR_UNIMPLEMENTED return codeOCF_ERR_UNIMPLEMENTEDOCF_ERR_UNIMPLEMENTED The requested action is not implemented. hard return code44 OCF_ERR_PERM Environment VariableOCF_ERR_PERM return codeOCF_ERR_PERMOCF_ERR_PERM The resource agent does not have sufficient privileges to complete the task. hard return code55 OCF_ERR_INSTALLED Environment VariableOCF_ERR_INSTALLED return codeOCF_ERR_INSTALLEDOCF_ERR_INSTALLED The tools required by the resource are not installed on this machine. hard return code66 OCF_ERR_CONFIGURED Environment VariableOCF_ERR_CONFIGURED return codeOCF_ERR_CONFIGUREDOCF_ERR_CONFIGURED The resource's configuration is invalid. Eg. required parameters are missing. fatal return code77 OCF_NOT_RUNNING Environment VariableOCF_NOT_RUNNING return codeOCF_NOT_RUNNINGOCF_NOT_RUNNING The resource is safely stopped. The cluster will not attempt to stop a resource that returns this for any action. N/A return code88 OCF_RUNNING_MASTER Environment VariableOCF_RUNNING_MASTER return codeOCF_RUNNING_MASTEROCF_RUNNING_MASTER The resource is running in Master mode. soft return code99 OCF_FAILED_MASTER Environment VariableOCF_FAILED_MASTER return codeOCF_FAILED_MASTEROCF_FAILED_MASTER The resource is in Master mode but has failed. The resource will be demoted, stopped and then started (and possibly promoted) again. soft other return codes return codeotherother NA Custom error code. soft
Although counterintuitive, even actions that return 0 (aka. OCF_SUCCESS) can be considered to have failed. This can happen when a resource that is expected to be in the Master state is found running as a Slave, or when a resource is found active on multiple machines.
Exceptions - - Non-recurring monitor actions (probes) that find a resource active (or in Master mode) will not result in recovery action unless it is also found active elsewhere - The recovery action taken when a resource is found active more than once is determined by the multiple-active property of the resource - Recurring actions that return OCF_ERR_UNIMPLEMENTED do not cause any type of recovery - + + Non-recurring monitor actions (probes) that find a resource active (or in Master mode) will not result in recovery action unless it is also found active elsewhere + The recovery action taken when a resource is found active more than once is determined by the multiple-active property of the resource + Recurring actions that return OCF_ERR_UNIMPLEMENTED do not cause any type of recovery +
diff --git a/doc/Pacemaker_Explained/en-US/Ap-Samples.xml b/doc/Pacemaker_Explained/en-US/Ap-Samples.xml index 363b37ed5d..ebb7a9798c 100644 --- a/doc/Pacemaker_Explained/en-US/Ap-Samples.xml +++ b/doc/Pacemaker_Explained/en-US/Ap-Samples.xml @@ -1,129 +1,129 @@ Sample Configurations
An Empty Configuration An <indexterm significance="preferred"><primary>Empty Configuration</primary></indexterm><indexterm significance="preferred"><primary>Configuration</primary><secondary>Empty</secondary></indexterm>empty configuration - + ]]>
A <indexterm significance="preferred"><primary>Simple</primary><secondary>Configuration</secondary></indexterm><indexterm significance="preferred"><primary>Configuration</primary><secondary>Simple</secondary></indexterm>Simple Configuration - 2 nodes, some cluster options and a resource + 2 nodes, some cluster options and a resource ]]> In this example, we have one resource (an IP address) that we check every five minutes and will run on host c001n01 until either the resource fails 10 times or the host shuts down.
An <indexterm significance="preferred"><primary>Advanced</primary><secondary>Configuration</secondary></indexterm><indexterm significance="preferred"><primary>Configuration</primary><secondary>Advanced</secondary></indexterm>Advanced Configuration - groups and clones with stonith + groups and clones with stonith ]]>
diff --git a/doc/Pacemaker_Explained/en-US/Ap-Upgrade-Config.xml b/doc/Pacemaker_Explained/en-US/Ap-Upgrade-Config.xml index a7d2971ad2..a011eb97b6 100644 --- a/doc/Pacemaker_Explained/en-US/Ap-Upgrade-Config.xml +++ b/doc/Pacemaker_Explained/en-US/Ap-Upgrade-Config.xml @@ -1,96 +1,96 @@ Upgrading the Configuration from 0.6
Preparation Upgrading the Configuration ConfigurationUpgrading DownloadDTD DTDDownload Download the latest DTD and ensure your configuration validates.
Perform the upgrade
- Upgrade the software - Refer to the appendix: + Upgrade the software + Refer to the appendix:
- Upgrade the Configuration - As XML is not the friendliest of languages, it is common for cluster administrators to have scripted some of their activities. In such cases, it is likely that those scripts will not work with the new 1.0 syntax. - In order to support such environments, it is actually possible to continue using the old 0.6 syntax. - The downside is, however, that not all the new features will be available and there is a performance impact since the cluster must do a non-persistent configuration upgrade before each transition. So while using the old syntax is possible, it is not advisable to continue using it indefinitely. - Even if you wish to continue using the old syntax, it is advisable to follow the upgrade procedure to ensure that the cluster is able to use your existing configuration (since it will perform much the same task internally). - - + Upgrade the Configuration + As XML is not the friendliest of languages, it is common for cluster administrators to have scripted some of their activities. In such cases, it is likely that those scripts will not work with the new 1.0 syntax. + In order to support such environments, it is actually possible to continue using the old 0.6 syntax. + The downside is, however, that not all the new features will be available and there is a performance impact since the cluster must do a non-persistent configuration upgrade before each transition. So while using the old syntax is possible, it is not advisable to continue using it indefinitely. + Even if you wish to continue using the old syntax, it is advisable to follow the upgrade procedure to ensure that the cluster is able to use your existing configuration (since it will perform much the same task internally). + + Create a shadow copyexample for upgradingshadow copy to work with - crm_shadow --create upgrade06 - - + crm_shadow --create upgrade06 + + Verify the ConfigurationVerifyVerifyConfigurationconfiguration is valid - crm_verify --live-check - - + crm_verify --live-check + + Fix any errors or warnings - - + + Perform the upgrade: cibadmin --upgrade - If this step fails, there are three main possibilities: - - The configuration was not valid to start with - go back to step 2 - The transformation failed - report a bug or email the project - The transformation was successful but produced an invalid result - The most common reason is ID values being repeated or invalid. Pacemaker 1.0 is much stricter regarding this type of validation. - - - If the result of the transformation is invalid, you may see a number of errors from the validation library. If these are not helpful, visit and/or try the procedure described below under . - - - Check the changes + If this step fails, there are three main possibilities: + + The configuration was not valid to start with - go back to step 2 + The transformation failed - report a bug or email the project + The transformation was successful but produced an invalid result + The most common reason is ID values being repeated or invalid. Pacemaker 1.0 is much stricter regarding this type of validation. + + + If the result of the transformation is invalid, you may see a number of errors from the validation library. If these are not helpful, visit and/or try the procedure described below under . + + + Check the changes crm_shadow --diff - If at this point there is anything about the upgrade that you wish to fine-tune (for example, to change some of the automatic IDs) now is the time to do so. Since the shadow configuration is not in use by the cluster, it is safe to edit the file manually: + If at this point there is anything about the upgrade that you wish to fine-tune (for example, to change some of the automatic IDs) now is the time to do so. Since the shadow configuration is not in use by the cluster, it is safe to edit the file manually: crm_shadow --edit - This will open the configuration in your favorite editor (whichever is specified by the standard $EDITOR environment variable). - - - Preview how the cluster will react - Test what the cluster will do when you upload the new configuration - # ptest -VVVVV --live-check --save-dotfile upgrade06.dot + This will open the configuration in your favorite editor (whichever is specified by the standard $EDITOR environment variable). + + + Preview how the cluster will react + Test what the cluster will do when you upload the new configuration + # ptest -VVVVV --live-check --save-dotfile upgrade06.dot # graphviz upgrade06.dot - - Verify that either no resource actions will occur or that you are happy with any that are scheduled. - If the output contains actions you do not expect (possibly due to changes to the score calculations), you may need to make further manual changes. - See for further details on how to interpret the output of ptest. - - - + + Verify that either no resource actions will occur or that you are happy with any that are scheduled. + If the output contains actions you do not expect (possibly due to changes to the score calculations), you may need to make further manual changes. + See for further details on how to interpret the output of ptest. + + + Upload the changes crm_shadow --commit upgrade06 --force - If this step fails, something really strange has occurred. You should report a bug. - - + If this step fails, something really strange has occurred. You should report a bug. + +
- Manually Upgrading the Configuration + Manually Upgrading the Configuration It is also possible to perform the ConfigurationUpgrade manuallyconfiguration upgrade steps manually. To do this - - - Locate the upgrade06.xsl conversion script or download the latest version from version control - - + + + Locate the upgrade06.xsl conversion script or download the latest version from version control + + Convert the XMLConvertXML blob: xsltproc /path/to/upgrade06.xsl config06.xml > config10.xml - - - Locate the pacemaker.rng script. - + + + Locate the pacemaker.rng script. + Check the ValidateXMLxmllintValidate XMLXML validity: xmllint --relaxng /path/to/pacemaker.rng config10.xml - - - - The advantage of this method is that it can be performed without the cluster running and any validation errors should be more informative (despite being generated by the same library!) since they include line numbers. + + + + The advantage of this method is that it can be performed without the cluster running and any validation errors should be more informative (despite being generated by the same library!) since they include line numbers.
diff --git a/doc/Pacemaker_Explained/en-US/Ap-Upgrade.xml b/doc/Pacemaker_Explained/en-US/Ap-Upgrade.xml index 5fc979631c..70d5f69c6f 100644 --- a/doc/Pacemaker_Explained/en-US/Ap-Upgrade.xml +++ b/doc/Pacemaker_Explained/en-US/Ap-Upgrade.xml @@ -1,258 +1,258 @@ Upgrading Cluster Software
Version Compatibility - When releasing newer versions we take care to make sure we are backwards compatible with older versions. While you will always be able to upgrade from version x to x+1, in order to continue to produce high quality software it may occasionally be necessary to drop compatibility with older versions. - There will always be an upgrade path from any series-2 release to any other series-2 release. - There are three approaches to upgrading your cluster software: - - Complete Cluster Shutdown - Rolling (node by node) - Disconnect and Reattach - - Each method has advantages and disadvantages, some of which are listed in the table below, and you should chose the one most appropriate to your needs. - - Summary of Upgrade Methodologies - + When releasing newer versions we take care to make sure we are backwards compatible with older versions. While you will always be able to upgrade from version x to x+1, in order to continue to produce high quality software it may occasionally be necessary to drop compatibility with older versions. + There will always be an upgrade path from any series-2 release to any other series-2 release. + There are three approaches to upgrading your cluster software: + + Complete Cluster Shutdown + Rolling (node by node) + Disconnect and Reattach + + Each method has advantages and disadvantages, some of which are listed in the table below, and you should chose the one most appropriate to your needs. +
+ Summary of Upgrade Methodologies + - Type - Available between all software versions - Service Outage During Upgrade - Service Recovery During Upgrade - Exercises Failover Logic/Configuration - - Allows change of cluster stack type - + Type + Available between all software versions + Service Outage During Upgrade + Service Recovery During Upgrade + Exercises Failover Logic/Configuration + + Allows change of cluster stack type + Cluster Stackswitching between - For example, switching from Heartbeat to Corosync. - Consult the Heartbeat or Corosync documentation to see if upgrading them to a newer version is also supported. - - - + For example, switching from Heartbeat to Corosync. + Consult the Heartbeat or Corosync documentation to see if upgrading them to a newer version is also supported. + + + - - + + UpgradeShutdown Shutdown Upgrade Shutdown - yes - always - N/A - no - yes + yes + always + N/A + no + yes UpgradeRolling Rolling Upgrade Rolling - no - always - yes - yes - no + no + always + yes + yes + no UpgradeReattach Reattach Upgrade Reattach - yes - only due to failure - no - no - yes + yes + only due to failure + no + no + yes - - -
+ + +
- Complete Cluster Shutdown - In this scenario one shuts down all cluster nodes and resources and upgrades all the nodes before restarting the cluster. -
Procedure - - + Complete Cluster Shutdown + In this scenario one shuts down all cluster nodes and resources and upgrades all the nodes before restarting the cluster. +
Procedure + + On each node: - - - Shutdown the cluster stack (Heartbeat or Corosync) - - - - Upgrade the Pacemaker software. - This may also include upgrading the cluster stack and/or the underlying operating system. - - - - - + + + Shutdown the cluster stack (Heartbeat or Corosync) + + + + Upgrade the Pacemaker software. + This may also include upgrading the cluster stack and/or the underlying operating system. + + + + + Check the configuration manually or with the crm_verify tool if available. - - + + On each node: - - - - Start the cluster stack. - This can be either Corosync or Heartbeat and does not need to be the same as the previous cluster stack. - - - - - -
+ + + + Start the cluster stack. + This can be either Corosync or Heartbeat and does not need to be the same as the previous cluster stack. + + + +
+
+
- Rolling (node by node) - In this scenario each node is removed from the cluster, upgraded and then brought back online until all nodes are running the newest version. - - - This method is currently broken between Pacemaker 0.6.x and 1.0.x. - - - Measures have been put into place to ensure rolling upgrades always work for versions after 1.0.0. - If there is sufficient demand, the work to repair 0.6 -> 1.0 compatibility will be carried out. - Otherwise, please try one of the other upgrade strategies. - Detach/Reattach is a particularly good option for most people. - - + Rolling (node by node) + In this scenario each node is removed from the cluster, upgraded and then brought back online until all nodes are running the newest version. + + + This method is currently broken between Pacemaker 0.6.x and 1.0.x. + + + Measures have been put into place to ensure rolling upgrades always work for versions after 1.0.0. + If there is sufficient demand, the work to repair 0.6 -> 1.0 compatibility will be carried out. + Otherwise, please try one of the other upgrade strategies. + Detach/Reattach is a particularly good option for most people. + + -
- Procedure - On each node: - - +
+ Procedure + On each node: + + Shutdown the cluster stack (Heartbeat or Corosync) - - + + Upgrade the Pacemaker software. This may also include upgrading the cluster stack and/or the underlying operating system. - - - On the first node, check the configuration manually or with the crm_verify tool if available. - - - - + + + On the first node, check the configuration manually or with the crm_verify tool if available. + + + + - Start the cluster stack. - This must be the same type of cluster stack (Corosync or Heartbeat) that the rest of the cluster is using. - Upgrading Corosync/Heartbeat may also be possible, please consult the documentation for those projects to see if the two versions will be compatible. - - - - Repeat for each node in the cluster. -
-
- Version Compatibility - - Version Compatibility Table - + Start the cluster stack. + This must be the same type of cluster stack (Corosync or Heartbeat) that the rest of the cluster is using. + Upgrading Corosync/Heartbeat may also be possible, please consult the documentation for those projects to see if the two versions will be compatible. + + + + Repeat for each node in the cluster. + +
+ Version Compatibility +
+ Version Compatibility Table + - - Version being Installed - Oldest Compatible Version - + + Version being Installed + Oldest Compatible Version + - Pacemaker 1.0.x - Pacemaker 1.0.0 - - - Pacemaker 0.7.x - Pacemaker 0.6 or Heartbeat 2.1.3 - - - Pacemaker 0.6.x - Heartbeat 2.0.8 - - - Heartbeat 2.1.3 (or less) - Heartbeat 2.0.4 - - - Heartbeat 2.0.4 (or less) - Heartbeat 2.0.0 - - - Heartbeat 2.0.0 - None. Use an alternate upgrade strategy. + Pacemaker 1.0.x + Pacemaker 1.0.0 + + + Pacemaker 0.7.x + Pacemaker 0.6 or Heartbeat 2.1.3 + + + Pacemaker 0.6.x + Heartbeat 2.0.8 + + + Heartbeat 2.1.3 (or less) + Heartbeat 2.0.4 + + + Heartbeat 2.0.4 (or less) + Heartbeat 2.0.0 + + + Heartbeat 2.0.0 + None. Use an alternate upgrade strategy. -
-
-
- Crossing Compatibility Boundaries - Rolling upgrades that cross compatibility boundaries must be preformed in multiple steps. For example, to perform a rolling update from Heartbeat 2.0.1 to Pacemaker 0.6.6 one must: - - Perform a rolling upgrade from Heartbeat 2.0.1 to Heartbeat 2.0.4 - Perform a rolling upgrade from Heartbeat 2.0.4 to Heartbeat 2.1.3 - Perform a rolling upgrade from Heartbeat 2.1.3 to Pacemaker 0.6.6 - -
+ +
+
+ Crossing Compatibility Boundaries + Rolling upgrades that cross compatibility boundaries must be preformed in multiple steps. For example, to perform a rolling update from Heartbeat 2.0.1 to Pacemaker 0.6.6 one must: + + Perform a rolling upgrade from Heartbeat 2.0.1 to Heartbeat 2.0.4 + Perform a rolling upgrade from Heartbeat 2.0.4 to Heartbeat 2.1.3 + Perform a rolling upgrade from Heartbeat 2.1.3 to Pacemaker 0.6.6 + +
- Disconnect and Reattach - A variant of a complete cluster shutdown, but the resources are left active and get re-detected when the cluster is restarted. -
- Procedure - - + Disconnect and Reattach + A variant of a complete cluster shutdown, but the resources are left active and get re-detected when the cluster is restarted. +
+ Procedure + + - Tell the cluster to stop managing services. - This is required to allow the services to remain active after the cluster shuts down. + Tell the cluster to stop managing services. + This is required to allow the services to remain active after the cluster shuts down. crm_attribute -t crm_config -n is-managed-default -v false - - + + For any resource that has a value for is-managed, make sure it is set to false (so that the cluster will not stop it) - crm_resource -t primitive -r <rsc_id> -p is-managed -v false - - + crm_resource -t primitive -r <rsc_id> -p is-managed -v false + + On each node: - - - Shutdown the cluster stack (Heartbeat or Corosync) - - - Upgrade the cluster stack program - This may also include upgrading the underlying operating system. - - - - + + + Shutdown the cluster stack (Heartbeat or Corosync) + + + Upgrade the cluster stack program - This may also include upgrading the underlying operating system. + + + + Check the configuration manually or with the crm_verify tool if available. - - + + On each node: - - - Start the cluster stack. - This can be either Corosync or Heartbeat and does not need to be the same as the previous cluster stack. - - - - + + + Start the cluster stack. + This can be either Corosync or Heartbeat and does not need to be the same as the previous cluster stack. + + + + Verify that the cluster re-detected all resources correctly. - - + + Allow the cluster to resume managing resources again: crm_attribute -t crm_config -n is-managed-default -v true - - + + For any resource that has a value for is-managed reset it to true (so the cluster can recover the service if it fails) if desired: crm_resource -t primitive -r <rsc_id> -p is-managed -v false - - -
-
- Notes + + +
+
+ Notes - Always check your existing configuration is still compatible with the version you are installing before starting the cluster. - - + Always check your existing configuration is still compatible with the version you are installing before starting the cluster. + + - The oldest version of the CRM to support this upgrade type was in Heartbeat 2.0.4 - -
+ The oldest version of the CRM to support this upgrade type was in Heartbeat 2.0.4 + +
diff --git a/doc/Pacemaker_Explained/en-US/Book_Info.xml b/doc/Pacemaker_Explained/en-US/Book_Info.xml index 62ce0bead5..8255c99d68 100644 --- a/doc/Pacemaker_Explained/en-US/Book_Info.xml +++ b/doc/Pacemaker_Explained/en-US/Book_Info.xml @@ -1,37 +1,37 @@ Configuration Explained An A-Z guide to Pacemaker's Configuration Options Pacemaker 1.1 1 0 The purpose of this document is to definitively explain the concepts used to configure Pacemaker. To achieve this, it will focus exclusively on the XML syntax used to configure the CIB. For those that are allergic to XML, Pacemaker comes with a cluster shell; a Python based GUI exists, too, however these tools will not be covered at all in this document - I hope, however, that the concepts explained here make the functionality of these tools more easily understood. + I hope, however, that the concepts explained here make the functionality of these tools more easily understood. , precisely because they hide the XML. Additionally, this document is NOT a step-by-step how-to guide for configuring a specific clustering scenario. Although such guides exist, the purpose of this document is to provide an understanding of the building blocks that can be used to construct any type of Pacemaker cluster. - + diff --git a/doc/Pacemaker_Explained/en-US/Ch-Advanced-Options.xml b/doc/Pacemaker_Explained/en-US/Ch-Advanced-Options.xml index 7915b8e09d..cecc112b04 100644 --- a/doc/Pacemaker_Explained/en-US/Ch-Advanced-Options.xml +++ b/doc/Pacemaker_Explained/en-US/Ch-Advanced-Options.xml @@ -1,545 +1,545 @@ Advanced Configuration
Connecting from a Remote Machine Remote connect Remote administration - Provided Pacemaker is installed on a machine, it is possible to connect to the cluster even if the machine itself is not in the same cluster. - To do this, one simply sets up a number of environment variables and runs the same commands as when working on a cluster node. + Provided Pacemaker is installed on a machine, it is possible to connect to the cluster even if the machine itself is not in the same cluster. + To do this, one simply sets up a number of environment variables and runs the same commands as when working on a cluster node. - Environment Variables Used to Connect to Remote Instances of the CIB - + Environment Variables Used to Connect to Remote Instances of the CIB + Environment VariableRemote Administration Environment Variable Description CIB_*, Env. Var. for Remote Conn.user Environment VariableCIB_user CIB_user The user to connect as. Needs to be part of the hacluster group on the target host. Defaults to $USER. - + CIB_*, Env. Var. for Remote Conn.passwd Environment VariableCIB_passwd CIB_passwd The user's password. Read from the command line if unset. CIB_*, Env. Var. for Remote Conn.server Environment VariableCIB_server CIB_server The host to contact. Defaults to localhost. CIB_*, Env. Var. for Remote Conn.port Environment VariableCIB_port CIB_port The port on which to contact the server; required. CIB_*, Env. Var. for Remote Conn.encrypted Environment VariableCIB_encrypted CIB_encrypted Encrypt network traffic; defaults to true. - - + +
- So, if c001n01 is an active cluster node and is listening on 1234 for connections, and someguy is a member of the hacluster group, - then the following would prompt for someguy's password and return the cluster's current configuration: + So, if c001n01 is an active cluster node and is listening on 1234 for connections, and someguy is a member of the hacluster group, + then the following would prompt for someguy's password and return the cluster's current configuration: export CIB_port=1234; export CIB_server=c001n01; export CIB_user=someguy; cibadmin -Q - For security reasons, the cluster does not listen for remote connections by default. - If you wish to allow remote access, you need to set the remote-tls-port (encrypted) or remote-clear-port (unencrypted) top-level options (ie., those kept in the cib tag, like num_updates and epoch). + For security reasons, the cluster does not listen for remote connections by default. + If you wish to allow remote access, you need to set the remote-tls-port (encrypted) or remote-clear-port (unencrypted) top-level options (ie., those kept in the cib tag, like num_updates and epoch). - - <indexterm significance="preferred"><primary>Remote</primary><secondary>connect, CIB options</secondary></indexterm> - Extra top-level CIB options for remote access - + + <indexterm significance="preferred"><primary>Remote</primary><secondary>connect, CIB options</secondary></indexterm> + Extra top-level CIB options for remote access + Field Description - remote-tls-port - remote-tls-port + remote-tls-port + remote-tls-port Listen for encrypted remote connections on this port. Default: none - remote-clear-port - remote-clear-port + remote-clear-port + remote-clear-port Listen for plaintext remote connections on this port. Default: none - - + +
Specifying When Recurring Actions are Performed - By default, recurring actions are scheduled relative to when the resource started. - So if your resource was last started at 14:32 and you have a backup set to be performed every 24 hours, then the backup will always run at in the middle of the business day - hardly desirable. + By default, recurring actions are scheduled relative to when the resource started. + So if your resource was last started at 14:32 and you have a backup set to be performed every 24 hours, then the backup will always run at in the middle of the business day - hardly desirable. - To specify a date/time that the operation should be relative to, set the operation's interval-origin. - The cluster uses this point to calculate the correct start-delay such that the operation will occur at origin + (interval * N). + To specify a date/time that the operation should be relative to, set the operation's interval-origin. + The cluster uses this point to calculate the correct start-delay such that the operation will occur at origin + (interval * N). - So, if the operation's interval is 24h, it's interval-origin is set to 02:00 and it is currently 14:32, then the cluster would initiate the operation with a start delay of 11 hours and 28 minutes. - If the resource is moved to another node before 2am, then the operation is of course cancelled. + So, if the operation's interval is 24h, it's interval-origin is set to 02:00 and it is currently 14:32, then the cluster would initiate the operation with a start delay of 11 hours and 28 minutes. + If the resource is moved to another node before 2am, then the operation is of course cancelled. - The value specified for interval and interval-origin can be any date/time conforming to the ISO8601 standard. - By way of example, to specify an operation that would run on the first Monday of 2009 and every Monday after that you would add: + The value specified for interval and interval-origin can be any date/time conforming to the ISO8601 standard. + By way of example, to specify an operation that would run on the first Monday of 2009 and every Monday after that you would add: - Specifying a Base for Recurring Action Intervals + Specifying a Base for Recurring Action Intervals <op id="my-weekly-action" name="custom-action" interval="P7D" interval-origin="2009-W01-1"/>
Moving Resources - Moving Resources - ResourceMoving + Moving Resources + ResourceMoving
- Manual Intervention - There are primarily two occasions when you would want to move a resource from it's current location: when the whole node is under maintenance, and when a single resource needs to be moved. - - Since everything eventually comes down to a score, you could create constraints for every resource to prevent them from running on one node. - While the configuration can seem convoluted at times, not even we would require this of administrators. - - - Instead one can set a special node attribute which tells the cluster "don't let anything run here". - There is even a helpful tool to help query and set it, called crm_standby. - To check the standby status of the current machine, simply run: - - crm_standby --get-value - - A value of true indicates that the node is NOT able to host any resources, while a value of false says that it CAN. - - - You can also check the status of other nodes in the cluster by specifying the --node-uname option: - - crm_standby --get-value --node-uname sles-2 - To change the current node's standby status, use --attr-value instead of --get-value. - crm_standby --attr-value - Again, you can change another host's value by supplying a host name with --node-uname. - - When only one resource is required to move, we do this by creating location constraints. - However, once again we provide a user friendly shortcut as part of the crm_resource command, which creates and modifies the extra constraints for you. - If Email was running on sles-1 and you wanted it moved to a specific location, the command would look something like: - - crm_resource -M -r Email -H sles-2 - Behind the scenes, the tool will create the following location constraint: + Manual Intervention + There are primarily two occasions when you would want to move a resource from it's current location: when the whole node is under maintenance, and when a single resource needs to be moved. + + Since everything eventually comes down to a score, you could create constraints for every resource to prevent them from running on one node. + While the configuration can seem convoluted at times, not even we would require this of administrators. + + + Instead one can set a special node attribute which tells the cluster "don't let anything run here". + There is even a helpful tool to help query and set it, called crm_standby. + To check the standby status of the current machine, simply run: + + crm_standby --get-value + + A value of true indicates that the node is NOT able to host any resources, while a value of false says that it CAN. + + + You can also check the status of other nodes in the cluster by specifying the --node-uname option: + + crm_standby --get-value --node-uname sles-2 + To change the current node's standby status, use --attr-value instead of --get-value. + crm_standby --attr-value + Again, you can change another host's value by supplying a host name with --node-uname. + + When only one resource is required to move, we do this by creating location constraints. + However, once again we provide a user friendly shortcut as part of the crm_resource command, which creates and modifies the extra constraints for you. + If Email was running on sles-1 and you wanted it moved to a specific location, the command would look something like: + + crm_resource -M -r Email -H sles-2 + Behind the scenes, the tool will create the following location constraint: <rsc_location rsc="Email" node="sles-2" score="INFINITY"/> - It is important to note that subsequent invocations of crm_resource -M are not cumulative. So, if you ran these commands - crm_resource -M -r Email -H sles-2 + It is important to note that subsequent invocations of crm_resource -M are not cumulative. So, if you ran these commands + crm_resource -M -r Email -H sles-2 crm_resource -M -r Email -H sles-3 - then it is as if you had never performed the first command. - To allow the resource to move back again, use: - crm_resource -U -r Email - - Note the use of the word allow. - The resource can move back to its original location but, depending on resource-stickiness, it might stay where it is. - To be absolutely certain that it moves back to sles-1, move it there before issuing the call to crm_resource -U: - - crm_resource -M -r Email -H sles-1 + then it is as if you had never performed the first command. + To allow the resource to move back again, use: + crm_resource -U -r Email + + Note the use of the word allow. + The resource can move back to its original location but, depending on resource-stickiness, it might stay where it is. + To be absolutely certain that it moves back to sles-1, move it there before issuing the call to crm_resource -U: + + crm_resource -M -r Email -H sles-1 crm_resource -U -r Email - Alternatively, if you only care that the resource should be moved from its current location, try - crm_resource -M -r Email - Which will instead create a negative constraint, like - <rsc_location rsc="Email" node="sles-1" score="-INFINITY"/> - - This will achieve the desired effect, but will also have long-term consequences. - As the tool will warn you, the creation of a -INFINITY constraint will prevent the resource from running on that node until crm_resource -U is used. - This includes the situation where every other cluster node is no longer available! - - - In some cases, such as when resource-stickiness is set to INFINITY, it is possible that you will end up with the problem described in . - The tool can detect some of these cases and deals with them by also creating both a positive and negative constraint. Eg. - + Alternatively, if you only care that the resource should be moved from its current location, try + crm_resource -M -r Email + Which will instead create a negative constraint, like + <rsc_location rsc="Email" node="sles-1" score="-INFINITY"/> + + This will achieve the desired effect, but will also have long-term consequences. + As the tool will warn you, the creation of a -INFINITY constraint will prevent the resource from running on that node until crm_resource -U is used. + This includes the situation where every other cluster node is no longer available! + + + In some cases, such as when resource-stickiness is set to INFINITY, it is possible that you will end up with the problem described in . + The tool can detect some of these cases and deals with them by also creating both a positive and negative constraint. Eg. + Email prefers sles-1 with a score of -INFINITY Email prefers sles-2 with a score of INFINITY - which has the same long-term consequences as discussed earlier. + which has the same long-term consequences as discussed earlier.
- Moving Resources Due to Failure - New in 1.0 is the concept of a migration threshold + Moving Resources Due to Failure + New in 1.0 is the concept of a migration threshold - The naming of this option was unfortunate as it is easily confused with true migration, the process of moving a resource from one node to another without stopping it. - Xen virtual guests are the most common example of resources that can be migrated in this manner. - - . - Simply define migration-threshold=N for a resource and it will migrate to a new node after N failures. - There is no threshold defined by default. - To determine the resource's current failure status and limits, use crm_mon --failcounts. - - - By default, once the threshold has been reached, this node will no longer be allowed to run the failed resource until the administrator manually resets the resource's failcount using crm_failcount (after hopefully first fixing the failure's cause). - However it is possible to expire them by setting the resource's failure-timeout option. - - So a setting of migration-threshold=2 and failure-timeout=60s would cause the resource to move to a new node after 2 failures, and allow it to move back (depending on the stickiness and constraint scores) after one minute. - - There are two exceptions to the migration threshold concept; they occur when a resource either fails to start or fails to stop. - Start failures cause the failcount to be set to INFINITY and thus always cause the resource to move immediately. - - - Stop failures are slightly different and crucial. - If a resource fails to stop and STONITH is enabled, then the cluster will fence the node in order to be able to start the resource elsewhere. - If STONITH is not enabled, then the cluster has no way to continue and will not try to start the resource elsewhere, but will try to stop it again after the failure timeout. - - Please read before enabling this option. + The naming of this option was unfortunate as it is easily confused with true migration, the process of moving a resource from one node to another without stopping it. + Xen virtual guests are the most common example of resources that can be migrated in this manner. + + . + Simply define migration-threshold=N for a resource and it will migrate to a new node after N failures. + There is no threshold defined by default. + To determine the resource's current failure status and limits, use crm_mon --failcounts. + + + By default, once the threshold has been reached, this node will no longer be allowed to run the failed resource until the administrator manually resets the resource's failcount using crm_failcount (after hopefully first fixing the failure's cause). + However it is possible to expire them by setting the resource's failure-timeout option. + + So a setting of migration-threshold=2 and failure-timeout=60s would cause the resource to move to a new node after 2 failures, and allow it to move back (depending on the stickiness and constraint scores) after one minute. + + There are two exceptions to the migration threshold concept; they occur when a resource either fails to start or fails to stop. + Start failures cause the failcount to be set to INFINITY and thus always cause the resource to move immediately. + + + Stop failures are slightly different and crucial. + If a resource fails to stop and STONITH is enabled, then the cluster will fence the node in order to be able to start the resource elsewhere. + If STONITH is not enabled, then the cluster has no way to continue and will not try to start the resource elsewhere, but will try to stop it again after the failure timeout. + + Please read before enabling this option.
- Moving Resources Due to Connectivity Changes - Setting up the cluster to move resources when external connectivity is lost is a two-step process. -
- Tell Pacemaker to monitor connectivity - - To do this, you need to add a ping resource to the cluster. - The ping resource uses the system utility of the same name to a test if list of machines (specified by DNS hostname or IPv4/IPv6 address) are reachable and uses the results to maintain a node attribute normally called pingd - The attribute name is customizable; that allows multiple ping groups to be defined. - . - - Older versions of Heartbeat required users to add ping nodes to ha.cf - this is no longer required. - - - - Older versions of Pacemaker used a custom binary called pingd for this functionality; this is now deprecated in favor of ping. - If your version of Pacemaker does not contain the ping agent, you can download the latest version. - + Moving Resources Due to Connectivity Changes + Setting up the cluster to move resources when external connectivity is lost is a two-step process. +
+ Tell Pacemaker to monitor connectivity + + To do this, you need to add a ping resource to the cluster. + The ping resource uses the system utility of the same name to a test if list of machines (specified by DNS hostname or IPv4/IPv6 address) are reachable and uses the results to maintain a node attribute normally called pingd + The attribute name is customizable; that allows multiple ping groups to be defined. + . + + Older versions of Heartbeat required users to add ping nodes to ha.cf - this is no longer required. + + + + Older versions of Pacemaker used a custom binary called pingd for this functionality; this is now deprecated in favor of ping. + If your version of Pacemaker does not contain the ping agent, you can download the latest version. + - - - Normally the resource will run on all cluster nodes, which means that you'll need to create a clone. - A template for this can be found below along with a description of the most interesting parameters. - - - Common Options for a 'ping' Resource - + + + Normally the resource will run on all cluster nodes, which means that you'll need to create a clone. + A template for this can be found below along with a description of the most interesting parameters. + +
+ Common Options for a 'ping' Resource + - - Field - Description - + + Field + Description + - - - + + + dampenResource Option ResourceOptiondampen - dampen - The time to wait (dampening) for further changes to occur. Use this to prevent a resource from bouncing around the cluster when cluster nodes notice the loss of connectivity at slightly different times. - - - + dampen + The time to wait (dampening) for further changes to occur. Use this to prevent a resource from bouncing around the cluster when cluster nodes notice the loss of connectivity at slightly different times. + + + multiplierResource Option ResourceOptionmultiplier - multiplier - The number of connected ping nodes gets multiplied by this value to get a score. Useful when there are multiple ping nodes configured. - - - + multiplier + The number of connected ping nodes gets multiplied by this value to get a score. Useful when there are multiple ping nodes configured. + + + host_listResource Option ResourceOptionhost_list - host_list - The machines to contact in order to determine the current connectivity status. Allowed values include resolvable DNS host names, IPv4 and IPv6 addresses. - - - -
- - An example ping cluster resource, checks node connectivity once every minute - + host_list + The machines to contact in order to determine the current connectivity status. Allowed values include resolvable DNS host names, IPv4 and IPv6 addresses. + + + + + + An example ping cluster resource, checks node connectivity once every minute + ]]> - - - - You're only half done. - The next section deals with telling Pacemaker how to deal with the connectivity status that ocf:pacemaker:ping is recording. - + + + + You're only half done. + The next section deals with telling Pacemaker how to deal with the connectivity status that ocf:pacemaker:ping is recording. + - -
-
- Tell Pacemaker how to interpret the connectivity data - NOTE: Before reading the following, please make sure you have read and understood above. - - There are a number of ways to use the connectivity data provided by Heartbeat. - The most common setup is for people to have a single ping node, to prevent the cluster from running a resource on any unconnected node. + +
+
+ Tell Pacemaker how to interpret the connectivity data + NOTE: Before reading the following, please make sure you have read and understood above. + + There are a number of ways to use the connectivity data provided by Heartbeat. + The most common setup is for people to have a single ping node, to prevent the cluster from running a resource on any unconnected node. TODO: is the idea that only nodes that can reach eg. the router should have active resources? - - - Don't run on unconnected nodes - + + + Don't run on unconnected nodes + ]]> - - - A more complex setup is to have a number of ping nodes configured. - You can require the cluster to only run resources on nodes that can connect to all (or a minimum subset) of them. - - - Run only on nodes connected to three or more ping nodes; this assumes <literal>multiplier</literal> is set to 1000. - + + + A more complex setup is to have a number of ping nodes configured. + You can require the cluster to only run resources on nodes that can connect to all (or a minimum subset) of them. + + + Run only on nodes connected to three or more ping nodes; this assumes <literal>multiplier</literal> is set to 1000. + ]]> - - - Instead you can tell the cluster only to prefer nodes with the best connectivity. - Just be sure to set multiplier to a value higher than that of resource-stickiness (and don't set either of them to INFINITY). - - - Prefer the node with the most connected ping nodes - + + + Instead you can tell the cluster only to prefer nodes with the best connectivity. + Just be sure to set multiplier to a value higher than that of resource-stickiness (and don't set either of them to INFINITY). + + + Prefer the node with the most connected ping nodes + ]]> - - - It is perhaps easier to think of this in terms of the simple constraints that the cluster translates it into. - For example, if sles-1 is connected to all 5 ping nodes but sles-2 is only connected to 2, then it would be as if you instead had the following constraints in your configuration: - -
- How the cluster translates the pingd constraint - + + + It is perhaps easier to think of this in terms of the simple constraints that the cluster translates it into. + For example, if sles-1 is connected to all 5 ping nodes but sles-2 is only connected to 2, then it would be as if you instead had the following constraints in your configuration: + +
+ How the cluster translates the pingd constraint + ]]> -
- The advantage is that you don't have to manually update any constraints whenever your network connectivity changes. - - You can also combine the concepts above into something even more complex. - The example below shows how you can prefer the node with the most connected ping nodes provided they have connectivity to at least three (again assuming that multiplier is set to 1000). - - - A more complex example of choosing a location based on connectivity - +
+ The advantage is that you don't have to manually update any constraints whenever your network connectivity changes. + + You can also combine the concepts above into something even more complex. + The example below shows how you can prefer the node with the most connected ping nodes provided they have connectivity to at least three (again assuming that multiplier is set to 1000). + + + A more complex example of choosing a location based on connectivity + ]]> - -
+ +
- Resource Migration - - Some resources, such as Xen virtual guests, are able to move to another location without loss of state. - We call this resource migration; this is different from the normal practice of stopping the resource on the first machine and starting it elsewhere. - - - Not all resources are able to migrate, see the Migration Checklist below, and those that can, won't do so in all situations. - Conceptually there are two requirements from which the other prerequisites follow: + Resource Migration + + Some resources, such as Xen virtual guests, are able to move to another location without loss of state. + We call this resource migration; this is different from the normal practice of stopping the resource on the first machine and starting it elsewhere. + + + Not all resources are able to migrate, see the Migration Checklist below, and those that can, won't do so in all situations. + Conceptually there are two requirements from which the other prerequisites follow: the resource must be active and healthy at the old location everything required for the resource to run must be available on both the old and new locations - - The cluster is able to accommodate both push and pull migration models by requiring the resource agent to support two new actions: migrate_to (performed on the current location) and migrate_from (performed on the destination). - - In push migration, the process on the current location transfers the resource to the new location where is it later activated. - In this scenario, most of the work would be done in the migrate_to action and, if anything, the activation would occur during migrate_from. - - Conversely for pull, the migrate_to action is practically empty and migrate_from does most of the work, extracting the relevant resource state from the old location and activating it. - There is no wrong or right way to implement migration for your service, as long as it works. -
- Migration Checklist - - The resource may not be a clone. - The resource must use an OCF style agent. - The resource must not be in a failed or degraded state. - The resource must not, directly or indirectly, depend on any primitive or group resources. TODO: how can a KVM with DRBD migrate? - The resource must support two new actions: migrate_to and migrate_from, and advertise them in its metadata. - The resource must have the allow-migrate meta-attribute set to true (which is not the default). - - - If the resource depends on a clone, and at the time the resource needs to be move, the clone has instances that are stopping and instances that are starting, then the resource will be moved in the traditional manner. - The Policy Engine is not yet able to model this situation correctly and so takes the safe (yet less optimal) path. - -
+
+ The cluster is able to accommodate both push and pull migration models by requiring the resource agent to support two new actions: migrate_to (performed on the current location) and migrate_from (performed on the destination). + + In push migration, the process on the current location transfers the resource to the new location where is it later activated. + In this scenario, most of the work would be done in the migrate_to action and, if anything, the activation would occur during migrate_from. + + Conversely for pull, the migrate_to action is practically empty and migrate_from does most of the work, extracting the relevant resource state from the old location and activating it. + There is no wrong or right way to implement migration for your service, as long as it works. +
+ Migration Checklist + + The resource may not be a clone. + The resource must use an OCF style agent. + The resource must not be in a failed or degraded state. + The resource must not, directly or indirectly, depend on any primitive or group resources. TODO: how can a KVM with DRBD migrate? + The resource must support two new actions: migrate_to and migrate_from, and advertise them in its metadata. + The resource must have the allow-migrate meta-attribute set to true (which is not the default). + + + If the resource depends on a clone, and at the time the resource needs to be move, the clone has instances that are stopping and instances that are starting, then the resource will be moved in the traditional manner. + The Policy Engine is not yet able to model this situation correctly and so takes the safe (yet less optimal) path. + +
Reusing Rules, Options and Sets of Operations - Sometimes a number of constraints need to use the same set of rules, and resources need to set the same options and parameters. - To simplify this situation, you can refer to an existing object using an id-ref instead of an id. + Sometimes a number of constraints need to use the same set of rules, and resources need to set the same options and parameters. + To simplify this situation, you can refer to an existing object using an id-ref instead of an id. So if for one resource you have ]]> Then instead of duplicating the rule for all your other resources, you can instead specify - Referencing rules from other constraints - + Referencing rules from other constraints + ]]> - - The cluster will insist that the rule exists somewhere. - Attempting to add a reference to a non-existing rule will cause a validation failure, as will attempting to remove a rule that is referenced elsewhere. - + + The cluster will insist that the rule exists somewhere. + Attempting to add a reference to a non-existing rule will cause a validation failure, as will attempting to remove a rule that is referenced elsewhere. + The same principle applies for meta_attributes and instance_attributes as illustrated in the example below - Referencing attributes, options, and operations from other resources - + Referencing attributes, options, and operations from other resources + ]]>
Reloading Services After a Definition Change - The cluster automatically detects changes to the definition of services it manages. - However, the normal response is to stop the service (using the old definition) and start it again (with the new definition). - This works well, but some services are smarter and can be told to use a new set of options without restarting. + The cluster automatically detects changes to the definition of services it manages. + However, the normal response is to stop the service (using the old definition) and start it again (with the new definition). + This works well, but some services are smarter and can be told to use a new set of options without restarting. - To take advantage of this capability, your resource agent must: - - - Accept the reload operation and perform any required actions. - The steps required here depend completely on your application! - - The DRBD Agent's Control logic for Supporting the <literal>reload</literal> Operation - + + Accept the reload operation and perform any required actions. + The steps required here depend completely on your application! + + The DRBD Agent's Control logic for Supporting the <literal>reload</literal> Operation + - - - - Advertise the reload operation in the actions section of its metadata - - The DRBD Agent Advertising Support for the <literal>reload</literal> Operation - + + + + Advertise the reload operation in the actions section of its metadata + + The DRBD Agent Advertising Support for the <literal>reload</literal> Operation + 1.1 Master/Slave OCF Resource Agent for DRBD ... ]]> - - - - Advertise one or more parameters that can take effect using reload. - Any parameter with the unique set to 0 is eligible to be used in this way. - - Parameter that can be changed using reload - + + + + Advertise one or more parameters that can take effect using reload. + Any parameter with the unique set to 0 is eligible to be used in this way. + + Parameter that can be changed using reload + Full path to the drbd.conf file. Path to drbd.conf ]]> - - - + + + - Once these requirements are satisfied, the cluster will automatically know to reload the resource (instead of restarting) when a non-unique fields changes. + Once these requirements are satisfied, the cluster will automatically know to reload the resource (instead of restarting) when a non-unique fields changes. - - The metadata is re-read when the resource is started. - This may mean that the resource will be restarted the first time, even though you changed a parameter with unique=0 - + + The metadata is re-read when the resource is started. + This may mean that the resource will be restarted the first time, even though you changed a parameter with unique=0 + - - If both a unique and non-unique field are changed simultaneously, the resource will still be restarted. - + + If both a unique and non-unique field are changed simultaneously, the resource will still be restarted. +
diff --git a/doc/Pacemaker_Explained/en-US/Ch-Advanced-Resources.xml b/doc/Pacemaker_Explained/en-US/Ch-Advanced-Resources.xml index 0eda4ab228..b134b0df4f 100644 --- a/doc/Pacemaker_Explained/en-US/Ch-Advanced-Resources.xml +++ b/doc/Pacemaker_Explained/en-US/Ch-Advanced-Resources.xml @@ -1,1023 +1,1023 @@ Advanced Resource Types
<indexterm significance="preferred"><primary>Group Resources</primary></indexterm> <indexterm><primary>Resources</primary><secondary>Groups</secondary></indexterm> Groups - A Syntactic Shortcut - One of the most common elements of a cluster is a set of resources that need to be located together, start sequentially, and stop in the reverse order. - To simplify this configuration we support the concept of groups. + One of the most common elements of a cluster is a set of resources that need to be located together, start sequentially, and stop in the reverse order. + To simplify this configuration we support the concept of groups. - An example group - + An example group + ]]> - Although the example above contains only two resources, there is no limit to the number of resources a group can contain. - The example is also sufficient to explain the fundamental properties of a group: + Although the example above contains only two resources, there is no limit to the number of resources a group can contain. + The example is also sufficient to explain the fundamental properties of a group: - Resources are started in the order they appear in (Public-IP first, then Email) - Resources are stopped in the reverse order to which they appear in (Email first, then Public-IP) - - If a resource in the group can't run anywhere, then nothing after that is allowed to run, too. - - If Public-IP can't run anywhere, neither can Email; - but if Email can't run anywhere, this does not affect Public-IP in any way - - - + Resources are started in the order they appear in (Public-IP first, then Email) + Resources are stopped in the reverse order to which they appear in (Email first, then Public-IP) + + If a resource in the group can't run anywhere, then nothing after that is allowed to run, too. + + If Public-IP can't run anywhere, neither can Email; + but if Email can't run anywhere, this does not affect Public-IP in any way + + + The group above is logically equivalent to writing: - How the cluster sees a group resource - + How the cluster sees a group resource + ]]> Obviously as the group grows bigger, the reduced configuration effort can become significant. Another (typical) example of a group is a DRBD volume, the filesystem mount, an IP address, and an application that uses them.
- Properties - - Properties of a Group Resource - - - + Properties +
+ Properties of a Group Resource + + + - Field - Description + Field + Description - - + + idGroup Resource Property Group Resource Propertiesid ResourceGroup Propertyid id - Your name for the group + Your name for the group - - -
+ + +
- Options - Options inherited from simple resources: priority, target-role, is-managed + Options + Options inherited from simple resources: priority, target-role, is-managed
-
- Instance Attributes - Groups have no instance attributes, however any that are set here will be inherited by the group's children. -
-
- Contents - - Groups may only contain a collection of primitive cluster resources. - To refer to the child of a group resource, just use the child's id instead of the group's. - -
-
- Constraints - Although it is possible to reference the group's children in constraints, it is usually preferable to use the group's name instead. - - Example constraints involving groups - +
+ Instance Attributes + Groups have no instance attributes, however any that are set here will be inherited by the group's children. +
+
+ Contents + + Groups may only contain a collection of primitive cluster resources. + To refer to the child of a group resource, just use the child's id instead of the group's. + +
+
+ Constraints + Although it is possible to reference the group's children in constraints, it is usually preferable to use the group's name instead. + + Example constraints involving groups + ]]> - -
-
+ +
+
<indexterm><primary>resource-stickiness</primary><secondary>of a Group Resource</secondary></indexterm> Stickiness - Stickiness, the measure of how much a resource wants to stay where it is, is additive in groups. + Stickiness, the measure of how much a resource wants to stay where it is, is additive in groups. Every active resource of the group will contribute its stickiness value to the group's total. So if the default resource-stickiness is 100, and a group has seven members, five of which are active, then the group as a whole will prefer its current location with a score of 500. -
+
<indexterm significance="preferred"><primary>Clone Resources</primary></indexterm> <indexterm><primary>Resources</primary><secondary>Clones</secondary></indexterm> Clones - Resources That Get Active on Multiple Hosts - Clones were initially conceived as a convenient way to start N instances of an IP resource and have them distributed throughout the cluster for load balancing. - They have turned out to quite useful for a number of purposes including integrating with Red Hat's DLM, the fencing subsystem, and OCFS2. + Clones were initially conceived as a convenient way to start N instances of an IP resource and have them distributed throughout the cluster for load balancing. + They have turned out to quite useful for a number of purposes including integrating with Red Hat's DLM, the fencing subsystem, and OCFS2. You can clone any resource, provided the resource agent supports it. Three types of cloned resources exist: - Anonymous - Globally Unique - Stateful + Anonymous + Globally Unique + Stateful - Anonymous clones are the simplest type. - These resources behave completely identically everywhere they are running. - Because of this, there can only be one copy of an anonymous clone active per machine. + Anonymous clones are the simplest type. + These resources behave completely identically everywhere they are running. + Because of this, there can only be one copy of an anonymous clone active per machine. - Globally unique clones are distinct entities. - A copy of the clone running on one machine is not equivalent to another instance on another node. - Nor would any two copies on the same node be equivalent. + Globally unique clones are distinct entities. + A copy of the clone running on one machine is not equivalent to another instance on another node. + Nor would any two copies on the same node be equivalent. Stateful clones are covered later in . - An example clone - + An example clone + ]]>
- Properties - - Properties of a Clone Resource - - - + Properties +
+ Properties of a Clone Resource + + + - Field - Description + Field + Description idClone Resource Property Clone Resource Propertiesid ResourceClone Propertyid id - Your name for the clone + Your name for the clone - - -
+ + +
- Options - Options inherited from simple resources: priority, target-role, is-managed - - Clone specific configuration options - - - + Options + Options inherited from simple resources: priority, target-role, is-managed +
+ Clone specific configuration options + + + - Field - Description + Field + Description - - + + clone-max Clone Resource Property Clone Resource Propertiesclone-max ResourceClone Propertyclone-max clone-max - How many copies of the resource to start. Defaults to the number of nodes in the cluster. + How many copies of the resource to start. Defaults to the number of nodes in the cluster. clone-node-max Clone Resource Property Clone Resource Propertiesclone-node-max ResourceClone Propertyclone-node-max clone-node-max - How many copies of the resource can be started on a single node; default 1. + How many copies of the resource can be started on a single node; default 1. notify Clone Resource Property Clone Resource Propertiesnotify ResourceClone Propertynotify notify - When stopping or starting a copy of the clone, tell all the other copies beforehand and when the action was successful. Allowed values: false, true - + When stopping or starting a copy of the clone, tell all the other copies beforehand and when the action was successful. Allowed values: false, true + globally-unique Clone Resource Property Clone Resource Propertiesglobally-unique ResourceClone Propertyglobally-unique globally-unique - Does each copy of the clone perform a different function? Allowed values: false, true + Does each copy of the clone perform a different function? Allowed values: false, true ordered Clone Resource Property Clone Resource Propertiesordered ResourceClone Propertyordered ordered - Should the copies be started in series (instead of in parallel). Allowed values: false, true - + Should the copies be started in series (instead of in parallel). Allowed values: false, true + interleave Clone Resource Property Clone Resource Propertiesinterleave ResourceClone Propertyinterleave interleave - Changes the behavior of ordering constraints (between clones/masters) so that instances can start/stop as soon as their peer instance has (rather than waiting for every instance of the other clone has). Allowed values: false, true - + Changes the behavior of ordering constraints (between clones/masters) so that instances can start/stop as soon as their peer instance has (rather than waiting for every instance of the other clone has). Allowed values: false, true + - - -
+ + +
-
- Instance Attributes - Clones have no instance attributes; however, any that are set here will be inherited by the clone's children. -
-
- Contents - Clones must contain exactly one group or one regular resource. - - - You should never reference the name of a clone's child. - If you think you need to do this, you probably need to re-evaluate your design. - - - -
-
- Constraints - - In most cases, a clone will have a single copy on each active cluster node. - If this is not the case, you can indicate which nodes the cluster should preferentially assign copies to with resource location constraints. - These constraints are written no differently to those for regular resources except that the clone's id is used. - - - Ordering constraints behave slightly differently for clones. - In the example below, apache-stats will wait until all copies of the clone that need to be started have done so before being started itself. - Only if no copies can be started apache-stats will be prevented from being active. - Additionally, the clone will wait for apache-stats to be stopped before stopping the clone. - - - Colocation of a regular (or group) resource with a clone means that the resource can run on any machine with an active copy of the clone. - The cluster will choose a copy based on where the clone is running and the resource's own location preferences. - - - Colocation between clones is also possible. - In such cases, the set of allowed locations for the clone is limited to nodes on which the clone is (or will be) active. - Allocation is then performed as normally. - - - Example constraints involving clones - +
+ Instance Attributes + Clones have no instance attributes; however, any that are set here will be inherited by the clone's children. +
+
+ Contents + Clones must contain exactly one group or one regular resource. + + + You should never reference the name of a clone's child. + If you think you need to do this, you probably need to re-evaluate your design. + + + +
+
+ Constraints + + In most cases, a clone will have a single copy on each active cluster node. + If this is not the case, you can indicate which nodes the cluster should preferentially assign copies to with resource location constraints. + These constraints are written no differently to those for regular resources except that the clone's id is used. + + + Ordering constraints behave slightly differently for clones. + In the example below, apache-stats will wait until all copies of the clone that need to be started have done so before being started itself. + Only if no copies can be started apache-stats will be prevented from being active. + Additionally, the clone will wait for apache-stats to be stopped before stopping the clone. + + + Colocation of a regular (or group) resource with a clone means that the resource can run on any machine with an active copy of the clone. + The cluster will choose a copy based on where the clone is running and the resource's own location preferences. + + + Colocation between clones is also possible. + In such cases, the set of allowed locations for the clone is limited to nodes on which the clone is (or will be) active. + Allocation is then performed as normally. + + + Example constraints involving clones + ]]> - -
-
- Stickiness - + +
+
+ Stickiness + resource-stickinessof a Clone Resource - To achieve a stable allocation pattern, clones are slightly sticky by default. - If no value for resource-stickiness is provided, the clone will use a value of 1. - Being a small value, it causes minimal disturbance to the score calculations of other resources but is enough to prevent Pacemaker from needlessly moving copies around the cluster. - -
-
- Resource Agent Requirements - - Any resource can be used as an anonymous clone, as it requires no additional support from the resource agent. - Whether it makes sense to do so depends on your resource and its resource agent. - - - Globally unique clones do require some additional support in the resource agent. - In particular, it must only respond with ${OCF_SUCCESS} if the node has that exact instance active. - All other probes for instances of the clone should result in ${OCF_NOT_RUNNING}. - Unless of course they are failed, in which case they should return one of the other OCF error codes. - - Copies of a clone are identified by appending a colon and a numerical offset, eg. apache:2. - Resource agents can find out how many copies there are by examining the OCF_RESKEY_CRM_meta_clone_max environment variable and which copy it is by examining OCF_RESKEY_CRM_meta_clone. - - You should not make any assumptions (based on OCF_RESKEY_CRM_meta_clone) about which copies are active. - In particular, the list of active copies will not always be an unbroken sequence, nor always start at 0. - -
-
- Notifications - - Supporting notifications requires the notify action to be implemented. - Once supported, the notify action will be passed a number of extra variables which, when combined with additional context, can be used to calculate the current state of the cluster and what is about to happen to it. - - - Environment variables supplied with Clone notify actions - - - + To achieve a stable allocation pattern, clones are slightly sticky by default. + If no value for resource-stickiness is provided, the clone will use a value of 1. + Being a small value, it causes minimal disturbance to the score calculations of other resources but is enough to prevent Pacemaker from needlessly moving copies around the cluster. + + +
+ Resource Agent Requirements + + Any resource can be used as an anonymous clone, as it requires no additional support from the resource agent. + Whether it makes sense to do so depends on your resource and its resource agent. + + + Globally unique clones do require some additional support in the resource agent. + In particular, it must only respond with ${OCF_SUCCESS} if the node has that exact instance active. + All other probes for instances of the clone should result in ${OCF_NOT_RUNNING}. + Unless of course they are failed, in which case they should return one of the other OCF error codes. + + Copies of a clone are identified by appending a colon and a numerical offset, eg. apache:2. + Resource agents can find out how many copies there are by examining the OCF_RESKEY_CRM_meta_clone_max environment variable and which copy it is by examining OCF_RESKEY_CRM_meta_clone. + + You should not make any assumptions (based on OCF_RESKEY_CRM_meta_clone) about which copies are active. + In particular, the list of active copies will not always be an unbroken sequence, nor always start at 0. + +
+
+ Notifications + + Supporting notifications requires the notify action to be implemented. + Once supported, the notify action will be passed a number of extra variables which, when combined with additional context, can be used to calculate the current state of the cluster and what is about to happen to it. + +
+ Environment variables supplied with Clone notify actions + + + - - Variable - Description - + + Variable + Description + - - - Environment VariableOCF_RESKEY_CRM_meta_notify_type + + + Environment VariableOCF_RESKEY_CRM_meta_notify_type OCF_RESKEY_CRM_meta_notify_type OCF_RESKEY_CRM_meta_notify_type - Allowed values: pre, post - - - Environment VariableOCF_RESKEY_CRM_meta_notify_operation + Allowed values: pre, post + + + Environment VariableOCF_RESKEY_CRM_meta_notify_operation OCF_RESKEY_CRM_meta_notify_operation OCF_RESKEY_CRM_meta_notify_operation - Allowed values: start, stop - - - Environment VariableOCF_RESKEY_CRM_meta_notify_start_resource + Allowed values: start, stop + + + Environment VariableOCF_RESKEY_CRM_meta_notify_start_resource OCF_RESKEY_CRM_meta_notify_start_resource OCF_RESKEY_CRM_meta_notify_start_resource - Resources to be started - - - Environment VariableOCF_RESKEY_CRM_meta_notify_stop_resource + Resources to be started + + + Environment VariableOCF_RESKEY_CRM_meta_notify_stop_resource OCF_RESKEY_CRM_meta_notify_stop_resource OCF_RESKEY_CRM_meta_notify_stop_resource - Resources to be stopped - - - Environment VariableOCF_RESKEY_CRM_meta_notify_active_resource + Resources to be stopped + + + Environment VariableOCF_RESKEY_CRM_meta_notify_active_resource OCF_RESKEY_CRM_meta_notify_active_resource OCF_RESKEY_CRM_meta_notify_active_resource - Resources that are running - - - Environment VariableOCF_RESKEY_CRM_meta_notify_inactive_resource + Resources that are running + + + Environment VariableOCF_RESKEY_CRM_meta_notify_inactive_resource OCF_RESKEY_CRM_meta_notify_inactive_resource OCF_RESKEY_CRM_meta_notify_inactive_resource - Resources that are not running - - - Environment VariableOCF_RESKEY_CRM_meta_notify_start_uname + Resources that are not running + + + Environment VariableOCF_RESKEY_CRM_meta_notify_start_uname OCF_RESKEY_CRM_meta_notify_start_uname OCF_RESKEY_CRM_meta_notify_start_uname - Nodes on which resources will be started - - - Environment VariableOCF_RESKEY_CRM_meta_notify_stop_uname + Nodes on which resources will be started + + + Environment VariableOCF_RESKEY_CRM_meta_notify_stop_uname OCF_RESKEY_CRM_meta_notify_stop_uname OCF_RESKEY_CRM_meta_notify_stop_uname - Nodes on which resources will be stopped - - - Environment VariableOCF_RESKEY_CRM_meta_notify_active_uname + Nodes on which resources will be stopped + + + Environment VariableOCF_RESKEY_CRM_meta_notify_active_uname OCF_RESKEY_CRM_meta_notify_active_uname OCF_RESKEY_CRM_meta_notify_active_uname - Nodes on which resources are running - - - Environment VariableOCF_RESKEY_CRM_meta_notify_inactive_uname + Nodes on which resources are running + + + Environment VariableOCF_RESKEY_CRM_meta_notify_inactive_uname OCF_RESKEY_CRM_meta_notify_inactive_uname OCF_RESKEY_CRM_meta_notify_inactive_uname - Nodes on which resources are not running - - - -
- The variables come in pairs, such as OCF_RESKEY_CRM_meta_notify_start_resource and OCF_RESKEY_CRM_meta_notify_start_uname and should be treated as an array of whitespace separated elements. - Thus in order to indicate that clone:0 will be started on sles-1, clone:2 will be started on sles-3, and clone:3 will be started on sles-2, the cluster would set - - Example notification variables - - OCF_RESKEY_CRM_meta_notify_start_resource="clone:0 clone:2 clone:3" - OCF_RESKEY_CRM_meta_notify_start_uname="sles-1 sles-3 sles-2" - - -
-
- Proper Interpretation of Notification Environment Variables - Pre-notification (stop): - - + Nodes on which resources are not running + + + + + The variables come in pairs, such as OCF_RESKEY_CRM_meta_notify_start_resource and OCF_RESKEY_CRM_meta_notify_start_uname and should be treated as an array of whitespace separated elements. + Thus in order to indicate that clone:0 will be started on sles-1, clone:2 will be started on sles-3, and clone:3 will be started on sles-2, the cluster would set + + Example notification variables + + OCF_RESKEY_CRM_meta_notify_start_resource="clone:0 clone:2 clone:3" + OCF_RESKEY_CRM_meta_notify_start_uname="sles-1 sles-3 sles-2" + + +
+
+ Proper Interpretation of Notification Environment Variables + Pre-notification (stop): + + Active resources: $OCF_RESKEY_CRM_meta_notify_active_resource - - + + Inactive resources: $OCF_RESKEY_CRM_meta_notify_inactive_resource - - + + Resources to be started: $OCF_RESKEY_CRM_meta_notify_start_resource - - + + Resources to be stopped: $OCF_RESKEY_CRM_meta_notify_stop_resource - - - Post-notification (stop) / Pre-notification (start): + + + Post-notification (stop) / Pre-notification (start): Active resources $OCF_RESKEY_CRM_meta_notify_active_resource minus $OCF_RESKEY_CRM_meta_notify_stop_resource Inactive resources $OCF_RESKEY_CRM_meta_notify_inactive_resource plus $OCF_RESKEY_CRM_meta_notify_stop_resource Resources that were started: $OCF_RESKEY_CRM_meta_notify_start_resource Resources that were stopped: $OCF_RESKEY_CRM_meta_notify_stop_resource Post-notification (start): Active resources: $OCF_RESKEY_CRM_meta_notify_active_resource minus $OCF_RESKEY_CRM_meta_notify_stop_resource plus $OCF_RESKEY_CRM_meta_notify_start_resource Inactive resources: $OCF_RESKEY_CRM_meta_notify_inactive_resource plus $OCF_RESKEY_CRM_meta_notify_stop_resource minus $OCF_RESKEY_CRM_meta_notify_start_resource - + Resources that were started: $OCF_RESKEY_CRM_meta_notify_start_resource Resources that were stopped: $OCF_RESKEY_CRM_meta_notify_stop_resource -
+
<indexterm significance="preferred"><primary>Multi-state Resources</primary></indexterm> <indexterm significance="preferred"><primary>Resources</primary><secondary>Multi-state</secondary></indexterm> Multi-state - Resources That Have Multiple Modes - Multi-state resources are a specialization of Clone resources; please ensure you understand the section on clones before continuing! They allow the instances to be in one of two operating modes; - these are called Master and Slave, but can mean whatever you wish them to mean. - The only limitation is that when an instance is started, it must come up in the Slave state. + Multi-state resources are a specialization of Clone resources; please ensure you understand the section on clones before continuing! They allow the instances to be in one of two operating modes; + these are called Master and Slave, but can mean whatever you wish them to mean. + The only limitation is that when an instance is started, it must come up in the Slave state.
- Properties - - Properties of a Multi-State Resource - - - + Properties +
+ Properties of a Multi-State Resource + + + - Field - Description + Field + Description idMulti-State Resource Property Multi-State Resource Propertiesid ResourceMulti-State Propertyid id - Your name for the multi-state resource + Your name for the multi-state resource - - -
+ + +
- Options - Options inherited from simple resources: priority, target-role, is-managed - Options inherited from clone resources: clone-max, clone-node-max, notify, globally-unique, ordered, interleave - - Multi-state specific resource configuration options - - - + Options + Options inherited from simple resources: priority, target-role, is-managed + Options inherited from clone resources: clone-max, clone-node-max, notify, globally-unique, ordered, interleave +
+ Multi-state specific resource configuration options + + + - Field - Description + Field + Description master-max Multi-State Resource Property Multi-State Resource Propertiesmaster-max ResourceMulti-State Propertymaster-max master-max - How many copies of the resource can be promoted to master status; default 1. + How many copies of the resource can be promoted to master status; default 1. master-node-max Multi-State Resource Property Multi-State Resource Propertiesmaster-node-max ResourceMulti-State Propertymaster-node-max master-node-max - How many copies of the resource can be promoted to master status on a single node; default 1. + How many copies of the resource can be promoted to master status on a single node; default 1. -
-
-
- Instance Attributes - Multi-state resources have no instance attributes; however, any that are set here will be inherited by master's children. -
-
- Contents - Masters must contain exactly one group or one regular resource. - - - You should never reference the name of a master's child. - If you think you need to do this, you probably need to re-evaluate your design. - - + +
+
+ Instance Attributes + Multi-state resources have no instance attributes; however, any that are set here will be inherited by master's children. +
+
+ Contents + Masters must contain exactly one group or one regular resource. + + + You should never reference the name of a master's child. + If you think you need to do this, you probably need to re-evaluate your design. + + -
-
- Monitoring Multi-State Resources - - The normal type of monitor actions are not sufficient to monitor a multi-state resource in the Master state. - To detect failures of the Master instance, you need to define an additional monitor action with role="Master". - +
+
+ Monitoring Multi-State Resources + + The normal type of monitor actions are not sufficient to monitor a multi-state resource in the Master state. + To detect failures of the Master instance, you need to define an additional monitor action with role="Master". + It is crucial that every monitor operation has a different interval! This is because Pacemaker currently differentiates between operations only by resource and interval; so if eg. a master/slave resource has the same monitor interval for both roles, Pacemaker would ignore the role when checking the status - which would cause unexpected return codes, and therefore unnecessary complications. - - Monitoring both states of a multi-state resource - + + Monitoring both states of a multi-state resource + ]]> - -
-
- Constraints - - In most cases, a multi-state resources will have a single copy on each active cluster node. - If this is not the case, you can indicate which nodes the cluster should preferentially assign copies to with resource location constraints. - These constraints are written no differently to those for regular resources except that the master's id is used. - - - When considering multi-state resources in constraints, for most purposes it is sufficient to treat them as clones. - The exception is when the rsc-role and/or with-rsc-role fields (for colocation constraints) and first-action and/or then-action fields (for ordering constraints) are used. - - - Additional constraint options relevant to multi-state resources - + + +
+ Constraints + + In most cases, a multi-state resources will have a single copy on each active cluster node. + If this is not the case, you can indicate which nodes the cluster should preferentially assign copies to with resource location constraints. + These constraints are written no differently to those for regular resources except that the master's id is used. + + + When considering multi-state resources in constraints, for most purposes it is sufficient to treat them as clones. + The exception is when the rsc-role and/or with-rsc-role fields (for colocation constraints) and first-action and/or then-action fields (for ordering constraints) are used. + +
+ Additional constraint options relevant to multi-state resources + - - Field - Description - + + Field + Description + rsc-role Multi-State Resource Constraints Multi-State Resource Constraintsrsc-role ResourceMulti-State Constraintsrsc-role rsc-role - - An additional attribute of colocation constraints that specifies the role that rsc must be in. - Allowed values: Started, Master, Slave. - - - + + An additional attribute of colocation constraints that specifies the role that rsc must be in. + Allowed values: Started, Master, Slave. + + + with-rsc-role Multi-State Resource Constraints Multi-State Resource Constraintswith-rsc-role ResourceMulti-State Constraintswith-rsc-role with-rsc-role - - An additional attribute of colocation constraints that specifies the role that with-rsc must be in. - Allowed values: Started, Master, Slave. - - - + + An additional attribute of colocation constraints that specifies the role that with-rsc must be in. + Allowed values: Started, Master, Slave. + + + first-action Multi-State Resource Constraints Multi-State Resource Constraintsfirst-action ResourceMulti-State Constraintsfirst-action first-action - - An additional attribute of ordering constraints that specifies the action that the first resource must complete before executing the specified action for the then resource. - Allowed values: start, stop, promote, demote. - - - + + An additional attribute of ordering constraints that specifies the action that the first resource must complete before executing the specified action for the then resource. + Allowed values: start, stop, promote, demote. + + + then-action Multi-State Resource Constraints Multi-State Resource Constraintsthen-action ResourceMulti-State Constraintsthen-action then-action - - An additional attribute of ordering constraints that specifies the action that the then resource can only execute after the first-action on the first resource has completed. - Allowed values: start, stop, promote, demote. Defaults to the value (specified or implied) of first-action. - - - - -
- - In the example below, myApp will wait until one of the database copies has been started and promoted to master before being started itself. - Only if no copies can be promoted will apache-stats be prevented from being active. - Additionally, the database will wait for myApp to be stopped before it is demoted. - - - Example constraints involving multi-state resources - + + An additional attribute of ordering constraints that specifies the action that the then resource can only execute after the first-action on the first resource has completed. + Allowed values: start, stop, promote, demote. Defaults to the value (specified or implied) of first-action. + + + + + + + In the example below, myApp will wait until one of the database copies has been started and promoted to master before being started itself. + Only if no copies can be promoted will apache-stats be prevented from being active. + Additionally, the database will wait for myApp to be stopped before it is demoted. + + + Example constraints involving multi-state resources + ]]> - - - Colocation of a regular (or group) resource with a multi-state resource means that it can run on any machine with an active copy of the multi-state resource that is in the specified state (Master or Slave). - In the example, the cluster will choose a location based on where database is running as a Master, and if there are multiple Master instances it will also factor in myApp's own location preferences when deciding which location to choose. - - - Colocation with regular clones and other multi-state resources is also possible. - In such cases, the set of allowed locations for the rsc clone is (after role filtering) limited to nodes on which the with-rsc multi-state resource is (or will be) in the specified role. - Allocation is then performed as-per-normal. - -
-
- Stickiness - + + + Colocation of a regular (or group) resource with a multi-state resource means that it can run on any machine with an active copy of the multi-state resource that is in the specified state (Master or Slave). + In the example, the cluster will choose a location based on where database is running as a Master, and if there are multiple Master instances it will also factor in myApp's own location preferences when deciding which location to choose. + + + Colocation with regular clones and other multi-state resources is also possible. + In such cases, the set of allowed locations for the rsc clone is (after role filtering) limited to nodes on which the with-rsc multi-state resource is (or will be) in the specified role. + Allocation is then performed as-per-normal. + +
+
+ Stickiness + resource-stickinessof a Multi-State Resource - To achieve a stable allocation pattern, multi-state resources are slightly sticky by default. - If no value for resource-stickiness is provided, the multi-state resource will use a value of 1. - Being a small value, it causes minimal disturbance to the score calculations of other resources but is enough to prevent Pacemaker from needlessly moving copies around the cluster. - -
-
- Which Resource Instance is Promoted - - During the start operation, most Resource Agent scripts should call the crm_master utility. - This tool automatically detects both the resource and host and should be used to set a preference for being promoted. - Based on this, master-max, and master-node-max, the instance(s) with the highest preference will be promoted. - - The other alternative is to create a location constraint that indicates which nodes are most preferred as masters. - - Manually specifying which node should be promoted - + To achieve a stable allocation pattern, multi-state resources are slightly sticky by default. + If no value for resource-stickiness is provided, the multi-state resource will use a value of 1. + Being a small value, it causes minimal disturbance to the score calculations of other resources but is enough to prevent Pacemaker from needlessly moving copies around the cluster. + +
+
+ Which Resource Instance is Promoted + + During the start operation, most Resource Agent scripts should call the crm_master utility. + This tool automatically detects both the resource and host and should be used to set a preference for being promoted. + Based on this, master-max, and master-node-max, the instance(s) with the highest preference will be promoted. + + The other alternative is to create a location constraint that indicates which nodes are most preferred as masters. + + Manually specifying which node should be promoted + ]]> - -
-
- Resource Agent Requirements - - Since multi-state resources are an extension of cloned resources, all the requirements of Clones are also requirements of multi-state resources. - Additionally, multi-state resources require two extra actions: demote and promote; - these actions are responsible for changing the state of the resource. - Like start and stop, they should return OCF_SUCCESS if they completed successfully or a relevant error code if they did not. - - - The states can mean whatever you wish, but when the resource is started, it must come up in the mode called Slave. - From there the cluster will then decide which instances to promote to Master. - - - In addition to the Clone requirements for monitor actions, agents must also accurately report which state they are in. - The cluster relies on the agent to report its status (including role) accurately and does not indicate to the agent what role it currently believes it to be in. - - - Role implications of OCF return codes - + + +
+ Resource Agent Requirements + + Since multi-state resources are an extension of cloned resources, all the requirements of Clones are also requirements of multi-state resources. + Additionally, multi-state resources require two extra actions: demote and promote; + these actions are responsible for changing the state of the resource. + Like start and stop, they should return OCF_SUCCESS if they completed successfully or a relevant error code if they did not. + + + The states can mean whatever you wish, but when the resource is started, it must come up in the mode called Slave. + From there the cluster will then decide which instances to promote to Master. + + + In addition to the Clone requirements for monitor actions, agents must also accurately report which state they are in. + The cluster relies on the agent to report its status (including role) accurately and does not indicate to the agent what role it currently believes it to be in. + +
+ Role implications of OCF return codes + - - Monitor Return Code - Description - + + Monitor Return Code + Description + - return codeOCF_NOT_RUNNING + return codeOCF_NOT_RUNNING Environment VariableOCF_NOT_RUNNING OCF_NOT_RUNNING OCF_NOT_RUNNING - Stopped - - - return codeOCF_SUCCESS + Stopped + + + return codeOCF_SUCCESS Environment VariableOCF_SUCCESS OCF_SUCCESS OCF_SUCCESS - Running (Slave) - - - return codeOCF_RUNNING_MASTER + Running (Slave) + + + return codeOCF_RUNNING_MASTER Environment VariableOCF_RUNNING_MASTER OCF_RUNNING_MASTER OCF_RUNNING_MASTER - Running (Master) - - - return codeOCF_FAILED_MASTER + Running (Master) + + + return codeOCF_FAILED_MASTER Environment VariableOCF_FAILED_MASTER OCF_FAILED_MASTER OCF_FAILED_MASTER - Failed (Master) - - - Other - Failed (Slave) + Failed (Master) + + + Other + Failed (Slave) -
-
-
- Notifications - - Like clones, supporting notifications requires the notify action to be implemented. - Once supported the notify action will be passed a number of extra variables which, when combined with additional context, can be used to calculate the current state of the cluster and what is about to happen to it. - - - Environment variables supplied with <literal>Master</literal> notify actions<footnote><para>Emphasized variables are specific to <literal>Master</literal> resources and all behave in the same manner as described for Clone resources.</para></footnote> - - +
+
+
+ Notifications + + Like clones, supporting notifications requires the notify action to be implemented. + Once supported the notify action will be passed a number of extra variables which, when combined with additional context, can be used to calculate the current state of the cluster and what is about to happen to it. + + + Environment variables supplied with <literal>Master</literal> notify actions<footnote><para>Emphasized variables are specific to <literal>Master</literal> resources and all behave in the same manner as described for Clone resources.</para></footnote> + + - - Variable - Description - + + Variable + Description + Environment VariableOCF_RESKEY_CRM__meta_notify_type OCF_RESKEY_CRM_meta_notify_type OCF_RESKEY_CRM_meta_notify_type - Allowed values: pre, post - - + Allowed values: pre, post + + Environment VariableOCF_RESKEY_CRM__meta_notify_operation OCF_RESKEY_CRM_meta_notify_operationOCF_RESKEY_CRM_meta_notify_operation - Allowed values: start, stop - - + Allowed values: start, stop + + Environment VariableOCF_RESKEY_CRM__meta_notify_active_resource OCF_RESKEY_CRM_meta_notify_active_resource OCF_RESKEY_CRM_meta_notify_active_resource - Resources the that are running - - + Resources the that are running + + Environment VariableOCF_RESKEY_CRM__meta_notify_inactive_resource OCF_RESKEY_CRM_meta_notify_inactive_resource OCF_RESKEY_CRM_meta_notify_inactive_resource - Resources the that are not running - - + Resources the that are not running + + Environment VariableOCF_RESKEY_CRM__meta_notify_master_resource OCF_RESKEY_CRM_meta_notify_master_resource OCF_RESKEY_CRM_meta_notify_master_resource - Resources that are running in Master mode - - + Resources that are running in Master mode + + Environment VariableOCF_RESKEY_CRM__meta_notify_slave_resource OCF_RESKEY_CRM_meta_notify_slave_resource OCF_RESKEY_CRM_meta_notify_slave_resource - Resources that are running in Slave mode - - + Resources that are running in Slave mode + + Environment VariableOCF_RESKEY_CRM__meta_notify_start_resource OCF_RESKEY_CRM_meta_notify_start_resource OCF_RESKEY_CRM_meta_notify_start_resource - Resources to be started - - + Resources to be started + + Environment VariableOCF_RESKEY_CRM__meta_notify_stop_resource OCF_RESKEY_CRM_meta_notify_stop_resource OCF_RESKEY_CRM_meta_notify_stop_resource - Resources to be stopped - - + Resources to be stopped + + Environment VariableOCF_RESKEY_CRM__meta_notify_promote_resource OCF_RESKEY_CRM_meta_notify_promote_resource OCF_RESKEY_CRM_meta_notify_promote_resource - Resources to be promoted - - + Resources to be promoted + + Environment VariableOCF_RESKEY_CRM__meta_notify_demote_resource OCF_RESKEY_CRM_meta_notify_demote_resource OCF_RESKEY_CRM_meta_notify_demote_resource - Resources to be demoted - - + Resources to be demoted + + Environment VariableOCF_RESKEY_CRM__meta_notify_start_uname OCF_RESKEY_CRM_meta_notify_start_uname OCF_RESKEY_CRM_meta_notify_start_uname - Nodes on which resources will be started - - + Nodes on which resources will be started + + Environment VariableOCF_RESKEY_CRM__meta_notify_stop_uname OCF_RESKEY_CRM_meta_notify_stop_uname OCF_RESKEY_CRM_meta_notify_stop_uname - Nodes on which resources will be stopped - - + Nodes on which resources will be stopped + + Environment VariableOCF_RESKEY_CRM__meta_notify_promote_uname OCF_RESKEY_CRM_meta_notify_promote_uname OCF_RESKEY_CRM_meta_notify_promote_uname - Nodes on which resources will be promoted - - + Nodes on which resources will be promoted + + Environment VariableOCF_RESKEY_CRM__meta_notify_demote_uname OCF_RESKEY_CRM_meta_notify_demote_uname OCF_RESKEY_CRM_meta_notify_demote_uname - Nodes on which resources will be demoted - - + Nodes on which resources will be demoted + + Environment VariableOCF_RESKEY_CRM__meta_notify_active_uname OCF_RESKEY_CRM_meta_notify_active_uname OCF_RESKEY_CRM_meta_notify_active_uname - Nodes on which resources are running - - + Nodes on which resources are running + + Environment VariableOCF_RESKEY_CRM__meta_notify_inactive_uname OCF_RESKEY_CRM_meta_notify_inactive_uname OCF_RESKEY_CRM_meta_notify_inactive_uname - Nodes on which resources are not running - - + Nodes on which resources are not running + + Environment VariableOCF_RESKEY_CRM__meta_notify_master_uname OCF_RESKEY_CRM_meta_notify_master_uname OCF_RESKEY_CRM_meta_notify_master_uname - Nodes on which resources are running in Master mode - - + Nodes on which resources are running in Master mode + + Environment VariableOCF_RESKEY_CRM__meta_notify_slave_uname OCF_RESKEY_CRM_meta_notify_slave_uname OCF_RESKEY_CRM_meta_notify_slave_uname - Nodes on which resources are running in Slave mode + Nodes on which resources are running in Slave mode -
-
-
- Proper Interpretation of Notification Environment Variables - Pre-notification (demote): - - Active resources: $OCF_RESKEY_CRM_meta_notify_active_resource - Master resources: $OCF_RESKEY_CRM_meta_notify_master_resource - Slave resources: $OCF_RESKEY_CRM_meta_notify_slave_resource - Inactive resources: $OCF_RESKEY_CRM_meta_notify_inactive_resource - Resources to be started: $OCF_RESKEY_CRM_meta_notify_start_resource - Resources to be promoted: $OCF_RESKEY_CRM_meta_notify_promote_resource - Resources to be demoted: $OCF_RESKEY_CRM_meta_notify_demote_resource - Resources to be stopped: $OCF_RESKEY_CRM_meta_notify_stop_resource - + +
+
+ Proper Interpretation of Notification Environment Variables + Pre-notification (demote): + + Active resources: $OCF_RESKEY_CRM_meta_notify_active_resource + Master resources: $OCF_RESKEY_CRM_meta_notify_master_resource + Slave resources: $OCF_RESKEY_CRM_meta_notify_slave_resource + Inactive resources: $OCF_RESKEY_CRM_meta_notify_inactive_resource + Resources to be started: $OCF_RESKEY_CRM_meta_notify_start_resource + Resources to be promoted: $OCF_RESKEY_CRM_meta_notify_promote_resource + Resources to be demoted: $OCF_RESKEY_CRM_meta_notify_demote_resource + Resources to be stopped: $OCF_RESKEY_CRM_meta_notify_stop_resource + - Post-notification (demote) / Pre-notification (stop): + Post-notification (demote) / Pre-notification (stop): Active resources: $OCF_RESKEY_CRM_meta_notify_active_resource Master resources: $OCF_RESKEY_CRM_meta_notify_master_resource minus $OCF_RESKEY_CRM_meta_notify_demote_resource - Slave resources: $OCF_RESKEY_CRM_meta_notify_slave_resource - Inactive resources: $OCF_RESKEY_CRM_meta_notify_inactive_resource - Resources to be started: $OCF_RESKEY_CRM_meta_notify_start_resource - Resources to be promoted: $OCF_RESKEY_CRM_meta_notify_promote_resource - Resources to be demoted: $OCF_RESKEY_CRM_meta_notify_demote_resource - Resources to be stopped: $OCF_RESKEY_CRM_meta_notify_stop_resource - Resources that were demoted: $OCF_RESKEY_CRM_meta_notify_demote_resource - - - Post-notification (stop) / Pre-notification (start) - + Slave resources: $OCF_RESKEY_CRM_meta_notify_slave_resource + Inactive resources: $OCF_RESKEY_CRM_meta_notify_inactive_resource + Resources to be started: $OCF_RESKEY_CRM_meta_notify_start_resource + Resources to be promoted: $OCF_RESKEY_CRM_meta_notify_promote_resource + Resources to be demoted: $OCF_RESKEY_CRM_meta_notify_demote_resource + Resources to be stopped: $OCF_RESKEY_CRM_meta_notify_stop_resource + Resources that were demoted: $OCF_RESKEY_CRM_meta_notify_demote_resource + + + Post-notification (stop) / Pre-notification (start) + Active resources: $OCF_RESKEY_CRM_meta_notify_active_resource minus $OCF_RESKEY_CRM_meta_notify_stop_resource - Master resources: + Master resources: $OCF_RESKEY_CRM_meta_notify_master_resource minus $OCF_RESKEY_CRM_meta_notify_demote_resource - Slave resources: + Slave resources: $OCF_RESKEY_CRM_meta_notify_slave_resource minus $OCF_RESKEY_CRM_meta_notify_stop_resource Inactive resources: $OCF_RESKEY_CRM_meta_notify_inactive_resource plus $OCF_RESKEY_CRM_meta_notify_stop_resource - Resources to be started: $OCF_RESKEY_CRM_meta_notify_start_resource - Resources to be promoted: $OCF_RESKEY_CRM_meta_notify_promote_resource - Resources to be demoted: $OCF_RESKEY_CRM_meta_notify_demote_resource - Resources to be stopped: $OCF_RESKEY_CRM_meta_notify_stop_resource - Resources that were demoted: $OCF_RESKEY_CRM_meta_notify_demote_resource - Resources that were stopped: $OCF_RESKEY_CRM_meta_notify_stop_resource + Resources to be started: $OCF_RESKEY_CRM_meta_notify_start_resource + Resources to be promoted: $OCF_RESKEY_CRM_meta_notify_promote_resource + Resources to be demoted: $OCF_RESKEY_CRM_meta_notify_demote_resource + Resources to be stopped: $OCF_RESKEY_CRM_meta_notify_stop_resource + Resources that were demoted: $OCF_RESKEY_CRM_meta_notify_demote_resource + Resources that were stopped: $OCF_RESKEY_CRM_meta_notify_stop_resource - Post-notification (start) / Pre-notification (promote) - - Active resources: + Post-notification (start) / Pre-notification (promote) + + Active resources: $OCF_RESKEY_CRM_meta_notify_active_resource minus $OCF_RESKEY_CRM_meta_notify_stop_resource plus $OCF_RESKEY_CRM_meta_notify_start_resource Master resources: $OCF_RESKEY_CRM_meta_notify_master_resource minus $OCF_RESKEY_CRM_meta_notify_demote_resource Slave resources: $OCF_RESKEY_CRM_meta_notify_slave_resource minus $OCF_RESKEY_CRM_meta_notify_stop_resource plus $OCF_RESKEY_CRM_meta_notify_start_resource Inactive resources: $OCF_RESKEY_CRM_meta_notify_inactive_resource plus $OCF_RESKEY_CRM_meta_notify_stop_resource minus $OCF_RESKEY_CRM_meta_notify_start_resource - Resources to be started: $OCF_RESKEY_CRM_meta_notify_start_resource - Resources to be promoted: $OCF_RESKEY_CRM_meta_notify_promote_resource - Resources to be demoted: $OCF_RESKEY_CRM_meta_notify_demote_resource - Resources to be stopped: $OCF_RESKEY_CRM_meta_notify_stop_resource - Resources that were started: $OCF_RESKEY_CRM_meta_notify_start_resource - Resources that were demoted: $OCF_RESKEY_CRM_meta_notify_demote_resource - Resources that were stopped: $OCF_RESKEY_CRM_meta_notify_stop_resource + Resources to be started: $OCF_RESKEY_CRM_meta_notify_start_resource + Resources to be promoted: $OCF_RESKEY_CRM_meta_notify_promote_resource + Resources to be demoted: $OCF_RESKEY_CRM_meta_notify_demote_resource + Resources to be stopped: $OCF_RESKEY_CRM_meta_notify_stop_resource + Resources that were started: $OCF_RESKEY_CRM_meta_notify_start_resource + Resources that were demoted: $OCF_RESKEY_CRM_meta_notify_demote_resource + Resources that were stopped: $OCF_RESKEY_CRM_meta_notify_stop_resource - - Post-notification (promote) + + Post-notification (promote) Active resources: $OCF_RESKEY_CRM_meta_notify_active_resource minus $OCF_RESKEY_CRM_meta_notify_stop_resource plus $OCF_RESKEY_CRM_meta_notify_start_resource Master resources: $OCF_RESKEY_CRM_meta_notify_master_resource minus $OCF_RESKEY_CRM_meta_notify_demote_resource plus $OCF_RESKEY_CRM_meta_notify_promote_resource Slave resources: $OCF_RESKEY_CRM_meta_notify_slave_resource minus $OCF_RESKEY_CRM_meta_notify_stop_resource plus $OCF_RESKEY_CRM_meta_notify_start_resource minus $OCF_RESKEY_CRM_meta_notify_promote_resource Inactive resources: $OCF_RESKEY_CRM_meta_notify_inactive_resource plus $OCF_RESKEY_CRM_meta_notify_stop_resource minus $OCF_RESKEY_CRM_meta_notify_start_resource Resources to be started: $OCF_RESKEY_CRM_meta_notify_start_resource Resources to be promoted: $OCF_RESKEY_CRM_meta_notify_promote_resource Resources to be demoted: $OCF_RESKEY_CRM_meta_notify_demote_resource Resources to be stopped: $OCF_RESKEY_CRM_meta_notify_stop_resource Resources that were started: $OCF_RESKEY_CRM_meta_notify_start_resource Resources that were promoted: $OCF_RESKEY_CRM_meta_notify_promote_resource Resources that were demoted: $OCF_RESKEY_CRM_meta_notify_demote_resource Resources that were stopped: $OCF_RESKEY_CRM_meta_notify_stop_resource -
+
diff --git a/doc/Pacemaker_Explained/en-US/Ch-Constraints.xml b/doc/Pacemaker_Explained/en-US/Ch-Constraints.xml index 0babe3113b..49c51e501f 100644 --- a/doc/Pacemaker_Explained/en-US/Ch-Constraints.xml +++ b/doc/Pacemaker_Explained/en-US/Ch-Constraints.xml @@ -1,508 +1,510 @@ Resource Constraints
Scores ResourceConstraints Constraintsfor Resources - Scores of all kinds are integral to how the cluster works. - Practically everything from moving a resource to deciding which resource to stop in a degraded cluster is achieved by manipulating scores in some way. + Scores of all kinds are integral to how the cluster works. + Practically everything from moving a resource to deciding which resource to stop in a degraded cluster is achieved by manipulating scores in some way. - Scores are calculated on a per-resource basis and any node with a negative score for a resource can't run that resource. - After calculating the scores for a resource, the cluster then chooses the node with the highest one. + Scores are calculated on a per-resource basis and any node with a negative score for a resource can't run that resource. + After calculating the scores for a resource, the cluster then chooses the node with the highest one.
- Infinity Math - INFINITY is currently defined as 1,000,000 and addition/subtraction with it follows these three basic rules: - - Any value + INFINITY = INFINITY - Any value - INFINITY = -INFINITY - INFINITY - INFINITY = -INFINITY - + Infinity Math + INFINITY is currently defined as 1,000,000 and addition/subtraction with it follows these three basic rules: + + Any value + INFINITY = INFINITY + Any value - INFINITY = -INFINITY + INFINITY - INFINITY = -INFINITY +
Deciding Which Nodes a Resource Can Run On - There are two alternative strategies for specifying which nodes a resources can run on. - One way is to say that by default they can run anywhere and then create location constraints for nodes that are not allowed. - The other option is to have nodes "opt-in"... - to start with nothing able to run anywhere and selectively enable allowed nodes. + There are two alternative strategies for specifying which nodes a resources can run on. + One way is to say that by default they can run anywhere and then create location constraints for nodes that are not allowed. + The other option is to have nodes "opt-in"... + to start with nothing able to run anywhere and selectively enable allowed nodes.
- Options - - Options for Simple Location Constraints - - - + Options +
+ Options for Simple Location Constraints + + + - Field - Description + Field + Description - - idConstraint Field - Constraint Fieldid - entry>id - A unique name for the constraint + + + + idConstraint Field + Constraint Fieldid + id + A unique name for the constraint rsc Constraint Field Constraint Fieldrsc rsc - A resource name + A resource name NodeConstraint Field Constraint Fieldnode node - A node's uname + A node's uname scoreConstraint Field Constraint Fieldscore score - Positive values indicate the resource should run on this node. Negative values indicate the resource should not run on this node. Values of +/- INFINITY change "should"/"should not" to "must"/"must not". + Positive values indicate the resource should run on this node. Negative values indicate the resource should not run on this node. Values of +/- INFINITY change "should"/"should not" to "must"/"must not". - - -
+ + +
<indexterm significance="preferred"><primary>Asymmetrical Opt-In Clusters</primary></indexterm> <indexterm significance="preferred"><primary>Cluster Type</primary><secondary>Asymmetrical Opt-In</secondary></indexterm> Asymmetrical "Opt-In" Clusters - To create an opt-in cluster, start by preventing resources from running anywhere by default: - crm_attribute --attr-name symmetric-cluster --attr-value false - - Then start enabling nodes. - The following fragment says that the web server prefers sles-1, the database prefers sles-2 and both can fail over to sles-3 if their most preferred node fails. - - - Example set of opt-in location constraints - + To create an opt-in cluster, start by preventing resources from running anywhere by default: + crm_attribute --attr-name symmetric-cluster --attr-value false + + Then start enabling nodes. + The following fragment says that the web server prefers sles-1, the database prefers sles-2 and both can fail over to sles-3 if their most preferred node fails. + + + Example set of opt-in location constraints + ]]> - +
<indexterm significance="preferred"><primary>Symmetrical Opt-Out Clusters</primary></indexterm> <indexterm significance="preferred"><primary>Cluster Type</primary><secondary>Symmetrical Opt-Out</secondary></indexterm> Symmetrical "Opt-Out" Clusters - To create an opt-out cluster, start by allowing resources to run anywhere by default - crm_attribute --attr-name symmetric-cluster --attr-value true - - Then start disabling nodes. - The following fragment is the equivalent of the above opt-in configuration. - - - Example set of opt-out location constraints - + To create an opt-out cluster, start by allowing resources to run anywhere by default + crm_attribute --attr-name symmetric-cluster --attr-value true + + Then start disabling nodes. + The following fragment is the equivalent of the above opt-in configuration. + + + Example set of opt-out location constraints + ]]> - - - Whether you should choose opt-in or opt-out depends both on your personal preference and the make-up of your cluster. - If most of your resources can run on most of the nodes, then an opt-out arrangement is likely to result in a simpler configuration. - On the other-hand, if most resources can only run on a small subset of nodes an opt-in configuration might be simpler. - + + + Whether you should choose opt-in or opt-out depends both on your personal preference and the make-up of your cluster. + If most of your resources can run on most of the nodes, then an opt-out arrangement is likely to result in a simpler configuration. + On the other-hand, if most resources can only run on a small subset of nodes an opt-in configuration might be simpler. +
- What if Two Nodes Have the Same Score - - If two nodes have the same score, then the cluster will choose one. - This choice may seem random and may not be what was intended, however the cluster was not given enough information to know any better. - - - Example of two resources that prefer two nodes equally - + What if Two Nodes Have the Same Score + + If two nodes have the same score, then the cluster will choose one. + This choice may seem random and may not be what was intended, however the cluster was not given enough information to know any better. + + + Example of two resources that prefer two nodes equally + ]]> - - - In the example above, assuming no other constraints and an inactive cluster, Webserver would probably be placed on sles-1 and Database on sles-2. - It would likely have placed Webserver based on the node's uname and Database based on the desire to spread the resource load evenly across the cluster. - However other factors can also be involved in more complex configurations. - + + + In the example above, assuming no other constraints and an inactive cluster, Webserver would probably be placed on sles-1 and Database on sles-2. + It would likely have placed Webserver based on the node's uname and Database based on the desire to spread the resource load evenly across the cluster. + However other factors can also be involved in more complex configurations. +
Specifying in which Order Resources Should Start/Stop The way to specify the order in which resources should start is by creating rsc_order constraints. - Properties of an Ordering Constraint - - - + Properties of an Ordering Constraint + + + - Field - Description + Field + Description - - - id - A unique name for the constraint + + + id + A unique name for the constraint - first - The name of a resource that must be started before the then resource is allowed to. + first + The name of a resource that must be started before the then resource is allowed to. - then - The name of a resource. This resource will start after the first resource. + then + The name of a resource. This resource will start after the first resource. - score - If greater than zero, the constraint is mandatory. Otherwise it is only a suggestion. Default value: INFINITY - + score + If greater than zero, the constraint is mandatory. Otherwise it is only a suggestion. Default value: INFINITY + - symmetrical - If true, which is the default, stop the resources in the reverse order. Default value: true + symmetrical + If true, which is the default, stop the resources in the reverse order. Default value: true - - + +
- Mandatory Ordering - - When the then resource cannot run without the first resource being active, one should use mandatory constraints. - To specify a constraint is mandatory, use scores greater than zero. - This will ensure that the then resource will react when the first resource changes state. - - - If the first resource was running and is stopped, the then resource will also be stopped (if it is running). - If the first resource was not running and cannot be started, the then resource will be stopped (if it is running). - If the first resource is (re)started while the then resource is running, the then resource will be stopped and restarted. - + Mandatory Ordering + + When the then resource cannot run without the first resource being active, one should use mandatory constraints. + To specify a constraint is mandatory, use scores greater than zero. + This will ensure that the then resource will react when the first resource changes state. + + + If the first resource was running and is stopped, the then resource will also be stopped (if it is running). + If the first resource was not running and cannot be started, the then resource will be stopped (if it is running). + If the first resource is (re)started while the then resource is running, the then resource will be stopped and restarted. +
- Advisory Ordering - - On the other hand, when score="0" is specified for a constraint, the constraint is considered optional and only has an effect when both resources are stopping and/or starting. - Any change in state by the first resource will have no effect on the then resource. - - - Example of an optional and mandatory ordering constraint - + Advisory Ordering + + On the other hand, when score="0" is specified for a constraint, the constraint is considered optional and only has an effect when both resources are stopping and/or starting. + Any change in state by the first resource will have no effect on the then resource. + + + Example of an optional and mandatory ordering constraint + ]]> - - Some additional information on ordering constraints can be found in the document Ordering Explained. - + + Some additional information on ordering constraints can be found in the document Ordering Explained. +
Placing Resources Relative to other Resources When the location of one resource depends on the location of another one, we call this colocation. - There is an important side-effect of creating a colocation constraint between two resources: it affects the order in which resources are assigned to a node. - If you think about it, it's somewhat obvious. - You can't place A relative to B unless you know where B is + There is an important side-effect of creating a colocation constraint between two resources: it affects the order in which resources are assigned to a node. + If you think about it, it's somewhat obvious. + You can't place A relative to B unless you know where B is While the human brain is sophisticated enough to read the constraint in any order and choose the correct one depending on the situation, the cluster is not quite so smart. Yet. - . - So when you are creating colocation constraints, it is important to consider whether you should colocate A with B or B with A. + . + So when you are creating colocation constraints, it is important to consider whether you should colocate A with B or B with A. - Another thing to keep in mind is that, assuming A is collocated with B, the cluster will also take into account A's preferences when deciding which node to choose for B. - For a detailed look at exactly how this occurs, see the Colocation Explained document. + Another thing to keep in mind is that, assuming A is collocated with B, the cluster will also take into account A's preferences when deciding which node to choose for B. + For a detailed look at exactly how this occurs, see the Colocation Explained document.
- Options - - Properties of a Collocation Constraint - - - + Options +
+ Properties of a Collocation Constraint + + + - Field - Description + Field + Description - - - id - A unique name for the constraint. + + + id + A unique name for the constraint. - rsc - The colocation source. If the constraint cannot be satisfied, the cluster may decide not to allow the resource to run at all. + rsc + The colocation source. If the constraint cannot be satisfied, the cluster may decide not to allow the resource to run at all. - with-rsc - The colocation target. The cluster will decide where to put this resource first and then decide where to put the resource in the rsc field. + with-rsc + The colocation target. The cluster will decide where to put this resource first and then decide where to put the resource in the rsc field. - score - Positive values indicate the resource should run on the same node. Negative values indicate the resources should not run on the same node. Values of +/- INFINITY change "should" to "must". + score + Positive values indicate the resource should run on the same node. Negative values indicate the resources should not run on the same node. Values of +/- INFINITY change "should" to "must". - - -
+ + +
- Mandatory Placement - - Mandatory placement occurs any time the constraint's score is +INFINITY or -INFINITY. - In such cases, if the constraint can't be satisfied, then the rsc resource is not permitted to run. - For score=INFINITY, this includes cases where the with-rsc resource is not active. - - If you need resource1 to always run on the same machine as resource2, you would add the following constraint: - - An example colocation constraint - <rsc_colocation id="colocate" rsc="resource1" with-rsc="resource2" score="INFINITY"/> - - - Remember, because INFINITY was used, if resource2 can't run on any of the cluster nodes (for whatever reason) then resource1 will not be allowed to run. - - Alternatively, you may want the opposite... - that resource1 cannot run on the same machine as resource2. - In this case use score="-INFINITY" - - - An example anti-colocation constraint + Mandatory Placement + + Mandatory placement occurs any time the constraint's score is +INFINITY or -INFINITY. + In such cases, if the constraint can't be satisfied, then the rsc resource is not permitted to run. + For score=INFINITY, this includes cases where the with-rsc resource is not active. + + If you need resource1 to always run on the same machine as resource2, you would add the following constraint: + + An example colocation constraint + <rsc_colocation id="colocate" rsc="resource1" with-rsc="resource2" score="INFINITY"/> + + + Remember, because INFINITY was used, if resource2 can't run on any of the cluster nodes (for whatever reason) then resource1 will not be allowed to run. + + Alternatively, you may want the opposite... + that resource1 cannot run on the same machine as resource2. + In this case use score="-INFINITY" + + + An example anti-colocation constraint <rsc_colocation id="anti-colocate" - rsc="resource1" with-rsc="resource2" score="-INFINITY"/> - - - - Again, by specifying -INFINTY, the constraint is binding. - So if the only place left to run is where resource2 already is, then resource1 may not run anywhere. - + rsc="resource1" with-rsc="resource2" score="-INFINITY"/> + + + + Again, by specifying -INFINTY, the constraint is binding. + So if the only place left to run is where resource2 already is, then resource1 may not run anywhere. +
- Advisory Placement - - If mandatory placement is about "must" and "must not", then advisory placement is the "I'd prefer if" alternative. - For constraints with scores greater than -INFINITY and less than INFINITY, the cluster will try and accommodate your wishes but may ignore them if the alternative is to stop some of the cluster resources. - - Like in life, where if enough people prefer something it effectively becomes mandatory, advisory colocation constraints can combine with other elements of the configuration to behave as if they were mandatory. - - An example advisory-only colocation constraint - <rsc_colocation id="colocate-maybe" rsc="resource1" with-rsc="resource2" score="500"/> - - + Advisory Placement + + If mandatory placement is about "must" and "must not", then advisory placement is the "I'd prefer if" alternative. + For constraints with scores greater than -INFINITY and less than INFINITY, the cluster will try and accommodate your wishes but may ignore them if the alternative is to stop some of the cluster resources. + + Like in life, where if enough people prefer something it effectively becomes mandatory, advisory colocation constraints can combine with other elements of the configuration to behave as if they were mandatory. + + An example advisory-only colocation constraint + <rsc_colocation id="colocate-maybe" rsc="resource1" with-rsc="resource2" score="500"/> + +
Ordering Sets of Resources A common situation is for an administrator to create a chain of ordered resources, such as: - A chain of ordered resources - + A chain of ordered resources + ]]> -
- Ordered Set - - - - - Visual representation of the four resources' start order for the above constraints - -
+
+ Ordered Set + + + + + Visual representation of the four resources' start order for the above constraints + +
To simplify this situation, there is an alternate format for ordering constraints: - A chain of ordered resources expressed as a set - + A chain of ordered resources expressed as a set + ]]> Resource sets have the same ordering semantics as groups. - A group resource with the equivalent ordering rules - + A group resource with the equivalent ordering rules + ]]> - While the set-based format is not less verbose, it is significantly easier to get right and maintain. - It can also be expanded to allow ordered sets of (un)ordered resources. - In the example below, rscA and rscB can both start in parallel, as can rscC and rscD, however rscC and rscD can only start once both rscA and rscB are active. + While the set-based format is not less verbose, it is significantly easier to get right and maintain. + It can also be expanded to allow ordered sets of (un)ordered resources. + In the example below, rscA and rscB can both start in parallel, as can rscC and rscD, however rscC and rscD can only start once both rscA and rscB are active. - Ordered sets of unordered resources - + Ordered sets of unordered resources + ]]> -
- Two Sets of Unordered Resources - - - - - Visual representation of the start order for two ordered sets of unordered resources - -
+
+ Two Sets of Unordered Resources + + + + + Visual representation of the start order for two ordered sets of unordered resources + +
Of course either set -- or both sets -- of resources can also be internally ordered (by setting sequential="true") and there is no limit to the number of sets that can be specified. - Advanced use of set ordering - Three ordered sets, two of which are internally unordered - + Advanced use of set ordering - Three ordered sets, two of which are internally unordered + ]]> -
- Three Resources Sets - - - - - Visual representation of the start order for the three sets defined above - -
+
+ Three Resources Sets + + + + + Visual representation of the start order for the three sets defined above + +
Collocating Sets of Resources - Another common situation is for an administrator to create a set of collocated resources. - Previously this was possible either by defining a resource group (See ) which could not always accurately express the design; or by defining each relationship as an individual constraint, causing a constraint explosion as the number of resources and combinations grew. + Another common situation is for an administrator to create a set of collocated resources. + Previously this was possible either by defining a resource group (See ) which could not always accurately express the design; or by defining each relationship as an individual constraint, causing a constraint explosion as the number of resources and combinations grew. - A chain of collocated resources - + A chain of collocated resources + ]]> - To make things easier, we allow an alternate form of colocation constraints using resource_sets. - Just like the expanded version, a resource that can't be active also prevents any resource that must be collocated with it from being active. - For example, if B was not able to run, then both C (and by inference D) must also remain stopped. + To make things easier, we allow an alternate form of colocation constraints using resource_sets. + Just like the expanded version, a resource that can't be active also prevents any resource that must be collocated with it from being active. + For example, if B was not able to run, then both C (and by inference D) must also remain stopped. - The equivalent colocation chain expressed using <literal>resource_sets</literal> - + The equivalent colocation chain expressed using <literal>resource_sets</literal> + ]]> Resource sets have the same colocation semantics as groups. - A group resource with the equivalent colocation rules - + A group resource with the equivalent colocation rules + ]]> - This notation can also be used in this context to tell the cluster that a set of resources must all be located with a common peer, but have no dependencies on each other. - In this scenario, unlike the previous, B would be allowed to remain active even if A or C (or both) were inactive. + This notation can also be used in this context to tell the cluster that a set of resources must all be located with a common peer, but have no dependencies on each other. + In this scenario, unlike the previous, B would be allowed to remain active even if A or C (or both) were inactive. - Using colocation sets to specify a common peer. - + Using colocation sets to specify a common peer. + ]]> - Of course there is no limit to the number and size of the sets used. - The only thing that matters is that in order for any member of set N to be active, all the members of set N+1 must also be active (and naturally on the same node); and if a set has sequential="true", then in order for member M to be active, member M+1 must also be active. - You can even specify the role in which the members of a set must be in using the set's role attribute. + Of course there is no limit to the number and size of the sets used. + The only thing that matters is that in order for any member of set N to be active, all the members of set N+1 must also be active (and naturally on the same node); and if a set has sequential="true", then in order for member M to be active, member M+1 must also be active. + You can even specify the role in which the members of a set must be in using the set's role attribute. - A colocation chain where the members of the middle set have no inter-dependencies and the last has master status. - + A colocation chain where the members of the middle set have no inter-dependencies and the last has master status. + ]]> -
- Another Three Resources Sets - - - - - Visual representation of a colocation chain where the members of the middle set have no inter-dependencies - -
+
+ Another Three Resources Sets + + + + + Visual representation of a colocation chain where the members of the middle set have no inter-dependencies + +
diff --git a/doc/Pacemaker_Explained/en-US/Ch-Intro.xml b/doc/Pacemaker_Explained/en-US/Ch-Intro.xml index c5c0201d55..992a771e80 100644 --- a/doc/Pacemaker_Explained/en-US/Ch-Intro.xml +++ b/doc/Pacemaker_Explained/en-US/Ch-Intro.xml @@ -1,172 +1,172 @@ Read-Me-First
The Scope of this Document - The purpose of this document is to definitively explain the concepts used to configure Pacemaker. - To achieve this, it will focus exclusively on the XML syntax used to configure the CIB. + The purpose of this document is to definitively explain the concepts used to configure Pacemaker. + To achieve this, it will focus exclusively on the XML syntax used to configure the CIB. - For those that are allergic to XML, Pacemaker comes with a cluster shell; a Python based GUI exists, too, however these tools will not be covered at all in this document - I hope, however, that the concepts explained here make the functionality of these tools more easily understood. - , precisely because they hide the XML. + For those that are allergic to XML, Pacemaker comes with a cluster shell; a Python based GUI exists, too, however these tools will not be covered at all in this document + I hope, however, that the concepts explained here make the functionality of these tools more easily understood. + , precisely because they hide the XML. - Additionally, this document is NOT a step-by-step how-to guide for configuring a specific clustering scenario. - Although such guides exist, the purpose of this document is to provide an understanding of the building blocks that can be used to construct any type of Pacemaker cluster. + Additionally, this document is NOT a step-by-step how-to guide for configuring a specific clustering scenario. + Although such guides exist, the purpose of this document is to provide an understanding of the building blocks that can be used to construct any type of Pacemaker cluster.
What Is Pacemaker? - Pacemaker is a cluster resource manager. - It achieves maximum availability for your cluster services (aka. resources) by detecting and recovering from node and resource-level failures by making use of the messaging and membership capabilities provided by your preferred cluster infrastructure (either Corosync or Heartbeat). + Pacemaker is a cluster resource manager. + It achieves maximum availability for your cluster services (aka. resources) by detecting and recovering from node and resource-level failures by making use of the messaging and membership capabilities provided by your preferred cluster infrastructure (either Corosync or Heartbeat). Pacemaker's key features include: - Detection and recovery of node and service-level failures - Storage agnostic, no requirement for shared storage - Resource agnostic, anything that can be scripted can be clustered - Supports STONITH for ensuring data integrity - Supports large and small clusters - Supports both quorate and resource driven clusters TODO: quorum-driven? - Supports practically any redundancy configuration - Automatically replicated configuration that can be updated from any node - Ability to specify cluster-wide service ordering, colocation and anti-colocation - Support for advanced services type - - Clones: for services which need to be active on multiple nodes - Multi-state: for services with multiple modes (eg. master/slave, primary/secondary) - - - Unified, scriptable, cluster shell + Detection and recovery of node and service-level failures + Storage agnostic, no requirement for shared storage + Resource agnostic, anything that can be scripted can be clustered + Supports STONITH for ensuring data integrity + Supports large and small clusters + Supports both quorate and resource driven clusters TODO: quorum-driven? + Supports practically any redundancy configuration + Automatically replicated configuration that can be updated from any node + Ability to specify cluster-wide service ordering, colocation and anti-colocation + Support for advanced services type + + Clones: for services which need to be active on multiple nodes + Multi-state: for services with multiple modes (eg. master/slave, primary/secondary) + + + Unified, scriptable, cluster shell
Types of Pacemaker Clusters Pacemaker makes no assumptions about your environment, this allows it to support practically any redundancy configuration including Active/Active, Active/Passive, N+1, N+M, N-to-1 and N-to-N. -
- Active/Passive Redundancy - - - - - Two-node Active/Passive clusters using Pacemaker and DRBD are a cost-effective solution for many High Availability situations. - -
+
+ Active/Passive Redundancy + + + + + Two-node Active/Passive clusters using Pacemaker and DRBD are a cost-effective solution for many High Availability situations. + +
-
- Shared Failover - - - - - By supporting many nodes, Pacemaker can dramatically reduce hardware costs by allowing several active/passive clusters to be combined and share a common backup node - -
+
+ Shared Failover + + + + + By supporting many nodes, Pacemaker can dramatically reduce hardware costs by allowing several active/passive clusters to be combined and share a common backup node + +
-
- N to N Redundancy - - - - - - When shared storage is available, every node can potentially be used for failover. - Pacemaker can even run multiple copies of services to spread out the workload. - - -
+
+ N to N Redundancy + + + + + + When shared storage is available, every node can potentially be used for failover. + Pacemaker can even run multiple copies of services to spread out the workload. + + +
Pacemaker Architecture At the highest level, the cluster is made up of three pieces: - + Core cluster infrastructure providing messaging and membership functionality (illustrated in red) - - + + Non-cluster aware components (illustrated in green). - In a Pacemaker cluster, these pieces include not only the scripts that knows how to start, stop and monitor resources, but also a local daemon that masks the differences between the different standards these scripts implement. - - + In a Pacemaker cluster, these pieces include not only the scripts that knows how to start, stop and monitor resources, but also a local daemon that masks the differences between the different standards these scripts implement. + + A brain (illustrated in blue) that processes and reacts to events from the cluster (nodes leaving or joining) and resources (eg. monitor failures) as well as configuration changes from the administrator. - In response to all of these events, Pacemaker will compute the ideal state of the cluster and plot a path to achieve it. - This may include moving resources, stopping nodes and even forcing nodes offline with remote power switches. - + In response to all of these events, Pacemaker will compute the ideal state of the cluster and plot a path to achieve it. + This may include moving resources, stopping nodes and even forcing nodes offline with remote power switches. + -
- Conceptual Stack Overview - - - - - Conceptual overview of the cluster stack - -
+
+ Conceptual Stack Overview + + + + + Conceptual overview of the cluster stack + +
When combined with Corosync, Pacemaker also supports popular open source cluster filesystems - Even though Pacemaker also supports Heartbeat, the filesystems need to use the stack for messaging and membership and Corosync seems to be what they're standardizing on. - Technically it would be possible for them to support Heartbeat as well, however there seems little interest in this. - - . - Due to recent standardization within the cluster filesystem community, they make use of a common distributed lock manager which makes use of Corosync for its messaging capabilities and Pacemaker for its membership (which nodes are up/down) and fencing services. + Even though Pacemaker also supports Heartbeat, the filesystems need to use the stack for messaging and membership and Corosync seems to be what they're standardizing on. + Technically it would be possible for them to support Heartbeat as well, however there seems little interest in this. + + . + Due to recent standardization within the cluster filesystem community, they make use of a common distributed lock manager which makes use of Corosync for its messaging capabilities and Pacemaker for its membership (which nodes are up/down) and fencing services. -
- The Pacemaker Stack - - - - - The Pacemaker stack when running on Corosync - -
+
+ The Pacemaker Stack + + + + + The Pacemaker stack when running on Corosync + +
- Internal Components - Pacemaker itself is composed of four key components (illustrated below in the same color scheme as the previous diagram): - - CIB (aka. Cluster Information Base) - CRMd (aka. Cluster Resource Management daemon) - PEngine (aka. PE or Policy Engine) - STONITHd - - -
- Internal Components - - - - - Subsystems of a Pacemaker cluster - -
-
- - The CIB uses XML to represent both the cluster's configuration and current state of all resources in the cluster. - The contents of the CIB are automatically kept in sync across the entire cluster and are used by the PEngine to compute the ideal state of the cluster and how it should be achieved. - - - This list of instructions is then fed to the DC (Designated Controller). - Pacemaker centralizes all cluster decision making by electing one of the CRMd instances to act as a master. - Should the elected CRMd process (or the node it is on) fail... - a new one is quickly established. - - The DC carries out PEngine's instructions in the required order by passing them to either the LRMd (Local Resource Management daemon) or CRMd peers on other nodes via the cluster messaging infrastructure (which in turn passes them on to their LRMd process). - The peer nodes all report the results of their operations back to the DC and, based on the expected and actual results, will either execute any actions that needed to wait for the previous one to complete, or abort processing and ask the PEngine to recalculate the ideal cluster state based on the unexpected results. - - In some cases, it may be necessary to power off nodes in order to protect shared data or complete resource recovery. - For this Pacemaker comes with STONITHd. - STONITH is an acronym for Shoot-The-Other-Node-In-The-Head and is usually implemented with a remote power switch. - In Pacemaker, STONITH devices are modeled as resources (and configured in the CIB) to enable them to be easily monitored for failure, however STONITHd takes care of understanding the STONITH topology such that its clients simply request a node be fenced and it does the rest. - + Internal Components + Pacemaker itself is composed of four key components (illustrated below in the same color scheme as the previous diagram): + + CIB (aka. Cluster Information Base) + CRMd (aka. Cluster Resource Management daemon) + PEngine (aka. PE or Policy Engine) + STONITHd + + +
+ Internal Components + + + + + Subsystems of a Pacemaker cluster + +
+
+ + The CIB uses XML to represent both the cluster's configuration and current state of all resources in the cluster. + The contents of the CIB are automatically kept in sync across the entire cluster and are used by the PEngine to compute the ideal state of the cluster and how it should be achieved. + + + This list of instructions is then fed to the DC (Designated Controller). + Pacemaker centralizes all cluster decision making by electing one of the CRMd instances to act as a master. + Should the elected CRMd process (or the node it is on) fail... + a new one is quickly established. + + The DC carries out PEngine's instructions in the required order by passing them to either the LRMd (Local Resource Management daemon) or CRMd peers on other nodes via the cluster messaging infrastructure (which in turn passes them on to their LRMd process). + The peer nodes all report the results of their operations back to the DC and, based on the expected and actual results, will either execute any actions that needed to wait for the previous one to complete, or abort processing and ask the PEngine to recalculate the ideal cluster state based on the unexpected results. + + In some cases, it may be necessary to power off nodes in order to protect shared data or complete resource recovery. + For this Pacemaker comes with STONITHd. + STONITH is an acronym for Shoot-The-Other-Node-In-The-Head and is usually implemented with a remote power switch. + In Pacemaker, STONITH devices are modeled as resources (and configured in the CIB) to enable them to be easily monitored for failure, however STONITHd takes care of understanding the STONITH topology such that its clients simply request a node be fenced and it does the rest. +
diff --git a/doc/Pacemaker_Explained/en-US/Ch-Nodes.xml b/doc/Pacemaker_Explained/en-US/Ch-Nodes.xml index e4617e0511..80b8bff2c0 100644 --- a/doc/Pacemaker_Explained/en-US/Ch-Nodes.xml +++ b/doc/Pacemaker_Explained/en-US/Ch-Nodes.xml @@ -1,128 +1,128 @@ Cluster Nodes
Defining a Cluster Node Each node in the cluster will have an entry in the nodes section containing its UUID, uname, and type. - Example cluster node entry - ]]> - + Example cluster node entry + ]]> + - In normal circumstances, the admin should let the cluster populate this information automatically from the communications and membership data. - However one can use the crm_uuid tool to read an existing UUID or define a value before the cluster starts. + In normal circumstances, the admin should let the cluster populate this information automatically from the communications and membership data. + However one can use the crm_uuid tool to read an existing UUID or define a value before the cluster starts.
Describing a Cluster Node - Beyond the basic definition of a node the administrator can also describe the node's attributes, such as how much RAM, disk, what OS or kernel version it has, perhaps even its physical location. - This information can then be used by the cluster when deciding where to place resources. - For more information on the use of node attributes, see the section on . + Beyond the basic definition of a node the administrator can also describe the node's attributes, such as how much RAM, disk, what OS or kernel version it has, perhaps even its physical location. + This information can then be used by the cluster when deciding where to place resources. + For more information on the use of node attributes, see the section on . Node attributes can be specified ahead of time or populated later, when the cluster is running, using crm_attribute. Below is what the node's definition would look like if the admin ran the command:
- The result of using crm_attribute to specify which kernel pcmk-1 is running - crm_attribute --type nodes --node-uname pcmk-1 --attr-name kernel --attr-value `uname -r` + The result of using crm_attribute to specify which kernel pcmk-1 is running + crm_attribute --type nodes --node-uname pcmk-1 --attr-name kernel --attr-value `uname -r` ]]>
A simpler way to determine the current value of an attribute is to use crm_attribute command again: crm_attribute --type nodes --node-uname pcmk-1 --attr-name kernel --get-value - By specifying --type nodes the admin tells the cluster that this attribute is persistent. - There are also transient attributes which are kept in the status section which are "forgotten" whenever the node rejoins the cluster. - The cluster uses this area to store a record of how many times a resource has failed on that node but administrators can also read and write to this section by specifying --type status. + By specifying --type nodes the admin tells the cluster that this attribute is persistent. + There are also transient attributes which are kept in the status section which are "forgotten" whenever the node rejoins the cluster. + The cluster uses this area to store a record of how many times a resource has failed on that node but administrators can also read and write to this section by specifying --type status.
Adding a New Cluster Node
- Corosync - Adding a new node is as simple as installing Corosync and Pacemaker, and copying /etc/corosync/corosync.conf and /etc/ais/authkey (if it exists) from an existing node. + Corosync + Adding a new node is as simple as installing Corosync and Pacemaker, and copying /etc/corosync/corosync.conf and /etc/ais/authkey (if it exists) from an existing node. You may need to modify the mcastaddr option to match the new node's IP address. - If a log message containing "Invalid digest" appears from Corosync, the keys are not consistent between the machines. + If a log message containing "Invalid digest" appears from Corosync, the keys are not consistent between the machines.
- Heartbeat - Provided you specified autojoin any in ha.cf, adding a new node is as simple as installing heartbeat and copying ha.cf and authkeys from an existing node. - If you don't want to use autojoin, then after setting up ha.cf and authkeys, you must use the hb_addnode command before starting the new node. + Heartbeat + Provided you specified autojoin any in ha.cf, adding a new node is as simple as installing heartbeat and copying ha.cf and authkeys from an existing node. + If you don't want to use autojoin, then after setting up ha.cf and authkeys, you must use the hb_addnode command before starting the new node.
Removing a Cluster Node
- Corosync - - Because the messaging and membership layers are the authoritative source for cluster nodes, deleting them from the CIB is not a reliable solution. - First one must arrange for heartbeat to forget about the node (pcmk-1 in the example below). - - On the host to be removed: - - - Find and record the node's Corosync id: crm_node -i - - - Stop the cluster: /etc/init.d/corosync stop - - - Next, from one of the remaining active cluster nodes: - - - Tell the cluster to forget about the removed host: crm_node -R COROSYNC_ID - - - Only now is it safe to delete the node from the CIB with: - cibadmin --delete --obj_type nodes --crm_xml '<node uname="pcmk-1"/>' - cibadmin --delete --obj_type status --crm_xml '<node_state uname="pcmk-1"/>' - - + Corosync + + Because the messaging and membership layers are the authoritative source for cluster nodes, deleting them from the CIB is not a reliable solution. + First one must arrange for heartbeat to forget about the node (pcmk-1 in the example below). + + On the host to be removed: + + + Find and record the node's Corosync id: crm_node -i + + + Stop the cluster: /etc/init.d/corosync stop + + + Next, from one of the remaining active cluster nodes: + + + Tell the cluster to forget about the removed host: crm_node -R COROSYNC_ID + + + Only now is it safe to delete the node from the CIB with: + cibadmin --delete --obj_type nodes --crm_xml '<node uname="pcmk-1"/>' + cibadmin --delete --obj_type status --crm_xml '<node_state uname="pcmk-1"/>' + +
- Heartbeat - - Because the messaging and membership layers are the authoritative source for cluster nodes, deleting them from the CIB is not a reliable solution. - First one must arrange for heartbeat to forget about the node (pcmk-1 in the example below). - To do this, shut down heartbeat on the node and then, from one of the remaining active cluster nodes, run: - - hb_delnode pcmk-1 - Only then is it safe to delete the node from the CIB with: - cibadmin --delete --obj_type nodes --crm_xml '<node uname="pcmk-1"/>' - cibadmin --delete --obj_type status --crm_xml '<node_state uname="pcmk-1"/>' + Heartbeat + + Because the messaging and membership layers are the authoritative source for cluster nodes, deleting them from the CIB is not a reliable solution. + First one must arrange for heartbeat to forget about the node (pcmk-1 in the example below). + To do this, shut down heartbeat on the node and then, from one of the remaining active cluster nodes, run: + + hb_delnode pcmk-1 + Only then is it safe to delete the node from the CIB with: + cibadmin --delete --obj_type nodes --crm_xml '<node uname="pcmk-1"/>' + cibadmin --delete --obj_type status --crm_xml '<node_state uname="pcmk-1"/>'
Replacing a Cluster Node
- Corosync - The five-step guide to replacing an existing cluster node: - - Make sure the old node is completely stopped - Give the new machine the same hostname and IP address as the old one - Install the cluster software :-) - Copy /etc/corosync/corosync.conf and /etc/ais/authkey (if it exists) to the new node - Start the new cluster node - - If a log message containing "Invalid digest" appears from Corosync, the keys are not consistent between the machines. + Corosync + The five-step guide to replacing an existing cluster node: + + Make sure the old node is completely stopped + Give the new machine the same hostname and IP address as the old one + Install the cluster software :-) + Copy /etc/corosync/corosync.conf and /etc/ais/authkey (if it exists) to the new node + Start the new cluster node + + If a log message containing "Invalid digest" appears from Corosync, the keys are not consistent between the machines.
- Heartbeat - The seven-step guide to replacing an existing cluster node: - - Make sure the old node is completely stopped - Give the new machine the same hostname as the old one - Go to an active cluster node and look up the UUID for the old node in /var/lib/heartbeat/hostcache - Install the cluster software - Copy ha.cf and authkeys to the new node - On the new node, populate it's UUID using crm_uuid -w and the UUID from step 2 - Start the new cluster node - + Heartbeat + The seven-step guide to replacing an existing cluster node: + + Make sure the old node is completely stopped + Give the new machine the same hostname as the old one + Go to an active cluster node and look up the UUID for the old node in /var/lib/heartbeat/hostcache + Install the cluster software + Copy ha.cf and authkeys to the new node + On the new node, populate it's UUID using crm_uuid -w and the UUID from step 2 + Start the new cluster node +
diff --git a/doc/Pacemaker_Explained/en-US/Ch-Options.txt b/doc/Pacemaker_Explained/en-US/Ch-Options.txt index a6cb66f752..e314980a05 100644 --- a/doc/Pacemaker_Explained/en-US/Ch-Options.txt +++ b/doc/Pacemaker_Explained/en-US/Ch-Options.txt @@ -1,282 +1,276 @@ = Cluster Options = == Special Options == indexterm:[Special Cluster Options] indexterm:[Cluster Options,Special Options] The reason for these fields to be placed at the top level instead of with the rest of cluster options is simply a matter of parsing. These options are used by the configuration database which is, by design, mostly ignorant of the content it holds. So the decision was made to place them in an easy to find location. == Configuration Version == indexterm:[Configuration Version, Cluster Option] indexterm:[Cluster Options,Configuration Version] When a node joins the cluster, the cluster will perform a check to see who has the best configuration based on the fields below. It then asks the node with the highest (+admin_epoch+, +epoch+, +num_updates+) tuple to replace the configuration on all the nodes - which makes setting them, and setting them correctly, very important. .Configuration Version Properties [width="95%",cols="1m,5<",options="header",align="center"] |========================================================= |Field |Description | admin_epoch | indexterm:[admin_epoch Cluster Option] indexterm:[Cluster Options,admin_epoch] Never modified by the cluster. Use this to make the configurations on any inactive nodes obsolete. _Never set this value to zero_, in such cases the cluster cannot tell the difference between your configuration and the "empty" one used when nothing is found on disk. | epoch | indexterm:[epoch Cluster Option] indexterm:[Cluster Options,epoch] Incremented every time the configuration is updated (usually by the admin) | num_updates | indexterm:[num_updates Cluster Option] indexterm:[Cluster Options,num_updates] Incremented every time the configuration or status is updated (usually by the cluster) |========================================================= == Other Fields == .Properties Controlling Validation [width="95%",cols="1m,5<",options="header",align="center"] |========================================================= |Field |Description | validate-with | indexterm:[validate-with Cluster Option] indexterm:[Cluster Options,validate-with] Determines the type of validation being done on the configuration. If set to "none", the cluster will not verify that updates conform to the DTD (nor reject ones that don't). This option can be useful when operating a mixed version cluster during an upgrade. |========================================================= == Fields Maintained by the Cluster == .Properties Maintained by the Cluster [width="95%",cols="1m,5<",options="header",align="center"] |========================================================= |Field |Description -|crm-debug-origin | -indexterm:[crm-debug-origin Cluster Fields] -indexterm:[Cluster Fields,crm-debug-origin] -Indicates where the last update came from. Informational purposes only. - |cib-last-written | indexterm:[cib-last-written Cluster Fields] indexterm:[Cluster Fields,cib-last-written] Indicates when the configuration was last written to disk. Informational purposes only. |dc-uuid | indexterm:[dc-uuid Cluster Fields] indexterm:[Cluster Fields,dc-uuid] Indicates which cluster node is the current leader. Used by the cluster when placing resources and determining the order of some events. |have-quorum | indexterm:[have-quorum Cluster Fields] indexterm:[Cluster Fields,have-quorum] Indicates if the cluster has quorum. If false, this may mean that the cluster cannot start resources or fence other nodes. See +no-quorum-policy+ below. |========================================================= Note that although these fields can be written to by the admin, in most cases the cluster will overwrite any values specified by the admin with the "correct" ones. To change the +admin_epoch+, for example, one would use: pass:[cibadmin --modify --crm_xml ‘<cib admin_epoch="42"/>'] A complete set of fields will look something like this: .An example of the fields set for a cib object [source,XML] ------- ------- == Cluster Options == Cluster options, as you might expect, control how the cluster behaves when confronted with certain situations. They are grouped into sets and, in advanced configurations, there may be more than one. -footnote:[This will be described later in the section on where we will show how to have the cluster use +footnote:[This will be described later in the section on +<> where we will show how to have the cluster use different sets of options during working hours (when downtime is usually to be avoided at all costs) than it does during the weekends (when resources can be moved to the their preferred hosts without bothering end users)] For now we will describe the simple case where each option is present at most once. == Available Cluster Options == .Cluster Options [width="95%",cols="5m,2m,13",options="header",align="center"] |========================================================= |Option |Default |Description | batch-limit | 30 | indexterm:[batch-limit Cluster Options] indexterm:[Cluster Options,batch-limit] The number of jobs that the TE is allowed to execute in parallel. The "correct" value will depend on the speed and load of your network and cluster nodes. | migration-limit | -1 (unlimited) | indexterm:[migration-limit Cluster Options] indexterm:[Cluster Options,migration-limit] The number of migration jobs that the TE is allowed to execute in parallel on a node. | no-quorum-policy | stop | indexterm:[no-quorum-policy Cluster Options] indexterm:[Cluster Options,no-quorum-policy] What to do when the cluster does not have quorum. Allowed values: * ignore - continue all resource management * freeze - continue resource management, but don't recover resources from nodes not in the affected partition * stop - stop all resources in the affected cluster partition * suicide - fence all nodes in the affected cluster partition | symmetric-cluster | TRUE | indexterm:[symmetric-cluster Cluster Options] indexterm:[Cluster Options,symmetric-cluster] Can all resources run on any node by default? | stonith-enabled | TRUE | indexterm:[stonith-enabled Cluster Options] indexterm:[Cluster Options,stonith-enabled] Should failed nodes and nodes with resources that can't be stopped be shot? If you value your data, set up a STONITH device and enable this. If true, or unset, the cluster will refuse to start resources unless one or more STONITH resources have been configured also. | stonith-action | reboot | indexterm:[stonith-action Cluster Options] indexterm:[Cluster Options,stonith-action] Action to send to STONITH device. Allowed values: reboot, poweroff. | cluster-delay | 60s | indexterm:[cluster-delay Cluster Options] indexterm:[Cluster Options,cluster-delay] Round trip delay over the network (excluding action execution). The "correct" value will depend on the speed and load of your network and cluster nodes. | stop-orphan-resources | TRUE | indexterm:[stop-orphan-resources Cluster Options] indexterm:[Cluster Options,stop-orphan-resources] Should deleted resources be stopped? | stop-orphan-actions | TRUE | indexterm:[stop-orphan-actions Cluster Options] indexterm:[Cluster Options,stop-orphan-actions] Should deleted actions be cancelled? | start-failure-is-fatal | TRUE | indexterm:[start-failure-is-fatal Cluster Options] indexterm:[Cluster Options,start-failure-is-fatal] When set to FALSE, the cluster will instead use the resource's +failcount+ and value for +resource-failure-stickiness+. | pe-error-series-max | -1 (all) | indexterm:[pe-error-series-max Cluster Options] indexterm:[Cluster Options,pe-error-series-max] The number of PE inputs resulting in ERRORs to save. Used when reporting problems. | pe-warn-series-max | -1 (all) | indexterm:[pe-warn-series-max Cluster Options] indexterm:[Cluster Options,pe-warn-series-max] The number of PE inputs resulting in WARNINGs to save. Used when reporting problems. | pe-input-series-max | -1 (all) | indexterm:[pe-input-series-max Cluster Options] indexterm:[Cluster Options,pe-input-series-max] The number of "normal" PE inputs to save. Used when reporting problems. |========================================================= You can always obtain an up-to-date list of cluster options, including their default values, by running the pass:[pengine metadata] command. == Querying and Setting Cluster Options == indexterm:[Querying Cluster Options] indexterm:[Setting Cluster Options] indexterm:[Cluster Options,Querying] indexterm:[Cluster Options,Setting] Cluster options can be queried and modified using the pass:[crm_attribute] tool. To get the current value of +cluster-delay+, simply use: pass:[crm_attribute --attr-name cluster-delay --get-value] which is more simply written as pass:[crm_attribute --get-value -n cluster-delay] If a value is found, you'll see a result like this: ======= pass:[ # crm_attribute --get-value -n cluster-delay] name=cluster-delay value=60s ======== However, if no value is found, the tool will display an error: ======= pass:[# crm_attribute --get-value -n clusta-deway] name=clusta-deway value=(null) Error performing operation: The object/attribute does not exist ======== To use a different value, eg. +30+, simply run: pass:[crm_attribute --attr-name cluster-delay --attr-value 30s] To go back to the cluster's default value you can delete the value, for example with this command: pass:[crm_attribute --attr-name cluster-delay --delete-attr] == When Options are Listed More Than Once == If you ever see something like the following, it means that the option you're modifying is present more than once. .Deleting an option that is listed twice ======= pass:[# crm_attribute --attr-name batch-limit --delete-attr] Multiple attributes match name=batch-limit in crm_config: Value: 50 (set=cib-bootstrap-options, id=cib-bootstrap-options-batch-limit) Value: 100 (set=custom, id=custom-batch-limit) Please choose from one of the matches above and supply the 'id' with --attr-id ======= In such cases follow the on-screen instructions to perform the requested action. To determine which value is currently being used by -the cluster, please refer to the section on . +the cluster, please refer to the section on <>. diff --git a/doc/Pacemaker_Explained/en-US/Ch-Resources.xml b/doc/Pacemaker_Explained/en-US/Ch-Resources.xml index 63c79a623f..2075048f8d 100644 --- a/doc/Pacemaker_Explained/en-US/Ch-Resources.xml +++ b/doc/Pacemaker_Explained/en-US/Ch-Resources.xml @@ -1,522 +1,522 @@ Cluster Resources
What is a Cluster Resource ResourceDescription - The role of a resource agent is to abstract the service it provides and present a consistent view to the cluster, which allows the cluster to be agnostic about the resources it manages. - The cluster doesn't need to understand how the resource works because it relies on the resource agent to do the right thing when given a start, stop or monitor command. + The role of a resource agent is to abstract the service it provides and present a consistent view to the cluster, which allows the cluster to be agnostic about the resources it manages. + The cluster doesn't need to understand how the resource works because it relies on the resource agent to do the right thing when given a start, stop or monitor command. For this reason it is crucial that resource agents are well tested. Typically resource agents come in the form of shell scripts, however they can be written using any technology (such as C, Python or Perl) that the author is comfortable with.
Supported Resource Classes ResourceClasses - There are three basic classes of agents supported by Pacemaker. - In order of encouraged usage they are: + There are three basic classes of agents supported by Pacemaker. + In order of encouraged usage they are:
- Open Cluster Framework + Open Cluster Framework ResourceOCF OCFResources Open Cluster FrameworkResources - The OCF Spec - at least as it relates to resource agents.'Note: The Pacemaker implementation has been somewhat extended from the OCF Specs, but none of those changes are incompatible with the original OCF specification. is basically an extension of the Linux Standard Base conventions for init scripts to - - support parameters, - make them self describing and - extensible - - - OCF specs have strict definitions of the exit codes that actions must return + The OCF Spec - at least as it relates to resource agents.'Note: The Pacemaker implementation has been somewhat extended from the OCF Specs, but none of those changes are incompatible with the original OCF specification. is basically an extension of the Linux Standard Base conventions for init scripts to + + support parameters, + make them self describing and + extensible + + + OCF specs have strict definitions of the exit codes that actions must return Included with the cluster is the ocf-tester script, which can be useful in this regard. - . - The cluster follows these specifications exactly, and giving the wrong exit code will cause the cluster to behave in ways you will likely find puzzling and annoying. - In particular, the cluster needs to distinguish a completely stopped resource from one which is in some erroneous and indeterminate state. - - - Parameters are passed to the script as environment variables, with the special prefix OCF_RESKEY_. - So, a parameter which the user thinks of as ip it will be passed to the script as OCF_RESKEY_ip. - The number and purpose of the parameters is completely arbitrary, however your script should advertise any that it supports using the meta-data command. - - The OCF class is the most preferred one as it is an industry standard, highly flexible (allowing parameters to be passed to agents in a non-positional manner) and self-describing. - For more information, see the reference and . + . + The cluster follows these specifications exactly, and giving the wrong exit code will cause the cluster to behave in ways you will likely find puzzling and annoying. + In particular, the cluster needs to distinguish a completely stopped resource from one which is in some erroneous and indeterminate state. + + + Parameters are passed to the script as environment variables, with the special prefix OCF_RESKEY_. + So, a parameter which the user thinks of as ip it will be passed to the script as OCF_RESKEY_ip. + The number and purpose of the parameters is completely arbitrary, however your script should advertise any that it supports using the meta-data command. + + The OCF class is the most preferred one as it is an industry standard, highly flexible (allowing parameters to be passed to agents in a non-positional manner) and self-describing. + For more information, see the reference and .
- Linux Standard Base + Linux Standard Base ResourceLSB LSBResources Linus Standard BaseResources - - LSB resource agents are those typically found in /etc/init.d. - Generally they are provided by the OS/distribution and, in order to be used with the cluster, they must conform to the LSB Spec - See - for the LSB Spec (as it relates to init scripts). - . - - - Many distributions claim LSB compliance but ship with broken init scripts. - To see if your init script is LSB-compatible, see the FAQ entry . - The most common problems are: - - - Not implementing the status operation at all - Not observing the correct exit status codes for start/stop/status actions - Starting a started resource returns an error (this violates the LSB spec) - Stopping a stopped resource returns an error (this violates the LSB spec) - + + LSB resource agents are those typically found in /etc/init.d. + Generally they are provided by the OS/distribution and, in order to be used with the cluster, they must conform to the LSB Spec + See + for the LSB Spec (as it relates to init scripts). + . + + + Many distributions claim LSB compliance but ship with broken init scripts. + To see if your init script is LSB-compatible, see the FAQ entry . + The most common problems are: + + + Not implementing the status operation at all + Not observing the correct exit status codes for start/stop/status actions + Starting a started resource returns an error (this violates the LSB spec) + Stopping a stopped resource returns an error (this violates the LSB spec) +
- Legacy Heartbeat + Legacy Heartbeat ResourceHeartbeat (legacy) HeartbeatLegacy Resources - - Version 1 of Heartbeat came with its own style of resource agents and it is highly likely that many people have written their own agents based on its conventions. - To enable administrators to continue to use these agents, they are supported by the new cluster manager - See for more information.. - + + Version 1 of Heartbeat came with its own style of resource agents and it is highly likely that many people have written their own agents based on its conventions. + To enable administrators to continue to use these agents, they are supported by the new cluster manager + See for more information.. +
- STONITH + STONITH ResourceSTONITH STONITHResources - - There is also an additional class, STONITH, which is used exclusively for fencing related resources. - This is discussed later in . - + + There is also an additional class, STONITH, which is used exclusively for fencing related resources. + This is discussed later in . +
Properties These values tell the cluster which script to use for the resource, where to find that script and what standards it conforms to. - Properties of a Primitive Resource - - - + Properties of a Primitive Resource + + + Field Description - - + + id id Your name for the resource classResource Field ResourceFieldclass class The standard the script conforms to. Allowed values: heartbeat, lsb, ocf, stonith typeResource Field ResourceFieldtype type The name of the Resource Agent you wish to use. Eg. IPaddr or Filesystem providerResource Field ResourceFieldprovider provider The OCF spec allows multiple vendors to supply the same ResourceAgent. To use the OCF resource agents supplied with Heartbeat, you should specify heartbeat here. - - + +
Resource definitions can be queried with the crm_resource tool. For example crm_resource --resource Email --query-xml might produce - An example LSB resource - ]]> - + An example LSB resource + ]]> + - One of the main drawbacks to LSB resources is that they do not allow any parameters! - + One of the main drawbacks to LSB resources is that they do not allow any parameters! + Example for an OCF resource: - An example OCF resource - + An example OCF resource + ]]> Or, finally for the equivalent legacy Heartbeat resource: - An example Heartbeat resource - + An example Heartbeat resource + ]]> - - Heartbeat resources take only ordered and unnamed parameters. - The supplied name therefore indicates the order in which they are passed to the script. - Only single digit values are allowed. - - + + Heartbeat resources take only ordered and unnamed parameters. + The supplied name therefore indicates the order in which they are passed to the script. + Only single digit values are allowed. + +
Resource Options Options are used by the cluster to decide how your resource should behave and can be easily set using the --meta option of the crm_resource command. - Options for a Primitive Resource - - - - + Options for a Primitive Resource + + + + Field Default Description priorityResource Option ResourceOptionpriority priority 0 If not all resources can be active, the cluster will stop lower priority resources in order to keep higher priority ones active. target-roleResource Option ResourceOptiontarget-role target-role Started - What state should the cluster attempt to keep this resource in? Allowed values: - + What state should the cluster attempt to keep this resource in? Allowed values: + Stopped - Force the resource to be stopped Started - Allow the resource to be started (In the case of multi-state resources, they will not promoted to master) Master - Allow the resource to be started and, if appropriate, promoted - + is-managedResource Option ResourceOptionis-managed is-managed TRUE - Is the cluster allowed to start and stop the resource? - Allowed values: true, false - + Is the cluster allowed to start and stop the resource? + Allowed values: true, false + resource-stickinessResource Option ResourceOptionresource-stickiness resource-stickiness Inherited - How much does the resource prefer to stay where it is? - Defaults to the value of resource-stickiness in the rsc_defaults section - + How much does the resource prefer to stay where it is? + Defaults to the value of resource-stickiness in the rsc_defaults section + migration-thresholdResource Option ResourceOptionmigration-threshold migration-threshold INFINITY (disabled) How many failures may occur for this resource on a node, before this node is marked ineligible to host this resource. failure-timeoutResource Option ResourceOptionfailure-timeout failure-timeout 0 (disabled) How many seconds to wait before acting as if the failure had not occurred, and potentially allowing the resource back to the node on which it failed. multiple-activeResource Option ResourceOptionmultiple-active multiple-active stop_start - What should the cluster do if it ever finds the resource active on more than one node. Allowed values: - + What should the cluster do if it ever finds the resource active on more than one node. Allowed values: + block - mark the resource as unmanaged stop_only - stop all active instances and leave them that way stop_start - stop all active instances and start the resource in one location only - + - - + +
If you performed the following commands on the previous LSB Email resource crm_resource --meta --resource Email --set-parameter priority --property-value 100 - crm_resource --meta --resource Email --set-parameter multiple-active --property-value block + crm_resource --meta --resource Email --set-parameter multiple-active --property-value block the resulting resource definition would be - An LSB resource with cluster options - + An LSB resource with cluster options + ]]>
Setting Global Defaults for Resource Options To set a default value for a resource option, simply add it to the rsc_defaults section with crm_attribute. Thus, crm_attribute --type rsc_defaults --attr-name is-managed --attr-value false would prevent the cluster from starting or stopping any of the resources in the configuration (unless of course the individual resources were specifically enabled and had is-managed set to true).
Instance Attributes The scripts of some resource classes (LSB not being one of them) can be given parameters which determine how they behave and which instance of a service they control. If your resource agent supports parameters, you can add them with the crm_resource command. For instance crm_resource --resource Public-IP --set-parameter ip --property-value 1.2.3.4 would create an entry in the resource like this: - An example OCF resource with instance attributes - + An example OCF resource with instance attributes + ]]> For an OCF resource, the result would be an environment variable called OCF_RESKEY_ip with a value of 1.2.3.4. - The list of instance attributes supported by an OCF script can be found by calling the resource script with the meta-data command. - The output contains an XML description of all the supported attributes, their purpose and default values. + The list of instance attributes supported by an OCF script can be found by calling the resource script with the meta-data command. + The output contains an XML description of all the supported attributes, their purpose and default values. - Displaying the metadata for the Dummy resource agent template + Displaying the metadata for the Dummy resource agent template export OCF_ROOT=/usr/lib/ocf; $OCF_ROOT/resource.d/pacemaker/Dummy meta-data 1.0 - This is a Dummy Resource Agent. It does absolutely nothing except + This is a Dummy Resource Agent. It does absolutely nothing except keep track of whether its running or not. Its purpose in life is for testing and to serve as a template for RA writers. Dummy resource agent Location to store the resource state in. State file - + Dummy attribute that can be changed to cause a reload Dummy attribute that can be changed to cause a reload ]]>
Resource Operations
- Monitoring Resources for Failure - - By default, the cluster will not ensure your resources are still healthy. - To instruct the cluster to do this, you need to add a monitor operation to the resource's definition. - - - An OCF resource with a recurring health check - + Monitoring Resources for Failure + + By default, the cluster will not ensure your resources are still healthy. + To instruct the cluster to do this, you need to add a monitor operation to the resource's definition. + + + An OCF resource with a recurring health check + ]]> - - - Properties of an Operation - - - + +
+ Properties of an Operation + + + - Field - Description + Field + Description - id - Your name for the action. Must be unique. + id + Your name for the action. Must be unique. - name - The action to perform. Common values: monitor, start, stop + name + The action to perform. Common values: monitor, start, stop - interval - How frequently (in seconds) to perform the operation. Default value: 0, meaning never. + interval + How frequently (in seconds) to perform the operation. Default value: 0, meaning never. - timeout - How long to wait before declaring the action has failed. + timeout + How long to wait before declaring the action has failed. - requires - - What conditions need to be satisfied before this action occurs. Allowed values: - + requires + + What conditions need to be satisfied before this action occurs. Allowed values: + nothing - The cluster may start this resource at any time quorum - The cluster can only start this resource if a majority of the configured nodes are active fencing - The cluster can only start this resource if a majority of the configured nodes are active and any failed or unknown nodes have been powered off. - - STONITH resources default to nothing, and all others default to fencing if STONITH is enabled and quorum otherwise. - + + STONITH resources default to nothing, and all others default to fencing if STONITH is enabled and quorum otherwise. + - on-fail - - The action to take if this action ever fails. Allowed values: - + on-fail + + The action to take if this action ever fails. Allowed values: + ignore - Pretend the resource did not fail block - Don't perform any further operations on the resource stop - Stop the resource and do not start it elsewhere restart - Stop the resource and start it again (possibly on a different node) fence - STONITH the node on which the resource failed standby - Move all resources away from the node on which the resource failed - - The default for the stop operation is fence when STONITH is enabled and block otherwise. All other operations default to stop. - + + The default for the stop operation is fence when STONITH is enabled and block otherwise. All other operations default to stop. + - enabled - If false, the operation is treated as if it does not exist. Allowed values: true, false + enabled + If false, the operation is treated as if it does not exist. Allowed values: true, false - - -
+ + +
Setting Global Defaults for Operations To set a default value for a operation option, simply add it to the op_defaults section with crm_attribute. Thus, crm_attribute --type op_defaults --attr-name timeout --attr-value 20s - would default each operation's timeout to 20 seconds. - If an operation's definition also includes a value for timeout, then that value would be used instead (for that operation only). + would default each operation's timeout to 20 seconds. + If an operation's definition also includes a value for timeout, then that value would be used instead (for that operation only).
- When Resources Take a Long Time to Start/Stop - - There are a number of implicit operations that the cluster will always perform - start, stop and a non-recurring monitor operation (used at startup to check the resource isn't already active). - If one of these is taking too long, then you can create an entry for them and simply specify a new value. - - - An OCF resource with custom timeouts for its implicit actions - + When Resources Take a Long Time to Start/Stop + + There are a number of implicit operations that the cluster will always perform - start, stop and a non-recurring monitor operation (used at startup to check the resource isn't already active). + If one of these is taking too long, then you can create an entry for them and simply specify a new value. + + + An OCF resource with custom timeouts for its implicit actions + ]]> - +
- Multiple Monitor Operations - - Provided no two operations (for a single resource) have the same name and interval you can have as many monitor operations as you like. - In this way you can do a superficial health check every minute and progressively more intense ones at higher intervals. - - - To tell the resource agent what kind of check to perform, you need to provide each monitor with a different value for a common parameter. - The OCF standard creates a special parameter called OCF_CHECK_LEVEL for this purpose and dictates that it is "made available to the resource agent without the normal OCF_RESKEY_ prefix". - - - Whatever name you choose, you can specify it by adding an instance_attributes block to the op tag. - Note that it is up to each resource agent to look for the parameter and decide how to use it. - - - An OCF resource with two recurring health checks, performing different levels of checks - specified via <literal>OCF_CHECK_LEVEL</literal>. - + Multiple Monitor Operations + + Provided no two operations (for a single resource) have the same name and interval you can have as many monitor operations as you like. + In this way you can do a superficial health check every minute and progressively more intense ones at higher intervals. + + + To tell the resource agent what kind of check to perform, you need to provide each monitor with a different value for a common parameter. + The OCF standard creates a special parameter called OCF_CHECK_LEVEL for this purpose and dictates that it is "made available to the resource agent without the normal OCF_RESKEY_ prefix". + + + Whatever name you choose, you can specify it by adding an instance_attributes block to the op tag. + Note that it is up to each resource agent to look for the parameter and decide how to use it. + + + An OCF resource with two recurring health checks, performing different levels of checks - specified via <literal>OCF_CHECK_LEVEL</literal>. + ]]> - +
- Disabling a Monitor Operation - - The easiest way to stop a recurring monitor is to just delete it. - However, there can be times when you only want to disable it temporarily. - In such cases, simply add disabled="true" to the operation's definition. - - - Example of an OCF resource with a disabled health check - + Disabling a Monitor Operation + + The easiest way to stop a recurring monitor is to just delete it. + However, there can be times when you only want to disable it temporarily. + In such cases, simply add enabled="false" to the operation's definition. + + + Example of an OCF resource with a disabled health check + - + ]]> - - This can be achieved from the command-line by executing - cibadmin -M -X ‘<op id="public-ip-check" disabled="true"/>' - Once you've done whatever you needed to do, you can then re-enable it with - cibadmin -M -X ‘<op id="public-ip-check" disabled="false"/>' + + This can be achieved from the command-line by executing + cibadmin -M -X ‘<op id="public-ip-check" enabled="false"/>' + Once you've done whatever you needed to do, you can then re-enable it with + cibadmin -M -X ‘<op id="public-ip-check" enabled="true"/>'
diff --git a/doc/Pacemaker_Explained/en-US/Ch-Rules.xml b/doc/Pacemaker_Explained/en-US/Ch-Rules.xml index 380a7e664b..b8c3050b78 100644 --- a/doc/Pacemaker_Explained/en-US/Ch-Rules.xml +++ b/doc/Pacemaker_Explained/en-US/Ch-Rules.xml @@ -1,463 +1,463 @@ Rules Rules can be used to make your configuration more dynamic. One common example is to set one value for resource-stickiness during working hours, to prevent resources from being moved back to their most preferred location, and another on weekends when no-one is around to notice an outage. Another use of rules might be to assign machines to different processing groups (using a node attribute) based on time and to then use that attribute when creating location constraints. Each rule can contain a number of expressions, date-expressions and even other rules. The results of the expressions are combined based on the rule's boolean-op field to determine if the rule ultimately evaluates to true or false. What happens next depends on the context in which the rule is being used. Properties of a Rule Field Description - - + + role Rule Property RulePropertiesrole role Limits the rule to apply only when the resource is in that role. Allowed values: Started, Slave, and Master. NOTE: A rule with role="Master" can not determine the initial location of a clone instance. It will only affect which of the active instances will be promoted. scoreRule Property RulePropertiesscore score The score to apply if the rule evaluates to true. Limited to use in rules that are part of location constraints. score-attribute Rule Property RulePropertiesscore-attribute score-attribute The node attribute to look up and use as a score if the rule evaluates to true. Limited to use in rules that are part of location constraints. boolean-op Rule Property RulePropertiesboolean-op boolean-op How to combine the result of multiple expression objects. Allowed values: and and or. - - + +
<indexterm significance="preferred"><primary>Node</primary><secondary>Attribute Expressions</secondary></indexterm>Node Attribute Expressions Expression objects are used to control a resource based on the attributes defined by a node or nodes. In addition to any attributes added by the administrator, each node has a built-in node attribute called #uname that can also be used. - Properties of an Expression - + Properties of an Expression + Field Description value Expression Property Expression Propertiesvalue value User supplied value for comparison attribute Expression Property Expression Propertiesattribute attribute The node attribute to test typeExpression Property Expression Propertiestype type Determines how the value(s) should be tested. Allowed values: string, integer, version operation Expression Property Expression Propertiesoperation operation - The comparison to perform. Allowed values: - + The comparison to perform. Allowed values: + lt - True if the node attribute's value is less than value gt - True if the node attribute's value is greater than value lte - True if the node attribute's value is less than or equal to value gte - True if the node attribute's value is greater than or equal to value eq - True if the node attribute's value is equal to value ne - True if the node attribute's value is not equal to value defined - True if the node has the named attribute not_defined - True if the node does not have the named attribute - + - - + +
<indexterm significance="preferred"><primary>Time Based Expressions</primary></indexterm> <indexterm significance="preferred"><primary>Expression</primary><secondary>Time/Date Based</secondary></indexterm> Time/Date Based Expressions - As the name suggests, date_expressions are used to control a resource or cluster option based on the current date/time. - They can contain an optional date_spec and/or duration object depending on the context. + As the name suggests, date_expressions are used to control a resource or cluster option based on the current date/time. + They can contain an optional date_spec and/or duration object depending on the context. - Properties of a Date Expression - + Properties of a Date Expression + Field Description start A date/time conforming to the ISO8601 specification. end A date/time conforming to the ISO8601 specification. Can be inferred by supplying a value for start and a duration. operation - Compares the current date/time with the start and/or end date, depending on the context. Allowed values: - + Compares the current date/time with the start and/or end date, depending on the context. Allowed values: + gt - True if the current date/time is after start lt - True if the current date/time is before end in-range - True if the current date/time is after start and before end date-spec - performs a cron-like comparison to the current date/time - + - - + +
Because the comparisons (except for date_spec) include the time, the eq, neq, gte and lte operators have not been implemented.
<indexterm significance="preferred"><primary>Date Specifications</primary></indexterm> Date Specifications - - date_spec objects are used to create cron-like expressions relating to time. - Each field can contain a single number or a single range. - Instead of defaulting to zero, any field not supplied is ignored. - - - For example, monthdays="1" matches the first day of every month and hours="09-17" matches the hours between 9am and 5pm (inclusive). - However, at this time one cannot specify weekdays="1,2" or weekdays="1-2,5-6" since they contain multiple ranges. - Depending on demand, this may be implemented in a future release. - - - Properties of a Date Spec - - - + + date_spec objects are used to create cron-like expressions relating to time. + Each field can contain a single number or a single range. + Instead of defaulting to zero, any field not supplied is ignored. + + + For example, monthdays="1" matches the first day of every month and hours="09-17" matches the hours between 9am and 5pm (inclusive). + However, at this time one cannot specify weekdays="1,2" or weekdays="1-2,5-6" since they contain multiple ranges. + Depending on demand, this may be implemented in a future release. + +
+ Properties of a Date Spec + + + - Field - Description + Field + Description - - + + idDate Spec Property Date Spec Propertiesid id - A unique name for the date + A unique name for the date hours Date Spec Property Date Spec Propertieshours hours - Allowed values: 0-23 + Allowed values: 0-23 monthdays Date Spec Property Date Spec Propertiesmonthdays monthdays - Allowed values: 0-31 (depending on month and year) + Allowed values: 0-31 (depending on month and year) weekdays Date Spec Property Date Spec Propertiesweekdays weekdays - Allowed values: 1-7 (1=Monday, 7=Sunday) + Allowed values: 1-7 (1=Monday, 7=Sunday) yeardays Date Spec Property Date Spec Propertiesyeardays yeardays - Allowed values: 1-366 (depending on the year) + Allowed values: 1-366 (depending on the year) months Date Spec Property Date Spec Propertiesmonths months - Allowed values: 1-12 + Allowed values: 1-12 weeks Date Spec Property Date Spec Propertiesweeks weeks - Allowed values: 1-53 (depending on weekyear) + Allowed values: 1-53 (depending on weekyear) years Date Spec Property Date Spec Propertiesyears years - Year according the Gregorian calendar + Year according the Gregorian calendar weekyears Date Spec Property Date Spec Propertiesweekyears weekyears - - May differ from Gregorian years; Eg. 2005-001 Ordinal is also 2005-01-01 Gregorian is also 2004-W53-6 Weekly - + + May differ from Gregorian years; Eg. 2005-001 Ordinal is also 2005-01-01 Gregorian is also 2004-W53-6 Weekly + moon Date Spec Property Date Spec Propertiesmoon moon - Allowed values: 0-7 (0 is new, 4 is full moon). Seriously, you can use this. This was implemented to demonstrate the ease with which new comparisons could be added. + Allowed values: 0-7 (0 is new, 4 is full moon). Seriously, you can use this. This was implemented to demonstrate the ease with which new comparisons could be added. - - -
+ + +
<indexterm significance="preferred"><primary>Durations Expressions</primary></indexterm> <indexterm significance="preferred"><primary>Expressions</primary><secondary>Durations</secondary></indexterm> Durations - - Durations are used to calculate a value for end when one is not supplied to in_range operations. - They contain the same fields as date_spec objects but without the limitations (ie. you can have a duration of 19 months). - Like date_specs, any field not supplied is ignored. - -
- Sample Time Based Expressions - - True if now is any time in the year 2005 - + + Durations are used to calculate a value for end when one is not supplied to in_range operations. + They contain the same fields as date_spec objects but without the limitations (ie. you can have a duration of 19 months). + Like date_specs, any field not supplied is ignored. + +
+ Sample Time Based Expressions + + True if now is any time in the year 2005 + ]]> - - - Equivalent expression. - + + + Equivalent expression. + ]]> - - - 9am-5pm, Mon-Friday - + + + 9am-5pm, Mon-Friday + ]]> - + Please note that the 16 matches up to 16:59:59, as the numeric value (hour) still matches! - - 9am-6pm, Mon-Friday, or all day saturday - + + 9am-6pm, Mon-Friday, or all day saturday + ]]> - - - 9am-5pm or 9pm-12pm, Mon-Friday - + + + 9am-5pm or 9pm-12pm, Mon-Friday + ]]> - - - Mondays in March 2005 - + + + Mondays in March 2005 + ]]> - - NOTE: Because no time is specified, 00:00:00 is implied. - This means that the range includes all of 2005-03-01 but none of 2005-04-01. - You may wish to write end="2005-03-31T23:59:59" to avoid confusion. - - A full moon on Friday the 13th - + + NOTE: Because no time is specified, 00:00:00 is implied. + This means that the range includes all of 2005-03-01 but none of 2005-04-01. + You may wish to write end="2005-03-31T23:59:59" to avoid confusion. + + A full moon on Friday the 13th + ]]> - -
+
+
<indexterm significance="preferred"><primary>Rule</primary><secondary>Determine Resource Location</secondary></indexterm> <indexterm><primary>Resource</primary><secondary>Location, Determine by Rules</secondary></indexterm> Using Rules to Determine Resource Location - If the constraint's outer-most rule evaluates to false, the cluster treats the constraint as if it was not there. - When the rule evaluates to true, the node's preference for running the resource is updated with the score associated with the rule. + If the constraint's outer-most rule evaluates to false, the cluster treats the constraint as if it was not there. + When the rule evaluates to true, the node's preference for running the resource is updated with the score associated with the rule. - If this sounds familiar, its because you have been using a simplified syntax for location constraint rules already. - Consider the following location constraint: + If this sounds familiar, its because you have been using a simplified syntax for location constraint rules already. + Consider the following location constraint: Prevent myApacheRsc from running on c001n03 <rsc_location id="dont-run-apache-on-c001n03" rsc="myApacheRsc" score="-INFINITY" node="c001n03"/> This constraint can be more verbosely written as: - Prevent myApacheRsc from running on c001n03 - expanded version - + Prevent myApacheRsc from running on c001n03 - expanded version + ]]> The advantage of using the expanded form is that one can then add extra clauses to the rule, such as limiting the rule such that it only applies during certain times of the day or days of the week (this is discussed in subsequent sections). - It also allows us to match on node properties other than its name. - If we rated each machine's CPU power such that the cluster had the following nodes section: + It also allows us to match on node properties other than its name. + If we rated each machine's CPU power such that the cluster had the following nodes section: - A sample nodes section for use with score-attribute - + A sample nodes section for use with score-attribute + ]]> then we could prevent resources from running on underpowered machines with the rule ]]>
- Using <literal>score-attribute</literal> Instead of <literal>score</literal> - - When using score-attribute instead of score, each node matched by the rule has its score adjusted differently, according to its value for the named node attribute. - Thus, in the previous example, if a rule used score-attribute="cpu_mips", c001n01 would have its preference to run the resource increased by 1234 whereas c001n02 would have its preference increased by 5678. - + Using <literal>score-attribute</literal> Instead of <literal>score</literal> + + When using score-attribute instead of score, each node matched by the rule has its score adjusted differently, according to its value for the named node attribute. + Thus, in the previous example, if a rule used score-attribute="cpu_mips", c001n01 would have its preference to run the resource increased by 1234 whereas c001n02 would have its preference increased by 5678. +
Using Rules to Control Resource Options Often some cluster nodes will be different from their peers; sometimes these differences (the location of a binary or the names of network interfaces) require resources to be configured differently depending on the machine they're hosted on. By defining multiple instance_attributes objects for the resource and adding a rule to each, we can easily handle these special cases. In the example below, mySpecialRsc will use eth1 and port 9999 when run on node1, eth2 and port 8888 on node2 and default to eth0 and port 9999 for all other nodes. - Defining different resource options based on the node name - + Defining different resource options based on the node name + ]]> - The order in which instance_attributes objects are evaluated is determined by their score (highest to lowest). - If not supplied, score defaults to zero and objects with an equal score are processed in listed order. - If the instance_attributes object does not have a rule or has a rule that evaluates to true, then for any parameter the resource does not yet have a value for, the resource will use the parameter values defined by the instance_attributes object. + The order in which instance_attributes objects are evaluated is determined by their score (highest to lowest). + If not supplied, score defaults to zero and objects with an equal score are processed in listed order. + If the instance_attributes object does not have a rule or has a rule that evaluates to true, then for any parameter the resource does not yet have a value for, the resource will use the parameter values defined by the instance_attributes object.
<indexterm><primary>Rule</primary><secondary>Controlling Cluster Options</secondary></indexterm> <indexterm><primary>Cluster Options</primary><secondary>Controlled by Rules</secondary></indexterm> Using Rules to Control Cluster Options Controlling cluster options is achieved in much the same manner as specifying different resource options on different nodes. - The difference is that because they are cluster options, one cannot (or should not, because they won't work) use attribute based expressions. - The following example illustrates how to set a different resource-stickiness value during and outside of work hours. - This allows resources to automatically move back to their most preferred hosts, but at a time that (in theory) does not interfere with business activities. + The difference is that because they are cluster options, one cannot (or should not, because they won't work) use attribute based expressions. + The following example illustrates how to set a different resource-stickiness value during and outside of work hours. + This allows resources to automatically move back to their most preferred hosts, but at a time that (in theory) does not interfere with business activities. - Change <literal>resource-stickiness</literal> during working hours - + Change <literal>resource-stickiness</literal> during working hours + ]]>
Ensuring Time Based Rules Take Effect - A Pacemaker cluster is an event driven system. - As such, it won't recalculate the best place for resources to run in unless something (like a resource failure or configuration change) happens. - This can mean that a location constraint that only allows resource X to run between 9am and 5pm is not enforced. + A Pacemaker cluster is an event driven system. + As such, it won't recalculate the best place for resources to run in unless something (like a resource failure or configuration change) happens. + This can mean that a location constraint that only allows resource X to run between 9am and 5pm is not enforced. - If you rely on time based rules, it is essential that you set the cluster-recheck-interval option. - This tells the cluster to periodically recalculate the ideal state of the cluster. - For example, if you set cluster-recheck-interval=5m, then sometime between 9:00 and 9:05 the cluster would notice that it needs to start resource X, and between 17:00 and 17:05 it would realize that X needed to be stopped. + If you rely on time based rules, it is essential that you set the cluster-recheck-interval option. + This tells the cluster to periodically recalculate the ideal state of the cluster. + For example, if you set cluster-recheck-interval=5m, then sometime between 9:00 and 9:05 the cluster would notice that it needs to start resource X, and between 17:00 and 17:05 it would realize that X needed to be stopped. Note that the timing of the actual start and stop actions depends on what else needs to be performed first.
diff --git a/doc/Pacemaker_Explained/en-US/Ch-Status.xml b/doc/Pacemaker_Explained/en-US/Ch-Status.xml index 1c14919420..682862f9a1 100644 --- a/doc/Pacemaker_Explained/en-US/Ch-Status.xml +++ b/doc/Pacemaker_Explained/en-US/Ch-Status.xml @@ -1,335 +1,335 @@ Status - Here be dragons Most users never need to understand the contents of the status section and can be happy with the output from crm_mon. However for those with a curious inclination, this section attempts to provide an overview of its contents.
<indexterm significance="preferred"><primary>Node</primary><secondary>Status</secondary></indexterm> <indexterm significance="preferred"><primary>Status of a Node</primary></indexterm> Node Status In addition to the cluster's configuration, the CIB holds an up-to-date representation of each cluster node in the status section.
- A bare-bones status entry for a healthy node called <literal>cl-virt-1</literal> - + A bare-bones status entry for a healthy node called <literal>cl-virt-1</literal> + ]]>
- Users are highly recommended not to modify any part of a node's state directly. - The cluster will periodically regenerate the entire section from authoritative sources. - So any changes should be done with the tools for those subsystems. + Users are highly recommended not to modify any part of a node's state directly. + The cluster will periodically regenerate the entire section from authoritative sources. + So any changes should be done with the tools for those subsystems. - Authoritative Sources for State Information - + Authoritative Sources for State Information + Dataset Authoritative Source node_state fields crmd transient_attributes tag attrd lrm tag lrmd
- The fields used in the node_state objects are named as they are largely for historical reasons and are rooted in Pacemaker's origins as the Heartbeat resource manager. - They have remained unchanged to preserve compatibility with older versions. + The fields used in the node_state objects are named as they are largely for historical reasons and are rooted in Pacemaker's origins as the Heartbeat resource manager. + They have remained unchanged to preserve compatibility with older versions. - Node Status Fields - + Node Status Fields + Field Description idNode Status Field NodeStatus Fieldid id Unique identifier for the node. Corosync based clusters use the uname of the machine, Heartbeat clusters use a human-readable (but annoying) UUID. uname Node Status Field NodeStatus Fielduname uname The node's machine name (output from uname -n). ha Node Status Field NodeStatus Fieldha ha Flag specifying whether the cluster software is active on the node. Allowed values: active, dead. in_ccm Node Status Field NodeStatus Fieldin_ccm in_ccm Flag for cluster membership; allowed values: true, false. crmd Node Status Field NodeStatus Fieldcrmd crmd Flag: is the crmd process active on the node? One of online, offline. join Node Status Field NodeStatus Fieldjoin join Flag saying whether the node participates in hosting resources. Possible values: down, pending, member, banned. expected Node Status Field NodeStatus Fieldexpected expected Expected value for join. crm-debug-origin Node Status Field NodeStatus Fieldcrm-debug-origin crm-debug-origin Diagnostic indicator: the origin of the most recent change(s).
The cluster uses these fields to determine if, at the node level, the node is healthy or is in a failed state and needs to be fenced.
Transient Node Attributes - Like regular node attributes, the name/value pairs listed here also help to describe the node. - However they are forgotten by the cluster when the node goes offline. - This can be useful, for instance, when you want a node to be in standby mode (not able to run resources) until the next reboot. + Like regular node attributes, the name/value pairs listed here also help to describe the node. + However they are forgotten by the cluster when the node goes offline. + This can be useful, for instance, when you want a node to be in standby mode (not able to run resources) until the next reboot. In addition to any values the administrator sets, the cluster will also store information about failed resources here.
- Example set of transient node attributes for node "cl-virt-1" - + Example set of transient node attributes for node "cl-virt-1" + ]]>
In the above example, we can see that the pingd:0 resource has failed once, at Mon Apr 6 11:22:22 2009 You can use the standard date command to print a human readable of any seconds-since-epoch value: - # date -d @number - . - We also see that the node is connected to three "pingd" peers and that all known resources have been checked for on this machine (probe_complete). + # date -d @number + . + We also see that the node is connected to three "pingd" peers and that all known resources have been checked for on this machine (probe_complete).
<indexterm significance="preferred"><primary>Operation History</primary></indexterm> Operation History - A node's resource history is held in the lrm_resources tag (a child of the lrm tag). - The information stored here includes enough information for the cluster to stop the resource safely if it is removed from the configuration section. - Specifically the resource's id, class, type and provider are stored. + A node's resource history is held in the lrm_resources tag (a child of the lrm tag). + The information stored here includes enough information for the cluster to stop the resource safely if it is removed from the configuration section. + Specifically the resource's id, class, type and provider are stored.
- A record of the apcstonith resource - <lrm_resource id="apcstonith" type="apcmastersnmp" class="stonith"> - + A record of the apcstonith resource + <lrm_resource id="apcstonith" type="apcmastersnmp" class="stonith"> +
- Additionally, we store the last job for every combination of resource, action and interval. - The concatenation of the values in this tuple are used to create the id of the lrm_rsc_op object. + Additionally, we store the last job for every combination of resource, action and interval. + The concatenation of the values in this tuple are used to create the id of the lrm_rsc_op object. - Contents of an <literal>lrm_rsc_op</literal> job. - - - + Contents of an <literal>lrm_rsc_op</literal> job. + + + Field Description idJob Field Job Fieldid id Identifier for the job constructed from the resource's id, operation and interval. call-id Job Field Job Fieldcall-id call-id The job's ticket number. Used as a sort key to determine the order in which the jobs were executed. operation Job Field Job Fieldoperation operation The action the resource agent was invoked with. interval Job Field Job Fieldinterval interval The frequency, in milliseconds, at which the operation will be repeated. A one-off job is indicated by 0. op-status Job Field Job Fieldop-status op-status The job's status. Generally this will be either 0 (done) or -1 (pending). Rarely used in favor of rc-code. rc-code Job Field Job Fieldrc-code rc-code The job's result. Refer to for details on what the values here mean and how they are interpreted. last-run Job Field Job Fieldlast-run last-run Diagnostic indicator. Machine local date/time, in seconds since epoch, at which the job was executed. last-rc-change Job Field Job Fieldlast-rc-change last-rc-change Diagnostic indicator. Machine local date/time, in seconds since epoch, at which the job first returned the current value of rc-code. exec-time Job Field Job Fieldexec-time exec-time Diagnostic indicator. Time, in milliseconds, that the job was running for. queue-time Job Field Job Fieldqueue-time queue-time Diagnostic indicator. Time, in seconds, that the job was queued for in the LRMd. crm_feature_set Job Field Job Fieldcrm_feature_set crm_feature_set The version which this job description conforms to. Used when processing op-digest. transition-key Job Field Job Fieldtransition-key transition-key A concatenation of the job's graph action number, the graph number, the expected result and the UUID of the crmd instance that scheduled it. This is used to construct transition-magic (below). transition-magic Job Field Job Fieldtransition-magic transition-magic A concatenation of the job's op-status, rc-code and transition-key. Guaranteed to be unique for the life of the cluster (which ensures it is part of CIB update notifications) and contains all the information needed for the crmd to correctly analyze and process the completed job. Most importantly, the decomposed elements tell the crmd if the job entry was expected and whether it failed. op-digest Job Field Job Fieldop-digest op-digest An MD5 sum representing the parameters passed to the job. Used to detect changes to the configuration, to restart resources if necessary. crm-debug-origin Job Field Job Fieldcrm-debug-origin crm-debug-origin Diagnostic indicator. The origin of the current values. - - + +
- Simple Example -
- A monitor operation (determines current state of the apcstonith resource) - + Simple Example +
+ A monitor operation (determines current state of the apcstonith resource) + ]]> -
- - In the above example, the job is a non-recurring monitor operation often referred to as a "probe" for the apcstonith resource. - The cluster schedules probes for every configured resource on when a new node starts, in order to determine the resource's current state before it takes any further action. - - - From the transition-key, we can see that this was the 22nd action of the 2nd graph produced by this instance of the crmd (2668bbeb-06d5-40f9-936d-24cb7f87006a). - The third field of the transition-key contains a 7, this indicates that the job expects to find the resource inactive. - By looking at the rc-code property, we see that this was the case. - - As that is the only job recorded for this node we can conclude that the cluster started the resource elsewhere. +
+ + In the above example, the job is a non-recurring monitor operation often referred to as a "probe" for the apcstonith resource. + The cluster schedules probes for every configured resource on when a new node starts, in order to determine the resource's current state before it takes any further action. + + + From the transition-key, we can see that this was the 22nd action of the 2nd graph produced by this instance of the crmd (2668bbeb-06d5-40f9-936d-24cb7f87006a). + The third field of the transition-key contains a 7, this indicates that the job expects to find the resource inactive. + By looking at the rc-code property, we see that this was the case. + + As that is the only job recorded for this node we can conclude that the cluster started the resource elsewhere.
- Complex Resource History Example -
- Resource history of a pingd clone with multiple jobs + Complex Resource History Example +
+ Resource history of a pingd clone with multiple jobs - ]]> -
- - When more than one job record exists, it is important to first sort them by call-id before interpreting them. - Once sorted, the above example can be summarized as: - - A non-recurring monitor operation returning 7 (not running), with a call-id of 3 - A stop operation returning 0 (success), with a call-id of 32 - A start operation returning 0 (success), with a call-id of 33 - A recurring monitor returning 0 (success), with a call-id of 34 - - - - The cluster processes each job record to build up a picture of the resource's state. - After the first and second entries, it is considered stopped and after the third it considered active. - Based on the last operation, we can tell that the resource is currently active. - - - Additionally, from the presence of a stop operation with a lower call-id than that of the start operation, we can conclude that the resource has been restarted. - Specifically this occurred as part of actions 11 and 31 of transition 11 from the crmd instance with the key 2668bbeb.... - This information can be helpful for locating the relevant section of the logs when looking for the source of a failure. - +
+ + When more than one job record exists, it is important to first sort them by call-id before interpreting them. + Once sorted, the above example can be summarized as: + + A non-recurring monitor operation returning 7 (not running), with a call-id of 3 + A stop operation returning 0 (success), with a call-id of 32 + A start operation returning 0 (success), with a call-id of 33 + A recurring monitor returning 0 (success), with a call-id of 34 + + + + The cluster processes each job record to build up a picture of the resource's state. + After the first and second entries, it is considered stopped and after the third it considered active. + Based on the last operation, we can tell that the resource is currently active. + + + Additionally, from the presence of a stop operation with a lower call-id than that of the start operation, we can conclude that the resource has been restarted. + Specifically this occurred as part of actions 11 and 31 of transition 11 from the crmd instance with the key 2668bbeb.... + This information can be helpful for locating the relevant section of the logs when looking for the source of a failure. +
diff --git a/doc/Pacemaker_Explained/en-US/Ch-Stonith.xml b/doc/Pacemaker_Explained/en-US/Ch-Stonith.xml index b908562ef9..1ffa5575d2 100644 --- a/doc/Pacemaker_Explained/en-US/Ch-Stonith.xml +++ b/doc/Pacemaker_Explained/en-US/Ch-Stonith.xml @@ -1,155 +1,155 @@ Protecting Your Data - STONITH
Why You Need STONITH STONITH is an acronym for Shoot-The-Other-Node-In-The-Head; its purpose is to protect your data from being corrupted by rogue nodes or concurrent access. - When a node is unresponsive it might still access your data. - The only way to be 100% sure that your data is safe, is to use STONITH, so we can be certain that the node is truly offline, before allowing the data to be accessed from another node. + When a node is unresponsive it might still access your data. + The only way to be 100% sure that your data is safe, is to use STONITH, so we can be certain that the node is truly offline, before allowing the data to be accessed from another node. - STONITH also has a role to play in the event that a clustered service cannot be stopped. - In this case, the cluster uses STONITH to force the whole node offline, thereby making it safe to start the service elsewhere. + STONITH also has a role to play in the event that a clustered service cannot be stopped. + In this case, the cluster uses STONITH to force the whole node offline, thereby making it safe to start the service elsewhere.
What STONITH Device Should You Use It is crucial that the STONITH device can allow the cluster to differentiate between a node and a network failure. - The biggest mistake people make in choosing a STONITH device is to use a remote power switch (such as many on-board IPMI controllers) that shares power with the node it controls. - In such cases, the cluster cannot be sure if the node is really offline, or active and suffering from a network fault. + The biggest mistake people make in choosing a STONITH device is to use a remote power switch (such as many on-board IPMI controllers) that shares power with the node it controls. + In such cases, the cluster cannot be sure if the node is really offline, or active and suffering from a network fault. Likewise, any device that relies on the machine being active (such as SSH-based "devices" used during testing) are inappropriate.
Configuring STONITH - + Find the correct driver: stonith_admin --list-installed - - + + Since every device is different, the parameters needed to configure it will vary. To find out which parameters the device supports resp. needs, run: stonith_admin --metadata --agent type - The output should be XML formatted text containing additional parameter descriptions. We + The output should be XML formatted text containing additional parameter descriptions. We will endeavour to make the output more friendly in a later version. - - + + Create a file called stonith.xml containing a primitive resource with a class of stonith, a type of type and a parameter for each of the values returned in step 2. If the device does not know how to fence nodes based on their uname, you may also need to set the special pcmk_host_map parameter. See man stonithd for details. If the device does not support the list command, you may also need to set the special pcmk_host_list and/or pcmk_host_check parameters. See man stonithd for details. If the device does not expect the victim to be specified with the port parameter, you may also need to set the special pcmk_host_argument parameter. See man stonithd for details. - + Upload it into the CIB using cibadmin: cibadmin -C -o resources --xml-file stonith.xml Once the stonith resource is running, you can test it by executing: stonith_admin --reboot nodename. Although you might want to stop the cluster on that machine first.
- Example - Assuming we have an chassis containing four nodes and an IPMI device active on 10.0.0.1, then + Example + Assuming we have an chassis containing four nodes and an IPMI device active on 10.0.0.1, then we would chose the fence_ipmilan driver in step 2 and obtain the following list of parameters: -
- Obtaining a list of STONITH Parameters +
+ Obtaining a list of STONITH Parameters # stonith_admin --metadata -a fence_ipmilan fence_ipmilan is an I/O Fencing agent which can be used with machines controlled by IPMI. This agent calls support software using ipmitool (http://ipmitool.sf.net/). To use fence_ipmilan with HP iLO 3 you have to enable lanplus option (lanplus / -P) and increase wait after operation to 4 seconds (power_wait=4 / -T 4) IPMI Lan Auth type (md5, password, or none) IPMI Lan IP to talk to Password to control power on IPMI device Script to retrieve password (if required) Use Lanplus Username/Login to control IPMI device Operation to perform. Valid operations: on, off, reboot, status, list, diag, monitor or metadata Timeout (sec) for IPMI operation Ciphersuite to use (same as ipmitool -C parameter) Method to fence (onoff or cycle) Wait X seconds after on/off operation Wait X seconds before fencing is started Verbose mode - - - + + + ]]> -
- From this list we would create a STONITH resource fragment that might look like this: - - Sample STONITH Resource - +
+ From this list we would create a STONITH resource fragment that might look like this: + + Sample STONITH Resource + ]]> - + The monitor interval of two hours is explained by bugs in some IPMI implementations; see Monitoring the fencing devices.
diff --git a/doc/Pacemaker_Explained/en-US/NOTES b/doc/Pacemaker_Explained/en-US/NOTES index 7782aefee8..ae5069b559 100644 --- a/doc/Pacemaker_Explained/en-US/NOTES +++ b/doc/Pacemaker_Explained/en-US/NOTES @@ -1,65 +1,69 @@ That's a "+", not a hyphen: Key combinations can be distinguished from keycaps by the hyphen connecting each part of a key combination. For example: Press Enter to execute the command. Press Ctrl+Alt+F2 to switch to the first virtual terminal. Press Ctrl+Alt+F1 to return to your X-Windows session. doesn't apply here: If source code is discussed, class names, methods, functions, v including application names; dialog box text; labeled buttons; check-box and radio button labels; menu titles and sub-menu titles. 1.2 terminal output has page-break 2.3 editing via VI isn't that racy? Are concurrent changes detected? why sometimes and sometimes
? example 2.2 has title at top, different to the figures 2.8 header slightly too long, line broken some are in , some in ... I'd like the latter more, or perhaps in a . Indentation makes whitespace at start of lines ... remove? +Chapter 3 +========= +- table 3.3 "Properties maintained by the Cluster" incomplete (crm-feature-set, ...) + 4.4.2 structure different from 4.4.1 ... numbered lists 5.3 Notes have next content overlaid ex 5.6: 1.0 ???? perhaps use 10.20.30.40 instead of the 1.2.3.4 example IP address? 6.5 images/resource-set.png missing, "images/two-sets.png" too; images/three-sets; "images/three-sets-complex.png" Ch 7 missing? Remove Ex9.9? collocate or colocate? Eg. in C.1: Multi-dimensional colocation and ordering constraints. See Section 6.5, “Ordering Sets of Resources” and Section 6.6, “Collocating Sets of Resources” Ap-Debug.xml not used? alias for primary? diff --git a/doc/Pacemaker_Explained/en-US/Revision_History.xml b/doc/Pacemaker_Explained/en-US/Revision_History.xml index 9df727a79b..b3b43ea2d9 100644 --- a/doc/Pacemaker_Explained/en-US/Revision_History.xml +++ b/doc/Pacemaker_Explained/en-US/Revision_History.xml @@ -1,33 +1,33 @@ Revision History 1 19 Oct 2009 - AndrewBeekhofandrew@beekhof.net - Import from Pages.app + AndrewBeekhofandrew@beekhof.net + Import from Pages.app 2 26 Oct 2009 - AndrewBeekhofandrew@beekhof.net - Cleanup and reformatting of docbook xml complete + AndrewBeekhofandrew@beekhof.net + Cleanup and reformatting of docbook xml complete - 3 - Tue Nov 12 2009 - AndrewBeekhofandrew@beekhof.net - - - Split book into chapters and pass validation - Re-organize book for use with Publican - - + 3 + Tue Nov 12 2009 + AndrewBeekhofandrew@beekhof.net + + + Split book into chapters and pass validation + Re-organize book for use with Publican + + diff --git a/doc/Pacemaker_Explained/pot/Ch-Options.pot b/doc/Pacemaker_Explained/pot/Ch-Options.pot index f05dfb2e8d..9d614a581a 100644 --- a/doc/Pacemaker_Explained/pot/Ch-Options.pot +++ b/doc/Pacemaker_Explained/pot/Ch-Options.pot @@ -1,495 +1,485 @@ # # AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: 0\n" "POT-Creation-Date: 2012-02-27T09:17:56\n" "PO-Revision-Date: 2012-02-27T09:17:56\n" "Last-Translator: Automatically generated\n" "Language-Team: None\n" "MIME-Version: 1.0\n" "Content-Type: application/x-publican; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Tag: title #, no-c-format msgid "Cluster Options" msgstr "" #. Tag: title #, no-c-format msgid "Special Options" msgstr "" #. Tag: para #, no-c-format msgid " Special Cluster Options Cluster OptionsSpecial Options Special Options " msgstr "" #. Tag: para #, no-c-format msgid "The reason for these fields to be placed at the top level instead of with the rest of cluster options is simply a matter of parsing. These options are used by the configuration database which is, by design, mostly ignorant of the content it holds. So the decision was made to place them in an easy to find location." msgstr "" #. Tag: title #, no-c-format msgid "Configuration Version" msgstr "" #. Tag: para #, no-c-format msgid " Configuration VersionCluster Option Cluster Option Cluster OptionsConfiguration Version Configuration Version " msgstr "" #. Tag: para #, no-c-format msgid "When a node joins the cluster, the cluster will perform a check to see who has the best configuration based on the fields below. It then asks the node with the highest (admin_epoch, epoch, num_updates) tuple to replace the configuration on all the nodes - which makes setting them, and setting them correctly, very important." msgstr "" #. Tag: title #, no-c-format msgid "Configuration Version Properties" msgstr "" #. Tag: entry #, no-c-format msgid "Field" msgstr "" #. Tag: entry #, no-c-format msgid "Description" msgstr "" #. Tag: para #, no-c-format msgid "admin_epoch" msgstr "" #. Tag: para #, no-c-format msgid " admin_epoch Cluster Option Cluster Optionsadmin_epoch admin_epoch Never modified by the cluster. Use this to make the configurations on any inactive nodes obsolete." msgstr "" #. Tag: para #, no-c-format msgid "Never set this value to zero, in such cases the cluster cannot tell the difference between your configuration and the \"empty\" one used when nothing is found on disk." msgstr "" #. Tag: para #, no-c-format msgid "epoch" msgstr "" #. Tag: para #, no-c-format msgid " epoch Cluster Option Cluster Optionsepoch epoch Incremented every time the configuration is updated (usually by the admin)" msgstr "" #. Tag: para #, no-c-format msgid "num_updates" msgstr "" #. Tag: para #, no-c-format msgid " num_updates Cluster Option Cluster Optionsnum_updates num_updates Incremented every time the configuration or status is updated (usually by the cluster)" msgstr "" #. Tag: title #, no-c-format msgid "Other Fields" msgstr "" #. Tag: title #, no-c-format msgid "Properties Controlling Validation" msgstr "" #. Tag: para #, no-c-format msgid "validate-with" msgstr "" #. Tag: para #, no-c-format msgid " validate-with Cluster Option Cluster Optionsvalidate-with validate-with Determines the type of validation being done on the configuration. If set to \"none\", the cluster will not verify that updates conform to the DTD (nor reject ones that don’t). This option can be useful when operating a mixed version cluster during an upgrade." msgstr "" #. Tag: title #, no-c-format msgid "Fields Maintained by the Cluster" msgstr "" #. Tag: title #, no-c-format msgid "Properties Maintained by the Cluster" msgstr "" -#. Tag: para -#, no-c-format -msgid "crm-debug-origin" -msgstr "" - -#. Tag: para -#, no-c-format -msgid " crm-debug-origin Cluster Fields Cluster Fieldscrm-debug-origin crm-debug-origin Indicates where the last update came from. Informational purposes only." -msgstr "" - #. Tag: para #, no-c-format msgid "cib-last-written" msgstr "" #. Tag: para #, no-c-format msgid " cib-last-written Cluster Fields Cluster Fieldscib-last-written cib-last-written Indicates when the configuration was last written to disk. Informational purposes only." msgstr "" #. Tag: para #, no-c-format msgid "dc-uuid" msgstr "" #. Tag: para #, no-c-format msgid " dc-uuid Cluster Fields Cluster Fieldsdc-uuid dc-uuid Indicates which cluster node is the current leader. Used by the cluster when placing resources and determining the order of some events." msgstr "" #. Tag: para #, no-c-format msgid "have-quorum" msgstr "" #. Tag: para #, no-c-format msgid " have-quorum Cluster Fields Cluster Fieldshave-quorum have-quorum Indicates if the cluster has quorum. If false, this may mean that the cluster cannot start resources or fence other nodes. See no-quorum-policy below." msgstr "" #. Tag: para #, no-c-format msgid "Note that although these fields can be written to by the admin, in most cases the cluster will overwrite any values specified by the admin with the \"correct\" ones. To change the admin_epoch, for example, one would use:" msgstr "" #. Tag: para #, no-c-format msgid "cibadmin --modify --crm_xml ‘<cib admin_epoch=\"42\"/>'" msgstr "" #. Tag: para #, no-c-format msgid "A complete set of fields will look something like this:" msgstr "" #. Tag: programlisting #, no-c-format msgid "<cib have-quorum=\"true\" validate-with=\"pacemaker-1.0\"\n" " admin_epoch=\"1\" epoch=\"12\" num_updates=\"65\"\n" " dc-uuid=\"ea7d39f4-3b94-4cfa-ba7a-952956daabee\">" msgstr "" #. Tag: para #, no-c-format msgid "Cluster options, as you might expect, control how the cluster behaves when confronted with certain situations." msgstr "" #. Tag: para #, no-c-format msgid "They are grouped into sets and, in advanced configurations, there may be more than one. This will be described later in the section on <xref linkend=\"ch-rules\"/> where we will show how to have the cluster use different sets of options during working hours (when downtime is usually to be avoided at all costs) than it does during the weekends (when resources can be moved to the their preferred hosts without bothering end users) For now we will describe the simple case where each option is present at most once." msgstr "" #. Tag: title #, no-c-format msgid "Available Cluster Options" msgstr "" #. Tag: entry #, no-c-format msgid "Option" msgstr "" #. Tag: entry #, no-c-format msgid "Default" msgstr "" #. Tag: para #, no-c-format msgid "batch-limit" msgstr "" #. Tag: para #, no-c-format msgid "30" msgstr "" #. Tag: para #, no-c-format msgid " batch-limit Cluster Options Cluster Optionsbatch-limit batch-limit The number of jobs that the TE is allowed to execute in parallel. The \"correct\" value will depend on the speed and load of your network and cluster nodes." msgstr "" #. Tag: para #, no-c-format msgid "no-quorum-policy" msgstr "" #. Tag: para #, no-c-format msgid "stop" msgstr "" #. Tag: para #, no-c-format msgid " no-quorum-policy Cluster Options Cluster Optionsno-quorum-policy no-quorum-policy What to do when the cluster does not have quorum. Allowed values:" msgstr "" #. Tag: para #, no-c-format msgid "* ignore - continue all resource management * freeze - continue resource management, but don’t recover resources from nodes not in the affected partition * stop - stop all resources in the affected cluster partition * suicide - fence all nodes in the affected cluster partition" msgstr "" #. Tag: para #, no-c-format msgid "symmetric-cluster" msgstr "" #. Tag: para #, no-c-format msgid "TRUE" msgstr "" #. Tag: para #, no-c-format msgid " symmetric-cluster Cluster Options Cluster Optionssymmetric-cluster symmetric-cluster Can all resources run on any node by default?" msgstr "" #. Tag: para #, no-c-format msgid "stonith-enabled" msgstr "" #. Tag: para #, no-c-format msgid " stonith-enabled Cluster Options Cluster Optionsstonith-enabled stonith-enabled Should failed nodes and nodes with resources that can’t be stopped be shot? If you value your data, set up a STONITH device and enable this." msgstr "" #. Tag: para #, no-c-format msgid "If true, or unset, the cluster will refuse to start resources unless one or more STONITH resources have been configured also." msgstr "" #. Tag: para #, no-c-format msgid "stonith-action" msgstr "" #. Tag: para #, no-c-format msgid "reboot" msgstr "" #. Tag: para #, no-c-format msgid " stonith-action Cluster Options Cluster Optionsstonith-action stonith-action Action to send to STONITH device. Allowed values: reboot, poweroff." msgstr "" #. Tag: para #, no-c-format msgid "cluster-delay" msgstr "" #. Tag: para #, no-c-format msgid "60s" msgstr "" #. Tag: para #, no-c-format msgid " cluster-delay Cluster Options Cluster Optionscluster-delay cluster-delay Round trip delay over the network (excluding action execution). The \"correct\" value will depend on the speed and load of your network and cluster nodes." msgstr "" #. Tag: para #, no-c-format msgid "stop-orphan-resources" msgstr "" #. Tag: para #, no-c-format msgid " stop-orphan-resources Cluster Options Cluster Optionsstop-orphan-resources stop-orphan-resources Should deleted resources be stopped?" msgstr "" #. Tag: para #, no-c-format msgid "stop-orphan-actions" msgstr "" #. Tag: para #, no-c-format msgid " stop-orphan-actions Cluster Options Cluster Optionsstop-orphan-actions stop-orphan-actions Should deleted actions be cancelled?" msgstr "" #. Tag: para #, no-c-format msgid "start-failure-is-fatal" msgstr "" #. Tag: para #, no-c-format msgid " start-failure-is-fatal Cluster Options Cluster Optionsstart-failure-is-fatal start-failure-is-fatal When set to FALSE, the cluster will instead use the resource’s failcount and value for resource-failure-stickiness." msgstr "" #. Tag: para #, no-c-format msgid "pe-error-series-max" msgstr "" #. Tag: para #, no-c-format msgid "-1 (all)" msgstr "" #. Tag: para #, no-c-format msgid " pe-error-series-max Cluster Options Cluster Optionspe-error-series-max pe-error-series-max The number of PE inputs resulting in ERRORs to save. Used when reporting problems." msgstr "" #. Tag: para #, no-c-format msgid "pe-warn-series-max" msgstr "" #. Tag: para #, no-c-format msgid " pe-warn-series-max Cluster Options Cluster Optionspe-warn-series-max pe-warn-series-max The number of PE inputs resulting in WARNINGs to save. Used when reporting problems." msgstr "" #. Tag: para #, no-c-format msgid "pe-input-series-max" msgstr "" #. Tag: para #, no-c-format msgid " pe-input-series-max Cluster Options Cluster Optionspe-input-series-max pe-input-series-max The number of \"normal\" PE inputs to save. Used when reporting problems." msgstr "" #. Tag: para #, no-c-format msgid "You can always obtain an up-to-date list of cluster options, including their default values, by running the pengine metadata command." msgstr "" #. Tag: title #, no-c-format msgid "Querying and Setting Cluster Options" msgstr "" #. Tag: para #, no-c-format msgid " Querying Cluster Options Setting Cluster Options Cluster OptionsQuerying Querying Cluster OptionsSetting Setting " msgstr "" #. Tag: para #, no-c-format msgid "Cluster options can be queried and modified using the crm_attribute tool. To get the current value of cluster-delay, simply use:" msgstr "" #. Tag: para #, no-c-format msgid "crm_attribute --attr-name cluster-delay --get-value" msgstr "" #. Tag: para #, no-c-format msgid "which is more simply written as" msgstr "" #. Tag: para #, no-c-format msgid "crm_attribute --get-value -n cluster-delay" msgstr "" #. Tag: para #, no-c-format msgid "If a value is found, you’ll see a result like this:" msgstr "" #. Tag: para #, no-c-format msgid " # crm_attribute --get-value -n cluster-delay" msgstr "" #. Tag: literallayout #, no-c-format msgid "name=cluster-delay value=60s" msgstr "" #. Tag: para #, no-c-format msgid "However, if no value is found, the tool will display an error:" msgstr "" #. Tag: para #, no-c-format msgid "# crm_attribute --get-value -n clusta-deway" msgstr "" #. Tag: literallayout #, no-c-format msgid "name=clusta-deway value=(null)\n" "Error performing operation: The object/attribute does not exist" msgstr "" #. Tag: para #, no-c-format msgid "To use a different value, eg. 30, simply run:" msgstr "" #. Tag: para #, no-c-format msgid "crm_attribute --attr-name cluster-delay --attr-value 30s" msgstr "" #. Tag: para #, no-c-format msgid "To go back to the cluster’s default value you can delete the value, for example with this command:" msgstr "" #. Tag: para #, no-c-format msgid "crm_attribute --attr-name cluster-delay --delete-attr" msgstr "" #. Tag: title #, no-c-format msgid "When Options are Listed More Than Once" msgstr "" #. Tag: para #, no-c-format msgid "If you ever see something like the following, it means that the option you’re modifying is present more than once." msgstr "" #. Tag: title #, no-c-format msgid "Deleting an option that is listed twice" msgstr "" #. Tag: para #, no-c-format msgid "# crm_attribute --attr-name batch-limit --delete-attr" msgstr "" #. Tag: literallayout #, no-c-format msgid "Multiple attributes match name=batch-limit in crm_config:\n" "Value: 50 (set=cib-bootstrap-options, id=cib-bootstrap-options-batch-limit)\n" "Value: 100 (set=custom, id=custom-batch-limit)\n" "Please choose from one of the matches above and supply the 'id' with --attr-id" msgstr "" #. Tag: para #, no-c-format msgid "In such cases follow the on-screen instructions to perform the requested action. To determine which value is currently being used by the cluster, please refer to the section on <xref linkend=\"ch-rules\"/>." msgstr "" diff --git a/doc/Pacemaker_Explained/pot/Ch-Resources.pot b/doc/Pacemaker_Explained/pot/Ch-Resources.pot index 55525a15ec..9239760092 100644 --- a/doc/Pacemaker_Explained/pot/Ch-Resources.pot +++ b/doc/Pacemaker_Explained/pot/Ch-Resources.pot @@ -1,959 +1,959 @@ # # AUTHOR , YEAR. # msgid "" msgstr "" "Project-Id-Version: 0\n" "POT-Creation-Date: 2012-02-27T09:17:56\n" "PO-Revision-Date: 2012-02-27T09:17:56\n" "Last-Translator: Automatically generated\n" "Language-Team: None\n" "MIME-Version: 1.0\n" "Content-Type: application/x-publican; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Tag: title #, no-c-format msgid "Cluster Resources" msgstr "" #. Tag: title #, no-c-format msgid "What is a Cluster Resource" msgstr "" #. Tag: indexterm #, no-c-format msgid "ResourceDescription" msgstr "" #. Tag: para #, no-c-format msgid "The role of a resource agent is to abstract the service it provides and present a consistent view to the cluster, which allows the cluster to be agnostic about the resources it manages. The cluster doesn't need to understand how the resource works because it relies on the resource agent to do the right thing when given a start, stop or monitor command." msgstr "" #. Tag: para #, no-c-format msgid "For this reason it is crucial that resource agents are well tested." msgstr "" #. Tag: para #, no-c-format msgid "Typically resource agents come in the form of shell scripts, however they can be written using any technology (such as C, Python or Perl) that the author is comfortable with." msgstr "" #. Tag: title #, no-c-format msgid "Supported Resource Classes" msgstr "" #. Tag: indexterm #, no-c-format msgid "ResourceClasses" msgstr "" #. Tag: para #, no-c-format msgid "There are three basic classes of agents supported by Pacemaker. In order of encouraged usage they are:" msgstr "" #. Tag: title #, no-c-format msgid "Open Cluster Framework" msgstr "" #. Tag: indexterm #, no-c-format msgid "ResourceOCF" msgstr "" #. Tag: indexterm #, no-c-format msgid "OCFResources" msgstr "" #. Tag: indexterm #, no-c-format msgid "Open Cluster FrameworkResources" msgstr "" #. Tag: para #, no-c-format msgid "The OCF Spec - at least as it relates to resource agents.'Note: The Pacemaker implementation has been somewhat extended from the OCF Specs, but none of those changes are incompatible with the original OCF specification. is basically an extension of the Linux Standard Base conventions for init scripts to" msgstr "" #. Tag: para #, no-c-format msgid "support parameters," msgstr "" #. Tag: para #, no-c-format msgid "make them self describing and" msgstr "" #. Tag: para #, no-c-format msgid "extensible" msgstr "" #. Tag: para #, no-c-format msgid "OCF specs have strict definitions of the exit codes that actions must return Included with the cluster is the ocf-tester script, which can be useful in this regard. . The cluster follows these specifications exactly, and giving the wrong exit code will cause the cluster to behave in ways you will likely find puzzling and annoying. In particular, the cluster needs to distinguish a completely stopped resource from one which is in some erroneous and indeterminate state." msgstr "" #. Tag: para #, no-c-format msgid "Parameters are passed to the script as environment variables, with the special prefix OCF_RESKEY_. So, a parameter which the user thinks of as ip it will be passed to the script as OCF_RESKEY_ip. The number and purpose of the parameters is completely arbitrary, however your script should advertise any that it supports using the meta-data command." msgstr "" #. Tag: para #, no-c-format msgid "The OCF class is the most preferred one as it is an industry standard, highly flexible (allowing parameters to be passed to agents in a non-positional manner) and self-describing." msgstr "" #. Tag: para #, no-c-format msgid "For more information, see the reference and ." msgstr "" #. Tag: title #, no-c-format msgid "Linux Standard Base" msgstr "" #. Tag: indexterm #, no-c-format msgid "ResourceLSB" msgstr "" #. Tag: indexterm #, no-c-format msgid "LSBResources" msgstr "" #. Tag: indexterm #, no-c-format msgid "Linus Standard BaseResources" msgstr "" #. Tag: para #, no-c-format msgid "LSB resource agents are those typically found in /etc/init.d. Generally they are provided by the OS/distribution and, in order to be used with the cluster, they must conform to the LSB Spec See for the LSB Spec (as it relates to init scripts). ." msgstr "" #. Tag: para #, no-c-format msgid "Many distributions claim LSB compliance but ship with broken init scripts. To see if your init script is LSB-compatible, see the FAQ entry . The most common problems are:" msgstr "" #. Tag: para #, no-c-format msgid "Not implementing the status operation at all" msgstr "" #. Tag: para #, no-c-format msgid "Not observing the correct exit status codes for start/stop/status actions" msgstr "" #. Tag: para #, no-c-format msgid "Starting a started resource returns an error (this violates the LSB spec)" msgstr "" #. Tag: para #, no-c-format msgid "Stopping a stopped resource returns an error (this violates the LSB spec)" msgstr "" #. Tag: title #, no-c-format msgid "Legacy Heartbeat" msgstr "" #. Tag: indexterm #, no-c-format msgid "ResourceHeartbeat (legacy)" msgstr "" #. Tag: indexterm #, no-c-format msgid "HeartbeatLegacy Resources" msgstr "" #. Tag: para #, no-c-format msgid "Version 1 of Heartbeat came with its own style of resource agents and it is highly likely that many people have written their own agents based on its conventions. To enable administrators to continue to use these agents, they are supported by the new cluster manager See for more information.." msgstr "" #. Tag: title #, no-c-format msgid "STONITH" msgstr "" #. Tag: indexterm #, no-c-format msgid "ResourceSTONITH" msgstr "" #. Tag: indexterm #, no-c-format msgid "STONITHResources" msgstr "" #. Tag: para #, no-c-format msgid "There is also an additional class, STONITH, which is used exclusively for fencing related resources. This is discussed later in ." msgstr "" #. Tag: title #, no-c-format msgid "Properties" msgstr "" #. Tag: para #, no-c-format msgid "These values tell the cluster which script to use for the resource, where to find that script and what standards it conforms to." msgstr "" #. Tag: title #, no-c-format msgid "Properties of a Primitive Resource" msgstr "" #. Tag: entry #, no-c-format msgid "Field" msgstr "" #. Tag: entry #, no-c-format msgid "Description" msgstr "" #. Tag: entry #, no-c-format msgid "id id" msgstr "" #. Tag: entry #, no-c-format msgid "Your name for the resource" msgstr "" #. Tag: entry #, no-c-format msgid "classResource Field ResourceFieldclass class" msgstr "" #. Tag: entry #, no-c-format msgid "The standard the script conforms to. Allowed values: heartbeat, lsb, ocf, stonith" msgstr "" #. Tag: entry #, no-c-format msgid "typeResource Field ResourceFieldtype type" msgstr "" #. Tag: entry #, no-c-format msgid "The name of the Resource Agent you wish to use. Eg. IPaddr or Filesystem" msgstr "" #. Tag: entry #, no-c-format msgid "providerResource Field ResourceFieldprovider provider" msgstr "" #. Tag: entry #, no-c-format msgid "The OCF spec allows multiple vendors to supply the same ResourceAgent. To use the OCF resource agents supplied with Heartbeat, you should specify heartbeat here." msgstr "" #. Tag: para #, no-c-format msgid "Resource definitions can be queried with the crm_resource tool. For example" msgstr "" #. Tag: screen #, no-c-format msgid "crm_resource --resource Email --query-xml" msgstr "" #. Tag: para #, no-c-format msgid "might produce" msgstr "" #. Tag: title #, no-c-format msgid "An example LSB resource" msgstr "" #. Tag: programlisting #, no-c-format msgid "<primitive id=\"Email\" class=\"lsb\" type=\"exim\"/>\n" " " msgstr "" #. Tag: para #, no-c-format msgid "One of the main drawbacks to LSB resources is that they do not allow any parameters!" msgstr "" #. Tag: para #, no-c-format msgid "Example for an OCF resource:" msgstr "" #. Tag: title #, no-c-format msgid "An example OCF resource" msgstr "" #. Tag: programlisting #, no-c-format msgid "<primitive id=\"Public-IP\" class=\"ocf\" type=\"IPaddr\" provider=\"heartbeat\">\n" " <instance_attributes id=\"params-public-ip\">\n" " <nvpair id=\"public-ip-addr\" name=\"ip\" value=\"1.2.3.4\"/>\n" " </instance_attributes>\n" " </primitive> " msgstr "" #. Tag: para #, no-c-format msgid "Or, finally for the equivalent legacy Heartbeat resource:" msgstr "" #. Tag: title #, no-c-format msgid "An example Heartbeat resource" msgstr "" #. Tag: programlisting #, no-c-format msgid " <primitive id=\"Public-IP-legacy\" class=\"heartbeat\" type=\"IPaddr\">\n" " <instance_attributes id=\"params-public-ip-legacy\">\n" " <nvpair id=\"public-ip-addr-legacy\" name=\"1\" value=\"1.2.3.4\"/>\n" " </instance_attributes>\n" " </primitive> " msgstr "" #. Tag: para #, no-c-format msgid "Heartbeat resources take only ordered and unnamed parameters. The supplied name therefore indicates the order in which they are passed to the script. Only single digit values are allowed." msgstr "" #. Tag: title #, no-c-format msgid "Resource Options" msgstr "" #. Tag: para #, no-c-format msgid "Options are used by the cluster to decide how your resource should behave and can be easily set using the --meta option of the crm_resource command." msgstr "" #. Tag: title #, no-c-format msgid "Options for a Primitive Resource" msgstr "" #. Tag: entry #, no-c-format msgid "Default" msgstr "" #. Tag: entry #, no-c-format msgid "priorityResource Option ResourceOptionpriority priority" msgstr "" #. Tag: entry #, no-c-format msgid "0" msgstr "" #. Tag: entry #, no-c-format msgid "If not all resources can be active, the cluster will stop lower priority resources in order to keep higher priority ones active." msgstr "" #. Tag: entry #, no-c-format msgid "target-roleResource Option ResourceOptiontarget-role target-role" msgstr "" #. Tag: entry #, no-c-format msgid "Started" msgstr "" #. Tag: para #, no-c-format msgid "What state should the cluster attempt to keep this resource in? Allowed values:" msgstr "" #. Tag: para #, no-c-format msgid "Stopped - Force the resource to be stopped" msgstr "" #. Tag: para #, no-c-format msgid "Started - Allow the resource to be started (In the case of multi-state resources, they will not promoted to master)" msgstr "" #. Tag: para #, no-c-format msgid "Master - Allow the resource to be started and, if appropriate, promoted" msgstr "" #. Tag: entry #, no-c-format msgid "is-managedResource Option ResourceOptionis-managed is-managed" msgstr "" #. Tag: entry #, no-c-format msgid "TRUE" msgstr "" #. Tag: entry #, no-c-format msgid "Is the cluster allowed to start and stop the resource? Allowed values: true, false" msgstr "" #. Tag: entry #, no-c-format msgid "resource-stickinessResource Option ResourceOptionresource-stickiness resource-stickiness" msgstr "" #. Tag: entry #, no-c-format msgid "Inherited" msgstr "" #. Tag: entry #, no-c-format msgid "How much does the resource prefer to stay where it is? Defaults to the value of resource-stickiness in the rsc_defaults section" msgstr "" #. Tag: entry #, no-c-format msgid "migration-thresholdResource Option ResourceOptionmigration-threshold migration-threshold" msgstr "" #. Tag: entry #, no-c-format msgid "INFINITY (disabled)" msgstr "" #. Tag: entry #, no-c-format msgid "How many failures may occur for this resource on a node, before this node is marked ineligible to host this resource." msgstr "" #. Tag: entry #, no-c-format msgid "failure-timeoutResource Option ResourceOptionfailure-timeout failure-timeout" msgstr "" #. Tag: entry #, no-c-format msgid "0 (disabled)" msgstr "" #. Tag: entry #, no-c-format msgid "How many seconds to wait before acting as if the failure had not occurred, and potentially allowing the resource back to the node on which it failed." msgstr "" #. Tag: entry #, no-c-format msgid "multiple-activeResource Option ResourceOptionmultiple-active multiple-active" msgstr "" #. Tag: entry #, no-c-format msgid "stop_start" msgstr "" #. Tag: para #, no-c-format msgid "What should the cluster do if it ever finds the resource active on more than one node. Allowed values:" msgstr "" #. Tag: para #, no-c-format msgid "block - mark the resource as unmanaged" msgstr "" #. Tag: para #, no-c-format msgid "stop_only - stop all active instances and leave them that way" msgstr "" #. Tag: para #, no-c-format msgid "stop_start - stop all active instances and start the resource in one location only" msgstr "" #. Tag: para #, no-c-format msgid "If you performed the following commands on the previous LSB Email resource" msgstr "" #. Tag: screen #, no-c-format msgid "crm_resource --meta --resource Email --set-parameter priority --property-value 100\n" " crm_resource --meta --resource Email --set-parameter multiple-active --property-value block\n" " " msgstr "" #. Tag: para #, no-c-format msgid "the resulting resource definition would be" msgstr "" #. Tag: title #, no-c-format msgid "An LSB resource with cluster options" msgstr "" #. Tag: programlisting #, no-c-format msgid "<primitive id=\"Email\" class=\"lsb\" type=\"exim\">\n" " <meta_attributes id=\"meta-email\">\n" " <nvpair id=\"email-priority\" name=\"priority\" value=\"100\"/>\n" " <nvpair id=\"email-active\" name=\"multiple-active\" value=\"block\"/>\n" " </meta_attributes>\n" " </primitive> " msgstr "" #. Tag: title #, no-c-format msgid "Setting Global Defaults for Resource Options" msgstr "" #. Tag: para #, no-c-format msgid "To set a default value for a resource option, simply add it to the rsc_defaults section with crm_attribute. Thus," msgstr "" #. Tag: para #, no-c-format msgid "crm_attribute --type rsc_defaults --attr-name is-managed --attr-value false" msgstr "" #. Tag: para #, no-c-format msgid "would prevent the cluster from starting or stopping any of the resources in the configuration (unless of course the individual resources were specifically enabled and had is-managed set to true)." msgstr "" #. Tag: title #, no-c-format msgid "Instance Attributes" msgstr "" #. Tag: para #, no-c-format msgid "The scripts of some resource classes (LSB not being one of them) can be given parameters which determine how they behave and which instance of a service they control." msgstr "" #. Tag: para #, no-c-format msgid "If your resource agent supports parameters, you can add them with the crm_resource command. For instance" msgstr "" #. Tag: programlisting #, no-c-format msgid "crm_resource --resource Public-IP --set-parameter ip --property-value 1.2.3.4" msgstr "" #. Tag: para #, no-c-format msgid "would create an entry in the resource like this:" msgstr "" #. Tag: title #, no-c-format msgid "An example OCF resource with instance attributes" msgstr "" #. Tag: programlisting #, no-c-format msgid " <primitive id=\"Public-IP\" class=\"ocf\" type=\"IPaddr\" provider=\"heartbeat\">\n" " <instance_attributes id=\"params-public-ip\">\n" " <nvpair id=\"public-ip-addr\" name=\"ip\" value=\"1.2.3.4\"/>\n" " </instance_attributes>\n" " </primitive> " msgstr "" #. Tag: para #, no-c-format msgid "For an OCF resource, the result would be an environment variable called OCF_RESKEY_ip with a value of 1.2.3.4." msgstr "" #. Tag: para #, no-c-format msgid "The list of instance attributes supported by an OCF script can be found by calling the resource script with the meta-data command. The output contains an XML description of all the supported attributes, their purpose and default values." msgstr "" #. Tag: title #, no-c-format msgid "Displaying the metadata for the Dummy resource agent template" msgstr "" #. Tag: programlisting #, no-c-format msgid "export OCF_ROOT=/usr/lib/ocf; $OCF_ROOT/resource.d/pacemaker/Dummy meta-data\n" " <?xml version=\"1.0\"?>\n" " <!DOCTYPE resource-agent SYSTEM \"ra-api-1.dtd\">\n" " <resource-agent name=\"Dummy\" version=\"0.9\">\n" " <version>1.0</version>\n" " \n" " <longdesc lang=\"en-US\">\n" " This is a Dummy Resource Agent. It does absolutely nothing except \n" " keep track of whether its running or not.\n" " Its purpose in life is for testing and to serve as a template for RA writers.\n" " </longdesc>\n" " <shortdesc lang=\"en-US\">Dummy resource agent</shortdesc>\n" " \n" " <parameters>\n" " <parameter name=\"state\" unique=\"1\">\n" " <longdesc lang=\"en-US\">\n" " Location to store the resource state in.\n" " </longdesc>\n" " <shortdesc lang=\"en-US\">State file</shortdesc>\n" " <content type=\"string\" default=\"/var/run/Dummy-{OCF_RESOURCE_INSTANCE}.state\" />\n" " </parameter>\n" " \n" " <parameter name=\"dummy\" unique=\"0\">\n" " <longdesc lang=\"en-US\"> \n" " Dummy attribute that can be changed to cause a reload\n" " </longdesc>\n" " <shortdesc lang=\"en-US\">Dummy attribute that can be changed to cause a reload</shortdesc>\n" " <content type=\"string\" default=\"blah\" />\n" " </parameter>\n" " </parameters>\n" " \n" " <actions>\n" " <action name=\"start\" timeout=\"90\" />\n" " <action name=\"stop\" timeout=\"100\" />\n" " <action name=\"monitor\" timeout=\"20\" interval=\"10\" depth=\"0\" start-delay=\"0\" />\n" " <action name=\"reload\" timeout=\"90\" />\n" " <action name=\"migrate_to\" timeout=\"100\" />\n" " <action name=\"migrate_from\" timeout=\"90\" />\n" " <action name=\"meta-data\" timeout=\"5\" />\n" " <action name=\"validate-all\" timeout=\"30\" />\n" " </actions>\n" " </resource-agent> " msgstr "" #. Tag: title #, no-c-format msgid "Resource Operations" msgstr "" #. Tag: title #, no-c-format msgid "Monitoring Resources for Failure" msgstr "" #. Tag: para #, no-c-format msgid "By default, the cluster will not ensure your resources are still healthy. To instruct the cluster to do this, you need to add a monitor operation to the resource's definition." msgstr "" #. Tag: title #, no-c-format msgid "An OCF resource with a recurring health check" msgstr "" #. Tag: programlisting #, no-c-format msgid " <primitive id=\"Public-IP\" class=\"ocf\" type=\"IPaddr\" provider=\"heartbeat\">\n" " <operations>\n" " <op id=\"public-ip-check\" name=\"monitor\" interval=\"60s\"/>\n" " </operations>\n" " <instance_attributes id=\"params-public-ip\">\n" " <nvpair id=\"public-ip-addr\" name=\"ip\" value=\"1.2.3.4\"/>\n" " </instance_attributes>\n" " </primitive> " msgstr "" #. Tag: title #, no-c-format msgid "Properties of an Operation" msgstr "" #. Tag: entry #, no-c-format msgid "id" msgstr "" #. Tag: entry #, no-c-format msgid "Your name for the action. Must be unique." msgstr "" #. Tag: entry #, no-c-format msgid "name" msgstr "" #. Tag: entry #, no-c-format msgid "The action to perform. Common values: monitor, start, stop" msgstr "" #. Tag: entry #, no-c-format msgid "interval" msgstr "" #. Tag: entry #, no-c-format msgid "How frequently (in seconds) to perform the operation. Default value: 0, meaning never." msgstr "" #. Tag: entry #, no-c-format msgid "timeout" msgstr "" #. Tag: entry #, no-c-format msgid "How long to wait before declaring the action has failed." msgstr "" #. Tag: entry #, no-c-format msgid "requires" msgstr "" #. Tag: para #, no-c-format msgid "What conditions need to be satisfied before this action occurs. Allowed values:" msgstr "" #. Tag: para #, no-c-format msgid "nothing - The cluster may start this resource at any time" msgstr "" #. Tag: para #, no-c-format msgid "quorum - The cluster can only start this resource if a majority of the configured nodes are active" msgstr "" #. Tag: para #, no-c-format msgid "fencing - The cluster can only start this resource if a majority of the configured nodes are active and any failed or unknown nodes have been powered off." msgstr "" #. Tag: para #, no-c-format msgid "STONITH resources default to nothing, and all others default to fencing if STONITH is enabled and quorum otherwise." msgstr "" #. Tag: entry #, no-c-format msgid "on-fail" msgstr "" #. Tag: para #, no-c-format msgid "The action to take if this action ever fails. Allowed values:" msgstr "" #. Tag: para #, no-c-format msgid "ignore - Pretend the resource did not fail" msgstr "" #. Tag: para #, no-c-format msgid "block - Don't perform any further operations on the resource" msgstr "" #. Tag: para #, no-c-format msgid "stop - Stop the resource and do not start it elsewhere" msgstr "" #. Tag: para #, no-c-format msgid "restart - Stop the resource and start it again (possibly on a different node)" msgstr "" #. Tag: para #, no-c-format msgid "fence - STONITH the node on which the resource failed" msgstr "" #. Tag: para #, no-c-format msgid "standby - Move all resources away from the node on which the resource failed" msgstr "" #. Tag: para #, no-c-format msgid "The default for the stop operation is fence when STONITH is enabled and block otherwise. All other operations default to stop." msgstr "" #. Tag: entry #, no-c-format msgid "enabled" msgstr "" #. Tag: entry #, no-c-format msgid "If false, the operation is treated as if it does not exist. Allowed values: true, false" msgstr "" #. Tag: title #, no-c-format msgid "Setting Global Defaults for Operations" msgstr "" #. Tag: para #, no-c-format msgid "To set a default value for a operation option, simply add it to the op_defaults section with crm_attribute. Thus," msgstr "" #. Tag: programlisting #, no-c-format msgid "crm_attribute --type op_defaults --attr-name timeout --attr-value 20s" msgstr "" #. Tag: para #, no-c-format msgid "would default each operation's timeout to 20 seconds. If an operation's definition also includes a value for timeout, then that value would be used instead (for that operation only)." msgstr "" #. Tag: title #, no-c-format msgid "When Resources Take a Long Time to Start/Stop" msgstr "" #. Tag: para #, no-c-format msgid "There are a number of implicit operations that the cluster will always perform - start, stop and a non-recurring monitor operation (used at startup to check the resource isn't already active). If one of these is taking too long, then you can create an entry for them and simply specify a new value." msgstr "" #. Tag: title #, no-c-format msgid "An OCF resource with custom timeouts for its implicit actions" msgstr "" #. Tag: programlisting #, no-c-format msgid " <primitive id=\"Public-IP\" class=\"ocf\" type=\"IPaddr\" provider=\"heartbeat\">\n" " <operations>\n" " <op id=\"public-ip-startup\" name=\"monitor\" interval=\"0\" timeout=\"90s\"/>\n" " <op id=\"public-ip-start\" name=\"start\" interval=\"0\" timeout=\"180s\"/>\n" " <op id=\"public-ip-stop\" name=\"stop\" interval=\"0\" timeout=\"15min\"/>\n" " </operations>\n" " <instance_attributes id=\"params-public-ip\">\n" " <nvpair id=\"public-ip-addr\" name=\"ip\" value=\"1.2.3.4\"/>\n" " </instance_attributes>\n" " </primitive> " msgstr "" #. Tag: title #, no-c-format msgid "Multiple Monitor Operations" msgstr "" #. Tag: para #, no-c-format msgid "Provided no two operations (for a single resource) have the same name and interval you can have as many monitor operations as you like. In this way you can do a superficial health check every minute and progressively more intense ones at higher intervals." msgstr "" #. Tag: para #, no-c-format msgid "To tell the resource agent what kind of check to perform, you need to provide each monitor with a different value for a common parameter. The OCF standard creates a special parameter called OCF_CHECK_LEVEL for this purpose and dictates that it is \"made available to the resource agent without the normal OCF_RESKEY_ prefix\"." msgstr "" #. Tag: para #, no-c-format msgid "Whatever name you choose, you can specify it by adding an instance_attributes block to the op tag. Note that it is up to each resource agent to look for the parameter and decide how to use it." msgstr "" #. Tag: title #, no-c-format msgid "An OCF resource with two recurring health checks, performing different levels of checks - specified via OCF_CHECK_LEVEL." msgstr "" #. Tag: programlisting #, no-c-format msgid " <primitive id=\"Public-IP\" class=\"ocf\" type=\"IPaddr\" provider=\"heartbeat\">\n" " <operations>\n" " <op id=\"public-ip-health-60\" name=\"monitor\" interval=\"60\">\n" " <instance_attributes id=\"params-public-ip-depth-60\">\n" " <nvpair id=\"public-ip-depth-60\" name=\"OCF_CHECK_LEVEL\" value=\"10\"/>\n" " </instance_attributes>\n" " </op>\n" " <op id=\"public-ip-health-300\" name=\"monitor\" interval=\"300\">\n" " <instance_attributes id=\"params-public-ip-depth-300\">\n" " <nvpair id=\"public-ip-depth-300\" name=\"OCF_CHECK_LEVEL\" value=\"20\"/>\n" " </instance_attributes>\n" " </op>\n" " </operations>\n" " <instance_attributes id=\"params-public-ip\">\n" " <nvpair id=\"public-ip-level\" name=\"ip\" value=\"1.2.3.4\"/>\n" " </instance_attributes>\n" " </primitive> " msgstr "" #. Tag: title #, no-c-format msgid "Disabling a Monitor Operation" msgstr "" #. Tag: para #, no-c-format -msgid "The easiest way to stop a recurring monitor is to just delete it. However, there can be times when you only want to disable it temporarily. In such cases, simply add disabled=\"true\" to the operation's definition." +msgid "The easiest way to stop a recurring monitor is to just delete it. However, there can be times when you only want to disable it temporarily. In such cases, simply add enabled=\"false\" to the operation's definition." msgstr "" #. Tag: title #, no-c-format msgid "Example of an OCF resource with a disabled health check" msgstr "" #. Tag: programlisting #, no-c-format msgid " <primitive id=\"Public-IP\" class=\"ocf\" type=\"IPaddr\" provider=\"heartbeat\">\n" " <operations>\n" -" <op id=\"public-ip-check\" name=\"monitor\" interval=\"60s\" disabled=\"true\"/>\n" +" <op id=\"public-ip-check\" name=\"monitor\" interval=\"60s\" enabled=\"false\"/>\n" " </operations>\n" " <instance_attributes id=\"params-public-ip\">\n" " <nvpair id=\"public-ip-addr\" name=\"ip\" value=\"1.2.3.4\"/>\n" " </instance_attributes>\n" " </primitive> " msgstr "" #. Tag: para #, no-c-format msgid "This can be achieved from the command-line by executing" msgstr "" #. Tag: programlisting #, no-c-format -msgid "cibadmin -M -X ‘<op id=\"public-ip-check\" disabled=\"true\"/>'" +msgid "cibadmin -M -X ‘<op id=\"public-ip-check\" enabled=\"false\"/>'" msgstr "" #. Tag: para #, no-c-format msgid "Once you've done whatever you needed to do, you can then re-enable it with" msgstr "" #. Tag: programlisting #, no-c-format -msgid "cibadmin -M -X ‘<op id=\"public-ip-check\" disabled=\"false\"/>'" +msgid "cibadmin -M -X ‘<op id=\"public-ip-check\" enabled=\"true\"/>'" msgstr "" diff --git a/doc/Pacemaker_Explained/ro-RO/Ch-Options.po b/doc/Pacemaker_Explained/ro-RO/Ch-Options.po index 716257e852..0a2b9abdcb 100644 --- a/doc/Pacemaker_Explained/ro-RO/Ch-Options.po +++ b/doc/Pacemaker_Explained/ro-RO/Ch-Options.po @@ -1,500 +1,490 @@ msgid "" msgstr "" "Project-Id-Version: Pacemaker 1.1\n" "POT-Creation-Date: 2012-01-01T17:48:32\n" "PO-Revision-Date: 2012-01-01T17:48:32\n" "Last-Translator: Dan Frîncu \n" "Language-Team: None\n" "MIME-Version: 1.0\n" "Content-Type: application/x-publican; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Tag: title #, no-c-format msgid "Cluster Options" msgstr "Opţiunile Clusterului" #. Tag: title #, no-c-format msgid "Special Cluster Options Cluster OptionsSpecial Options Special Options" msgstr "Opțiunile Speciale ale Clusterului Opțiunile ClusteruluiOpțiuni Speciale Opțiuni Speciale" #. Tag: para #, no-c-format msgid "The reason for these fields to be placed at the top level instead of with the rest of cluster options is simply a matter of parsing. These options are used by the configuration database which is, by design, mostly ignorant of the content it holds. So the decision was made to place them in an easy to find location." msgstr "Motivul pentru care aceste câmpuri să fie plasate la nivelul cel mai înalt în loc să fie cu restul opţiunilor clusterului este pur şi simplu legat de parsare. Aceste opţiuni sunt folosite de către baza de date cu configuraţii care este, prin design, în principal ignorantă faţă de conţinutul pe care îl deţine. Aşa că decizia a fost luată de a le plasa într-o locaţie uşor de găsit." #. Tag: title #, no-c-format msgid "Configuration Version, Cluster Option Cluster OptionsConfiguration Version Configuration Version" msgstr "Versiunea Configurației, Opțiunea Clusterului Opțiunile ClusteruluiVersiunea Configurației Versiunea Configurației" #. Tag: para #, no-c-format msgid "When a node joins the cluster, the cluster will perform a check to see who has the best configuration based on the fields below. It then asks the node with the highest (admin_epoch, epoch, num_updates) tuple to replace the configuration on all the nodes - which makes setting them, and setting them correctly, very important." msgstr "Când un nod aderă la cluster, clusterul va efectua o verificare pentru a vedea cine are cea mai bună configuraţie bazată pe câmpurile de mai jos. Apoi întreabă nodul cu cea mai mare tuplă (admin_epoch, epoch, num_updates) să înlocuiască configuraţia pe toate nodurile - fapt care face setarea acestora şi setarea lor corectă, foarte importantă." #. Tag: title #, no-c-format msgid "Configuration Version Properties" msgstr "Proprietăţi ale Versiunii Configuraţiei" #. Tag: entry #, no-c-format msgid "Field" msgstr "Câmp" #. Tag: entry #, no-c-format msgid "Description" msgstr "Descriere" #. Tag: entry #, no-c-format msgid "admin_epoch Cluster Option Cluster Optionsadmin_epoch admin_epoch" msgstr "Opțiunea Clusterului admin_epoch Opțiunile Clusteruluiadmin_epoch admin_epoch" #. Tag: para #, no-c-format msgid "Never modified by the cluster. Use this to make the configurations on any inactive nodes obsolete." msgstr "Niciodată modificat de către cluster. Folosiţi acesta pentru a face configuraţiile pe nodurile inactive să fie învechite." #. Tag: para #, no-c-format msgid "Never set this value to zero, in such cases the cluster cannot tell the difference between your configuration and the \"empty\" one used when nothing is found on disk." msgstr "Nu setaţi niciodată această valoare la zero, în astfel de cazuri clusterul nu poate face diferenţa între configuraţia voastră şi cea \"goală\" folosită atunci când nu este găsit nimic pe disc." #. Tag: entry #, no-c-format msgid "epoch Cluster Option Cluster Optionsepoch epoch" msgstr "Opțiunea Clusterului epoch Opțiunile Clusteruluiepoch epoch" #. Tag: entry #, no-c-format msgid "Incremented every time the configuration is updated (usually by the admin)" msgstr "Incrementată de fiecare dată când configuraţia este actualizată (de obicei de către administrator)" #. Tag: entry #, no-c-format msgid "num_updates Cluster Option Cluster Optionsnum_updates num_updates" msgstr "Opțiunea Clusterului num_updates Opțiunile Clusteruluinum_updates num_updates" #. Tag: entry #, no-c-format msgid "Incremented every time the configuration or status is updated (usually by the cluster)" msgstr "Incrementată de fiecare dată când configuraţia sau statusul este actualizat (de obicei de către cluster)" #. Tag: title #, no-c-format msgid "Other Fields" msgstr "Alte Câmpuri" #. Tag: title #, no-c-format msgid "Properties Controlling Validation" msgstr "Proprietăţi care Controlează Validarea" #. Tag: entry #, no-c-format msgid "validate-with Cluster Option Cluster Optionsvalidate-with validate-with" msgstr "Opțiunea Clusterului validate-with Opțiunile Clusteruluivalidate-with validate-with" #. Tag: entry #, no-c-format msgid "Determines the type of validation being done on the configuration. If set to \"none\", the cluster will not verify that updates conform to the DTD (nor reject ones that don't). This option can be useful when operating a mixed version cluster during an upgrade." msgstr "Determină tipul de validare care este realizat pe configuraţie. Dacă este setat pe \"none\", clusterul nu va verifica dacă actualizările sunt conforme cu DTD (nici nu le va respinge pe cele care nu sunt). Această opţiune poate fi utilă când lucraţi cu o versiune combinată a clusterului în timpul unei actualizări." #. Tag: title #, no-c-format msgid "Fields Maintained by the Cluster" msgstr "Câmpuri Menţinute de către Cluster" #. Tag: title #, no-c-format msgid "Properties Maintained by the Cluster" msgstr "Proprietăţi Menţinute de către Cluster" -#. Tag: entry -#, no-c-format -msgid "crm-debug-origin Cluster Fields Cluster Fieldscrm-debug-origin crm-debug-origin" -msgstr "Câmpurile Clusterului crm-debug-origin Câmpurile Clusteruluicrm-debug-origin crm-debug-origin" - -#. Tag: entry -#, no-c-format -msgid "Indicates where the last update came from. Informational purposes only." -msgstr "Indică de unde a provenit ultima actualizare. Numai cu scop informaţional." - #. Tag: entry #, no-c-format msgid "cib-last-written Cluster Fields Cluster Fieldscib-last-written cib-last-written" msgstr "Câmpurile Clusterului cib-last-written Câmpurile Clusteruluicib-last-written cib-last-written" #. Tag: entry #, no-c-format msgid "Indicates when the configuration was last written to disk. Informational purposes only." msgstr "Indică momentul când configuraţia a fost scrisă ultima oară pe disc. Numai cu scop informaţional." #. Tag: entry #, no-c-format msgid "dc-uuid Cluster Fields Cluster Fieldsdc-uuid dc-uuid" msgstr "Câmpurile Clusterului dc-uuid Câmpurile Clusteruluidc-uuid dc-uuid" #. Tag: entry #, no-c-format msgid "Indicates which cluster node is the current leader. Used by the cluster when placing resources and determining the order of some events." msgstr "Arată care dintre nodurile clusterului este conducătorul curent. Folosit de către cluster când plasează resurse şi determină ordinea anumitor evenimente." #. Tag: entry #, no-c-format msgid "have-quorum Cluster Fields Cluster Fieldshave-quorum have-quorum" msgstr "Câmpurile Clusterului have-quorum Câmpurile Clusteruluihave-quorum have-quorum" #. Tag: entry #, no-c-format msgid "Indicates if the cluster has quorum. If false, this may mean that the cluster cannot start resources or fence other nodes. See no-quorum-policy below." msgstr "Indică dacă clusterul are quorum. Dacă este fals, acest lucru ar putea însemna că, clusterul nu poate porni resurse sau evacua forțat alte noduri. Vedeţi no-quorum-policy mai jos." #. Tag: para #, no-c-format msgid "Note that although these fields can be written to by the admin, in most cases the cluster will overwrite any values specified by the admin with the \"correct\" ones. To change the admin_epoch, for example, one would use:" msgstr "Luaţi aminte că deşi aceste câmpuri pot fi scrise de către administrator, în majoritatea cazurilor clusterul va suprascrie orice valoare specificată de către administrator cu cele \"corecte\". Pentru a schimba admin_epoch de exemplu, cineva ar putea folosi:" #. Tag: para #, no-c-format msgid "cibadmin --modify --crm_xml ‘<cib admin_epoch=\"42\"/>'" msgstr "cibadmin --modify --crm_xml ‘<cib admin_epoch=\"42\"/>'" #. Tag: para #, no-c-format msgid "A complete set of fields will look something like this:" msgstr "Un set complet de câmpuri ar arăta ceva de genul acesta:" #. Tag: title #, no-c-format msgid "An example of the fields set for a cib object" msgstr "Un exemplu al câmpurilor setate pentru un obiect CIB" #. Tag: programlisting #, no-c-format msgid "<cib have-quorum=\"true\" validate-with=\"pacemaker-1.0\"\n" " admin_epoch=\"1\" epoch=\"12\" num_updates=\"65\"\n" " dc-uuid=\"ea7d39f4-3b94-4cfa-ba7a-952956daabee\"> \n" " " msgstr "" "<cib have-quorum=\"true\" validate-with=\"pacemaker-1.0\"\n" " admin_epoch=\"1\" epoch=\"12\" num_updates=\"65\"\n" " dc-uuid=\"ea7d39f4-3b94-4cfa-ba7a-952956daabee\"> \n" " " #. Tag: para #, no-c-format msgid "Cluster options, as you might expect, control how the cluster behaves when confronted with certain situations." msgstr "Opţiunile clusterului, aşa cum v-aţi aştepta, controlează cum se comportă clusterul când se confruntă cu anumite situaţii." #. Tag: para #, no-c-format msgid "They are grouped into sets and, in advanced configurations, there may be more than one This will be described later in the section on where we will show how to have the cluster use different sets of options during working hours (when downtime is usually to be avoided at all costs) than it does during the weekends (when resources can be moved to the their preferred hosts without bothering end users) . For now we will describe the simple case where each option is present at most once." msgstr "Sunt grupate în seturi şi, în configuraţii avansate, ar putea fi mai mult de una Acest aspect va fi descris mai târziu în secţiunea despre unde vă vom arăta cum să punem clusterul să folosească diferite seturi de opţiuni în timpul orelor de lucru (când nefuncţionarea este de evitat cu orice preţ) faţă de cele folosite în timpul weekend-urilor (când resursele pot fi mutate pe gazdele preferate fără să deranjeze utilizatorii finali) . Momentan vom descrie cazul simplu în care fiecare opţiune este prezentă cel mult o dată." #. Tag: title #, no-c-format msgid "Available Cluster Options" msgstr "Opţiuni Disponibile ale Clusterului" #. Tag: entry #, no-c-format msgid "Option" msgstr "Opţiune" #. Tag: entry #, no-c-format msgid "Default" msgstr "Valoare implicită" #. Tag: entry #, no-c-format msgid "batch-limit Cluster Options Cluster Optionsbatch-limit batch-limit" msgstr "Opțiunea Clusterului batch-limit Opțiunile Clusteruluibatch-limit batch-limit" #. Tag: entry #, no-c-format msgid "30" msgstr "30" #. Tag: entry #, no-c-format msgid "The number of jobs that the TE is allowed to execute in parallel. The \"correct\" value will depend on the speed and load of your network and cluster nodes." msgstr "Numărul de sarcini pe care TE-ul este permis să le execute în paralel. Valoarea \"corectă\" va depinde de viteza şi de încărcarea reţelei şi a nodurilor voastre din cluster." #. Tag: entry #, no-c-format msgid "no-quorum-policy Cluster Options Cluster Optionsno-quorum-policy no-quorum-policy" msgstr "Opțiunea Clusterului no-quorum-policy Opțiunile Clusteruluino-quorum-policy no-quorum-policy" #. Tag: entry #, no-c-format msgid "stop" msgstr "stop" #. Tag: entry #, no-c-format msgid "What to do when the cluster does not have quorum. Allowed values:" msgstr "Ce este de făcut atunci când clusterul nu are quorum. Valori permise:" #. Tag: para #, no-c-format msgid "ignore - continue all resource management" msgstr "ignore - continuă toată gestionarea resurselor" #. Tag: para #, no-c-format msgid "freeze - continue resource management, but don't recover resources from nodes not in the affected partition" msgstr "freeze - continuă gestionarea resurselor, dar nu recupera resurse de pe noduri care nu sunt în partiţia afectată" #. Tag: para #, no-c-format msgid "stop - stop all resources in the affected cluster partition" msgstr "stop - opreşte toate resursele în partiţia de cluster afectată" #. Tag: para #, no-c-format msgid "suicide - fence all nodes in the affected cluster partition" msgstr "suicide - evacuează forțat toate nodurile din partiţia de cluster afectată" #. Tag: entry #, no-c-format msgid "symmetric-cluster Cluster Options Cluster Optionssymmetric-cluster symmetric-cluster" msgstr "Opțiunea Clusterului symmetric-cluster Opțiunile Clusteruluisymmetric-cluster symmetric-cluster" #. Tag: entry #, no-c-format msgid "TRUE" msgstr "TRUE" #. Tag: entry #, no-c-format msgid "Can all resources run on any node by default?" msgstr "Pot rula toate resursele pe orice nod în mod implicit?" #. Tag: entry #, no-c-format msgid "stonith-enabled Cluster Options Cluster Optionsstonith-enabled stonith-enabled" msgstr "Opțiunea Clusterului stonith-enabled Opțiunile Clusteruluistonith-enabled stonith-enabled" #. Tag: para #, no-c-format msgid "Should failed nodes and nodes with resources that can't be stopped be shot? If you value your data, set up a STONITH device and enable this." msgstr "Ar trebui nodurile care au eşuat şi nodurile cu resurse care nu pot fi oprite să fie împuşcate? Dacă ţineţi la datele voastre, setaţi un dispozitiv STONITH şi activaţi această opţiune." #. Tag: para #, no-c-format msgid "If true, or unset, the cluster will refuse to start resources unless one or more STONITH resources have been configured also." msgstr "Dacă este true, sau nu este setată, clusterul va refuza să pornească resurse decât dacă unul sau mai multe dispozitive STONITH au fost configurate de asemenea." #. Tag: entry #, no-c-format msgid "stonith-action Cluster Options Cluster Optionsstonith-action stonith-action" msgstr "Opțiunea Clusterului stonith-action Opțiunile Clusteruluistonith-action stonith-action" #. Tag: entry #, no-c-format msgid "reboot" msgstr "reboot" #. Tag: entry #, no-c-format msgid "Action to send to STONITH device. Allowed values: reboot, poweroff." msgstr "Acţiunea care să fie trimisă către dispozitivul STONITH. Valori permise: reboot, poweroff." #. Tag: entry #, no-c-format msgid "cluster-delay Cluster Options Cluster Optionscluster-delay cluster-delay" msgstr "Opțiunea Clusterului cluster-delay Opțiunile Clusteruluicluster-delay cluster-delay" #. Tag: entry #, no-c-format msgid "60s" msgstr "60s" #. Tag: entry #, no-c-format msgid "Round trip delay over the network (excluding action execution). The \"correct\" value will depend on the speed and load of your network and cluster nodes." msgstr "Întârzierea dus-întors experimentată pe reţea (excluzând timpul necesar executării acţiunii). Valoarea \"corectă\" va depinde de viteza şi de nivelul de încărcare al reţelei şi al nodurilor voastre din cluster." #. Tag: entry #, no-c-format msgid "stop-orphan-resources Cluster Options Cluster Optionsstop-orphan-resources stop-orphan-resources" msgstr "Opțiunea Clusterului stop-orphan-resources Opțiunile Clusteruluistop-orphan-resources stop-orphan-resources" #. Tag: entry #, no-c-format msgid "Should deleted resources be stopped?" msgstr "Ar trebui să fie oprite resursele şterse?" #. Tag: entry #, no-c-format msgid "stop-orphan-actions Cluster Options Cluster Optionsstop-orphan-actions stop-orphan-actions" msgstr "Opțiunea Clusterului stop-orphan-actions Opțiunile Clusteruluistop-orphan-actions stop-orphan-actions" #. Tag: entry #, no-c-format msgid "Should deleted actions be cancelled?" msgstr "Ar trebui anulate acţiunile şterse?" #. Tag: entry #, no-c-format msgid "start-failure-is-fatal Cluster Options Cluster Optionsstart-failure-is-fatal start-failure-is-fatal" msgstr "Opțiunea Clusterului start-failure-is-fatal Opțiunile Clusteruluistart-failure-is-fatal start-failure-is-fatal" #. Tag: entry #, no-c-format msgid "When set to FALSE, the cluster will instead use the resource's failcount and value for resource-failure-stickiness." msgstr "Când este setat pe FALSE, clusterul va folosi în schimb failcount-ul şi valoarea resursei pentru resource-failure-stickiness." #. Tag: entry #, no-c-format msgid "pe-error-series-max Cluster Options Cluster Optionspe-error-series-max pe-error-series-max" msgstr "Opțiunea Clusterului pe-error-series-max Opțiunile Clusteruluipe-error-series-max pe-error-series-max" #. Tag: entry #, no-c-format msgid "-1 (all)" msgstr "-1 (all)" #. Tag: entry #, no-c-format msgid "The number of PE inputs resulting in ERRORs to save. Used when reporting problems." msgstr "Numărul de intrări PE care rezultă în ERROR(i) de a salva. Folosite când se raporteazâ probleme." #. Tag: entry #, no-c-format msgid "pe-warn-series-max Cluster Options Cluster Optionspe-warn-series-max pe-warn-series-max" msgstr "Opțiunea Clusterului pe-warn-series-max Opțiunile Clusteruluipe-warn-series-max pe-warn-series-max" #. Tag: entry #, no-c-format msgid "The number of PE inputs resulting in WARNINGs to save. Used when reporting problems." msgstr "Numărul de intrări PE care rezultă în WARNING-uri de a salva. Folosite când se raportează probleme." #. Tag: entry #, no-c-format msgid "pe-input-series-max Cluster Options Cluster Optionspe-input-series-max pe-input-series-max" msgstr "Opțiunea Clusterului pe-input-series-max Opțiunile Clusteruluipe-input-series-max pe-input-series-max" #. Tag: entry #, no-c-format msgid "The number of \"normal\" PE inputs to save. Used when reporting problems." msgstr "Numărul de intrări PE \"normale\" care să fie salvate. Folosite când se raportează probleme." #. Tag: para #, no-c-format msgid "You can always obtain an up-to-date list of cluster options, including their default values, by running the pengine metadata command." msgstr "Puteţi întotdeauna să obţineţi o listă actualizată a opţiunilor clusterului, incluzând valorile implicite ale acestora, prin rularea comenzii pengine metadata." #. Tag: title #, no-c-format msgid "Querying Cluster Options Setting Cluster Options Cluster OptionsQuerying Cluster OptionsSetting Querying and Setting Cluster Options" msgstr "Interogarea Opțiunilor Clusterului Setarea Opțiunilor Clusterului Opțiunile ClusteruluiInterogarea Opțiunilor ClusteruluiSetarea Interogarea și Setarea Opțiunilor Clusterului" #. Tag: para #, no-c-format msgid "Cluster options can be queried and modified using the crm_attribute tool. To get the current value of cluster-delay, simply use:" msgstr "Opţiunile clusterului pot fi interogate şi modificate folosind utilitarul crm_attribute. Pentru a obţine valoarea curentă a cluster-delay, pur şi simplu folosiţi:" #. Tag: para #, no-c-format msgid "crm_attribute --attr-name cluster-delay --get-value" msgstr "crm_attribute --attr-name cluster-delay --get-value" #. Tag: para #, no-c-format msgid "which is more simply written as" msgstr "care este scrisă mai simplu ca" #. Tag: para #, no-c-format msgid "crm_attribute --get-value -n cluster-delay" msgstr "crm_attribute --get-value -n cluster-delay" #. Tag: para #, no-c-format msgid "If a value is found, you'll see a result like this:" msgstr "Dacă o valoare este găsită, atunci veţi vedea un rezultat ca acesta" #. Tag: screen #, no-c-format msgid " # crm_attribute --get-value -n cluster-delay\n" " name=cluster-delay value=60s" msgstr "" " # crm_attribute --get-value -n cluster-delay\n" " name=cluster-delay value=60s" #. Tag: para #, no-c-format msgid "However, if no value is found, the tool will display an error:" msgstr "Însă dacă nici o valoare nu este găsită, utilitarul va arăta o eroare:" #. Tag: screen #, no-c-format msgid "# crm_attribute --get-value -n clusta-deway\n" " name=clusta-deway value=(null)\n" " Error performing operation: The object/attribute does not exist" msgstr "" "# crm_attribute --get-value -n clusta-deway\n" " name=clusta-deway value=(null)\n" " Error performing operation: The object/attribute does not exist" #. Tag: para #, no-c-format msgid "To use a different value, eg. , simply run:" msgstr "Pentru a folosi o altă valoare, ex. , pur şi simplu rulaţi:" #. Tag: para #, no-c-format msgid "crm_attribute --attr-name cluster-delay --attr-value 30s" msgstr "crm_attribute --attr-name cluster-delay --attr-value 30s" #. Tag: para #, no-c-format msgid "To go back to the cluster's default value you can delete the value, for example with this command:" msgstr "Pentru a reveni la valoarea implicită a clusterului puteţi ştergeţi valoarea, de exemplu cu această comandă: " #. Tag: para #, no-c-format msgid "crm_attribute --attr-name cluster-delay --delete-attr" msgstr "crm_attribute --attr-name cluster-delay --delete-attr" #. Tag: title #, no-c-format msgid "When Options are Listed More Than Once" msgstr "Când Opţiunile sunt Listate Mai Mult De O Dată" #. Tag: para #, no-c-format msgid "If you ever see something like the following, it means that the option you're modifying is present more than once." msgstr "Dacă vedeţi vreodată ceva precum următoarele, înseamnă că opţiunea pe care o modificaţi este prezentă mai mult de o dată." #. Tag: title #, no-c-format msgid "Deleting an option that is listed twice" msgstr "Ştergerea unei opţiuni care este listată de două ori" #. Tag: screen #, no-c-format msgid "# crm_attribute --attr-name batch-limit --delete-attr\n" " Multiple attributes match name=batch-limit in crm_config:\n" " Value: 50 (set=cib-bootstrap-options, id=cib-bootstrap-options-batch-limit)\n" " Value: 100 (set=custom, id=custom-batch-limit)\n" " Please choose from one of the matches above and supply the 'id' with --attr-id" msgstr "" "# crm_attribute --attr-name batch-limit --delete-attr\n" " Multiple attributes match name=batch-limit in crm_config:\n" " Value: 50 (set=cib-bootstrap-options, id=cib-bootstrap-options-batch-limit)\n" " Value: 100 (set=custom, id=custom-batch-limit)\n" " Please choose from one of the matches above and supply the 'id' with --attr-id" #. Tag: para #, no-c-format msgid "In such cases follow the on-screen instructions to perform the requested action. To determine which value is currently being used by the cluster, please refer to the section on ." msgstr "În astfel de cazuri urmaţi instrucţiunile de pe ecran pentru a efectua acţiunea cerută. Pentru a determina care valoare este folosită în mod curent de către cluster, vă rugăm să faceţi referinţă la secţiunea despre ." diff --git a/doc/Pacemaker_Explained/ro-RO/Ch-Resources.po b/doc/Pacemaker_Explained/ro-RO/Ch-Resources.po index c4e1a88e4b..bf00e81ec7 100644 --- a/doc/Pacemaker_Explained/ro-RO/Ch-Resources.po +++ b/doc/Pacemaker_Explained/ro-RO/Ch-Resources.po @@ -1,1067 +1,1067 @@ msgid "" msgstr "" "Project-Id-Version: Pacemaker 1.1\n" "POT-Creation-Date: 2012-01-01T17:48:32\n" "PO-Revision-Date: 2012-01-01T17:48:32\n" "Last-Translator: Dan Frîncu \n" "Language-Team: None\n" "MIME-Version: 1.0\n" "Content-Type: application/x-publican; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. Tag: title #, no-c-format msgid "Cluster Resources" msgstr "Resursele Clusterului" #. Tag: title #, no-c-format msgid "What is a Cluster Resource" msgstr "Ce este o Resursă de Cluster" #. Tag: indexterm #, no-c-format msgid "ResourceDescription" msgstr "DescriereaResursei" #. Tag: para #, no-c-format msgid "The role of a resource agent is to abstract the service it provides and present a consistent view to the cluster, which allows the cluster to be agnostic about the resources it manages. The cluster doesn't need to understand how the resource works because it relies on the resource agent to do the right thing when given a start, stop or monitor command." msgstr "Rolul agentului de resursă este de a abstractiza serviciul pe care îl furnizează şi de a prezenta o viziune consistentă clusterului, care îi permite clusterului să fie agnostic cu resursele pe care le gestionează. Clusterul nu trebuie să înţeleagă cum funcţionează resursa pentru că se bazează pe agentul de resursă să efectueze ceea ce trebuie atunci când îi este trimisă o comandă de start, stop sau monitor." #. Tag: para #, no-c-format msgid "For this reason it is crucial that resource agents are well tested." msgstr "Din acest motiv este imperativ ca agenţii de resursă să fie testaţi corespunzător." #. Tag: para #, no-c-format msgid "Typically resource agents come in the form of shell scripts, however they can be written using any technology (such as C, Python or Perl) that the author is comfortable with." msgstr "În mod normal agenţii de resursă vin sub forma de scripturi de shell, însă aceştia pot fi scrişi folosind orice limbaj de programare (cum ar fi C, Python sau Perl) cu care este confortabil autorul." #. Tag: title #, no-c-format msgid "Supported Resource Classes" msgstr "Clase de Resurse Suportate" #. Tag: indexterm #, no-c-format msgid "ResourceClasses" msgstr "Clase deResurse" #. Tag: para #, no-c-format msgid "There are three basic classes of agents supported by Pacemaker. In order of encouraged usage they are:" msgstr "Există trei clase de bază de agenţi suportate de Pacemaker. În ordinea în care este încurajată folosirea acestora ele sunt:" #. Tag: title #, no-c-format msgid "Open Cluster Framework" msgstr "Open Cluster Framework" #. Tag: indexterm #, no-c-format msgid "ResourceOCF" msgstr "ResursăOCF" #. Tag: indexterm #, no-c-format msgid "OCFResources" msgstr "ResurseOCF" #. Tag: indexterm #, no-c-format msgid "Open Cluster FrameworkResources" msgstr "ResurseOpen Cluster Framework" #. Tag: para #, no-c-format msgid "The OCF Spec - at least as it relates to resource agents.'Note: The Pacemaker implementation has been somewhat extended from the OCF Specs, but none of those changes are incompatible with the original OCF specification. is basically an extension of the Linux Standard Base conventions for init scripts to" msgstr "Spec-ul OCF - cel puțin partea care se leagă de agenții de resursă.'Notă: Implementarea Pacemaker a fost oarecum extinsă din Specificațiile OCF, dar nici una din acele modificări nu sunt incompatibile cu specificația originală OCF. este în principiu o extensie a convențiilor Linux Standard Base folosite pentru scripturile de init ca să" #. Tag: para #, no-c-format msgid "support parameters," msgstr "suporte parametri" #. Tag: para #, no-c-format msgid "make them self describing and" msgstr "să îi facă auto descriptivi şi" #. Tag: para #, no-c-format msgid "extensible" msgstr "extensibili" #. Tag: para #, no-c-format msgid "OCF specs have strict definitions of the exit codes that actions must return Included with the cluster is the ocf-tester script, which can be useful in this regard. . The cluster follows these specifications exactly, and giving the wrong exit code will cause the cluster to behave in ways you will likely find puzzling and annoying. In particular, the cluster needs to distinguish a completely stopped resource from one which is in some erroneous and indeterminate state." msgstr "Specificaţiile OCF au definiţii stricte asupra căror coduri de ieşire trebuie să returneze acţiunile Inclus cu clusterul este scriptul ocf-tester care poate fi folositor în această privinţă. . Clusterul urmează aceste specificaţii întocmai, iar ieşirea din execuţie cu codul de eroare greşit va cauza clusterul să se comporte în feluri pe care le puteţi găsi enervante şi lipsite de sens. În mod special, clusterul trebuie să poată distinge între o resursă oprită complet şi una care se află într-o stare eronată sau nedeterminată." #. Tag: para #, no-c-format msgid "Parameters are passed to the script as environment variables, with the special prefix OCF_RESKEY_. So, a parameter which the user thinks of as ip it will be passed to the script as OCF_RESKEY_ip. The number and purpose of the parameters is completely arbitrary, however your script should advertise any that it supports using the meta-data command." msgstr "Parametrii sunt pasaţi scriptului ca variabile de mediu, cu prefixul special OCF_RESKEY_. Deci, un parametru pe care utilizatorul îl consideră ca fiind ip va fi pasat către script ca OCF_RESKEY_ip. Numărul şi scopul parametrilor este complet arbitrar, însă scriptul vostru ar trebui să îi anunţe pe toţi pe care îi suportă folosind comanda meta-data." #. Tag: para #, no-c-format msgid "The OCF class is the most preferred one as it is an industry standard, highly flexible (allowing parameters to be passed to agents in a non-positional manner) and self-describing." msgstr "Clasa OCF este cea mai preferată din moment ce este un standard al industriei, foarte flexibilă (permiţând parametrii să fie pasaţi agenţilor într-o manieră care nu ţine cont de poziţia acestora) şi auto-descriptivă." #. Tag: para #, no-c-format msgid "For more information, see the reference and ." msgstr "Pentru mai multe informaţii, vedeţi referința şi ." #. Tag: title #, no-c-format msgid "Linux Standard Base" msgstr "Linux Standard Base" #. Tag: indexterm #, no-c-format msgid "ResourceLSB" msgstr "ResursăLSB" #. Tag: indexterm #, no-c-format msgid "LSBResources" msgstr "ResurseLSB" #. Tag: indexterm #, no-c-format msgid "Linus Standard BaseResources" msgstr "ResurseLinus Standard Base" #. Tag: para #, no-c-format msgid "LSB resource agents are those typically found in /etc/init.d. Generally they are provided by the OS/distribution and, in order to be used with the cluster, they must conform to the LSB Spec See for the LSB Spec (as it relates to init scripts). ." msgstr "Agenţii de resursă LSB sunt cei găsiţi în /etc/init.d. În mod normal aceştia sunt furnizaţi de către OS/distribuţie şi pentru a putea fi folosiţi împreună cu clusterul, trebuie să se conforme Specificaţiilor LSB Vedeți pentru Spec-ul LSB (partea care se leagă de scripturi de init). ." #. Tag: para #, no-c-format msgid "Many distributions claim LSB compliance but ship with broken init scripts. To see if your init script is LSB-compatible, see the FAQ entry . The most common problems are:" msgstr "Multe distribuţii afirmă compatibilitatea LSB dar livrează scripturi de init nefuncţionale din acest punct de vedere. Pentru a vedea dacă scriptul vostru de init este compatibil LSB, vedeţi intrarea din FAQ referitoare la . Cele mai comune probleme sunt:" #. Tag: para #, no-c-format msgid "Not implementing the status operation at all" msgstr "Neimplementarea în vreun fel a operaţiunii status" #. Tag: para #, no-c-format msgid "Not observing the correct exit status codes for start/stop/status actions" msgstr "Neobservarea status-urilor corecte de ieşire pentru acţiuni start/stop/status" #. Tag: para #, no-c-format msgid "Starting a started resource returns an error (this violates the LSB spec)" msgstr "Pornirea unei resurse deja pornite returnează o eroare (acest aspect încalcă specificaţia LSB)" #. Tag: para #, no-c-format msgid "Stopping a stopped resource returns an error (this violates the LSB spec)" msgstr "Oprirea unei resurse deja oprită returnează o eroare (acest aspect încalcă specificaţia LSB)" #. Tag: title #, no-c-format msgid "Legacy Heartbeat" msgstr "Depreciat Heartbeat" #. Tag: indexterm #, no-c-format msgid "ResourceHeartbeat (legacy)" msgstr "ResursăHeartbeat (depreciat)" #. Tag: indexterm #, no-c-format msgid "HeartbeatLegacy Resources" msgstr "Resurse DepreciateHeartbeat" #. Tag: para #, no-c-format msgid "Version 1 of Heartbeat came with its own style of resource agents and it is highly likely that many people have written their own agents based on its conventions. To enable administrators to continue to use these agents, they are supported by the new cluster manager See for more information.." msgstr "Versiunea 1 de Heartbeat venea cu propriul stil de agenţi de resursă şi este foarte probabil că mulţi oameni şi-au scris proprii agenţi de resursă pe baza convenţiilor acestuia. Pentru a permite administratorilor să continue folosirea acestor agenţi, aceştia sunt suportaţi de către noul manager de cluster Vedeți pentru mai multe informații.." #. Tag: title #, no-c-format msgid "STONITH" msgstr "STONITH" #. Tag: indexterm #, no-c-format msgid "ResourceSTONITH" msgstr "ResursăSTONITH" #. Tag: indexterm #, no-c-format msgid "STONITHResources" msgstr "ResurseSTONITH" #. Tag: para #, no-c-format msgid "There is also an additional class, STONITH, which is used exclusively for fencing related resources. This is discussed later in ." msgstr "Mai există o clasă adiţională, STONITH, care este folosită exclusiv pentru resurse relevante în procesul de evacuare forțată. Acest aspect este discutat mai târziu în ." #. Tag: title #, no-c-format msgid "Properties" msgstr "Proprietăţi" #. Tag: para #, no-c-format msgid "These values tell the cluster which script to use for the resource, where to find that script and what standards it conforms to." msgstr "Aceste valori îi spun clusterului care script să îl folosească pentru resursă, unde să găsească acel script şi care sunt standardele la care acesta aderă." #. Tag: title #, no-c-format msgid "Properties of a Primitive Resource" msgstr "Proprietăţile unei Resurse Primitive" #. Tag: entry #, no-c-format msgid "Field" msgstr "Câmp" #. Tag: entry #, no-c-format msgid "Description" msgstr "Descriere" #. Tag: entry #, no-c-format msgid "id id" msgstr "id id" #. Tag: entry #, no-c-format msgid "Your name for the resource" msgstr "Numele pe care îl daţi resursei" #. Tag: entry #, no-c-format msgid "classResource Field ResourceFieldclass class" msgstr "classCâmpul Resursei CâmpulResurseiclass class" #. Tag: entry #, no-c-format msgid "The standard the script conforms to. Allowed values: heartbeat, lsb, ocf, stonith" msgstr "Standardul la care aderă scriptul. Valori permise: heartbeat, lsb, ocf, stonith" #. Tag: entry #, no-c-format msgid "typeResource Field ResourceFieldtype type" msgstr "typeCâmpul Resursei CâmpulResurseitype type" #. Tag: entry #, no-c-format msgid "The name of the Resource Agent you wish to use. Eg. IPaddr or Filesystem" msgstr "Numele Agentului de Resursă pe care doriţi să îl folosiţi. ex. IPaddr or Filesystem" #. Tag: entry #, no-c-format msgid "providerResource Field ResourceFieldprovider provider" msgstr "providerCâmpul Resursei CâmpulResurseiprovider provider" #. Tag: entry #, no-c-format msgid "The OCF spec allows multiple vendors to supply the same ResourceAgent. To use the OCF resource agents supplied with Heartbeat, you should specify heartbeat here." msgstr "Specificaţia OCF permite mai multor entităţi să furnizeze acelaşi Agent de Resursă. Pentru a folosi agenţii de resursă OCF furnizaţi împreună cu Heartbeat, ar trebui să specificaţi heartbeat aici." #. Tag: para #, no-c-format msgid "Resource definitions can be queried with the crm_resource tool. For example" msgstr "Definiţiile resurselor pot fi interogate cu utilitarul crm_resource. De exemplu" #. Tag: screen #, no-c-format msgid "crm_resource --resource Email --query-xml" msgstr "crm_resource --resource Email --query-xml" #. Tag: para #, no-c-format msgid "might produce" msgstr "ar putea produce" #. Tag: title #, no-c-format msgid "An example LSB resource" msgstr "Un exemplu de resursă LSB" #. Tag: programlisting #, no-c-format msgid "<primitive id=\"Email\" class=\"lsb\" type=\"exim\"/>\n" " " msgstr "" "<primitive id=\"Email\" class=\"lsb\" type=\"exim\"/>\n" " " #. Tag: para #, no-c-format msgid "One of the main drawbacks to LSB resources is that they do not allow any parameters!" msgstr "Unul din principalele aspecte negative ale resurselor LSB este acela că nu permit parametri!" #. Tag: para #, no-c-format msgid "Example for an OCF resource:" msgstr "Exemplu pentru o resursă OCF:" #. Tag: title #, no-c-format msgid "An example OCF resource" msgstr "Un exemplu de resursă OCF" #. Tag: programlisting #, no-c-format msgid "<primitive id=\"Public-IP\" class=\"ocf\" type=\"IPaddr\" provider=\"heartbeat\">\n" " <instance_attributes id=\"params-public-ip\">\n" " <nvpair id=\"public-ip-addr\" name=\"ip\" value=\"1.2.3.4\"/>\n" " </instance_attributes>\n" " </primitive> " msgstr "" "<primitive id=\"Public-IP\" class=\"ocf\" type=\"IPaddr\" provider=\"heartbeat\">\n" " <instance_attributes id=\"params-public-ip\">\n" " <nvpair id=\"public-ip-addr\" name=\"ip\" value=\"1.2.3.4\"/>\n" " </instance_attributes>\n" " </primitive> " #. Tag: para #, no-c-format msgid "Or, finally for the equivalent legacy Heartbeat resource:" msgstr "sau în sfârşit pentru echivalentul unei resurse depreciate Heartbeat: " #. Tag: title #, no-c-format msgid "An example Heartbeat resource" msgstr "Un exemplu de resursă Heartbeat" #. Tag: programlisting #, no-c-format msgid " <primitive id=\"Public-IP-legacy\" class=\"heartbeat\" type=\"IPaddr\">\n" " <instance_attributes id=\"params-public-ip-legacy\">\n" " <nvpair id=\"public-ip-addr-legacy\" name=\"1\" value=\"1.2.3.4\"/>\n" " </instance_attributes>\n" " </primitive> " msgstr "" " <primitive id=\"Public-IP-legacy\" class=\"heartbeat\" type=\"IPaddr\">\n" " <instance_attributes id=\"params-public-ip-legacy\">\n" " <nvpair id=\"public-ip-addr-legacy\" name=\"1\" value=\"1.2.3.4\"/>\n" " </instance_attributes>\n" " </primitive> " #. Tag: para #, no-c-format msgid "Heartbeat resources take only ordered and unnamed parameters. The supplied name therefore indicates the order in which they are passed to the script. Only single digit values are allowed." msgstr "Resursele Heartbeat primesc doar parametri ordonaţi şi fără denumire. Numele furnizat indică prin urmare ordinea în care sunt pasaţi către script. Doar valori formate dintr-o singură cifră sunt permise." #. Tag: title #, no-c-format msgid "Resource Options" msgstr "Opţiuni ale Resurselor" #. Tag: para #, no-c-format msgid "Options are used by the cluster to decide how your resource should behave and can be easily set using the --meta option of the crm_resource command." msgstr "Opţiunile sunt folosite de către cluster pentru a decide cum ar trebui să se comporte resursa voastră şi pot fi setate facil folosind opţiunea --meta a comenzii crm_resource." #. Tag: title #, no-c-format msgid "Options for a Primitive Resource" msgstr "Opţiuni pentru o Resursă Primitivă" #. Tag: entry #, no-c-format msgid "Default" msgstr "Valoarea implicită" #. Tag: entry #, no-c-format msgid "priorityResource Option ResourceOptionpriority priority" msgstr "priorityOpțiunea Resursei OpțiuneaResurseipriority priority" #. Tag: entry #, no-c-format msgid "0" msgstr "0" #. Tag: entry #, no-c-format msgid "If not all resources can be active, the cluster will stop lower priority resources in order to keep higher priority ones active." msgstr "Dacă nu pot fi active toate resursele, clusterul va opri resursele cu prioritate mai mică pentru a păstra resursele cu o prioritate mai mare active." #. Tag: entry #, no-c-format msgid "target-roleResource Option ResourceOptiontarget-role target-role" msgstr "target-roleOpțiunea Resursei OpțiuneaResurseitarget-role target-role" #. Tag: entry #, no-c-format msgid "Started" msgstr "Started" #. Tag: para #, no-c-format msgid "What state should the cluster attempt to keep this resource in? Allowed values:" msgstr "În ce stare ar trebui să încerce clusterul să menţină această resursă? Valori permise:" #. Tag: para #, no-c-format msgid "Stopped - Force the resource to be stopped" msgstr "Stopped - Forţează resursa să fie oprită" #. Tag: para #, no-c-format msgid "Started - Allow the resource to be started (In the case of multi-state resources, they will not promoted to master)" msgstr "Started - Permite resursei să fie pornită (În cazul resurselor cu multi-state, acestea nu vor fi promovate la master)" #. Tag: para #, no-c-format msgid "Master - Allow the resource to be started and, if appropriate, promoted" msgstr "Master - Permite resursei să fie pornită, iar dacă este adecvat, promovată" #. Tag: entry #, no-c-format msgid "is-managedResource Option ResourceOptionis-managed is-managed" msgstr "is-managedOpțiunea Resursei OpțiuneaResurseiis-managed is-managed" #. Tag: entry #, no-c-format msgid "TRUE" msgstr "TRUE" #. Tag: entry #, no-c-format msgid "Is the cluster allowed to start and stop the resource? Allowed values: true, false" msgstr "Îi este permis clusterului să pornească şi să oprească resursa? Valori permise: true, false" #. Tag: entry #, no-c-format msgid "resource-stickinessResource Option ResourceOptionresource-stickiness resource-stickiness" msgstr "resource-stickinessOpțiunea Resursei OpțiuneaResurseiresource-stickiness resource-stickiness" #. Tag: entry #, no-c-format msgid "Inherited" msgstr "Moştenită" #. Tag: entry #, no-c-format msgid "How much does the resource prefer to stay where it is? Defaults to the value of resource-stickiness in the rsc_defaults section" msgstr "Cât de mult preferă resursa să rămână acolo unde este? Valoarea implicită este cea a resource-stickiness din secţiunea rsc_defaults" #. Tag: entry #, no-c-format msgid "migration-thresholdResource Option ResourceOptionmigration-threshold migration-threshold" msgstr "migration-thresholdOpțiunea Resursei OpțiuneaResurseimigration-threshold migration-threshold" #. Tag: entry #, no-c-format msgid "INFINITY (disabled)" msgstr "INFINITY (dezactivat)" #. Tag: entry #, no-c-format msgid "How many failures may occur for this resource on a node, before this node is marked ineligible to host this resource." msgstr "Câte eşecuri ar trebui să se întâmple acestei resurse pe un nod înainte de face nodul ineligibil de a mai găzdui această resursă." #. Tag: entry #, no-c-format msgid "failure-timeoutResource Option ResourceOptionfailure-timeout failure-timeout" msgstr "failure-timeoutOpțiunea Resursei OpțiuneaResurseifailure-timeout failure-timeout" #. Tag: entry #, no-c-format msgid "0 (disabled)" msgstr "0 (dezactivat)" #. Tag: entry #, no-c-format msgid "How many seconds to wait before acting as if the failure had not occurred, and potentially allowing the resource back to the node on which it failed." msgstr "Câte secunde să aştepte înainte să se comporte ca şi cum eşecul nu s-ar fi întâmplat (şi potenţial să permită resursei să revină pe nodul pe care a eşuat)." #. Tag: entry #, no-c-format msgid "multiple-activeResource Option ResourceOptionmultiple-active multiple-active" msgstr "multiple-activeOpțiunea Resursei OpțiuneaResurseimultiple-active multiple-active" #. Tag: entry #, no-c-format msgid "stop_start" msgstr "stop_start" #. Tag: para #, no-c-format msgid "What should the cluster do if it ever finds the resource active on more than one node. Allowed values:" msgstr "Ce ar trebui să realizeze clusterul dacă găseşte vreodată o resursă activă pe mai mult de un nod. Valori permise:" #. Tag: para #, no-c-format msgid "block - mark the resource as unmanaged" msgstr "block - marchează resursa ca fiind negestionată" #. Tag: para #, no-c-format msgid "stop_only - stop all active instances and leave them that way" msgstr "stop_only - opreşte toate instanţele active şi lasă-le în acest fel" #. Tag: para #, no-c-format msgid "stop_start - stop all active instances and start the resource in one location only" msgstr "stop_start - opreşte toate instanţele active şi porneşte resursa doar într-o singură locaţie" #. Tag: para #, no-c-format msgid "If you performed the following commands on the previous LSB Email resource" msgstr "Dacă aţi efectuat următoarele comenzi pe resursa LSB Email anterioară" #. Tag: screen #, no-c-format msgid "crm_resource --meta --resource Email --set-parameter priority --property-value 100\n" " crm_resource --meta --resource Email --set-parameter multiple-active --property-value block\n" " " msgstr "" "crm_resource --meta --resource Email --set-parameter priority --property-value 100\n" " crm_resource --meta --resource Email --set-parameter multiple-active --property-value block\n" " " #. Tag: para #, no-c-format msgid "the resulting resource definition would be" msgstr "definiţia rezultantă a resursei ar fi" #. Tag: title #, no-c-format msgid "An LSB resource with cluster options" msgstr "O resursă LSB cu opţiuni ale clusterului" #. Tag: programlisting #, no-c-format msgid "<primitive id=\"Email\" class=\"lsb\" type=\"exim\">\n" " <meta_attributes id=\"meta-email\">\n" " <nvpair id=\"email-priority\" name=\"priority\" value=\"100\"/>\n" " <nvpair id=\"email-active\" name=\"multiple-active\" value=\"block\"/>\n" " </meta_attributes>\n" " </primitive> " msgstr "" "<primitive id=\"Email\" class=\"lsb\" type=\"exim\">\n" " <meta_attributes id=\"meta-email\">\n" " <nvpair id=\"email-priority\" name=\"priority\" value=\"100\"/>\n" " <nvpair id=\"email-active\" name=\"multiple-active\" value=\"block\"/>\n" " </meta_attributes>\n" " </primitive> " #. Tag: title #, no-c-format msgid "Setting Global Defaults for Resource Options" msgstr "Setarea de Valori Implicite Globale pentru Opţiunile Clusterului" #. Tag: para #, no-c-format msgid "To set a default value for a resource option, simply add it to the rsc_defaults section with crm_attribute. Thus," msgstr "Pentru a seta o valoare implicită pentru o opţiune a resursei, pur şi simplu adăugaţi-o la secţiunea rsc_defaults cu crm_attribute. Astfel," #. Tag: para #, no-c-format msgid "crm_attribute --type rsc_defaults --attr-name is-managed --attr-value false" msgstr "crm_attribute --type rsc_defaults --attr-name is-managed --attr-value false" #. Tag: para #, no-c-format msgid "would prevent the cluster from starting or stopping any of the resources in the configuration (unless of course the individual resources were specifically enabled and had is-managed set to true)." msgstr "ar preveni clusterul de a porni sau opri orice resurse din configuraţie (cu excepţia cazului când resursele individuale au fost activate în mod specific şi aveau is-managed setat pe true)." #. Tag: title #, no-c-format msgid "Instance Attributes" msgstr "Atributele Instanţelor" #. Tag: para #, no-c-format msgid "The scripts of some resource classes (LSB not being one of them) can be given parameters which determine how they behave and which instance of a service they control." msgstr "Scripturile unor clase de resurse (LSB nefiind una dintre acestea) pot primi parametri care determină cum se comportă şi care instanţe ale unui serviciu controlează acestea." #. Tag: para #, no-c-format msgid "If your resource agent supports parameters, you can add them with the crm_resource command. For instance" msgstr "Dacă agentul vostru de resursă suportă parametri, îi puteţi adăuga cu comanda crm_resource. De exemplu" #. Tag: programlisting #, no-c-format msgid "crm_resource --resource Public-IP --set-parameter ip --property-value 1.2.3.4" msgstr "crm_resource --resource Public-IP --set-parameter ip --property-value 1.2.3.4" #. Tag: para #, no-c-format msgid "would create an entry in the resource like this:" msgstr "ar crea o intrare în resursă precum aceasta:" #. Tag: title #, no-c-format msgid "An example OCF resource with instance attributes" msgstr "Un exemplu de resursă OCF cu atribute de instanţă" #. Tag: programlisting #, no-c-format msgid " <primitive id=\"Public-IP\" class=\"ocf\" type=\"IPaddr\" provider=\"heartbeat\">\n" " <instance_attributes id=\"params-public-ip\">\n" " <nvpair id=\"public-ip-addr\" name=\"ip\" value=\"1.2.3.4\"/>\n" " </instance_attributes>\n" " </primitive> " msgstr "" " <primitive id=\"Public-IP\" class=\"ocf\" type=\"IPaddr\" provider=\"heartbeat\">\n" " <instance_attributes id=\"params-public-ip\">\n" " <nvpair id=\"public-ip-addr\" name=\"ip\" value=\"1.2.3.4\"/>\n" " </instance_attributes>\n" " </primitive> " #. Tag: para #, no-c-format msgid "For an OCF resource, the result would be an environment variable called OCF_RESKEY_ip with a value of 1.2.3.4." msgstr "Pentru o resursă OCF, rezultatul ar fi o variabilă de mediu numită OCF_RESKEY_ip cu o valoare de 1.2.3.4." #. Tag: para #, no-c-format msgid "The list of instance attributes supported by an OCF script can be found by calling the resource script with the meta-data command. The output contains an XML description of all the supported attributes, their purpose and default values." msgstr "Lista de atribute de instanţă suportate de un script OCF poate fi găsită apelând scriptul resursei cu comanda meta-data. Rezultatul de ieşire conţine o descriere XML a tuturor atributelor suportate, scopul acestora şi valori implicite." #. Tag: title #, no-c-format msgid "Displaying the metadata for the Dummy resource agent template" msgstr "Afişarea metadata pentru template-ul agentului de resursă Dummy" #. Tag: programlisting #, no-c-format msgid "export OCF_ROOT=/usr/lib/ocf; $OCF_ROOT/resource.d/pacemaker/Dummy meta-data\n" " <?xml version=\"1.0\"?>\n" " <!DOCTYPE resource-agent SYSTEM \"ra-api-1.dtd\">\n" " <resource-agent name=\"Dummy\" version=\"0.9\">\n" " <version>1.0</version>\n" " \n" " <longdesc lang=\"en-US\">\n" " This is a Dummy Resource Agent. It does absolutely nothing except \n" " keep track of whether its running or not.\n" " Its purpose in life is for testing and to serve as a template for RA writers.\n" " </longdesc>\n" " <shortdesc lang=\"en-US\">Dummy resource agent</shortdesc>\n" " \n" " <parameters>\n" " <parameter name=\"state\" unique=\"1\">\n" " <longdesc lang=\"en-US\">\n" " Location to store the resource state in.\n" " </longdesc>\n" " <shortdesc lang=\"en-US\">State file</shortdesc>\n" " <content type=\"string\" default=\"/var/run/Dummy-{OCF_RESOURCE_INSTANCE}.state\" />\n" " </parameter>\n" " \n" " <parameter name=\"dummy\" unique=\"0\">\n" " <longdesc lang=\"en-US\"> \n" " Dummy attribute that can be changed to cause a reload\n" " </longdesc>\n" " <shortdesc lang=\"en-US\">Dummy attribute that can be changed to cause a reload</shortdesc>\n" " <content type=\"string\" default=\"blah\" />\n" " </parameter>\n" " </parameters>\n" " \n" " <actions>\n" " <action name=\"start\" timeout=\"90\" />\n" " <action name=\"stop\" timeout=\"100\" />\n" " <action name=\"monitor\" timeout=\"20\" interval=\"10\" depth=\"0\" start-delay=\"0\" />\n" " <action name=\"reload\" timeout=\"90\" />\n" " <action name=\"migrate_to\" timeout=\"100\" />\n" " <action name=\"migrate_from\" timeout=\"90\" />\n" " <action name=\"meta-data\" timeout=\"5\" />\n" " <action name=\"validate-all\" timeout=\"30\" />\n" " </actions>\n" " </resource-agent> " msgstr "" "export OCF_ROOT=/usr/lib/ocf; $OCF_ROOT/resource.d/pacemaker/Dummy meta-data\n" " <?xml version=\"1.0\"?>\n" " <!DOCTYPE resource-agent SYSTEM \"ra-api-1.dtd\">\n" " <resource-agent name=\"Dummy\" version=\"0.9\">\n" " <version>1.0</version>\n" " \n" " <longdesc lang=\"en-US\">\n" " This is a Dummy Resource Agent. It does absolutely nothing except \n" " keep track of whether its running or not.\n" " Its purpose in life is for testing and to serve as a template for RA writers.\n" " </longdesc>\n" " <shortdesc lang=\"en-US\">Dummy resource agent</shortdesc>\n" " \n" " <parameters>\n" " <parameter name=\"state\" unique=\"1\">\n" " <longdesc lang=\"en-US\">\n" " Location to store the resource state in.\n" " </longdesc>\n" " <shortdesc lang=\"en-US\">State file</shortdesc>\n" " <content type=\"string\" default=\"/var/run/Dummy-{OCF_RESOURCE_INSTANCE}.state\" />\n" " </parameter>\n" " \n" " <parameter name=\"dummy\" unique=\"0\">\n" " <longdesc lang=\"en-US\"> \n" " Dummy attribute that can be changed to cause a reload\n" " </longdesc>\n" " <shortdesc lang=\"en-US\">Dummy attribute that can be changed to cause a reload</shortdesc>\n" " <content type=\"string\" default=\"blah\" />\n" " </parameter>\n" " </parameters>\n" " \n" " <actions>\n" " <action name=\"start\" timeout=\"90\" />\n" " <action name=\"stop\" timeout=\"100\" />\n" " <action name=\"monitor\" timeout=\"20\" interval=\"10\" depth=\"0\" start-delay=\"0\" />\n" " <action name=\"reload\" timeout=\"90\" />\n" " <action name=\"migrate_to\" timeout=\"100\" />\n" " <action name=\"migrate_from\" timeout=\"90\" />\n" " <action name=\"meta-data\" timeout=\"5\" />\n" " <action name=\"validate-all\" timeout=\"30\" />\n" " </actions>\n" " </resource-agent> " #. Tag: title #, no-c-format msgid "Resource Operations" msgstr "Operaţiile Resurselor" #. Tag: title #, no-c-format msgid "Monitoring Resources for Failure" msgstr "Monitorizarea Resurselor pentru Defecţiuni" #. Tag: para #, no-c-format msgid "By default, the cluster will not ensure your resources are still healthy. To instruct the cluster to do this, you need to add a monitor operation to the resource's definition." msgstr "În mod implicit, clusterul nu va asigura că resursele voastre sunt încă sănătoase. Pentru a instrui clusterul să realizeze acest lucru, trebuie să adăugaţi o operaţiune monitor la definiţia resursei." #. Tag: title #, no-c-format msgid "An OCF resource with a recurring health check" msgstr "O resursă OCF cu o verificare recurentă a sănătăţii" #. Tag: programlisting #, no-c-format msgid " <primitive id=\"Public-IP\" class=\"ocf\" type=\"IPaddr\" provider=\"heartbeat\">\n" " <operations>\n" " <op id=\"public-ip-check\" name=\"monitor\" interval=\"60s\"/>\n" " </operations>\n" " <instance_attributes id=\"params-public-ip\">\n" " <nvpair id=\"public-ip-addr\" name=\"ip\" value=\"1.2.3.4\"/>\n" " </instance_attributes>\n" " </primitive> " msgstr "" " <primitive id=\"Public-IP\" class=\"ocf\" type=\"IPaddr\" provider=\"heartbeat\">\n" " <operations>\n" " <op id=\"public-ip-check\" name=\"monitor\" interval=\"60s\"/>\n" " </operations>\n" " <instance_attributes id=\"params-public-ip\">\n" " <nvpair id=\"public-ip-addr\" name=\"ip\" value=\"1.2.3.4\"/>\n" " </instance_attributes>\n" " </primitive> " #. Tag: title #, no-c-format msgid "Properties of an Operation" msgstr "Proprietăţile unei Operaţii" #. Tag: entry #, no-c-format msgid "id" msgstr "id" #. Tag: entry #, no-c-format msgid "Your name for the action. Must be unique." msgstr "Numele dat acţiunii. Trebuie să fie unic." #. Tag: entry #, no-c-format msgid "name" msgstr "nume" #. Tag: entry #, no-c-format msgid "The action to perform. Common values: monitor, start, stop" msgstr "Acţiunea pe care să o execute. Valori obişnuite: monitor, start, stop" #. Tag: entry #, no-c-format msgid "interval" msgstr "interval" #. Tag: entry #, no-c-format msgid "How frequently (in seconds) to perform the operation. Default value: 0, meaning never." msgstr "Cât de frecvent (în secunde) să efectueze operaţiunea. Valoarea implicită: 0, însemnând niciodată." #. Tag: entry #, no-c-format msgid "timeout" msgstr "timeout" #. Tag: entry #, no-c-format msgid "How long to wait before declaring the action has failed." msgstr "Cât de mult să aştepte înainte de a declara că acţiunea a eşuat." #. Tag: entry #, no-c-format msgid "requires" msgstr "necesită" #. Tag: para #, no-c-format msgid "What conditions need to be satisfied before this action occurs. Allowed values:" msgstr "Care condiţii trebuie să fie satisfăcute înainte ca această acţiune să se întâmple. Valori permise:" #. Tag: para #, no-c-format msgid "nothing - The cluster may start this resource at any time" msgstr "nothing - Clusterul poate porni această resursă oricând" #. Tag: para #, no-c-format msgid "quorum - The cluster can only start this resource if a majority of the configured nodes are active" msgstr "quorum - Clusterul poate porni această resursă dacă o majoritate a nodurilor configurate este activă" #. Tag: para #, no-c-format msgid "fencing - The cluster can only start this resource if a majority of the configured nodes are active and any failed or unknown nodes have been powered off." msgstr "fencing - Clusterul poate porni această resursă doar dacă o majoritate a nodurilor configurate este activă şi orice noduri necunoscute sau defectate au fost deconectate de la reţeaua de alimentare." #. Tag: para #, no-c-format msgid "STONITH resources default to nothing, and all others default to fencing if STONITH is enabled and quorum otherwise." msgstr "Resursele STONITH au ca valoare implicită nimic, iar toate celelalte au ca valoare implicită fencing dacă STONITH este activat şi quorum în caz contrar." #. Tag: entry #, no-c-format msgid "on-fail" msgstr "on-fail" #. Tag: para #, no-c-format msgid "The action to take if this action ever fails. Allowed values:" msgstr "Acţiunea pe care să o execute dacă vreodată această acţiune eşuează. Valori permise:" #. Tag: para #, no-c-format msgid "ignore - Pretend the resource did not fail" msgstr "ignore - Consideră că acţiunea nu a eşuat" #. Tag: para #, no-c-format msgid "block - Don't perform any further operations on the resource" msgstr "block - Nu mai efectua operaţiuni ulterioare pe resursă" #. Tag: para #, no-c-format msgid "stop - Stop the resource and do not start it elsewhere" msgstr "stop - Opreşte resursa şi nu o mai porni în altă parte" #. Tag: para #, no-c-format msgid "restart - Stop the resource and start it again (possibly on a different node)" msgstr "restart - Opreşte resursa şi porneşte-o din nou (posibil pe un nod diferit)" #. Tag: para #, no-c-format msgid "fence - STONITH the node on which the resource failed" msgstr "fence - STONITH nodul pe care resursa a eşuat" #. Tag: para #, no-c-format msgid "standby - Move all resources away from the node on which the resource failed" msgstr "standby - Mută toate resursele de pe nodul pe care resursa a eşuat" #. Tag: para #, no-c-format msgid "The default for the stop operation is fence when STONITH is enabled and block otherwise. All other operations default to stop." msgstr "Valoarea implicită pentru operaţiunea stop este fence atunci când STONITH este activat şi block în caz contrar. Toate celelalte operaţiuni au valoarea implicită stop." #. Tag: entry #, no-c-format msgid "enabled" msgstr "activat" #. Tag: entry #, no-c-format msgid "If false, the operation is treated as if it does not exist. Allowed values: true, false" msgstr "Dacă este false, operaţiunea este tratată ca şi când nu ar exista. Valori permise: true, false" #. Tag: title #, no-c-format msgid "Setting Global Defaults for Operations" msgstr "Setarea de Valori Implicite Globale pentru Operaţiuni" #. Tag: para #, no-c-format msgid "To set a default value for a operation option, simply add it to the op_defaults section with crm_attribute. Thus," msgstr "Pentru a seta o valoare implicită pentru o opţiune a resursei, pur şi simplu adăugaţi-o la secţiunea rsc_defaults cu crm_attribute. Astfel," #. Tag: programlisting #, no-c-format msgid "crm_attribute --type op_defaults --attr-name timeout --attr-value 20s" msgstr "crm_attribute --type op_defaults --attr-name timeout --attr-value 20s" #. Tag: para #, no-c-format msgid "would default each operation's timeout to 20 seconds. If an operation's definition also includes a value for timeout, then that value would be used instead (for that operation only)." msgstr "ar seta valoarea implicită a timeout-ului fiecărei operaţiuni la 20 de secunde. Dacă definiţia unei operaţiuni include de asemenea o valoare pentru timeout, atunci acea valoare ar fi folosită în schimb (numai pentru acea operaţiune)." #. Tag: title #, no-c-format msgid "When Resources Take a Long Time to Start/Stop" msgstr "Când Resursele Durează Mult Timp să Pornească/Oprească" #. Tag: para #, no-c-format msgid "There are a number of implicit operations that the cluster will always perform - start, stop and a non-recurring monitor operation (used at startup to check the resource isn't already active). If one of these is taking too long, then you can create an entry for them and simply specify a new value." msgstr "Sunt un număr de operaţiuni implicite pe care clusterul pe va efectua întotdeauna - start, stop şi o operaţiune monitor nerecurentă (folosită la pornire pentru a verifica dacă resursa nu este deja activă). Dacă una din aceste operaţiuni durează prea mult, atunci puteţi crea o intrare pentru acestea şi să specificaţi o valoarea nouă." #. Tag: title #, no-c-format msgid "An OCF resource with custom timeouts for its implicit actions" msgstr "O resursă OCF cu intervale customizate pentru acţiunile implicite ale acesteia" #. Tag: programlisting #, no-c-format msgid " <primitive id=\"Public-IP\" class=\"ocf\" type=\"IPaddr\" provider=\"heartbeat\">\n" " <operations>\n" " <op id=\"public-ip-startup\" name=\"monitor\" interval=\"0\" timeout=\"90s\"/>\n" " <op id=\"public-ip-start\" name=\"start\" interval=\"0\" timeout=\"180s\"/>\n" " <op id=\"public-ip-stop\" name=\"stop\" interval=\"0\" timeout=\"15min\"/>\n" " </operations>\n" " <instance_attributes id=\"params-public-ip\">\n" " <nvpair id=\"public-ip-addr\" name=\"ip\" value=\"1.2.3.4\"/>\n" " </instance_attributes>\n" " </primitive> " msgstr "" " <primitive id=\"Public-IP\" class=\"ocf\" type=\"IPaddr\" provider=\"heartbeat\">\n" " <operations>\n" " <op id=\"public-ip-startup\" name=\"monitor\" interval=\"0\" timeout=\"90s\"/>\n" " <op id=\"public-ip-start\" name=\"start\" interval=\"0\" timeout=\"180s\"/>\n" " <op id=\"public-ip-stop\" name=\"stop\" interval=\"0\" timeout=\"15min\"/>\n" " </operations>\n" " <instance_attributes id=\"params-public-ip\">\n" " <nvpair id=\"public-ip-addr\" name=\"ip\" value=\"1.2.3.4\"/>\n" " </instance_attributes>\n" " </primitive> " #. Tag: title #, no-c-format msgid "Multiple Monitor Operations" msgstr "Operaţiuni de Monitorizare Multiple" #. Tag: para #, no-c-format msgid "Provided no two operations (for a single resource) have the same name and interval you can have as many monitor operations as you like. In this way you can do a superficial health check every minute and progressively more intense ones at higher intervals." msgstr "Atâta timp cât o pereche de două operaţiuni (pentru o singură resursă) nu au acelaşi nume sau acelaşi interval puteţi avea cât de multe operaţiuni de monitorizare pe cât doriţi. În acest fel puteţi realiza o verificare superficială a stării de sănătate la fiecare minut şi unele progresiv mai intense la intervale mai mari." #. Tag: para #, no-c-format msgid "To tell the resource agent what kind of check to perform, you need to provide each monitor with a different value for a common parameter. The OCF standard creates a special parameter called OCF_CHECK_LEVEL for this purpose and dictates that it is \"made available to the resource agent without the normal OCF_RESKEY_ prefix\"." msgstr "Pentru a spune agentului ce fel de verificare să efectueze, trebuie să furnizaţi fiecărei operaţiuni monitor o valoare diferită pentru un parametru comun. Standardul OCF creează un parametru special numit OCF_CHECK_LEVEL pentru acest scop şi dictează că este \"făcut disponibil agentului de resursă fără obişnuitul prefix OCF_RESKEY_ \"." #. Tag: para #, no-c-format msgid "Whatever name you choose, you can specify it by adding an instance_attributes block to the op tag. Note that it is up to each resource agent to look for the parameter and decide how to use it." msgstr "Indiferent de ce nume alegeţi, puteţi să îl specificaţi adăugând un bloc instance_attributes la tag-ul op. Ţineţi cont că acest lucru este datoria fiecărui agent de resursă să verifice dacă parametrul există şi să decidă cum să îl folosească." #. Tag: title #, no-c-format msgid "An OCF resource with two recurring health checks, performing different levels of checks - specified via OCF_CHECK_LEVEL." msgstr "O resursă OCF cu două verificări de sănătate recurente, efectuând nivele diferite de verificări - specificate via OCF_CHECK_LEVEL." #. Tag: programlisting #, no-c-format msgid " <primitive id=\"Public-IP\" class=\"ocf\" type=\"IPaddr\" provider=\"heartbeat\">\n" " <operations>\n" " <op id=\"public-ip-health-60\" name=\"monitor\" interval=\"60\">\n" " <instance_attributes id=\"params-public-ip-depth-60\">\n" " <nvpair id=\"public-ip-depth-60\" name=\"OCF_CHECK_LEVEL\" value=\"10\"/>\n" " </instance_attributes>\n" " </op>\n" " <op id=\"public-ip-health-300\" name=\"monitor\" interval=\"300\">\n" " <instance_attributes id=\"params-public-ip-depth-300\">\n" " <nvpair id=\"public-ip-depth-300\" name=\"OCF_CHECK_LEVEL\" value=\"20\"/>\n" " </instance_attributes>\n" " </op>\n" " </operations>\n" " <instance_attributes id=\"params-public-ip\">\n" " <nvpair id=\"public-ip-level\" name=\"ip\" value=\"1.2.3.4\"/>\n" " </instance_attributes>\n" " </primitive> " msgstr "" " <primitive id=\"Public-IP\" class=\"ocf\" type=\"IPaddr\" provider=\"heartbeat\">\n" " <operations>\n" " <op id=\"public-ip-health-60\" name=\"monitor\" interval=\"60\">\n" " <instance_attributes id=\"params-public-ip-depth-60\">\n" " <nvpair id=\"public-ip-depth-60\" name=\"OCF_CHECK_LEVEL\" value=\"10\"/>\n" " </instance_attributes>\n" " </op>\n" " <op id=\"public-ip-health-300\" name=\"monitor\" interval=\"300\">\n" " <instance_attributes id=\"params-public-ip-depth-300\">\n" " <nvpair id=\"public-ip-depth-300\" name=\"OCF_CHECK_LEVEL\" value=\"20\"/>\n" " </instance_attributes>\n" " </op>\n" " </operations>\n" " <instance_attributes id=\"params-public-ip\">\n" " <nvpair id=\"public-ip-level\" name=\"ip\" value=\"1.2.3.4\"/>\n" " </instance_attributes>\n" " </primitive> " #. Tag: title #, no-c-format msgid "Disabling a Monitor Operation" msgstr "Dezactivarea unei Operaţiuni de Monitorizare" #. Tag: para #, no-c-format -msgid "The easiest way to stop a recurring monitor is to just delete it. However, there can be times when you only want to disable it temporarily. In such cases, simply add disabled=\"true\" to the operation's definition." -msgstr "Cel mai simplu mod de a opri un monitor recurent este să îl ştergeţi. Însă pot exista momente când vreţi doar să îl dezactivaţi temporar. În astfel de cazuri, pur şi simplu adăugaţi disabled=\"true\" la definiţia operaţiunii." +msgid "The easiest way to stop a recurring monitor is to just delete it. However, there can be times when you only want to disable it temporarily. In such cases, simply add enabled=\"false\" to the operation's definition." +msgstr "Cel mai simplu mod de a opri un monitor recurent este să îl ştergeţi. Însă pot exista momente când vreţi doar să îl dezactivaţi temporar. În astfel de cazuri, pur şi simplu adăugaţi enabled=\"false\" la definiţia operaţiunii." #. Tag: title #, no-c-format msgid "Example of an OCF resource with a disabled health check" msgstr "Exemplu de resursă OCF cu o verificare a sănătăţii dezactivată" #. Tag: programlisting #, no-c-format msgid " <primitive id=\"Public-IP\" class=\"ocf\" type=\"IPaddr\" provider=\"heartbeat\">\n" " <operations>\n" -" <op id=\"public-ip-check\" name=\"monitor\" interval=\"60s\" disabled=\"true\"/>\n" +" <op id=\"public-ip-check\" name=\"monitor\" interval=\"60s\" enabled=\"false\"/>\n" " </operations>\n" " <instance_attributes id=\"params-public-ip\">\n" " <nvpair id=\"public-ip-addr\" name=\"ip\" value=\"1.2.3.4\"/>\n" " </instance_attributes>\n" " </primitive> " msgstr "" " <primitive id=\"Public-IP\" class=\"ocf\" type=\"IPaddr\" provider=\"heartbeat\">\n" " <operations>\n" -" <op id=\"public-ip-check\" name=\"monitor\" interval=\"60s\" disabled=\"true\"/>\n" +" <op id=\"public-ip-check\" name=\"monitor\" interval=\"60s\" enabled=\"false\"/>\n" " </operations>\n" " <instance_attributes id=\"params-public-ip\">\n" " <nvpair id=\"public-ip-addr\" name=\"ip\" value=\"1.2.3.4\"/>\n" " </instance_attributes>\n" " </primitive> " #. Tag: para #, no-c-format msgid "This can be achieved from the command-line by executing" msgstr "Acest lucru poate fi realizat din linia de comanda executând" #. Tag: programlisting #, no-c-format -msgid "cibadmin -M -X ‘<op id=\"public-ip-check\" disabled=\"true\"/>'" -msgstr "cibadmin -M -X ‘<op id=\"public-ip-check\" disabled=\"true\"/>'" +msgid "cibadmin -M -X ‘<op id=\"public-ip-check\" enabled=\"false\"/>'" +msgstr "cibadmin -M -X ‘<op id=\"public-ip-check\" enabled=\"false\"/>'" #. Tag: para #, no-c-format msgid "Once you've done whatever you needed to do, you can then re-enable it with" msgstr "Odată ce aţi făcut ceea ce aveaţi nevoie să faceţi, îl puteţi reactiva cu" #. Tag: programlisting #, no-c-format -msgid "cibadmin -M -X ‘<op id=\"public-ip-check\" disabled=\"false\"/>'" -msgstr "cibadmin -M -X ‘<op id=\"public-ip-check\" disabled=\"false\"/>'" +msgid "cibadmin -M -X ‘<op id=\"public-ip-check\" enabled=\"true\"/>'" +msgstr "cibadmin -M -X ‘<op id=\"public-ip-check\" enabled=\"true\"/>'" diff --git a/lib/cluster/cluster.c b/lib/cluster/cluster.c index 6cefcde7aa..bcb8f7be33 100644 --- a/lib/cluster/cluster.c +++ b/lib/cluster/cluster.c @@ -1,530 +1,530 @@ /* * Copyright (C) 2004 Andrew Beekhof * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "stack.h" CRM_TRACE_INIT_DATA(cluster); #if SUPPORT_HEARTBEAT void *hb_library = NULL; #endif static GHashTable *crm_uuid_cache = NULL; static GHashTable *crm_uname_cache = NULL; xmlNode *create_common_message(xmlNode * original_request, xmlNode * xml_response_data); static char * get_heartbeat_uuid(uint32_t unused, const char *uname) { char *uuid_calc = NULL; #if SUPPORT_HEARTBEAT cl_uuid_t uuid_raw; const char *unknown = "00000000-0000-0000-0000-000000000000"; if (heartbeat_cluster == NULL) { crm_warn("No connection to heartbeat, using uuid=uname"); return NULL; } if (heartbeat_cluster->llc_ops->get_uuid_by_name(heartbeat_cluster, uname, &uuid_raw) == HA_FAIL) { crm_err("get_uuid_by_name() call failed for host %s", uname); crm_free(uuid_calc); return NULL; } crm_malloc0(uuid_calc, 50); cl_uuid_unparse(&uuid_raw, uuid_calc); if (safe_str_eq(uuid_calc, unknown)) { crm_warn("Could not calculate UUID for %s", uname); crm_free(uuid_calc); return NULL; } #endif return uuid_calc; } static gboolean uname_is_uuid(void) { static const char *uuid_pref = NULL; if (uuid_pref == NULL) { uuid_pref = getenv("PCMK_uname_is_uuid"); } if (uuid_pref == NULL) { /* true is legacy mode */ uuid_pref = "false"; } return crm_is_true(uuid_pref); } int get_corosync_id(int id, const char *uuid) { if (id == 0 && !uname_is_uuid() && is_corosync_cluster()) { id = crm_atoi(uuid, "0"); } return id; } char * get_corosync_uuid(uint32_t id, const char *uname) { if (!uname_is_uuid() && is_corosync_cluster()) { if (id <= 0) { /* Try the membership cache... */ crm_node_t *node = g_hash_table_lookup(crm_peer_cache, uname); if (node != NULL) { id = node->id; } } if (id > 0) { return crm_itoa(id); } else { crm_warn("Node %s is not yet known by corosync", uname); } } else if (uname != NULL) { return crm_strdup(uname); } return NULL; } const char * get_node_uuid(uint32_t id, const char *uname) { char *uuid = NULL; enum cluster_type_e type = get_cluster_type(); if (crm_uuid_cache == NULL) { crm_uuid_cache = g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str); } /* avoid blocking heartbeat calls where possible */ if (uname) { uuid = g_hash_table_lookup(crm_uuid_cache, uname); } if (uuid != NULL) { return uuid; } switch (type) { case pcmk_cluster_corosync: uuid = get_corosync_uuid(id, uname); break; case pcmk_cluster_cman: case pcmk_cluster_classic_ais: if (uname) { uuid = crm_strdup(uname); } break; case pcmk_cluster_heartbeat: uuid = get_heartbeat_uuid(id, uname); break; case pcmk_cluster_unknown: case pcmk_cluster_invalid: crm_err("Unsupported cluster type"); break; } if (uuid == NULL) { return NULL; } if (uname) { g_hash_table_insert(crm_uuid_cache, crm_strdup(uname), uuid); return g_hash_table_lookup(crm_uuid_cache, uname); } /* Memory leak! */ CRM_LOG_ASSERT(uuid != NULL); return uuid; } gboolean crm_cluster_connect(char **our_uname, char **our_uuid, void *dispatch, void *destroy, #if SUPPORT_HEARTBEAT ll_cluster_t ** hb_conn #else void **hb_conn #endif ) { enum cluster_type_e type = get_cluster_type(); crm_notice("Connecting to cluster infrastructure: %s", name_for_cluster_type(type)); if (hb_conn != NULL) { *hb_conn = NULL; } #if SUPPORT_COROSYNC if (is_openais_cluster()) { crm_peer_init(); return init_ais_connection(dispatch, destroy, our_uuid, our_uname, NULL); } #endif #if SUPPORT_HEARTBEAT if (is_heartbeat_cluster()) { int rv; CRM_ASSERT(hb_conn != NULL); /* coverity[var_deref_op] False positive */ if (*hb_conn == NULL) { /* No object passed in, create a new one. */ ll_cluster_t *(*new_cluster) (const char *llctype) = find_library_function(&hb_library, HEARTBEAT_LIBRARY, "ll_cluster_new"); *hb_conn = (*new_cluster) ("heartbeat"); /* dlclose(handle); */ } else { /* Object passed in. Disconnect first, then reconnect below. */ ll_cluster_t *conn = *hb_conn; conn->llc_ops->signoff(conn, FALSE); } /* make sure we are disconnected first with the old object, if any. */ if (heartbeat_cluster && heartbeat_cluster != *hb_conn) { heartbeat_cluster->llc_ops->signoff(heartbeat_cluster, FALSE); } CRM_ASSERT(*hb_conn != NULL); heartbeat_cluster = *hb_conn; rv = register_heartbeat_conn(heartbeat_cluster, our_uuid, our_uname, dispatch, destroy); if (rv) { /* we'll benefit from a bigger queue length on heartbeat side. * Otherwise, if peers send messages faster than we can consume * them right now, heartbeat messaging layer will kick us out once * it's (small) default queue fills up :( * If we fail to adjust the sendq length, that's not yet fatal, though. */ if (HA_OK != (*hb_conn)->llc_ops->set_sendq_len(*hb_conn, 1024)) { crm_warn("Cannot set sendq length: %s", (*hb_conn)->llc_ops->errmsg(*hb_conn)); } } return rv; } #endif crm_info("Unsupported cluster stack: %s", getenv("HA_cluster_type")); return FALSE; } gboolean send_cluster_message(const char *node, enum crm_ais_msg_types service, xmlNode * data, gboolean ordered) { #if SUPPORT_COROSYNC if (is_openais_cluster()) { return send_ais_message(data, FALSE, node, service); } #endif #if SUPPORT_HEARTBEAT if (is_heartbeat_cluster()) { return send_ha_message(heartbeat_cluster, data, node, ordered); } #endif return FALSE; } void empty_uuid_cache(void) { if (crm_uuid_cache != NULL) { g_hash_table_destroy(crm_uuid_cache); crm_uuid_cache = NULL; } } void unget_uuid(const char *uname) { if (crm_uuid_cache == NULL) { return; } g_hash_table_remove(crm_uuid_cache, uname); } const char * get_uuid(const char *uname) { return get_node_uuid(0, uname); } const char * get_uname(const char *uuid) { const char *uname = NULL; if (crm_uname_cache == NULL) { crm_uname_cache = g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str); } CRM_CHECK(uuid != NULL, return NULL); /* avoid blocking calls where possible */ uname = g_hash_table_lookup(crm_uname_cache, uuid); if (uname != NULL) { return uname; } #if SUPPORT_COROSYNC if (is_openais_cluster()) { if (!uname_is_uuid() && is_corosync_cluster()) { uint32_t id = crm_int_helper(uuid, NULL); crm_node_t *node = g_hash_table_lookup(crm_peer_id_cache, GUINT_TO_POINTER(id)); uname = node ? node->uname : NULL; } else { uname = uuid; } if (uname) { g_hash_table_insert(crm_uname_cache, crm_strdup(uuid), crm_strdup(uname)); } } #endif #if SUPPORT_HEARTBEAT if (is_heartbeat_cluster()) { if (heartbeat_cluster != NULL && uuid != NULL) { cl_uuid_t uuid_raw; char *hb_uname = NULL; char *uuid_copy = crm_strdup(uuid); cl_uuid_parse(uuid_copy, &uuid_raw); - crm_malloc(uname, MAX_NAME); + crm_malloc(hb_uname, MAX_NAME); if (heartbeat_cluster->llc_ops->get_name_by_uuid(heartbeat_cluster, &uuid_raw, hb_uname, MAX_NAME) == HA_FAIL) { crm_err("Could not calculate uname for %s", uuid); crm_free(uuid_copy); crm_free(hb_uname); } else { g_hash_table_insert(crm_uname_cache, uuid_copy, hb_uname); } } } #endif return g_hash_table_lookup(crm_uname_cache, uuid); } void set_uuid(xmlNode * node, const char *attr, const char *uname) { const char *uuid_calc = get_uuid(uname); crm_xml_add(node, attr, uuid_calc); return; } xmlNode * createPingAnswerFragment(const char *from, const char *status) { xmlNode *ping = NULL; ping = create_xml_node(NULL, XML_CRM_TAG_PING); crm_xml_add(ping, XML_PING_ATTR_STATUS, status); crm_xml_add(ping, XML_PING_ATTR_SYSFROM, from); return ping; } const char * name_for_cluster_type(enum cluster_type_e type) { switch (type) { case pcmk_cluster_classic_ais: return "classic openais (with plugin)"; case pcmk_cluster_cman: return "cman"; case pcmk_cluster_corosync: return "corosync"; case pcmk_cluster_heartbeat: return "heartbeat"; case pcmk_cluster_unknown: return "unknown"; case pcmk_cluster_invalid: return "invalid"; } crm_err("Invalid cluster type: %d", type); return "invalid"; } /* Do not expose these two */ int set_cluster_type(enum cluster_type_e type); static enum cluster_type_e cluster_type = pcmk_cluster_unknown; int set_cluster_type(enum cluster_type_e type) { if (cluster_type == pcmk_cluster_unknown) { crm_info("Cluster type set to: %s", name_for_cluster_type(type)); cluster_type = type; return 0; } else if (cluster_type == type) { return 0; } else if (pcmk_cluster_unknown == type) { cluster_type = type; return 0; } crm_err("Cluster type already set to %s, ignoring %s", name_for_cluster_type(cluster_type), name_for_cluster_type(type)); return -1; } enum cluster_type_e get_cluster_type(void) { if (cluster_type == pcmk_cluster_unknown) { const char *cluster = getenv("HA_cluster_type"); cluster_type = pcmk_cluster_invalid; if (cluster) { crm_info("Cluster type is: '%s'", cluster); } else { #if SUPPORT_COROSYNC cluster_type = find_corosync_variant(); if (cluster_type == pcmk_cluster_unknown) { cluster = "heartbeat"; crm_info("Assuming a 'heartbeat' based cluster"); } else { cluster = name_for_cluster_type(cluster_type); crm_info("Detected an active '%s' cluster", cluster); } #else cluster = "heartbeat"; #endif } if (safe_str_eq(cluster, "heartbeat")) { #if SUPPORT_HEARTBEAT cluster_type = pcmk_cluster_heartbeat; #else cluster_type = pcmk_cluster_invalid; #endif } else if (safe_str_eq(cluster, "openais") || safe_str_eq(cluster, "classic openais (with plugin)")) { #if SUPPORT_COROSYNC cluster_type = pcmk_cluster_classic_ais; #else cluster_type = pcmk_cluster_invalid; #endif } else if (safe_str_eq(cluster, "corosync")) { #if SUPPORT_COROSYNC cluster_type = pcmk_cluster_corosync; #else cluster_type = pcmk_cluster_invalid; #endif } else if (safe_str_eq(cluster, "cman")) { #if SUPPORT_CMAN cluster_type = pcmk_cluster_cman; #else cluster_type = pcmk_cluster_invalid; #endif } else { cluster_type = pcmk_cluster_invalid; } if (cluster_type == pcmk_cluster_invalid) { crm_crit ("This installation of Pacemaker does not support the '%s' cluster infrastructure. Terminating.", cluster); exit(100); } } return cluster_type; } gboolean is_cman_cluster(void) { return get_cluster_type() == pcmk_cluster_cman; } gboolean is_corosync_cluster(void) { return get_cluster_type() == pcmk_cluster_corosync; } gboolean is_classic_ais_cluster(void) { return get_cluster_type() == pcmk_cluster_classic_ais; } gboolean is_openais_cluster(void) { enum cluster_type_e type = get_cluster_type(); if (type == pcmk_cluster_classic_ais) { return TRUE; } else if (type == pcmk_cluster_corosync) { return TRUE; } else if (type == pcmk_cluster_cman) { return TRUE; } return FALSE; } gboolean is_heartbeat_cluster(void) { return get_cluster_type() == pcmk_cluster_heartbeat; } diff --git a/lib/pengine/unpack.c b/lib/pengine/unpack.c index 31d3ae18ad..095d465dc8 100644 --- a/lib/pengine/unpack.c +++ b/lib/pengine/unpack.c @@ -1,2405 +1,2408 @@ /* * Copyright (C) 2004 Andrew Beekhof * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include #include #include #include #include #include #include CRM_TRACE_INIT_DATA(pe_status); #define set_config_flag(data_set, option, flag) do { \ const char *tmp = pe_pref(data_set->config_hash, option); \ if(tmp) { \ if(crm_is_true(tmp)) { \ set_bit_inplace(data_set->flags, flag); \ } else { \ clear_bit_inplace(data_set->flags, flag); \ } \ } \ } while(0) gboolean unpack_rsc_op(resource_t * rsc, node_t * node, xmlNode * xml_op, GListPtr next, enum action_fail_response *failed, pe_working_set_t * data_set); static void pe_fence_node(pe_working_set_t * data_set, node_t * node, const char *reason) { CRM_CHECK(node, return); if (node->details->unclean == FALSE) { if (is_set(data_set->flags, pe_flag_stonith_enabled)) { crm_warn("Node %s will be fenced %s", node->details->uname, reason); } else { crm_warn("Node %s is unclean %s", node->details->uname, reason); } } node->details->unclean = TRUE; } gboolean unpack_config(xmlNode * config, pe_working_set_t * data_set) { const char *value = NULL; GHashTable *config_hash = g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str); data_set->config_hash = config_hash; unpack_instance_attributes(data_set->input, config, XML_CIB_TAG_PROPSET, NULL, config_hash, CIB_OPTIONS_FIRST, FALSE, data_set->now); verify_pe_options(data_set->config_hash); set_config_flag(data_set, "enable-startup-probes", pe_flag_startup_probes); crm_info("Startup probes: %s", is_set(data_set->flags, pe_flag_startup_probes) ? "enabled" : "disabled (dangerous)"); value = pe_pref(data_set->config_hash, "stonith-timeout"); data_set->stonith_timeout = crm_get_msec(value); crm_debug("STONITH timeout: %d", data_set->stonith_timeout); set_config_flag(data_set, "stonith-enabled", pe_flag_stonith_enabled); crm_debug("STONITH of failed nodes is %s", is_set(data_set->flags, pe_flag_stonith_enabled) ? "enabled" : "disabled"); data_set->stonith_action = pe_pref(data_set->config_hash, "stonith-action"); crm_trace("STONITH will %s nodes", data_set->stonith_action); set_config_flag(data_set, "stop-all-resources", pe_flag_stop_everything); crm_debug("Stop all active resources: %s", is_set(data_set->flags, pe_flag_stop_everything) ? "true" : "false"); set_config_flag(data_set, "symmetric-cluster", pe_flag_symmetric_cluster); if (is_set(data_set->flags, pe_flag_symmetric_cluster)) { crm_debug("Cluster is symmetric" " - resources can run anywhere by default"); } value = pe_pref(data_set->config_hash, "default-resource-stickiness"); data_set->default_resource_stickiness = char2score(value); crm_debug("Default stickiness: %d", data_set->default_resource_stickiness); value = pe_pref(data_set->config_hash, "no-quorum-policy"); if (safe_str_eq(value, "ignore")) { data_set->no_quorum_policy = no_quorum_ignore; } else if (safe_str_eq(value, "freeze")) { data_set->no_quorum_policy = no_quorum_freeze; } else if (safe_str_eq(value, "suicide")) { gboolean do_panic = FALSE; crm_element_value_int(data_set->input, XML_ATTR_QUORUM_PANIC, &do_panic); if (is_set(data_set->flags, pe_flag_stonith_enabled) == FALSE) { crm_config_err ("Setting no-quorum-policy=suicide makes no sense if stonith-enabled=false"); } if (do_panic && is_set(data_set->flags, pe_flag_stonith_enabled)) { data_set->no_quorum_policy = no_quorum_suicide; } else if (is_set(data_set->flags, pe_flag_have_quorum) == FALSE && do_panic == FALSE) { crm_notice("Resetting no-quorum-policy to 'stop': The cluster has never had quorum"); data_set->no_quorum_policy = no_quorum_stop; } } else { data_set->no_quorum_policy = no_quorum_stop; } switch (data_set->no_quorum_policy) { case no_quorum_freeze: crm_debug("On loss of CCM Quorum: Freeze resources"); break; case no_quorum_stop: crm_debug("On loss of CCM Quorum: Stop ALL resources"); break; case no_quorum_suicide: crm_notice("On loss of CCM Quorum: Fence all remaining nodes"); break; case no_quorum_ignore: crm_notice("On loss of CCM Quorum: Ignore"); break; } set_config_flag(data_set, "stop-orphan-resources", pe_flag_stop_rsc_orphans); crm_trace("Orphan resources are %s", is_set(data_set->flags, pe_flag_stop_rsc_orphans) ? "stopped" : "ignored"); set_config_flag(data_set, "stop-orphan-actions", pe_flag_stop_action_orphans); crm_trace("Orphan resource actions are %s", is_set(data_set->flags, pe_flag_stop_action_orphans) ? "stopped" : "ignored"); set_config_flag(data_set, "remove-after-stop", pe_flag_remove_after_stop); crm_trace("Stopped resources are removed from the status section: %s", is_set(data_set->flags, pe_flag_remove_after_stop) ? "true" : "false"); set_config_flag(data_set, "maintenance-mode", pe_flag_maintenance_mode); crm_trace("Maintenance mode: %s", is_set(data_set->flags, pe_flag_maintenance_mode) ? "true" : "false"); if (is_set(data_set->flags, pe_flag_maintenance_mode)) { clear_bit(data_set->flags, pe_flag_is_managed_default); } else { set_config_flag(data_set, "is-managed-default", pe_flag_is_managed_default); } crm_trace("By default resources are %smanaged", is_set(data_set->flags, pe_flag_is_managed_default) ? "" : "not "); set_config_flag(data_set, "start-failure-is-fatal", pe_flag_start_failure_fatal); crm_trace("Start failures are %s", is_set(data_set->flags, pe_flag_start_failure_fatal) ? "always fatal" : "handled by failcount"); node_score_red = char2score(pe_pref(data_set->config_hash, "node-health-red")); node_score_green = char2score(pe_pref(data_set->config_hash, "node-health-green")); node_score_yellow = char2score(pe_pref(data_set->config_hash, "node-health-yellow")); crm_info("Node scores: 'red' = %s, 'yellow' = %s, 'green' = %s", pe_pref(data_set->config_hash, "node-health-red"), pe_pref(data_set->config_hash, "node-health-yellow"), pe_pref(data_set->config_hash, "node-health-green")); data_set->placement_strategy = pe_pref(data_set->config_hash, "placement-strategy"); crm_trace("Placement strategy: %s", data_set->placement_strategy); return TRUE; } gboolean unpack_nodes(xmlNode * xml_nodes, pe_working_set_t * data_set) { xmlNode *xml_obj = NULL; node_t *new_node = NULL; const char *id = NULL; const char *uname = NULL; const char *type = NULL; const char *score = NULL; gboolean unseen_are_unclean = TRUE; const char *blind_faith = pe_pref(data_set->config_hash, "startup-fencing"); if (crm_is_true(blind_faith) == FALSE) { unseen_are_unclean = FALSE; crm_warn("Blind faith: not fencing unseen nodes"); } for (xml_obj = __xml_first_child(xml_nodes); xml_obj != NULL; xml_obj = __xml_next(xml_obj)) { if (crm_str_eq((const char *)xml_obj->name, XML_CIB_TAG_NODE, TRUE)) { new_node = NULL; id = crm_element_value(xml_obj, XML_ATTR_ID); uname = crm_element_value(xml_obj, XML_ATTR_UNAME); type = crm_element_value(xml_obj, XML_ATTR_TYPE); score = crm_element_value(xml_obj, XML_RULE_ATTR_SCORE); crm_trace("Processing node %s/%s", uname, id); if (id == NULL) { crm_config_err("Must specify id tag in "); continue; } if (type == NULL) { crm_config_err("Must specify type tag in "); continue; } if (pe_find_node(data_set->nodes, uname) != NULL) { crm_config_warn("Detected multiple node entries with uname=%s" " - this is rarely intended", uname); } crm_malloc0(new_node, sizeof(node_t)); if (new_node == NULL) { return FALSE; } new_node->weight = char2score(score); new_node->fixed = FALSE; crm_malloc0(new_node->details, sizeof(struct node_shared_s)); if (new_node->details == NULL) { crm_free(new_node); return FALSE; } crm_trace("Creaing node for entry %s/%s", uname, id); new_node->details->id = id; new_node->details->uname = uname; new_node->details->type = node_ping; new_node->details->online = FALSE; new_node->details->shutdown = FALSE; new_node->details->running_rsc = NULL; new_node->details->attrs = g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str); new_node->details->utilization = g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str); /* if(data_set->have_quorum == FALSE */ /* && data_set->no_quorum_policy == no_quorum_stop) { */ /* /\* start shutting resources down *\/ */ /* new_node->weight = -INFINITY; */ /* } */ if (is_set(data_set->flags, pe_flag_stonith_enabled) == FALSE || unseen_are_unclean == FALSE) { /* blind faith... */ new_node->details->unclean = FALSE; } else { /* all nodes are unclean until we've seen their * status entry */ new_node->details->unclean = TRUE; } if (type == NULL || safe_str_eq(type, "member") || safe_str_eq(type, NORMALNODE)) { new_node->details->type = node_member; } add_node_attrs(xml_obj, new_node, FALSE, data_set); unpack_instance_attributes(data_set->input, xml_obj, XML_TAG_UTILIZATION, NULL, new_node->details->utilization, NULL, FALSE, data_set->now); data_set->nodes = g_list_append(data_set->nodes, new_node); crm_trace("Done with node %s", crm_element_value(xml_obj, XML_ATTR_UNAME)); } } return TRUE; } static void g_hash_destroy_node_list(gpointer data) { GListPtr domain = data; slist_basic_destroy(domain); } gboolean unpack_domains(xmlNode * xml_domains, pe_working_set_t * data_set) { const char *id = NULL; GListPtr domain = NULL; xmlNode *xml_node = NULL; xmlNode *xml_domain = NULL; crm_info("Unpacking domains"); data_set->domains = g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_node_list); for (xml_domain = __xml_first_child(xml_domains); xml_domain != NULL; xml_domain = __xml_next(xml_domain)) { if (crm_str_eq((const char *)xml_domain->name, XML_CIB_TAG_DOMAIN, TRUE)) { domain = NULL; id = crm_element_value(xml_domain, XML_ATTR_ID); for (xml_node = __xml_first_child(xml_domain); xml_node != NULL; xml_node = __xml_next(xml_node)) { if (crm_str_eq((const char *)xml_node->name, XML_CIB_TAG_NODE, TRUE)) { node_t *copy = NULL; node_t *node = NULL; const char *uname = crm_element_value(xml_node, "name"); const char *score = crm_element_value(xml_node, XML_RULE_ATTR_SCORE); if (uname == NULL) { crm_config_err("Invalid domain %s: Must specify id tag in ", id); continue; } node = pe_find_node(data_set->nodes, uname); if (node == NULL) { node = pe_find_node_id(data_set->nodes, uname); } if (node == NULL) { crm_config_warn("Invalid domain %s: Node %s does not exist", id, uname); continue; } copy = node_copy(node); copy->weight = char2score(score); crm_debug("Adding %s to domain %s with score %s", node->details->uname, id, score); domain = g_list_prepend(domain, copy); } } if (domain) { crm_debug("Created domain %s with %d members", id, g_list_length(domain)); g_hash_table_replace(data_set->domains, crm_strdup(id), domain); } } } return TRUE; } static void destroy_template_rsc_set(gpointer data) { xmlNode *rsc_set = data; free_xml(rsc_set); } gboolean unpack_resources(xmlNode * xml_resources, pe_working_set_t * data_set) { xmlNode *xml_obj = NULL; data_set->template_rsc_sets = g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, destroy_template_rsc_set); for (xml_obj = __xml_first_child(xml_resources); xml_obj != NULL; xml_obj = __xml_next(xml_obj)) { resource_t *new_rsc = NULL; if (crm_str_eq((const char *)xml_obj->name, XML_CIB_TAG_RSC_TEMPLATE, TRUE)) { const char *template_id = ID(xml_obj); if (template_id && g_hash_table_lookup_extended(data_set->template_rsc_sets, template_id, NULL, NULL) == FALSE) { /* Record the template's ID for the knowledge of its existence anyway. */ g_hash_table_insert(data_set->template_rsc_sets, crm_strdup(template_id), NULL); } continue; } crm_trace("Beginning unpack... <%s id=%s... >", crm_element_name(xml_obj), ID(xml_obj)); if (common_unpack(xml_obj, &new_rsc, NULL, data_set)) { data_set->resources = g_list_append(data_set->resources, new_rsc); print_resource(LOG_DEBUG_3, "Added", new_rsc, FALSE); } else { crm_config_err("Failed unpacking %s %s", crm_element_name(xml_obj), crm_element_value(xml_obj, XML_ATTR_ID)); if (new_rsc != NULL && new_rsc->fns != NULL) { new_rsc->fns->free(new_rsc); } } } data_set->resources = g_list_sort(data_set->resources, sort_rsc_priority); if (is_set(data_set->flags, pe_flag_stonith_enabled) && is_set(data_set->flags, pe_flag_have_stonith_resource) == FALSE) { crm_config_err("Resource start-up disabled since no STONITH resources have been defined"); crm_config_err("Either configure some or disable STONITH with the stonith-enabled option"); crm_config_err("NOTE: Clusters with shared data need STONITH to ensure data integrity"); } return TRUE; } /* The ticket state section: * "/cib/status/tickets/ticket_state" */ static gboolean unpack_ticket_state(xmlNode * xml_ticket, pe_working_set_t * data_set) { const char *ticket_id = NULL; const char *granted = NULL; const char *last_granted = NULL; const char *standby = NULL; xmlAttrPtr xIter = NULL; ticket_t *ticket = NULL; ticket_id = ID(xml_ticket); if (ticket_id == NULL || strlen(ticket_id) == 0) { return FALSE; } crm_trace("Processing ticket state for %s", ticket_id); ticket = g_hash_table_lookup(data_set->tickets, ticket_id); if (ticket == NULL) { ticket = ticket_new(ticket_id, data_set); if (ticket == NULL) { return FALSE; } } for (xIter = xml_ticket->properties; xIter; xIter = xIter->next) { const char *prop_name = (const char *)xIter->name; const char *prop_value = crm_element_value(xml_ticket, prop_name); if(crm_str_eq(prop_name, XML_ATTR_ID, TRUE)) { continue; } g_hash_table_replace(ticket->state, crm_strdup(prop_name), crm_strdup(prop_value)); } granted = g_hash_table_lookup(ticket->state, "granted"); if (granted && crm_is_true(granted)) { ticket->granted = TRUE; crm_info("We have ticket '%s'", ticket->id); } else { ticket->granted = FALSE; crm_info("We do not have ticket '%s'", ticket->id); } last_granted = g_hash_table_lookup(ticket->state, "last-granted"); if (last_granted) { ticket->last_granted = crm_parse_int(last_granted, 0); } standby = g_hash_table_lookup(ticket->state, "standby"); if (standby && crm_is_true(standby)) { ticket->standby = TRUE; if (ticket->granted) { crm_info("Granted ticket '%s' is in standby-mode", ticket->id); } } else { ticket->standby = FALSE; } crm_trace("Done with ticket state for %s", ticket_id); return TRUE; } static gboolean unpack_tickets_state(xmlNode * xml_tickets, pe_working_set_t * data_set) { xmlNode *xml_obj = NULL; for (xml_obj = __xml_first_child(xml_tickets); xml_obj != NULL; xml_obj = __xml_next(xml_obj)) { if (crm_str_eq((const char *)xml_obj->name, XML_CIB_TAG_TICKET_STATE, TRUE) == FALSE) { continue; } unpack_ticket_state(xml_obj, data_set); } return TRUE; } /* Compatibility with the deprecated ticket state section: * "/cib/status/tickets/instance_attributes" */ static void get_ticket_state_legacy(gpointer key, gpointer value, gpointer user_data) { const char *long_key = key; char *state_key = NULL; const char *granted_prefix = "granted-ticket-"; const char *last_granted_prefix = "last-granted-"; static int granted_prefix_strlen = 0; static int last_granted_prefix_strlen = 0; const char *ticket_id = NULL; const char *is_granted = NULL; const char *last_granted = NULL; const char *sep = NULL; ticket_t *ticket = NULL; pe_working_set_t *data_set = user_data; if (granted_prefix_strlen == 0) { granted_prefix_strlen = strlen(granted_prefix); } if (last_granted_prefix_strlen == 0) { last_granted_prefix_strlen = strlen(last_granted_prefix); } if (strstr(long_key, granted_prefix) == long_key) { ticket_id = long_key + granted_prefix_strlen; if (strlen(ticket_id)) { state_key = crm_strdup("granted"); is_granted = value; } } else if (strstr(long_key, last_granted_prefix) == long_key) { ticket_id = long_key + last_granted_prefix_strlen; if (strlen(ticket_id)) { state_key = crm_strdup("last-granted"); last_granted = value; } } else if ((sep = strrchr(long_key, '-'))) { ticket_id = sep + 1; state_key = strndup(long_key, strlen(long_key) - strlen(sep)); } if (ticket_id == NULL || strlen(ticket_id) == 0) { crm_free(state_key); return; } if (state_key == NULL || strlen(state_key) == 0) { crm_free(state_key); return; } ticket = g_hash_table_lookup(data_set->tickets, ticket_id); if (ticket == NULL) { ticket = ticket_new(ticket_id, data_set); if (ticket == NULL) { crm_free(state_key); return; } } g_hash_table_replace(ticket->state, state_key, crm_strdup(value)); if (is_granted) { if (crm_is_true(is_granted)) { ticket->granted = TRUE; crm_info("We have ticket '%s'", ticket->id); } else { ticket->granted = FALSE; crm_info("We do not have ticket '%s'", ticket->id); } } else if (last_granted) { ticket->last_granted = crm_parse_int(last_granted, 0); } } /* remove nodes that are down, stopping */ /* create +ve rsc_to_node constraints between resources and the nodes they are running on */ /* anything else? */ gboolean unpack_status(xmlNode * status, pe_working_set_t * data_set) { const char *id = NULL; const char *uname = NULL; xmlNode *lrm_rsc = NULL; xmlNode *attrs = NULL; xmlNode *state = NULL; xmlNode *node_state = NULL; node_t *this_node = NULL; crm_trace("Beginning unpack"); if (data_set->tickets == NULL) { data_set->tickets = g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, destroy_ticket); } for (state = __xml_first_child(status); state != NULL; state = __xml_next(state)) { if (crm_str_eq((const char *)state->name, XML_CIB_TAG_TICKETS, TRUE)) { xmlNode *xml_tickets = state; GHashTable *state_hash = NULL; /* Compatibility with the deprecated ticket state section: * Unpack the attributes in the deprecated "/cib/status/tickets/instance_attributes" if it exists. */ state_hash = g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str); unpack_instance_attributes(data_set->input, xml_tickets, XML_TAG_ATTR_SETS, NULL, state_hash, NULL, TRUE, data_set->now); g_hash_table_foreach(state_hash, get_ticket_state_legacy, data_set); if (state_hash) { g_hash_table_destroy(state_hash); } /* Unpack the new "/cib/status/tickets/ticket_state"s */ unpack_tickets_state(xml_tickets, data_set); } if (crm_str_eq((const char *)state->name, XML_CIB_TAG_STATE, TRUE)) { node_state = state; id = crm_element_value(node_state, XML_ATTR_ID); uname = crm_element_value(node_state, XML_ATTR_UNAME); attrs = find_xml_node(node_state, XML_TAG_TRANSIENT_NODEATTRS, FALSE); crm_trace("Processing node id=%s, uname=%s", id, uname); this_node = pe_find_node_id(data_set->nodes, id); if (uname == NULL) { /* error */ continue; } else if (this_node == NULL) { crm_config_warn("Node %s in status section no longer exists", uname); continue; } /* Mark the node as provisionally clean * - at least we have seen it in the current cluster's lifetime */ this_node->details->unclean = FALSE; add_node_attrs(attrs, this_node, TRUE, data_set); if (crm_is_true(g_hash_table_lookup(this_node->details->attrs, "standby"))) { crm_info("Node %s is in standby-mode", this_node->details->uname); this_node->details->standby = TRUE; } crm_trace("determining node state"); determine_online_status(node_state, this_node, data_set); if (this_node->details->online && data_set->no_quorum_policy == no_quorum_suicide) { /* Everything else should flow from this automatically * At least until the PE becomes able to migrate off healthy resources */ pe_fence_node(data_set, this_node, "because the cluster does not have quorum"); } } } /* Now that we know all node states, we can safely handle migration ops * But, for now, only process healthy nodes * - this is necessary for the logic in bug lf#2508 to function correctly */ for (node_state = __xml_first_child(status); node_state != NULL; node_state = __xml_next(node_state)) { if (crm_str_eq((const char *)node_state->name, XML_CIB_TAG_STATE, TRUE) == FALSE) { continue; } id = crm_element_value(node_state, XML_ATTR_ID); this_node = pe_find_node_id(data_set->nodes, id); if (this_node == NULL) { crm_info("Node %s is unknown", id); continue; } else if (this_node->details->online) { crm_trace("Processing lrm resource entries on healthy node: %s", this_node->details->uname); lrm_rsc = find_xml_node(node_state, XML_CIB_TAG_LRM, FALSE); lrm_rsc = find_xml_node(lrm_rsc, XML_LRM_TAG_RESOURCES, FALSE); unpack_lrm_resources(this_node, lrm_rsc, data_set); } } /* Now handle failed nodes - but only if stonith is enabled * * By definition, offline nodes run no resources so there is nothing to do. * Only when stonith is enabled do we need to know what is on the node to * ensure rsc start events happen after the stonith */ for (node_state = __xml_first_child(status); node_state != NULL && is_set(data_set->flags, pe_flag_stonith_enabled); node_state = __xml_next(node_state)) { if (crm_str_eq((const char *)node_state->name, XML_CIB_TAG_STATE, TRUE) == FALSE) { continue; } id = crm_element_value(node_state, XML_ATTR_ID); this_node = pe_find_node_id(data_set->nodes, id); if (this_node == NULL || this_node->details->online) { continue; } else { crm_trace("Processing lrm resource entries on unhealthy node: %s", this_node->details->uname); lrm_rsc = find_xml_node(node_state, XML_CIB_TAG_LRM, FALSE); lrm_rsc = find_xml_node(lrm_rsc, XML_LRM_TAG_RESOURCES, FALSE); unpack_lrm_resources(this_node, lrm_rsc, data_set); } } return TRUE; } static gboolean determine_online_status_no_fencing(pe_working_set_t * data_set, xmlNode * node_state, node_t * this_node) { gboolean online = FALSE; const char *join_state = crm_element_value(node_state, XML_CIB_ATTR_JOINSTATE); const char *crm_state = crm_element_value(node_state, XML_CIB_ATTR_CRMDSTATE); const char *ccm_state = crm_element_value(node_state, XML_CIB_ATTR_INCCM); const char *ha_state = crm_element_value(node_state, XML_CIB_ATTR_HASTATE); const char *exp_state = crm_element_value(node_state, XML_CIB_ATTR_EXPSTATE); if (ha_state == NULL) { ha_state = DEADSTATUS; } if (!crm_is_true(ccm_state) || safe_str_eq(ha_state, DEADSTATUS)) { crm_trace("Node is down: ha_state=%s, ccm_state=%s", crm_str(ha_state), crm_str(ccm_state)); } else if (safe_str_eq(crm_state, ONLINESTATUS)) { if (safe_str_eq(join_state, CRMD_JOINSTATE_MEMBER)) { online = TRUE; } else { crm_debug("Node is not ready to run resources: %s", join_state); } } else if (this_node->details->expected_up == FALSE) { crm_trace("CRMd is down: ha_state=%s, ccm_state=%s", crm_str(ha_state), crm_str(ccm_state)); crm_trace("\tcrm_state=%s, join_state=%s, expected=%s", crm_str(crm_state), crm_str(join_state), crm_str(exp_state)); } else { /* mark it unclean */ pe_fence_node(data_set, this_node, "because it is partially and/or un-expectedly down"); crm_info("\tha_state=%s, ccm_state=%s," " crm_state=%s, join_state=%s, expected=%s", crm_str(ha_state), crm_str(ccm_state), crm_str(crm_state), crm_str(join_state), crm_str(exp_state)); } return online; } static gboolean determine_online_status_fencing(pe_working_set_t * data_set, xmlNode * node_state, node_t * this_node) { gboolean online = FALSE; gboolean do_terminate = FALSE; const char *join_state = crm_element_value(node_state, XML_CIB_ATTR_JOINSTATE); const char *crm_state = crm_element_value(node_state, XML_CIB_ATTR_CRMDSTATE); const char *ccm_state = crm_element_value(node_state, XML_CIB_ATTR_INCCM); const char *ha_state = crm_element_value(node_state, XML_CIB_ATTR_HASTATE); const char *exp_state = crm_element_value(node_state, XML_CIB_ATTR_EXPSTATE); const char *terminate = g_hash_table_lookup(this_node->details->attrs, "terminate"); if (ha_state == NULL) { ha_state = DEADSTATUS; } if (crm_is_true(terminate)) { do_terminate = TRUE; } else if (terminate != NULL && strlen(terminate) > 0) { /* could be a time() value */ char t = terminate[0]; if (t != '0' && isdigit(t)) { do_terminate = TRUE; } } if (crm_is_true(ccm_state) && safe_str_eq(ha_state, ACTIVESTATUS) && safe_str_eq(crm_state, ONLINESTATUS)) { if (safe_str_eq(join_state, CRMD_JOINSTATE_MEMBER)) { online = TRUE; if (do_terminate) { pe_fence_node(data_set, this_node, "because termination was requested"); } } else if (join_state == exp_state /* == NULL */ ) { crm_info("Node %s is coming up", this_node->details->uname); crm_debug("\tha_state=%s, ccm_state=%s," " crm_state=%s, join_state=%s, expected=%s", crm_str(ha_state), crm_str(ccm_state), crm_str(crm_state), crm_str(join_state), crm_str(exp_state)); } else if (safe_str_eq(join_state, CRMD_JOINSTATE_PENDING)) { crm_info("Node %s is not ready to run resources", this_node->details->uname); this_node->details->standby = TRUE; this_node->details->pending = TRUE; online = TRUE; } else if (safe_str_eq(join_state, CRMD_JOINSTATE_NACK)) { crm_warn("Node %s is not part of the cluster", this_node->details->uname); this_node->details->standby = TRUE; this_node->details->pending = TRUE; online = TRUE; } else if (safe_str_eq(join_state, exp_state)) { crm_info("Node %s is still coming up: %s", this_node->details->uname, join_state); crm_info("\tha_state=%s, ccm_state=%s, crm_state=%s", crm_str(ha_state), crm_str(ccm_state), crm_str(crm_state)); this_node->details->standby = TRUE; this_node->details->pending = TRUE; online = TRUE; } else { crm_warn("Node %s (%s) is un-expectedly down", this_node->details->uname, this_node->details->id); crm_info("\tha_state=%s, ccm_state=%s," " crm_state=%s, join_state=%s, expected=%s", crm_str(ha_state), crm_str(ccm_state), crm_str(crm_state), crm_str(join_state), crm_str(exp_state)); pe_fence_node(data_set, this_node, "because it is un-expectedly down"); } } else if (crm_is_true(ccm_state) == FALSE && safe_str_eq(ha_state, DEADSTATUS) && safe_str_eq(crm_state, OFFLINESTATUS) && this_node->details->expected_up == FALSE) { crm_debug("Node %s is down: join_state=%s, expected=%s", this_node->details->uname, crm_str(join_state), crm_str(exp_state)); #if 0 /* While a nice optimization, it causes the cluster to block until the node * comes back online. Which is a serious problem if the cluster software * is not configured to start at boot or stonith is configured to merely * stop the node instead of restart it. * Easily triggered by setting terminate=true for the DC */ } else if (do_terminate) { crm_info("Node %s is %s after forced termination", this_node->details->uname, crm_is_true(ccm_state) ? "coming up" : "going down"); crm_debug("\tha_state=%s, ccm_state=%s," " crm_state=%s, join_state=%s, expected=%s", crm_str(ha_state), crm_str(ccm_state), crm_str(crm_state), crm_str(join_state), crm_str(exp_state)); if (crm_is_true(ccm_state) == FALSE) { this_node->details->standby = TRUE; this_node->details->pending = TRUE; online = TRUE; } #endif } else if (this_node->details->expected_up) { /* mark it unclean */ pe_fence_node(data_set, this_node, "because it is un-expectedly down"); crm_info("\tha_state=%s, ccm_state=%s," " crm_state=%s, join_state=%s, expected=%s", crm_str(ha_state), crm_str(ccm_state), crm_str(crm_state), crm_str(join_state), crm_str(exp_state)); } else { crm_info("Node %s is down", this_node->details->uname); crm_debug("\tha_state=%s, ccm_state=%s," " crm_state=%s, join_state=%s, expected=%s", crm_str(ha_state), crm_str(ccm_state), crm_str(crm_state), crm_str(join_state), crm_str(exp_state)); } return online; } gboolean determine_online_status(xmlNode * node_state, node_t * this_node, pe_working_set_t * data_set) { gboolean online = FALSE; const char *shutdown = NULL; const char *exp_state = crm_element_value(node_state, XML_CIB_ATTR_EXPSTATE); if (this_node == NULL) { crm_config_err("No node to check"); return online; } this_node->details->shutdown = FALSE; this_node->details->expected_up = FALSE; shutdown = g_hash_table_lookup(this_node->details->attrs, XML_CIB_ATTR_SHUTDOWN); if (shutdown != NULL && safe_str_neq("0", shutdown)) { this_node->details->shutdown = TRUE; } else if (safe_str_eq(exp_state, CRMD_JOINSTATE_MEMBER)) { this_node->details->expected_up = TRUE; } if (is_set(data_set->flags, pe_flag_stonith_enabled) == FALSE) { online = determine_online_status_no_fencing(data_set, node_state, this_node); } else { online = determine_online_status_fencing(data_set, node_state, this_node); } if (online) { this_node->details->online = TRUE; } else { /* remove node from contention */ this_node->fixed = TRUE; this_node->weight = -INFINITY; } if (online && this_node->details->shutdown) { /* dont run resources here */ this_node->fixed = TRUE; this_node->weight = -INFINITY; } if (this_node->details->unclean) { pe_proc_warn("Node %s is unclean", this_node->details->uname); } else if (this_node->details->online) { crm_info("Node %s is %s", this_node->details->uname, this_node->details->shutdown ? "shutting down" : this_node->details->pending ? "pending" : this_node->details->standby ? "standby" : "online"); } else { crm_trace("Node %s is offline", this_node->details->uname); } return online; } #define set_char(x) last_rsc_id[lpc] = x; complete = TRUE; char * clone_zero(const char *last_rsc_id) { int lpc = 0; char *zero = NULL; CRM_CHECK(last_rsc_id != NULL, return NULL); if (last_rsc_id != NULL) { lpc = strlen(last_rsc_id); } while (--lpc > 0) { switch (last_rsc_id[lpc]) { case 0: return NULL; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; case ':': crm_malloc0(zero, lpc + 3); memcpy(zero, last_rsc_id, lpc); zero[lpc] = ':'; zero[lpc + 1] = '0'; zero[lpc + 2] = 0; return zero; } } return NULL; } char * increment_clone(char *last_rsc_id) { int lpc = 0; int len = 0; char *tmp = NULL; gboolean complete = FALSE; CRM_CHECK(last_rsc_id != NULL, return NULL); if (last_rsc_id != NULL) { len = strlen(last_rsc_id); } lpc = len - 1; while (complete == FALSE && lpc > 0) { switch (last_rsc_id[lpc]) { case 0: lpc--; break; case '0': set_char('1'); break; case '1': set_char('2'); break; case '2': set_char('3'); break; case '3': set_char('4'); break; case '4': set_char('5'); break; case '5': set_char('6'); break; case '6': set_char('7'); break; case '7': set_char('8'); break; case '8': set_char('9'); break; case '9': last_rsc_id[lpc] = '0'; lpc--; break; case ':': tmp = last_rsc_id; crm_malloc0(last_rsc_id, len + 2); memcpy(last_rsc_id, tmp, len); last_rsc_id[++lpc] = '1'; last_rsc_id[len] = '0'; last_rsc_id[len + 1] = 0; complete = TRUE; crm_free(tmp); break; default: crm_err("Unexpected char: %c (%d)", last_rsc_id[lpc], lpc); return NULL; break; } } return last_rsc_id; } static int get_clone(char *last_rsc_id) { int clone = 0; int lpc = 0; int len = 0; CRM_CHECK(last_rsc_id != NULL, return -1); if (last_rsc_id != NULL) { len = strlen(last_rsc_id); } lpc = len - 1; while (lpc > 0) { switch (last_rsc_id[lpc]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': clone += (int)(last_rsc_id[lpc] - '0') * (len - lpc); lpc--; break; case ':': return clone; break; default: crm_err("Unexpected char: %d (%c)", lpc, last_rsc_id[lpc]); return clone; break; } } return -1; } static resource_t * create_fake_resource(const char *rsc_id, xmlNode * rsc_entry, pe_working_set_t * data_set) { resource_t *rsc = NULL; xmlNode *xml_rsc = create_xml_node(NULL, XML_CIB_TAG_RESOURCE); copy_in_properties(xml_rsc, rsc_entry); crm_xml_add(xml_rsc, XML_ATTR_ID, rsc_id); crm_log_xml_debug(xml_rsc, "Orphan resource"); if (!common_unpack(xml_rsc, &rsc, NULL, data_set)) { return NULL; } set_bit(rsc->flags, pe_rsc_orphan); data_set->resources = g_list_append(data_set->resources, rsc); return rsc; } extern resource_t *create_child_clone(resource_t * rsc, int sub_id, pe_working_set_t * data_set); static resource_t * find_clone(pe_working_set_t * data_set, node_t * node, resource_t * parent, const char *rsc_id) { int len = 0; resource_t *rsc = NULL; char *base = clone_zero(rsc_id); char *alt_rsc_id = NULL; CRM_ASSERT(parent != NULL); CRM_ASSERT(parent->variant == pe_clone || parent->variant == pe_master); if (base) { len = strlen(base); } if (len > 0) { base[len - 1] = 0; } crm_trace("Looking for %s on %s in %s %d", rsc_id, node->details->uname, parent->id, is_set(parent->flags, pe_rsc_unique)); if (is_set(parent->flags, pe_rsc_unique)) { crm_trace("Looking for %s", rsc_id); rsc = parent->fns->find_rsc(parent, rsc_id, NULL, pe_find_current); } else { crm_trace("Looking for %s on %s", base, node->details->uname); rsc = parent->fns->find_rsc(parent, base, node, pe_find_partial | pe_find_current); if (rsc != NULL && rsc->running_on) { GListPtr gIter = parent->children; rsc = NULL; crm_trace("Looking for an existing orphan for %s: %s on %s", parent->id, rsc_id, node->details->uname); /* There is already an instance of this _anonymous_ clone active on "node". * * If there is a partially active orphan (only applies to clone groups) on * the same node, use that. * Otherwise create a new (orphaned) instance at "orphan_check:". */ for (; gIter != NULL; gIter = gIter->next) { resource_t *child = (resource_t *) gIter->data; node_t *loc = child->fns->location(child, NULL, TRUE); if (loc && loc->details == node->details) { resource_t *tmp = child->fns->find_rsc(child, base, NULL, pe_find_partial | pe_find_current); if (tmp && tmp->running_on == NULL) { rsc = tmp; break; } } } goto orphan_check; } else if (((resource_t *) parent->children->data)->variant == pe_group) { /* If we're grouped, we need to look for a peer thats active on $node * and use their clone instance number */ resource_t *peer = parent->fns->find_rsc(parent, NULL, node, pe_find_clone | pe_find_current); if (peer && peer->running_on) { char buffer[256]; int clone_num = get_clone(peer->id); snprintf(buffer, 256, "%s%d", base, clone_num); rsc = parent->fns->find_rsc(parent, buffer, node, pe_find_current | pe_find_inactive); if (rsc) { crm_trace("Found someone active: %s on %s, becoming %s", peer->id, ((node_t *) peer->running_on->data)->details->uname, buffer); } } } if (parent->fns->find_rsc(parent, rsc_id, NULL, pe_find_current)) { alt_rsc_id = crm_strdup(rsc_id); } else { alt_rsc_id = clone_zero(rsc_id); } while (rsc == NULL) { rsc = parent->fns->find_rsc(parent, alt_rsc_id, NULL, pe_find_current); if (rsc == NULL) { crm_trace("Unknown resource: %s", alt_rsc_id); break; } if (rsc->running_on == NULL) { crm_trace("Resource %s: just right", alt_rsc_id); break; } crm_trace("Resource %s: already active", alt_rsc_id); alt_rsc_id = increment_clone(alt_rsc_id); rsc = NULL; } } orphan_check: if (rsc == NULL) { /* Create an extra orphan */ resource_t *top = create_child_clone(parent, -1, data_set); crm_debug("Created orphan for %s: %s on %s", parent->id, rsc_id, node->details->uname); rsc = top->fns->find_rsc(top, base, NULL, pe_find_current | pe_find_partial); CRM_ASSERT(rsc != NULL); } crm_free(rsc->clone_name); rsc->clone_name = NULL; if (safe_str_neq(rsc_id, rsc->id)) { crm_info("Internally renamed %s on %s to %s%s", rsc_id, node->details->uname, rsc->id, is_set(rsc->flags, pe_rsc_orphan) ? " (ORPHAN)" : ""); rsc->clone_name = crm_strdup(rsc_id); } crm_free(alt_rsc_id); crm_free(base); return rsc; } static resource_t * unpack_find_resource(pe_working_set_t * data_set, node_t * node, const char *rsc_id, xmlNode * rsc_entry) { resource_t *rsc = NULL; resource_t *clone_parent = NULL; char *alt_rsc_id = crm_strdup(rsc_id); crm_trace("looking for %s", rsc_id); rsc = pe_find_resource(data_set->resources, alt_rsc_id); /* no match */ if (rsc == NULL) { /* Even when clone-max=0, we still create a single :0 orphan to match against */ char *tmp = clone_zero(alt_rsc_id); resource_t *clone0 = pe_find_resource(data_set->resources, tmp); clone_parent = uber_parent(clone0); crm_free(tmp); crm_trace("%s not found: %s", alt_rsc_id, clone_parent ? clone_parent->id : "orphan"); } else { clone_parent = uber_parent(rsc); } if (clone_parent && clone_parent->variant > pe_group) { rsc = find_clone(data_set, node, clone_parent, rsc_id); CRM_ASSERT(rsc != NULL); } crm_free(alt_rsc_id); return rsc; } static resource_t * process_orphan_resource(xmlNode * rsc_entry, node_t * node, pe_working_set_t * data_set) { resource_t *rsc = NULL; const char *rsc_id = crm_element_value(rsc_entry, XML_ATTR_ID); crm_debug("Detected orphan resource %s on %s", rsc_id, node->details->uname); rsc = create_fake_resource(rsc_id, rsc_entry, data_set); if (is_set(data_set->flags, pe_flag_stop_rsc_orphans) == FALSE) { clear_bit(rsc->flags, pe_rsc_managed); } else { GListPtr gIter = NULL; print_resource(LOG_DEBUG_3, "Added orphan", rsc, FALSE); CRM_CHECK(rsc != NULL, return NULL); resource_location(rsc, NULL, -INFINITY, "__orphan_dont_run__", data_set); for (gIter = data_set->nodes; gIter != NULL; gIter = gIter->next) { node_t *node = (node_t *) gIter->data; if (node->details->online && get_failcount(node, rsc, NULL, data_set)) { action_t *clear_op = NULL; action_t *ready = get_pseudo_op(CRM_OP_PROBED, data_set); clear_op = custom_action(rsc, crm_concat(rsc->id, CRM_OP_CLEAR_FAILCOUNT, '_'), CRM_OP_CLEAR_FAILCOUNT, node, FALSE, TRUE, data_set); add_hash_param(clear_op->meta, XML_ATTR_TE_NOWAIT, XML_BOOLEAN_TRUE); crm_info("Clearing failcount (%d) for orphaned resource %s on %s (%s)", get_failcount(node, rsc, NULL, data_set), rsc->id, node->details->uname, clear_op->uuid); order_actions(clear_op, ready, pe_order_optional); } } } return rsc; } static void process_rsc_state(resource_t * rsc, node_t * node, enum action_fail_response on_fail, xmlNode * migrate_op, pe_working_set_t * data_set) { crm_trace("Resource %s is %s on %s: on_fail=%s", rsc->id, role2text(rsc->role), node->details->uname, fail2text(on_fail)); /* process current state */ if (rsc->role != RSC_ROLE_UNKNOWN) { resource_t *iter = rsc; while (iter) { if (g_hash_table_lookup(iter->known_on, node->details->id) == NULL) { node_t *n = node_copy(node); g_hash_table_insert(iter->known_on, (gpointer) n->details->id, n); } if (is_set(iter->flags, pe_rsc_unique)) { break; } iter = iter->parent; } } if (node->details->unclean) { /* No extra processing needed * Also allows resources to be started again after a node is shot */ on_fail = action_fail_ignore; } switch (on_fail) { case action_fail_ignore: /* nothing to do */ break; case action_fail_fence: /* treat it as if it is still running * but also mark the node as unclean */ pe_fence_node(data_set, node, "to recover from resource failure(s)"); break; case action_fail_standby: node->details->standby = TRUE; node->details->standby_onfail = TRUE; break; case action_fail_block: /* is_managed == FALSE will prevent any * actions being sent for the resource */ clear_bit(rsc->flags, pe_rsc_managed); set_bit(rsc->flags, pe_rsc_block); break; case action_fail_migrate: /* make sure it comes up somewhere else * or not at all */ resource_location(rsc, node, -INFINITY, "__action_migration_auto__", data_set); break; case action_fail_stop: rsc->next_role = RSC_ROLE_STOPPED; break; case action_fail_recover: if (rsc->role != RSC_ROLE_STOPPED && rsc->role != RSC_ROLE_UNKNOWN) { set_bit(rsc->flags, pe_rsc_failed); stop_action(rsc, node, FALSE); } break; } if (rsc->role != RSC_ROLE_STOPPED && rsc->role != RSC_ROLE_UNKNOWN) { if (is_set(rsc->flags, pe_rsc_orphan)) { if (is_set(rsc->flags, pe_rsc_managed)) { crm_config_warn("Detected active orphan %s running on %s", rsc->id, node->details->uname); } else { crm_config_warn("Cluster configured not to stop active orphans." " %s must be stopped manually on %s", rsc->id, node->details->uname); } } native_add_running(rsc, node, data_set); if (on_fail != action_fail_ignore) { set_bit(rsc->flags, pe_rsc_failed); } } else if (rsc->clone_name) { crm_trace("Resetting clone_name %s for %s (stopped)", rsc->clone_name, rsc->id); crm_free(rsc->clone_name); rsc->clone_name = NULL; } else { char *key = stop_key(rsc); GListPtr possible_matches = find_actions(rsc->actions, key, node); GListPtr gIter = possible_matches; for (; gIter != NULL; gIter = gIter->next) { action_t *stop = (action_t *) gIter->data; stop->flags |= pe_action_optional; } crm_free(key); } } /* create active recurring operations as optional */ static void process_recurring(node_t * node, resource_t * rsc, int start_index, int stop_index, GListPtr sorted_op_list, pe_working_set_t * data_set) { int counter = -1; const char *task = NULL; const char *status = NULL; GListPtr gIter = sorted_op_list; crm_trace("%s: Start index %d, stop index = %d", rsc->id, start_index, stop_index); for (; gIter != NULL; gIter = gIter->next) { xmlNode *rsc_op = (xmlNode *) gIter->data; int interval = 0; char *key = NULL; const char *id = ID(rsc_op); const char *interval_s = NULL; counter++; if (node->details->online == FALSE) { crm_trace("Skipping %s/%s: node is offline", rsc->id, node->details->uname); break; /* Need to check if there's a monitor for role="Stopped" */ } else if (start_index < stop_index && counter <= stop_index) { crm_trace("Skipping %s/%s: resource is not active", id, node->details->uname); continue; } else if (counter < start_index) { crm_trace("Skipping %s/%s: old %d", id, node->details->uname, counter); continue; } interval_s = crm_element_value(rsc_op, XML_LRM_ATTR_INTERVAL); interval = crm_parse_int(interval_s, "0"); if (interval == 0) { crm_trace("Skipping %s/%s: non-recurring", id, node->details->uname); continue; } status = crm_element_value(rsc_op, XML_LRM_ATTR_OPSTATUS); if (safe_str_eq(status, "-1")) { crm_trace("Skipping %s/%s: status", id, node->details->uname); continue; } task = crm_element_value(rsc_op, XML_LRM_ATTR_TASK); /* create the action */ key = generate_op_key(rsc->id, task, interval); crm_trace("Creating %s/%s", key, node->details->uname); custom_action(rsc, key, task, node, TRUE, TRUE, data_set); } } void calculate_active_ops(GListPtr sorted_op_list, int *start_index, int *stop_index) { int counter = -1; const char *task = NULL; const char *status = NULL; GListPtr gIter = sorted_op_list; *stop_index = -1; *start_index = -1; for (; gIter != NULL; gIter = gIter->next) { xmlNode *rsc_op = (xmlNode *) gIter->data; counter++; task = crm_element_value(rsc_op, XML_LRM_ATTR_TASK); status = crm_element_value(rsc_op, XML_LRM_ATTR_OPSTATUS); if (safe_str_eq(task, CRMD_ACTION_STOP) && safe_str_eq(status, "0")) { *stop_index = counter; } else if (safe_str_eq(task, CRMD_ACTION_START) || safe_str_eq(task, CRMD_ACTION_MIGRATED)) { *start_index = counter; } else if (*start_index <= *stop_index && safe_str_eq(task, CRMD_ACTION_STATUS)) { const char *rc = crm_element_value(rsc_op, XML_LRM_ATTR_RC); if (safe_str_eq(rc, "0") || safe_str_eq(rc, "8")) { *start_index = counter; } } } } static void unpack_lrm_rsc_state(node_t * node, xmlNode * rsc_entry, pe_working_set_t * data_set) { GListPtr gIter = NULL; int stop_index = -1; int start_index = -1; enum rsc_role_e req_role = RSC_ROLE_UNKNOWN; const char *task = NULL; const char *rsc_id = crm_element_value(rsc_entry, XML_ATTR_ID); resource_t *rsc = NULL; GListPtr op_list = NULL; GListPtr sorted_op_list = NULL; xmlNode *migrate_op = NULL; xmlNode *rsc_op = NULL; enum action_fail_response on_fail = FALSE; enum rsc_role_e saved_role = RSC_ROLE_UNKNOWN; crm_trace("[%s] Processing %s on %s", crm_element_name(rsc_entry), rsc_id, node->details->uname); /* extract operations */ op_list = NULL; sorted_op_list = NULL; for (rsc_op = __xml_first_child(rsc_entry); rsc_op != NULL; rsc_op = __xml_next(rsc_op)) { if (crm_str_eq((const char *)rsc_op->name, XML_LRM_TAG_RSC_OP, TRUE)) { op_list = g_list_prepend(op_list, rsc_op); } } if (op_list == NULL) { /* if there are no operations, there is nothing to do */ return; } /* find the resource */ rsc = unpack_find_resource(data_set, node, rsc_id, rsc_entry); if (rsc == NULL) { rsc = process_orphan_resource(rsc_entry, node, data_set); } CRM_ASSERT(rsc != NULL); /* process operations */ saved_role = rsc->role; on_fail = action_fail_ignore; rsc->role = RSC_ROLE_UNKNOWN; sorted_op_list = g_list_sort(op_list, sort_op_by_callid); for (gIter = sorted_op_list; gIter != NULL; gIter = gIter->next) { xmlNode *rsc_op = (xmlNode *) gIter->data; task = crm_element_value(rsc_op, XML_LRM_ATTR_TASK); if (safe_str_eq(task, CRMD_ACTION_MIGRATED)) { migrate_op = rsc_op; } unpack_rsc_op(rsc, node, rsc_op, gIter->next, &on_fail, data_set); } /* create active recurring operations as optional */ calculate_active_ops(sorted_op_list, &start_index, &stop_index); process_recurring(node, rsc, start_index, stop_index, sorted_op_list, data_set); /* no need to free the contents */ g_list_free(sorted_op_list); process_rsc_state(rsc, node, on_fail, migrate_op, data_set); if (get_target_role(rsc, &req_role)) { if (rsc->next_role == RSC_ROLE_UNKNOWN || req_role < rsc->next_role) { crm_debug("%s: Overwriting calculated next role %s" " with requested next role %s", rsc->id, role2text(rsc->next_role), role2text(req_role)); rsc->next_role = req_role; } else if (req_role > rsc->next_role) { crm_info("%s: Not overwriting calculated next role %s" " with requested next role %s", rsc->id, role2text(rsc->next_role), role2text(req_role)); } } if (saved_role > rsc->role) { rsc->role = saved_role; } } gboolean unpack_lrm_resources(node_t * node, xmlNode * lrm_rsc_list, pe_working_set_t * data_set) { xmlNode *rsc_entry = NULL; CRM_CHECK(node != NULL, return FALSE); crm_trace("Unpacking resources on %s", node->details->uname); for (rsc_entry = __xml_first_child(lrm_rsc_list); rsc_entry != NULL; rsc_entry = __xml_next(rsc_entry)) { if (crm_str_eq((const char *)rsc_entry->name, XML_LRM_TAG_RESOURCE, TRUE)) { unpack_lrm_rsc_state(node, rsc_entry, data_set); } } return TRUE; } static void set_active(resource_t * rsc) { resource_t *top = uber_parent(rsc); if (top && top->variant == pe_master) { rsc->role = RSC_ROLE_SLAVE; } else { rsc->role = RSC_ROLE_STARTED; } } static void set_node_score(gpointer key, gpointer value, gpointer user_data) { node_t *node = value; int *score = user_data; node->weight = *score; } #define STATUS_PATH_MAX 1024 static xmlNode * find_lrm_op(const char *resource, const char *op, const char *node, const char *source, pe_working_set_t * data_set) { int offset = 0; char xpath[STATUS_PATH_MAX]; offset += snprintf(xpath + offset, STATUS_PATH_MAX - offset, "//node_state[@uname='%s']", node); offset += snprintf(xpath + offset, STATUS_PATH_MAX - offset, "//" XML_LRM_TAG_RESOURCE "[@id='%s']", resource); /* Need to check against transition_magic too? */ if (source && safe_str_eq(op, CRMD_ACTION_MIGRATE)) { offset += snprintf(xpath + offset, STATUS_PATH_MAX - offset, "/" XML_LRM_TAG_RSC_OP "[@operation='%s' and @migrate_target='%s']", op, source); } else if (source && safe_str_eq(op, CRMD_ACTION_MIGRATED)) { offset += snprintf(xpath + offset, STATUS_PATH_MAX - offset, "/" XML_LRM_TAG_RSC_OP "[@operation='%s' and @migrate_source='%s']", op, source); } else { offset += snprintf(xpath + offset, STATUS_PATH_MAX - offset, "/" XML_LRM_TAG_RSC_OP "[@operation='%s']", op); } return get_xpath_object(xpath, data_set->input, LOG_DEBUG); } gboolean unpack_rsc_op(resource_t * rsc, node_t * node, xmlNode * xml_op, GListPtr next, enum action_fail_response * on_fail, pe_working_set_t * data_set) { int task_id = 0; const char *id = NULL; const char *key = NULL; const char *task = NULL; + const char *task_key = NULL; const char *magic = NULL; const char *actual_rc = NULL; /* const char *target_rc = NULL; */ const char *task_status = NULL; const char *interval_s = NULL; const char *op_version = NULL; int interval = 0; int task_status_i = -2; int actual_rc_i = 0; int target_rc = -1; int last_failure = 0; action_t *action = NULL; node_t *effective_node = NULL; resource_t *failed = NULL; gboolean expired = FALSE; gboolean is_probe = FALSE; gboolean clear_past_failure = FALSE; CRM_CHECK(rsc != NULL, return FALSE); CRM_CHECK(node != NULL, return FALSE); CRM_CHECK(xml_op != NULL, return FALSE); id = ID(xml_op); task = crm_element_value(xml_op, XML_LRM_ATTR_TASK); + task_key = crm_element_value(xml_op, XML_LRM_ATTR_TASK_KEY); task_status = crm_element_value(xml_op, XML_LRM_ATTR_OPSTATUS); op_version = crm_element_value(xml_op, XML_ATTR_CRM_VERSION); magic = crm_element_value(xml_op, XML_ATTR_TRANSITION_MAGIC); key = crm_element_value(xml_op, XML_ATTR_TRANSITION_KEY); crm_element_value_int(xml_op, XML_LRM_ATTR_CALLID, &task_id); CRM_CHECK(id != NULL, return FALSE); CRM_CHECK(task != NULL, return FALSE); CRM_CHECK(task_status != NULL, return FALSE); task_status_i = crm_parse_int(task_status, NULL); CRM_CHECK(task_status_i <= LRM_OP_ERROR, return FALSE); CRM_CHECK(task_status_i >= LRM_OP_PENDING, return FALSE); if (safe_str_eq(task, CRMD_ACTION_NOTIFY)) { /* safe to ignore these */ return TRUE; } if (rsc->failure_timeout > 0) { int last_run = 0; if (crm_element_value_int(xml_op, "last-rc-change", &last_run) == 0) { time_t now = get_timet_now(data_set); if (now > (last_run + rsc->failure_timeout)) { expired = TRUE; } } } crm_trace("Unpacking task %s/%s (call_id=%d, status=%s) on %s (role=%s)", id, task, task_id, task_status, node->details->uname, role2text(rsc->role)); interval_s = crm_element_value(xml_op, XML_LRM_ATTR_INTERVAL); interval = crm_parse_int(interval_s, "0"); if (interval == 0 && safe_str_eq(task, CRMD_ACTION_STATUS)) { is_probe = TRUE; } if (node->details->unclean) { crm_trace("Node %s (where %s is running) is unclean." " Further action depends on the value of the stop's on-fail attribue", node->details->uname, rsc->id); } actual_rc = crm_element_value(xml_op, XML_LRM_ATTR_RC); CRM_CHECK(actual_rc != NULL, return FALSE); actual_rc_i = crm_parse_int(actual_rc, NULL); if (key) { int dummy = 0; char *dummy_string = NULL; decode_transition_key(key, &dummy_string, &dummy, &dummy, &target_rc); crm_free(dummy_string); } if (task_status_i == LRM_OP_DONE && target_rc >= 0) { if (target_rc == actual_rc_i) { task_status_i = LRM_OP_DONE; } else { task_status_i = LRM_OP_ERROR; crm_debug("%s on %s returned %d (%s) instead of the expected value: %d (%s)", id, node->details->uname, actual_rc_i, execra_code2string(actual_rc_i), target_rc, execra_code2string(target_rc)); } } else if (task_status_i == LRM_OP_ERROR) { /* let us decide that */ task_status_i = LRM_OP_DONE; } if (task_status_i == LRM_OP_NOTSUPPORTED) { actual_rc_i = EXECRA_UNIMPLEMENT_FEATURE; } if (task_status_i != actual_rc_i && rsc->failure_timeout > 0 && get_failcount(node, rsc, &last_failure, data_set) == 0) { if (last_failure > 0) { action_t *clear_op = NULL; clear_op = custom_action(rsc, crm_concat(rsc->id, CRM_OP_CLEAR_FAILCOUNT, '_'), CRM_OP_CLEAR_FAILCOUNT, node, FALSE, TRUE, data_set); add_hash_param(clear_op->meta, XML_ATTR_TE_NOWAIT, XML_BOOLEAN_TRUE); crm_notice("Clearing expired failcount for %s on %s", rsc->id, node->details->uname); } } if (expired && actual_rc_i != EXECRA_NOT_RUNNING && actual_rc_i != EXECRA_RUNNING_MASTER && actual_rc_i != EXECRA_OK) { crm_notice("Ignoring expired failure %s (rc=%d, magic=%s) on %s", id, actual_rc_i, magic, node->details->uname); goto done; } /* we could clean this up significantly except for old LRMs and CRMs that * didnt include target_rc and liked to remap status */ switch (actual_rc_i) { case EXECRA_NOT_RUNNING: if (is_probe || target_rc == actual_rc_i) { task_status_i = LRM_OP_DONE; rsc->role = RSC_ROLE_STOPPED; /* clear any previous failure actions */ *on_fail = action_fail_ignore; rsc->next_role = RSC_ROLE_UNKNOWN; } else if (safe_str_neq(task, CRMD_ACTION_STOP)) { task_status_i = LRM_OP_ERROR; } break; case EXECRA_RUNNING_MASTER: if (is_probe) { task_status_i = LRM_OP_DONE; crm_notice("Operation %s found resource %s active in master mode on %s", task, rsc->id, node->details->uname); } else if (target_rc == actual_rc_i) { /* nothing to do */ } else if (target_rc >= 0) { task_status_i = LRM_OP_ERROR; /* legacy code for pre-0.6.5 operations */ } else if (safe_str_neq(task, CRMD_ACTION_STATUS) || rsc->role != RSC_ROLE_MASTER) { task_status_i = LRM_OP_ERROR; if (rsc->role != RSC_ROLE_MASTER) { crm_err("%s reported %s in master mode on %s", id, rsc->id, node->details->uname); } } rsc->role = RSC_ROLE_MASTER; break; case EXECRA_FAILED_MASTER: rsc->role = RSC_ROLE_MASTER; task_status_i = LRM_OP_ERROR; break; case EXECRA_UNIMPLEMENT_FEATURE: if (interval > 0) { task_status_i = LRM_OP_NOTSUPPORTED; break; } /* else: fall through */ case EXECRA_INSUFFICIENT_PRIV: case EXECRA_NOT_INSTALLED: case EXECRA_INVALID_PARAM: effective_node = node; /* fall through */ case EXECRA_NOT_CONFIGURED: failed = rsc; if (is_not_set(rsc->flags, pe_rsc_unique)) { failed = uber_parent(failed); } do_crm_log(actual_rc_i == EXECRA_NOT_INSTALLED ? LOG_NOTICE : LOG_ERR, "Preventing %s from re-starting %s %s: operation %s failed '%s' (rc=%d)", failed->id, effective_node ? "on" : "anywhere in the cluster", effective_node ? effective_node->details->uname : "", task, execra_code2string(actual_rc_i), actual_rc_i); resource_location(failed, effective_node, -INFINITY, "hard-error", data_set); if (is_probe) { /* treat these like stops */ task = CRMD_ACTION_STOP; task_status_i = LRM_OP_DONE; crm_xml_add(xml_op, XML_ATTR_UNAME, node->details->uname); if (actual_rc_i != EXECRA_NOT_INSTALLED || is_set(data_set->flags, pe_flag_symmetric_cluster)) { if ((node->details->shutdown == FALSE) || (node->details->online == TRUE)) { add_node_copy(data_set->failed, xml_op); } } } break; case EXECRA_OK: if (is_probe && target_rc == 7) { task_status_i = LRM_OP_DONE; crm_info("Operation %s found resource %s active on %s", task, rsc->id, node->details->uname); /* legacy code for pre-0.6.5 operations */ } else if (target_rc < 0 && interval > 0 && rsc->role == RSC_ROLE_MASTER) { /* catch status ops that return 0 instead of 8 while they * are supposed to be in master mode */ task_status_i = LRM_OP_ERROR; } break; default: if (task_status_i == LRM_OP_DONE) { crm_info("Remapping %s (rc=%d) on %s to an ERROR", id, actual_rc_i, node->details->uname); task_status_i = LRM_OP_ERROR; } } if (task_status_i == LRM_OP_ERROR || task_status_i == LRM_OP_TIMEOUT || task_status_i == LRM_OP_NOTSUPPORTED) { - action = custom_action(rsc, crm_strdup(id), task, NULL, TRUE, FALSE, data_set); + const char *action_key = task_key ? task_key : id; + action = custom_action(rsc, crm_strdup(action_key), task, NULL, TRUE, FALSE, data_set); if (expired) { crm_notice("Ignoring expired failure (calculated) %s (rc=%d, magic=%s) on %s", id, actual_rc_i, magic, node->details->uname); goto done; } else if (action->on_fail == action_fail_ignore) { crm_warn("Remapping %s (rc=%d) on %s to DONE: ignore", id, actual_rc_i, node->details->uname); task_status_i = LRM_OP_DONE; set_bit(rsc->flags, pe_rsc_failure_ignored); crm_xml_add(xml_op, XML_ATTR_UNAME, node->details->uname); if ((node->details->shutdown == FALSE) || (node->details->online == TRUE)) { add_node_copy(data_set->failed, xml_op); } } } switch (task_status_i) { case LRM_OP_PENDING: if (safe_str_eq(task, CRMD_ACTION_START)) { set_bit(rsc->flags, pe_rsc_start_pending); set_active(rsc); } else if (safe_str_eq(task, CRMD_ACTION_PROMOTE)) { rsc->role = RSC_ROLE_MASTER; } /* * Intentionally ignoring pending migrate ops here; * haven't decided if we need to do anything special * with them yet... */ break; case LRM_OP_DONE: crm_trace("%s/%s completed on %s", rsc->id, task, node->details->uname); if (actual_rc_i == EXECRA_NOT_RUNNING) { clear_past_failure = TRUE; } else if (safe_str_eq(task, CRMD_ACTION_START)) { rsc->role = RSC_ROLE_STARTED; clear_past_failure = TRUE; } else if (safe_str_eq(task, CRMD_ACTION_STOP)) { rsc->role = RSC_ROLE_STOPPED; clear_past_failure = TRUE; } else if (safe_str_eq(task, CRMD_ACTION_PROMOTE)) { rsc->role = RSC_ROLE_MASTER; clear_past_failure = TRUE; } else if (safe_str_eq(task, CRMD_ACTION_DEMOTE)) { /* Demote from Master does not clear an error */ rsc->role = RSC_ROLE_SLAVE; } else if (safe_str_eq(task, CRMD_ACTION_MIGRATED)) { rsc->role = RSC_ROLE_STARTED; clear_past_failure = TRUE; } else if (safe_str_eq(task, CRMD_ACTION_MIGRATE)) { /* * The normal sequence is (now): migrate_to(Src) -> migrate_from(Tgt) -> stop(Src) * * So if a migrate_to is followed by a stop, then we dont need to care what * happended on the target node * * Without the stop, we need to look for a successful migrate_from. * This would also imply we're no longer running on the source * * Without the stop, and without a migrate_from op we make sure the resource * gets stopped on both source and target (assuming the target is up) * */ int stop_id = 0; xmlNode *stop_op = find_lrm_op(rsc->id, CRMD_ACTION_STOP, node->details->id, NULL, data_set); if (stop_op) { crm_element_value_int(stop_op, XML_LRM_ATTR_CALLID, &stop_id); } if (stop_op == NULL || stop_id < task_id) { int from_rc = 0, from_status = 0; const char *migrate_source = crm_element_value(xml_op, XML_LRM_ATTR_MIGRATE_SOURCE); const char *migrate_target = crm_element_value(xml_op, XML_LRM_ATTR_MIGRATE_TARGET); node_t *target = pe_find_node(data_set->nodes, migrate_target); node_t *source = pe_find_node(data_set->nodes, migrate_source); xmlNode *migrate_from = find_lrm_op(rsc->id, CRMD_ACTION_MIGRATED, migrate_target, migrate_source, data_set); rsc->role = RSC_ROLE_STARTED; /* can be master? */ if (migrate_from) { crm_element_value_int(migrate_from, XML_LRM_ATTR_RC, &from_rc); crm_element_value_int(migrate_from, XML_LRM_ATTR_OPSTATUS, &from_status); crm_trace("%s op on %s exited with status=%d, rc=%d", ID(migrate_from), migrate_target, from_status, from_rc); } if (migrate_from && from_rc == EXECRA_OK && from_status == LRM_OP_DONE) { crm_trace("Detected dangling migration op: %s on %s", ID(xml_op), migrate_source); /* all good * just need to arrange for the stop action to get sent * but _without_ affecting the target somehow */ rsc->role = RSC_ROLE_STOPPED; rsc->dangling_migrations = g_list_prepend(rsc->dangling_migrations, node); } else if (migrate_from) { /* Failed */ crm_trace("Marking active on %s %p %d", migrate_target, target, target->details->online); if (target && target->details->online) { native_add_running(rsc, target, data_set); } } else { /* Pending or complete but erased */ node_t *target = pe_find_node_id(data_set->nodes, migrate_target); crm_trace("Marking active on %s %p %d", migrate_target, target, target->details->online); if (target && target->details->online) { native_add_running(rsc, target, data_set); if (source && source->details->online) { /* If we make it here we have a partial migration. The migrate_to * has completed but the migrate_from on the target has not. Hold on * to the target and source on the resource. Later on if we detect that * the resource is still going to run on that target, we may continue * the migration */ rsc->partial_migration_target = target; rsc->partial_migration_source = source; } } else { /* Consider it failed here - forces a restart, prevents migration */ set_bit_inplace(rsc->flags, pe_rsc_failed); } } } } else if (rsc->role < RSC_ROLE_STARTED) { /* start, migrate_to and migrate_from will land here */ crm_trace("%s active on %s", rsc->id, node->details->uname); set_active(rsc); } /* clear any previous failure actions */ if (clear_past_failure) { switch (*on_fail) { case action_fail_block: case action_fail_stop: case action_fail_fence: case action_fail_migrate: case action_fail_standby: crm_trace("%s.%s is not cleared by a completed stop", rsc->id, fail2text(*on_fail)); break; case action_fail_ignore: case action_fail_recover: *on_fail = action_fail_ignore; rsc->next_role = RSC_ROLE_UNKNOWN; } } break; case LRM_OP_ERROR: case LRM_OP_TIMEOUT: case LRM_OP_NOTSUPPORTED: crm_warn("Processing failed op %s on %s: %s (%d)", id, node->details->uname, execra_code2string(actual_rc_i), actual_rc_i); crm_xml_add(xml_op, XML_ATTR_UNAME, node->details->uname); if ((node->details->shutdown == FALSE) || (node->details->online == TRUE)) { add_node_copy(data_set->failed, xml_op); } if (*on_fail < action->on_fail) { *on_fail = action->on_fail; } if (safe_str_eq(task, CRMD_ACTION_STOP)) { resource_location(rsc, node, -INFINITY, "__stop_fail__", data_set); } else if (safe_str_eq(task, CRMD_ACTION_MIGRATED)) { int stop_id = 0; int migrate_id = 0; const char *migrate_source = crm_element_value(xml_op, XML_LRM_ATTR_MIGRATE_SOURCE); const char *migrate_target = crm_element_value(xml_op, XML_LRM_ATTR_MIGRATE_TARGET); xmlNode *stop_op = find_lrm_op(rsc->id, CRMD_ACTION_STOP, migrate_source, NULL, data_set); xmlNode *migrate_op = find_lrm_op(rsc->id, CRMD_ACTION_MIGRATE, migrate_source, migrate_target, data_set); if (stop_op) { crm_element_value_int(stop_op, XML_LRM_ATTR_CALLID, &stop_id); } if (migrate_op) { crm_element_value_int(migrate_op, XML_LRM_ATTR_CALLID, &migrate_id); } /* Get our state right */ rsc->role = RSC_ROLE_STARTED; /* can be master? */ if (stop_op == NULL || stop_id < migrate_id) { node_t *source = pe_find_node(data_set->nodes, migrate_source); if (source && source->details->online) { native_add_running(rsc, source, data_set); } } } else if (safe_str_eq(task, CRMD_ACTION_MIGRATE)) { int stop_id = 0; int migrate_id = 0; const char *migrate_source = crm_element_value(xml_op, XML_LRM_ATTR_MIGRATE_SOURCE); const char *migrate_target = crm_element_value(xml_op, XML_LRM_ATTR_MIGRATE_TARGET); xmlNode *stop_op = find_lrm_op(rsc->id, CRMD_ACTION_STOP, migrate_target, NULL, data_set); xmlNode *migrate_op = find_lrm_op(rsc->id, CRMD_ACTION_MIGRATED, migrate_target, migrate_source, data_set); if (stop_op) { crm_element_value_int(stop_op, XML_LRM_ATTR_CALLID, &stop_id); } if (migrate_op) { crm_element_value_int(migrate_op, XML_LRM_ATTR_CALLID, &migrate_id); } /* Get our state right */ rsc->role = RSC_ROLE_STARTED; /* can be master? */ if (stop_op == NULL || stop_id < migrate_id) { node_t *target = pe_find_node(data_set->nodes, migrate_target); crm_trace("Stop: %p %d, Migrated: %p %d", stop_op, stop_id, migrate_op, migrate_id); if (target && target->details->online) { native_add_running(rsc, target, data_set); } } else if (migrate_op == NULL) { /* Make sure it gets cleaned up, the stop may pre-date the migrate_from */ rsc->dangling_migrations = g_list_prepend(rsc->dangling_migrations, node); } } else if (safe_str_eq(task, CRMD_ACTION_PROMOTE)) { rsc->role = RSC_ROLE_MASTER; } else if (safe_str_eq(task, CRMD_ACTION_DEMOTE)) { /* * staying in role=master ends up putting the PE/TE into a loop * setting role=slave is not dangerous because no master will be * promoted until the failed resource has been fully stopped */ crm_warn("Forcing %s to stop after a failed demote action", rsc->id); rsc->next_role = RSC_ROLE_STOPPED; rsc->role = RSC_ROLE_SLAVE; } else if (compare_version("2.0", op_version) > 0 && safe_str_eq(task, CRMD_ACTION_START)) { crm_warn("Compatibility handling for failed op %s on %s", id, node->details->uname); resource_location(rsc, node, -INFINITY, "__legacy_start__", data_set); } if (rsc->role < RSC_ROLE_STARTED) { set_active(rsc); } crm_trace("Resource %s: role=%s, unclean=%s, on_fail=%s, fail_role=%s", rsc->id, role2text(rsc->role), node->details->unclean ? "true" : "false", fail2text(action->on_fail), role2text(action->fail_role)); if (action->fail_role != RSC_ROLE_STARTED && rsc->next_role < action->fail_role) { rsc->next_role = action->fail_role; } if (action->fail_role == RSC_ROLE_STOPPED) { int score = -INFINITY; crm_err("Making sure %s doesn't come up again", rsc->id); /* make sure it doesnt come up again */ g_hash_table_destroy(rsc->allowed_nodes); rsc->allowed_nodes = node_hash_from_list(data_set->nodes); g_hash_table_foreach(rsc->allowed_nodes, set_node_score, &score); } pe_free_action(action); action = NULL; break; case LRM_OP_CANCELLED: /* do nothing?? */ pe_err("Dont know what to do for cancelled ops yet"); break; } done: crm_trace("Resource %s after %s: role=%s", rsc->id, task, role2text(rsc->role)); pe_free_action(action); return TRUE; } gboolean add_node_attrs(xmlNode * xml_obj, node_t * node, gboolean overwrite, pe_working_set_t * data_set) { g_hash_table_insert(node->details->attrs, crm_strdup("#" XML_ATTR_UNAME), crm_strdup(node->details->uname)); g_hash_table_insert(node->details->attrs, crm_strdup("#" XML_ATTR_ID), crm_strdup(node->details->id)); if (safe_str_eq(node->details->id, data_set->dc_uuid)) { data_set->dc_node = node; node->details->is_dc = TRUE; g_hash_table_insert(node->details->attrs, crm_strdup("#" XML_ATTR_DC), crm_strdup(XML_BOOLEAN_TRUE)); } else { g_hash_table_insert(node->details->attrs, crm_strdup("#" XML_ATTR_DC), crm_strdup(XML_BOOLEAN_FALSE)); } unpack_instance_attributes(data_set->input, xml_obj, XML_TAG_ATTR_SETS, NULL, node->details->attrs, NULL, overwrite, data_set->now); return TRUE; } static GListPtr extract_operations(const char *node, const char *rsc, xmlNode * rsc_entry, gboolean active_filter) { int counter = -1; int stop_index = -1; int start_index = -1; xmlNode *rsc_op = NULL; GListPtr gIter = NULL; GListPtr op_list = NULL; GListPtr sorted_op_list = NULL; /* extract operations */ op_list = NULL; sorted_op_list = NULL; for (rsc_op = __xml_first_child(rsc_entry); rsc_op != NULL; rsc_op = __xml_next(rsc_op)) { if (crm_str_eq((const char *)rsc_op->name, XML_LRM_TAG_RSC_OP, TRUE)) { crm_xml_add(rsc_op, "resource", rsc); crm_xml_add(rsc_op, XML_ATTR_UNAME, node); op_list = g_list_prepend(op_list, rsc_op); } } if (op_list == NULL) { /* if there are no operations, there is nothing to do */ return NULL; } sorted_op_list = g_list_sort(op_list, sort_op_by_callid); /* create active recurring operations as optional */ if (active_filter == FALSE) { return sorted_op_list; } op_list = NULL; calculate_active_ops(sorted_op_list, &start_index, &stop_index); for (gIter = sorted_op_list; gIter != NULL; gIter = gIter->next) { xmlNode *rsc_op = (xmlNode *) gIter->data; counter++; if (start_index < stop_index) { crm_trace("Skipping %s: not active", ID(rsc_entry)); break; } else if (counter < start_index) { crm_trace("Skipping %s: old", ID(rsc_op)); continue; } op_list = g_list_append(op_list, rsc_op); } g_list_free(sorted_op_list); return op_list; } GListPtr find_operations(const char *rsc, const char *node, gboolean active_filter, pe_working_set_t * data_set) { GListPtr output = NULL; GListPtr intermediate = NULL; xmlNode *tmp = NULL; xmlNode *status = find_xml_node(data_set->input, XML_CIB_TAG_STATUS, TRUE); const char *uname = NULL; node_t *this_node = NULL; xmlNode *node_state = NULL; for (node_state = __xml_first_child(status); node_state != NULL; node_state = __xml_next(node_state)) { if (crm_str_eq((const char *)node_state->name, XML_CIB_TAG_STATE, TRUE)) { uname = crm_element_value(node_state, XML_ATTR_UNAME); if (node != NULL && safe_str_neq(uname, node)) { continue; } this_node = pe_find_node(data_set->nodes, uname); CRM_CHECK(this_node != NULL, continue); determine_online_status(node_state, this_node, data_set); if (this_node->details->online || is_set(data_set->flags, pe_flag_stonith_enabled)) { /* offline nodes run no resources... * unless stonith is enabled in which case we need to * make sure rsc start events happen after the stonith */ xmlNode *lrm_rsc = NULL; tmp = find_xml_node(node_state, XML_CIB_TAG_LRM, FALSE); tmp = find_xml_node(tmp, XML_LRM_TAG_RESOURCES, FALSE); for (lrm_rsc = __xml_first_child(tmp); lrm_rsc != NULL; lrm_rsc = __xml_next(lrm_rsc)) { if (crm_str_eq((const char *)lrm_rsc->name, XML_LRM_TAG_RESOURCE, TRUE)) { const char *rsc_id = crm_element_value(lrm_rsc, XML_ATTR_ID); if (rsc != NULL && safe_str_neq(rsc_id, rsc)) { continue; } intermediate = extract_operations(uname, rsc_id, lrm_rsc, active_filter); output = g_list_concat(output, intermediate); } } } } } return output; } diff --git a/pengine/regression.sh b/pengine/regression.sh index a13c3218d7..876d93161f 100755 --- a/pengine/regression.sh +++ b/pengine/regression.sh @@ -1,634 +1,636 @@ #!/bin/bash # Copyright (C) 2004 Andrew Beekhof # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This software is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # core=`dirname $0` . $core/regression.core.sh create_mode="true" info Generating test outputs for these tests... # do_test file description info Done. echo "" info Performing the following tests from $io_dir create_mode="false" echo "" do_test simple1 "Offline " do_test simple2 "Start " do_test simple3 "Start 2 " do_test simple4 "Start Failed" do_test simple6 "Stop Start " do_test simple7 "Shutdown " #do_test simple8 "Stonith " #do_test simple9 "Lower version" #do_test simple10 "Higher version" do_test simple11 "Priority (ne)" do_test simple12 "Priority (eq)" do_test simple8 "Stickiness" echo "" do_test group1 "Group " do_test group2 "Group + Native " do_test group3 "Group + Group " do_test group4 "Group + Native (nothing)" do_test group5 "Group + Native (move) " do_test group6 "Group + Group (move) " do_test group7 "Group colocation" do_test group13 "Group colocation (cant run)" do_test group8 "Group anti-colocation" do_test group9 "Group recovery" do_test group10 "Group partial recovery" do_test group11 "Group target_role" do_test group14 "Group stop (graph terminated)" do_test group15 "-ve group colocation" do_test bug-1573 "Partial stop of a group with two children" do_test bug-1718 "Mandatory group ordering - Stop group_FUN" do_test bug-lf-2613 "Move group on failure" do_test bug-lf-2619 "Move group on clone failure" echo "" do_test rsc_dep1 "Must not " do_test rsc_dep3 "Must " do_test rsc_dep5 "Must not 3 " do_test rsc_dep7 "Must 3 " do_test rsc_dep10 "Must (but cant)" do_test rsc_dep2 "Must (running) " do_test rsc_dep8 "Must (running : alt) " do_test rsc_dep4 "Must (running + move)" do_test asymmetric "Asymmetric - require explicit location constraints" echo "" do_test orphan-0 "Orphan ignore" do_test orphan-1 "Orphan stop" do_test orphan-2 "Orphan stop, remove failcount" echo "" do_test params-0 "Params: No change" do_test params-1 "Params: Changed" do_test params-2 "Params: Resource definition" do_test params-4 "Params: Reload" do_test params-5 "Params: Restart based on probe digest" do_test novell-251689 "Resource definition change + target_role=stopped" do_test bug-lf-2106 "Restart all anonymous clone instances after config change" do_test params-6 "Params: Detect reload in previously migrated resource" echo "" do_test target-0 "Target Role : baseline" do_test target-1 "Target Role : master" do_test target-2 "Target Role : invalid" echo "" do_test domain "Failover domains" do_test base-score "Set a node's default score for all nodes" echo "" do_test date-1 "Dates" -t "2005-020" do_test date-2 "Date Spec - Pass" -t "2005-020T12:30" do_test date-3 "Date Spec - Fail" -t "2005-020T11:30" do_test probe-0 "Probe (anon clone)" do_test probe-1 "Pending Probe" do_test probe-2 "Correctly re-probe cloned groups" do_test probe-3 "Probe (pending node)" do_test probe-4 "Probe (pending node + stopped resource)" --rc 4 do_test standby "Standby" do_test comments "Comments" echo "" do_test one-or-more-0 "Everything starts" do_test one-or-more-1 "Nothing starts because of A" do_test one-or-more-2 "D can start because of C" do_test one-or-more-3 "D cannot start because of B and C" do_test one-or-more-4 "D cannot start because of target-role" do_test one-or-more-5 "Start A and F even though C and D are stopped" do_test one-or-more-6 "Leave A running even though B is stopped" do_test one-or-more-7 "Leave A running even though C is stopped" echo "" do_test order1 "Order start 1 " do_test order2 "Order start 2 " do_test order3 "Order stop " do_test order4 "Order (multiple) " do_test order5 "Order (move) " do_test order6 "Order (move w/ restart) " do_test order7 "Order (manditory) " do_test order-optional "Order (score=0) " do_test order-required "Order (score=INFINITY) " do_test bug-lf-2171 "Prevent group start when clone is stopped" do_test order-clone "Clone ordering should be able to prevent startup of dependant clones" do_test order-sets "Ordering for resource sets" do_test order-serialize "Serialize resources without inhibiting migration" do_test order-serialize-set "Serialize a set of resources without inhibiting migration" do_test clone-order-primitive "Order clone start after a primitive" do_test order-optional-keyword "Order (optional keyword)" do_test order-mandatory "Order (mandatory keyword)" do_test bug-lf-2493 "Don't imply colocation requirements when applying ordering constraints with clones" do_test ordered-set-basic-startup "Constraint set with default order settings." # This test emits an error log and thus upsets the test suite; even # though it explicitly aims to test an error leg. FIXME # do_test order-wrong-kind "Order (error)" echo "" do_test coloc-loop "Colocation - loop" do_test coloc-many-one "Colocation - many-to-one" do_test coloc-list "Colocation - many-to-one with list" do_test coloc-group "Colocation - groups" do_test coloc-slave-anti "Anti-colocation with slave shouldn't prevent master colocation" do_test coloc-attr "Colocation based on node attributes" do_test coloc-negative-group "Negative colocation with a group" do_test coloc-intra-set "Intra-set colocation" do_test bug-lf-2435 "Colocation sets with a negative score" do_test coloc-clone-stays-active "Ensure clones don't get stopped/demoted because a dependant must stop" echo "" do_test rsc-sets-seq-true "Resource Sets - sequential=false" do_test rsc-sets-seq-false "Resource Sets - sequential=true" do_test rsc-sets-clone "Resource Sets - Clone" do_test rsc-sets-master "Resource Sets - Master" do_test rsc-sets-clone-1 "Resource Sets - Clone (lf#2404)" #echo "" #do_test agent1 "version: lt (empty)" #do_test agent2 "version: eq " #do_test agent3 "version: gt " echo "" do_test attrs1 "string: eq (and) " do_test attrs2 "string: lt / gt (and)" do_test attrs3 "string: ne (or) " do_test attrs4 "string: exists " do_test attrs5 "string: not_exists " do_test attrs6 "is_dc: true " do_test attrs7 "is_dc: false " do_test attrs8 "score_attribute " echo "" do_test mon-rsc-1 "Schedule Monitor - start" do_test mon-rsc-2 "Schedule Monitor - move " do_test mon-rsc-3 "Schedule Monitor - pending start " do_test mon-rsc-4 "Schedule Monitor - move/pending start" echo "" do_test rec-rsc-0 "Resource Recover - no start " do_test rec-rsc-1 "Resource Recover - start " do_test rec-rsc-2 "Resource Recover - monitor " do_test rec-rsc-3 "Resource Recover - stop - ignore" do_test rec-rsc-4 "Resource Recover - stop - block " do_test rec-rsc-5 "Resource Recover - stop - fence " do_test rec-rsc-6 "Resource Recover - multiple - restart" do_test rec-rsc-7 "Resource Recover - multiple - stop " do_test rec-rsc-8 "Resource Recover - multiple - block " do_test rec-rsc-9 "Resource Recover - group/group" echo "" do_test quorum-1 "No quorum - ignore" do_test quorum-2 "No quorum - freeze" do_test quorum-3 "No quorum - stop " do_test quorum-4 "No quorum - start anyway" do_test quorum-5 "No quorum - start anyway (group)" do_test quorum-6 "No quorum - start anyway (clone)" echo "" do_test rec-node-1 "Node Recover - Startup - no fence" do_test rec-node-2 "Node Recover - Startup - fence " do_test rec-node-3 "Node Recover - HA down - no fence" do_test rec-node-4 "Node Recover - HA down - fence " do_test rec-node-5 "Node Recover - CRM down - no fence" do_test rec-node-6 "Node Recover - CRM down - fence " do_test rec-node-7 "Node Recover - no quorum - ignore " do_test rec-node-8 "Node Recover - no quorum - freeze " do_test rec-node-9 "Node Recover - no quorum - stop " do_test rec-node-10 "Node Recover - no quorum - stop w/fence" do_test rec-node-11 "Node Recover - CRM down w/ group - fence " do_test rec-node-12 "Node Recover - nothing active - fence " do_test rec-node-13 "Node Recover - failed resource + shutdown - fence " do_test rec-node-15 "Node Recover - unknown lrm section" do_test rec-node-14 "Serialize all stonith's" echo "" do_test multi1 "Multiple Active (stop/start)" echo "" do_test migrate-begin "Normal migration" do_test migrate-success "Completed migration" do_test migrate-partial-1 "Completed migration, missing stop on source" do_test migrate-partial-2 "Successful migrate_to only" do_test migrate-partial-3 "Successful migrate_to only, target down" do_test migrate-partial-4 "Migrate from the correct host after migrate_to+migrate_from" do_test migrate-fail-2 "Failed migrate_from" do_test migrate-fail-3 "Failed migrate_from + stop on source" do_test migrate-fail-4 "Failed migrate_from + stop on target - ideally we wouldn't need to re-stop on target" do_test migrate-fail-5 "Failed migrate_from + stop on source and target" do_test migrate-fail-6 "Failed migrate_to" do_test migrate-fail-7 "Failed migrate_to + stop on source" do_test migrate-fail-8 "Failed migrate_to + stop on target - ideally we wouldn't need to re-stop on target" do_test migrate-fail-9 "Failed migrate_to + stop on source and target" do_test migrate-stop "Migration in a stopping stack" do_test migrate-start "Migration in a starting stack" do_test migrate-stop_start "Migration in a restarting stack" do_test migrate-stop-complex "Migration in a complex stopping stack" do_test migrate-start-complex "Migration in a complex starting stack" do_test migrate-stop-start-complex "Migration in a complex moving stack" do_test migrate-shutdown "Order the post-migration 'stop' before node shutdown" do_test migrate-1 "Migrate (migrate)" do_test migrate-2 "Migrate (stable)" do_test migrate-3 "Migrate (failed migrate_to)" do_test migrate-4 "Migrate (failed migrate_from)" do_test novell-252693 "Migration in a stopping stack" do_test novell-252693-2 "Migration in a starting stack" do_test novell-252693-3 "Non-Migration in a starting and stopping stack" do_test bug-1820 "Migration in a group" do_test bug-1820-1 "Non-migration in a group" do_test migrate-5 "Primitive migration with a clone" do_test migrate-fencing "Migration after Fencing" #echo "" #do_test complex1 "Complex " do_test bug-lf-2422 "Dependancy on partially active group - stop ocfs:*" echo "" do_test clone-anon-probe-1 "Probe the correct (anonymous) clone instance for each node" do_test clone-anon-probe-2 "Avoid needless re-probing of anonymous clones" do_test clone-anon-failcount "Merge failcounts for anonymous clones" do_test inc0 "Incarnation start" do_test inc1 "Incarnation start order" do_test inc2 "Incarnation silent restart, stop, move" do_test inc3 "Inter-incarnation ordering, silent restart, stop, move" do_test inc4 "Inter-incarnation ordering, silent restart, stop, move (ordered)" do_test inc5 "Inter-incarnation ordering, silent restart, stop, move (restart 1)" do_test inc6 "Inter-incarnation ordering, silent restart, stop, move (restart 2)" do_test inc7 "Clone colocation" do_test inc8 "Clone anti-colocation" do_test inc9 "Non-unique clone" do_test inc10 "Non-unique clone (stop)" do_test inc11 "Primitive colocation with clones" do_test inc12 "Clone shutdown" do_test cloned-group "Make sure only the correct number of cloned groups are started" do_test clone-no-shuffle "Dont prioritize allocation of instances that must be moved" do_test clone-max-zero "Orphan processing with clone-max=0" do_test clone-anon-dup "Bug LF#2087 - Correctly parse the state of anonymous clones that are active more than once per node" do_test bug-lf-2160 "Dont shuffle clones due to colocation" do_test bug-lf-2213 "clone-node-max enforcement for cloned groups" do_test bug-lf-2153 "Clone ordering constraints" do_test bug-lf-2361 "Ensure clones observe mandatory ordering constraints if the LHS is unrunnable" do_test bug-lf-2317 "Avoid needless restart of primitive depending on a clone" do_test clone-colocate-instance-1 "Colocation with a specific clone instance (negative example)" do_test clone-colocate-instance-2 "Colocation with a specific clone instance" do_test clone-order-instance "Ordering with specific clone instances" do_test bug-lf-2453 "Enforce mandatory clone ordering without colocation" do_test bug-lf-2508 "Correctly reconstruct the status of anonymous cloned groups" do_test bug-lf-2544 "Balanced clone placement" do_test bug-lf-2445 "Redistribute clones with node-max > 1 and stickiness = 0" do_test bug-lf-2574 "Avoid clone shuffle" do_test bug-lf-2581 "Avoid group restart due to unrelated clone (re)start" echo "" do_test master-0 "Stopped -> Slave" do_test master-1 "Stopped -> Promote" do_test master-2 "Stopped -> Promote : notify" do_test master-3 "Stopped -> Promote : master location" do_test master-4 "Started -> Promote : master location" do_test master-5 "Promoted -> Promoted" do_test master-6 "Promoted -> Promoted (2)" do_test master-7 "Promoted -> Fenced" do_test master-8 "Promoted -> Fenced -> Moved" do_test master-9 "Stopped + Promotable + No quorum" do_test master-10 "Stopped -> Promotable : notify with monitor" do_test master-11 "Stopped -> Promote : colocation" do_test novell-239082 "Demote/Promote ordering" do_test novell-239087 "Stable master placement" do_test master-12 "Promotion based solely on rsc_location constraints" do_test master-13 "Include preferences of colocated resources when placing master" do_test master-demote "Ordering when actions depends on demoting a slave resource" do_test master-ordering "Prevent resources from starting that need a master" do_test bug-1765 "Master-Master Colocation (dont stop the slaves)" do_test master-group "Promotion of cloned groups" do_test bug-lf-1852 "Don't shuffle master/slave instances unnecessarily" do_test master-failed-demote "Dont retry failed demote actions" do_test master-failed-demote-2 "Dont retry failed demote actions (notify=false)" do_test master-depend "Ensure resources that depend on the master don't get allocated until the master does" do_test master-reattach "Re-attach to a running master" do_test master-allow-start "Don't include master score if it would prevent allocation" do_test master-colocation "Allow master instances placemaker to be influenced by colocation constraints" do_test master-pseudo "Make sure promote/demote pseudo actions are created correctly" do_test master-role "Prevent target-role from promoting more than master-max instances" do_test bug-lf-2358 "Master-Master anti-colocation" do_test master-promotion-constraint "Mandatory master colocation constraints" do_test unmanaged-master "Ensure role is preserved for unmanaged resources" do_test master-unmanaged-monitor "Start the correct monitor operation for unmanaged masters" do_test master-demote-2 "Demote does not clear past failure" do_test master-move "Move master based on failure of colocated group" do_test master-probed-score "Observe the promotion score of probed resources" echo "" do_test history-1 "Correctly parse stateful-1 resource state" echo "" do_test managed-0 "Managed (reference)" do_test managed-1 "Not managed - down " do_test managed-2 "Not managed - up " do_test bug-5028 "Shutdown should block if anything depends on an unmanaged resource" do_test bug-5028-detach "Ensure detach still works" do_test bug-5028-bottom "Ensure shutdown still blocks if the blocked resource is at the bottom of the stack" echo "" do_test interleave-0 "Interleave (reference)" do_test interleave-1 "coloc - not interleaved" do_test interleave-2 "coloc - interleaved " do_test interleave-3 "coloc - interleaved (2)" do_test interleave-pseudo-stop "Interleaved clone during stonith" do_test interleave-stop "Interleaved clone during stop" do_test interleave-restart "Interleaved clone during dependancy restart" echo "" do_test notify-0 "Notify reference" do_test notify-1 "Notify simple" do_test notify-2 "Notify simple, confirm" do_test notify-3 "Notify move, confirm" do_test novell-239079 "Notification priority" #do_test notify-2 "Notify - 764" echo "" do_test 594 "OSDL #594 - Unrunnable actions scheduled in transition" do_test 662 "OSDL #662 - Two resources start on one node when incarnation_node_max = 1" do_test 696 "OSDL #696 - CRM starts stonith RA without monitor" do_test 726 "OSDL #726 - Attempting to schedule rsc_posic041_monitor_5000 _after_ a stop" do_test 735 "OSDL #735 - Correctly detect that rsc_hadev1 is stopped on hadev3" do_test 764 "OSDL #764 - Missing monitor op for DoFencing:child_DoFencing:1" do_test 797 "OSDL #797 - Assert triggered: task_id_i > max_call_id" do_test 829 "OSDL #829" do_test 994 "OSDL #994 - Stopping the last resource in a resource group causes the entire group to be restarted" do_test 994-2 "OSDL #994 - with a dependant resource" do_test 1360 "OSDL #1360 - Clone stickiness" do_test 1484 "OSDL #1484 - on_fail=stop" do_test 1494 "OSDL #1494 - Clone stability" do_test unrunnable-1 "Unrunnable" do_test stonith-0 "Stonith loop - 1" do_test stonith-1 "Stonith loop - 2" do_test stonith-2 "Stonith loop - 3" do_test stonith-3 "Stonith startup" do_test bug-1572-1 "Recovery of groups depending on master/slave" do_test bug-1572-2 "Recovery of groups depending on master/slave when the master is never re-promoted" do_test bug-1685 "Depends-on-master ordering" do_test bug-1822 "Dont promote partially active groups" do_test bug-pm-11 "New resource added to a m/s group" do_test bug-pm-12 "Recover only the failed portion of a cloned group" do_test bug-n-387749 "Don't shuffle clone instances" do_test bug-n-385265 "Don't ignore the failure stickiness of group children - resource_idvscommon should stay stopped" do_test bug-n-385265-2 "Ensure groups are migrated instead of remaining partially active on the current node" do_test bug-lf-1920 "Correctly handle probes that find active resources" do_test bnc-515172 "Location constraint with multiple expressions" do_test colocate-primitive-with-clone "Optional colocation with a clone" do_test use-after-free-merge "Use-after-free in native_merge_weights" do_test bug-lf-2551 "STONITH ordering for stop" do_test bug-lf-2606 "Stonith implies demote" do_test bug-lf-2474 "Ensure resource op timeout takes precedence over op_defaults" do_test bug-suse-707150 "Prevent vm-01 from starting due to colocation/ordering" do_test bug-5014-A-start-B-start "Verify when A starts B starts using symmetrical=false" do_test bug-5014-A-stop-B-started "Verify when A stops B does not stop if it has already started using symmetric=false" do_test bug-5014-A-stopped-B-stopped "Verify when A is stopped and B has not started, B does not start before A using symmetric=false" do_test bug-5014-CthenAthenB-C-stopped "Verify when C then A is symmetrical=true, A then B is symmetric=false, and C is stopped that nothing starts." do_test bug-5014-CLONE-A-start-B-start "Verify when A starts B starts using clone resources with symmetric=false" do_test bug-5014-CLONE-A-stop-B-started "Verify when A stops B does not stop if it has already started using clone resources with symmetric=false." do_test bug-5014-GROUP-A-start-B-start "Verify when A starts B starts when using group resources with symmetric=false." do_test bug-5014-GROUP-A-stopped-B-started "Verify when A stops B does not stop if it has already started using group resources with symmetric=false." do_test bug-5014-GROUP-A-stopped-B-stopped "Verify when A is stopped and B has not started, B does not start before A using group resources with symmetric=false." do_test bug-5014-ordered-set-symmetrical-false "Verify ordered sets work with symmetrical=false" do_test bug-5014-ordered-set-symmetrical-true "Verify ordered sets work with symmetrical=true" do_test bug-5007-masterslave_colocation "Verify use of colocation scores other than INFINITY and -INFINITY work on multi-state resources." do_test bug-5038 "Prevent restart of anonymous clones when clone-max decreases" do_test bug-5025-1 "Automatically clean up failcount after resource config change with reload" do_test bug-5025-2 "Make sure clear failcount action isn't set when config does not change." do_test bug-5025-3 "Automatically clean up failcount after resource config change with restart" +do_test monitor-onfail-restart "bug-5058 - Monitor failure with on-fail set to restart" +do_test monitor-onfail-stop "bug-5058 - Monitor failure wiht on-fail set to stop" echo "" do_test systemhealth1 "System Health () #1" do_test systemhealth2 "System Health () #2" do_test systemhealth3 "System Health () #3" do_test systemhealthn1 "System Health (None) #1" do_test systemhealthn2 "System Health (None) #2" do_test systemhealthn3 "System Health (None) #3" do_test systemhealthm1 "System Health (Migrate On Red) #1" do_test systemhealthm2 "System Health (Migrate On Red) #2" do_test systemhealthm3 "System Health (Migrate On Red) #3" do_test systemhealtho1 "System Health (Only Green) #1" do_test systemhealtho2 "System Health (Only Green) #2" do_test systemhealtho3 "System Health (Only Green) #3" do_test systemhealthp1 "System Health (Progessive) #1" do_test systemhealthp2 "System Health (Progessive) #2" do_test systemhealthp3 "System Health (Progessive) #3" echo "" do_test utilization "Placement Strategy - utilization" do_test minimal "Placement Strategy - minimal" do_test balanced "Placement Strategy - balanced" echo "" do_test placement-stickiness "Optimized Placement Strategy - stickiness" do_test placement-priority "Optimized Placement Strategy - priority" do_test placement-location "Optimized Placement Strategy - location" do_test placement-capacity "Optimized Placement Strategy - capacity" echo "" do_test utilization-order1 "Utilization Order - Simple" do_test utilization-order2 "Utilization Order - Complex" do_test utilization-order3 "Utilization Order - Migrate" do_test utilization-order4 "Utilization Order - Live Mirgration (bnc#695440)" do_test utilization-shuffle "Don't displace prmExPostgreSQLDB2 on act2, Start prmExPostgreSQLDB1 on act3" echo "" do_test reprobe-target_rc "Ensure correct target_rc for reprobe of inactive resources" echo "" do_test stopped-monitor-00 "Stopped Monitor - initial start" do_test stopped-monitor-01 "Stopped Monitor - failed started" do_test stopped-monitor-02 "Stopped Monitor - started multi-up" do_test stopped-monitor-03 "Stopped Monitor - stop started" do_test stopped-monitor-04 "Stopped Monitor - failed stop" do_test stopped-monitor-05 "Stopped Monitor - start unmanaged" do_test stopped-monitor-06 "Stopped Monitor - unmanaged multi-up" do_test stopped-monitor-07 "Stopped Monitor - start unmanaged multi-up" do_test stopped-monitor-08 "Stopped Monitor - migrate" do_test stopped-monitor-09 "Stopped Monitor - unmanage started" do_test stopped-monitor-10 "Stopped Monitor - unmanaged started multi-up" do_test stopped-monitor-11 "Stopped Monitor - stop unmanaged started" do_test stopped-monitor-12 "Stopped Monitor - unmanaged started multi-up (targer-role="Stopped")" do_test stopped-monitor-20 "Stopped Monitor - initial stop" do_test stopped-monitor-21 "Stopped Monitor - stopped single-up" do_test stopped-monitor-22 "Stopped Monitor - stopped multi-up" do_test stopped-monitor-23 "Stopped Monitor - start stopped" do_test stopped-monitor-24 "Stopped Monitor - unmanage stopped" do_test stopped-monitor-25 "Stopped Monitor - unmanaged stopped multi-up" do_test stopped-monitor-26 "Stopped Monitor - start unmanaged stopped" do_test stopped-monitor-27 "Stopped Monitor - unmanaged stopped multi-up (target-role="Started")" do_test stopped-monitor-30 "Stopped Monitor - new node started" do_test stopped-monitor-31 "Stopped Monitor - new node stopped" echo"" do_test ticket-primitive-1 "Ticket - Primitive (loss-policy=stop, initial)" do_test ticket-primitive-2 "Ticket - Primitive (loss-policy=stop, granted)" do_test ticket-primitive-3 "Ticket - Primitive (loss-policy-stop, revoked)" do_test ticket-primitive-4 "Ticket - Primitive (loss-policy=demote, initial)" do_test ticket-primitive-5 "Ticket - Primitive (loss-policy=demote, granted)" do_test ticket-primitive-6 "Ticket - Primitive (loss-policy=demote, revoked)" do_test ticket-primitive-7 "Ticket - Primitive (loss-policy=fence, initial)" do_test ticket-primitive-8 "Ticket - Primitive (loss-policy=fence, granted)" do_test ticket-primitive-9 "Ticket - Primitive (loss-policy=fence, revoked)" do_test ticket-primitive-10 "Ticket - Primitive (loss-policy=freeze, initial)" do_test ticket-primitive-11 "Ticket - Primitive (loss-policy=freeze, granted)" do_test ticket-primitive-12 "Ticket - Primitive (loss-policy=freeze, revoked)" do_test ticket-primitive-13 "Ticket - Primitive (loss-policy=stop, standby, granted)" do_test ticket-primitive-14 "Ticket - Primitive (loss-policy=stop, granted, standby)" do_test ticket-primitive-15 "Ticket - Primitive (loss-policy=stop, standby, revoked)" do_test ticket-primitive-16 "Ticket - Primitive (loss-policy=demote, standby, granted)" do_test ticket-primitive-17 "Ticket - Primitive (loss-policy=demote, granted, standby)" do_test ticket-primitive-18 "Ticket - Primitive (loss-policy=demote, standby, revoked)" do_test ticket-primitive-19 "Ticket - Primitive (loss-policy=fence, standby, granted)" do_test ticket-primitive-20 "Ticket - Primitive (loss-policy=fence, granted, standby)" do_test ticket-primitive-21 "Ticket - Primitive (loss-policy=fence, standby, revoked)" do_test ticket-primitive-22 "Ticket - Primitive (loss-policy=freeze, standby, granted)" do_test ticket-primitive-23 "Ticket - Primitive (loss-policy=freeze, granted, standby)" do_test ticket-primitive-24 "Ticket - Primitive (loss-policy=freeze, standby, revoked)" echo"" do_test ticket-group-1 "Ticket - Group (loss-policy=stop, initial)" do_test ticket-group-2 "Ticket - Group (loss-policy=stop, granted)" do_test ticket-group-3 "Ticket - Group (loss-policy-stop, revoked)" do_test ticket-group-4 "Ticket - Group (loss-policy=demote, initial)" do_test ticket-group-5 "Ticket - Group (loss-policy=demote, granted)" do_test ticket-group-6 "Ticket - Group (loss-policy=demote, revoked)" do_test ticket-group-7 "Ticket - Group (loss-policy=fence, initial)" do_test ticket-group-8 "Ticket - Group (loss-policy=fence, granted)" do_test ticket-group-9 "Ticket - Group (loss-policy=fence, revoked)" do_test ticket-group-10 "Ticket - Group (loss-policy=freeze, initial)" do_test ticket-group-11 "Ticket - Group (loss-policy=freeze, granted)" do_test ticket-group-12 "Ticket - Group (loss-policy=freeze, revoked)" do_test ticket-group-13 "Ticket - Group (loss-policy=stop, standby, granted)" do_test ticket-group-14 "Ticket - Group (loss-policy=stop, granted, standby)" do_test ticket-group-15 "Ticket - Group (loss-policy=stop, standby, revoked)" do_test ticket-group-16 "Ticket - Group (loss-policy=demote, standby, granted)" do_test ticket-group-17 "Ticket - Group (loss-policy=demote, granted, standby)" do_test ticket-group-18 "Ticket - Group (loss-policy=demote, standby, revoked)" do_test ticket-group-19 "Ticket - Group (loss-policy=fence, standby, granted)" do_test ticket-group-20 "Ticket - Group (loss-policy=fence, granted, standby)" do_test ticket-group-21 "Ticket - Group (loss-policy=fence, standby, revoked)" do_test ticket-group-22 "Ticket - Group (loss-policy=freeze, standby, granted)" do_test ticket-group-23 "Ticket - Group (loss-policy=freeze, granted, standby)" do_test ticket-group-24 "Ticket - Group (loss-policy=freeze, standby, revoked)" echo"" do_test ticket-clone-1 "Ticket - Clone (loss-policy=stop, initial)" do_test ticket-clone-2 "Ticket - Clone (loss-policy=stop, granted)" do_test ticket-clone-3 "Ticket - Clone (loss-policy-stop, revoked)" do_test ticket-clone-4 "Ticket - Clone (loss-policy=demote, initial)" do_test ticket-clone-5 "Ticket - Clone (loss-policy=demote, granted)" do_test ticket-clone-6 "Ticket - Clone (loss-policy=demote, revoked)" do_test ticket-clone-7 "Ticket - Clone (loss-policy=fence, initial)" do_test ticket-clone-8 "Ticket - Clone (loss-policy=fence, granted)" do_test ticket-clone-9 "Ticket - Clone (loss-policy=fence, revoked)" do_test ticket-clone-10 "Ticket - Clone (loss-policy=freeze, initial)" do_test ticket-clone-11 "Ticket - Clone (loss-policy=freeze, granted)" do_test ticket-clone-12 "Ticket - Clone (loss-policy=freeze, revoked)" do_test ticket-clone-13 "Ticket - Clone (loss-policy=stop, standby, granted)" do_test ticket-clone-14 "Ticket - Clone (loss-policy=stop, granted, standby)" do_test ticket-clone-15 "Ticket - Clone (loss-policy=stop, standby, revoked)" do_test ticket-clone-16 "Ticket - Clone (loss-policy=demote, standby, granted)" do_test ticket-clone-17 "Ticket - Clone (loss-policy=demote, granted, standby)" do_test ticket-clone-18 "Ticket - Clone (loss-policy=demote, standby, revoked)" do_test ticket-clone-19 "Ticket - Clone (loss-policy=fence, standby, granted)" do_test ticket-clone-20 "Ticket - Clone (loss-policy=fence, granted, standby)" do_test ticket-clone-21 "Ticket - Clone (loss-policy=fence, standby, revoked)" do_test ticket-clone-22 "Ticket - Clone (loss-policy=freeze, standby, granted)" do_test ticket-clone-23 "Ticket - Clone (loss-policy=freeze, granted, standby)" do_test ticket-clone-24 "Ticket - Clone (loss-policy=freeze, standby, revoked)" echo"" do_test ticket-master-1 "Ticket - Master (loss-policy=stop, initial)" do_test ticket-master-2 "Ticket - Master (loss-policy=stop, granted)" do_test ticket-master-3 "Ticket - Master (loss-policy-stop, revoked)" do_test ticket-master-4 "Ticket - Master (loss-policy=demote, initial)" do_test ticket-master-5 "Ticket - Master (loss-policy=demote, granted)" do_test ticket-master-6 "Ticket - Master (loss-policy=demote, revoked)" do_test ticket-master-7 "Ticket - Master (loss-policy=fence, initial)" do_test ticket-master-8 "Ticket - Master (loss-policy=fence, granted)" do_test ticket-master-9 "Ticket - Master (loss-policy=fence, revoked)" do_test ticket-master-10 "Ticket - Master (loss-policy=freeze, initial)" do_test ticket-master-11 "Ticket - Master (loss-policy=freeze, granted)" do_test ticket-master-12 "Ticket - Master (loss-policy=freeze, revoked)" do_test ticket-master-13 "Ticket - Master (loss-policy=stop, standby, granted)" do_test ticket-master-14 "Ticket - Master (loss-policy=stop, granted, standby)" do_test ticket-master-15 "Ticket - Master (loss-policy=stop, standby, revoked)" do_test ticket-master-16 "Ticket - Master (loss-policy=demote, standby, granted)" do_test ticket-master-17 "Ticket - Master (loss-policy=demote, granted, standby)" do_test ticket-master-18 "Ticket - Master (loss-policy=demote, standby, revoked)" do_test ticket-master-19 "Ticket - Master (loss-policy=fence, standby, granted)" do_test ticket-master-20 "Ticket - Master (loss-policy=fence, granted, standby)" do_test ticket-master-21 "Ticket - Master (loss-policy=fence, standby, revoked)" do_test ticket-master-22 "Ticket - Master (loss-policy=freeze, standby, granted)" do_test ticket-master-23 "Ticket - Master (loss-policy=freeze, granted, standby)" do_test ticket-master-24 "Ticket - Master (loss-policy=freeze, standby, revoked)" echo "" do_test ticket-rsc-sets-1 "Ticket - Resource sets (1 ticket, initial)" do_test ticket-rsc-sets-2 "Ticket - Resource sets (1 ticket, granted)" do_test ticket-rsc-sets-3 "Ticket - Resource sets (1 ticket, revoked)" do_test ticket-rsc-sets-4 "Ticket - Resource sets (2 tickets, initial)" do_test ticket-rsc-sets-5 "Ticket - Resource sets (2 tickets, granted)" do_test ticket-rsc-sets-6 "Ticket - Resource sets (2 tickets, granted)" do_test ticket-rsc-sets-7 "Ticket - Resource sets (2 tickets, revoked)" do_test ticket-rsc-sets-8 "Ticket - Resource sets (1 ticket, standby, granted)" do_test ticket-rsc-sets-9 "Ticket - Resource sets (1 ticket, granted, standby)" do_test ticket-rsc-sets-10 "Ticket - Resource sets (1 ticket, standby, revoked)" do_test ticket-rsc-sets-11 "Ticket - Resource sets (2 tickets, standby, granted)" do_test ticket-rsc-sets-12 "Ticket - Resource sets (2 tickets, standby, granted)" do_test ticket-rsc-sets-13 "Ticket - Resource sets (2 tickets, granted, standby)" do_test ticket-rsc-sets-14 "Ticket - Resource sets (2 tickets, standby, revoked)" echo "" do_test template-1 "Template - 1" do_test template-2 "Template - 2" do_test template-3 "Template - 3 (merge operations)" do_test template-coloc-1 "Template - Colocation 1" do_test template-coloc-2 "Template - Colocation 2" do_test template-coloc-3 "Template - Colocation 3" do_test template-order-1 "Template - Order 1" do_test template-order-2 "Template - Order 2" do_test template-order-3 "Template - Order 3" do_test template-ticket "Template - Ticket" do_test template-rsc-sets-1 "Template - Resource Sets 1" do_test template-rsc-sets-2 "Template - Resource Sets 2" do_test template-rsc-sets-3 "Template - Resource Sets 3" do_test template-rsc-sets-4 "Template - Resource Sets 4" echo "" test_results diff --git a/pengine/test10/monitor-onfail-restart.dot b/pengine/test10/monitor-onfail-restart.dot new file mode 100644 index 0000000000..227e643c1a --- /dev/null +++ b/pengine/test10/monitor-onfail-restart.dot @@ -0,0 +1,9 @@ + digraph "g" { +"A_monitor_20000 fc16-builder" [ style=bold color="green" fontcolor="black"] +"A_start_0 fc16-builder" -> "A_monitor_20000 fc16-builder" [ style = bold] +"A_start_0 fc16-builder" [ style=bold color="green" fontcolor="black"] +"A_stop_0 fc16-builder" -> "A_start_0 fc16-builder" [ style = bold] +"A_stop_0 fc16-builder" -> "all_stopped" [ style = bold] +"A_stop_0 fc16-builder" [ style=bold color="green" fontcolor="black"] +"all_stopped" [ style=bold color="green" fontcolor="orange"] +} diff --git a/pengine/test10/monitor-onfail-restart.exp b/pengine/test10/monitor-onfail-restart.exp new file mode 100644 index 0000000000..c4634ad692 --- /dev/null +++ b/pengine/test10/monitor-onfail-restart.exp @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/monitor-onfail-restart.scores b/pengine/test10/monitor-onfail-restart.scores new file mode 100644 index 0000000000..f342d5974e --- /dev/null +++ b/pengine/test10/monitor-onfail-restart.scores @@ -0,0 +1,3 @@ +Allocation scores: +native_color: A allocation score on fc16-builder2: 0 +native_color: A allocation score on fc16-builder: 0 diff --git a/pengine/test10/monitor-onfail-restart.xml b/pengine/test10/monitor-onfail-restart.xml new file mode 100644 index 0000000000..7895eaf2c3 --- /dev/null +++ b/pengine/test10/monitor-onfail-restart.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/monitor-onfail-stop.dot b/pengine/test10/monitor-onfail-stop.dot new file mode 100644 index 0000000000..822a003b72 --- /dev/null +++ b/pengine/test10/monitor-onfail-stop.dot @@ -0,0 +1,5 @@ + digraph "g" { +"A_stop_0 fc16-builder" -> "all_stopped" [ style = bold] +"A_stop_0 fc16-builder" [ style=bold color="green" fontcolor="black"] +"all_stopped" [ style=bold color="green" fontcolor="orange"] +} diff --git a/pengine/test10/monitor-onfail-stop.exp b/pengine/test10/monitor-onfail-stop.exp new file mode 100644 index 0000000000..6a5eec8310 --- /dev/null +++ b/pengine/test10/monitor-onfail-stop.exp @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/monitor-onfail-stop.scores b/pengine/test10/monitor-onfail-stop.scores new file mode 100644 index 0000000000..14878afb80 --- /dev/null +++ b/pengine/test10/monitor-onfail-stop.scores @@ -0,0 +1,3 @@ +Allocation scores: +native_color: A allocation score on fc16-builder2: -INFINITY +native_color: A allocation score on fc16-builder: -INFINITY diff --git a/pengine/test10/monitor-onfail-stop.xml b/pengine/test10/monitor-onfail-stop.xml new file mode 100644 index 0000000000..73debaf363 --- /dev/null +++ b/pengine/test10/monitor-onfail-stop.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +