diff --git a/crm/pengine/allocate.c b/crm/pengine/allocate.c index b390a783aa..1d6856a19b 100644 --- a/crm/pengine/allocate.c +++ b/crm/pengine/allocate.c @@ -1,1469 +1,1481 @@ /* * 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.1 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include void set_alloc_actions(pe_working_set_t *data_set); void migrate_reload_madness(pe_working_set_t *data_set); resource_alloc_functions_t resource_class_alloc_functions[] = { { native_merge_weights, native_color, native_create_actions, native_create_probe, native_internal_constraints, native_rsc_colocation_lh, native_rsc_colocation_rh, native_rsc_order_lh, native_rsc_order_rh, native_rsc_location, native_expand, complex_migrate_reload, complex_stonith_ordering, complex_create_notify_element, }, { group_merge_weights, group_color, group_create_actions, native_create_probe, group_internal_constraints, group_rsc_colocation_lh, group_rsc_colocation_rh, group_rsc_order_lh, group_rsc_order_rh, group_rsc_location, group_expand, complex_migrate_reload, complex_stonith_ordering, complex_create_notify_element, }, { native_merge_weights, clone_color, clone_create_actions, clone_create_probe, clone_internal_constraints, clone_rsc_colocation_lh, clone_rsc_colocation_rh, clone_rsc_order_lh, clone_rsc_order_rh, clone_rsc_location, clone_expand, complex_migrate_reload, complex_stonith_ordering, complex_create_notify_element, }, { native_merge_weights, master_color, master_create_actions, clone_create_probe, master_internal_constraints, clone_rsc_colocation_lh, master_rsc_colocation_rh, clone_rsc_order_lh, clone_rsc_order_rh, clone_rsc_location, clone_expand, complex_migrate_reload, complex_stonith_ordering, complex_create_notify_element, } }; static gboolean check_rsc_parameters(resource_t *rsc, node_t *node, crm_data_t *rsc_entry, pe_working_set_t *data_set) { int attr_lpc = 0; gboolean force_restart = FALSE; gboolean delete_resource = FALSE; const char *value = NULL; const char *old_value = NULL; const char *attr_list[] = { XML_ATTR_TYPE, XML_AGENT_ATTR_CLASS, XML_AGENT_ATTR_PROVIDER }; for(; attr_lpc < DIMOF(attr_list); attr_lpc++) { value = crm_element_value(rsc->xml, attr_list[attr_lpc]); old_value = crm_element_value(rsc_entry, attr_list[attr_lpc]); if(value == old_value /* ie. NULL */ || crm_str_eq(value, old_value, TRUE)) { continue; } force_restart = TRUE; crm_notice("Forcing restart of %s on %s, %s changed: %s -> %s", rsc->id, node->details->uname, attr_list[attr_lpc], crm_str(old_value), crm_str(value)); } if(force_restart) { /* make sure the restart happens */ stop_action(rsc, node, FALSE); rsc->start_pending = TRUE; delete_resource = TRUE; } return delete_resource; } static gboolean check_action_definition(resource_t *rsc, node_t *active_node, crm_data_t *xml_op, pe_working_set_t *data_set) { char *key = NULL; int interval = 0; const char *interval_s = NULL; gboolean did_change = FALSE; gboolean start_op = FALSE; crm_data_t *params_all = NULL; crm_data_t *params_restart = NULL; GHashTable *local_rsc_params = NULL; char *digest_all_calc = NULL; const char *digest_all = NULL; const char *restart_list = NULL; const char *digest_restart = NULL; char *digest_restart_calc = NULL; action_t *action = NULL; const char *task = crm_element_value(xml_op, XML_LRM_ATTR_TASK); const char *op_version = crm_element_value(xml_op, XML_ATTR_CRM_VERSION); CRM_CHECK(active_node != NULL, return FALSE); interval_s = crm_element_value(xml_op, XML_LRM_ATTR_INTERVAL); interval = crm_parse_int(interval_s, "0"); /* we need to reconstruct the key because of the way we used to construct resource IDs */ key = generate_op_key(rsc->id, task, interval); if(interval > 0) { crm_data_t *op_match = NULL; crm_debug_2("Checking parameters for %s", key); op_match = find_rsc_op_entry(rsc, key); if(op_match == NULL && data_set->stop_action_orphans) { /* create a cancel action */ action_t *cancel = NULL; char *cancel_key = NULL; const char *call_id = crm_element_value(xml_op, XML_LRM_ATTR_CALLID); crm_info("Orphan action will be stopped: %s on %s", key, active_node->details->uname); cancel_key = generate_op_key( rsc->id, CRMD_ACTION_CANCEL, interval); cancel = custom_action( rsc, cancel_key, CRMD_ACTION_CANCEL, active_node, FALSE, TRUE, data_set); add_hash_param(cancel->meta, XML_LRM_ATTR_TASK, task); add_hash_param(cancel->meta, XML_LRM_ATTR_CALLID, call_id); add_hash_param(cancel->meta, XML_LRM_ATTR_INTERVAL, interval_s); custom_action_order( rsc, stop_key(rsc), NULL, rsc, NULL, cancel, pe_order_optional, data_set); crm_free(key); key = NULL; return TRUE; } else if(op_match == NULL) { crm_debug("Orphan action detected: %s on %s", key, active_node->details->uname); crm_free(key); key = NULL; return TRUE; } } action = custom_action(rsc, key, task, active_node, TRUE, FALSE, data_set); local_rsc_params = g_hash_table_new_full( g_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str); unpack_instance_attributes( rsc->xml, XML_TAG_ATTR_SETS, active_node->details->attrs, local_rsc_params, NULL, data_set->now); params_all = create_xml_node(NULL, XML_TAG_PARAMS); g_hash_table_foreach(action->extra, hash2field, params_all); g_hash_table_foreach(rsc->parameters, hash2field, params_all); g_hash_table_foreach(action->meta, hash2metafield, params_all); g_hash_table_foreach(local_rsc_params, hash2field, params_all); filter_action_parameters(params_all, op_version); digest_all_calc = calculate_xml_digest(params_all, TRUE); digest_all = crm_element_value(xml_op, XML_LRM_ATTR_OP_DIGEST); digest_restart = crm_element_value(xml_op, XML_LRM_ATTR_RESTART_DIGEST); restart_list = crm_element_value(xml_op, XML_LRM_ATTR_OP_RESTART); if(crm_str_eq(task, CRMD_ACTION_START, TRUE)) { start_op = TRUE; } if(start_op && digest_restart) { params_restart = copy_xml(params_all); if(restart_list) { filter_reload_parameters(params_restart, restart_list); } digest_restart_calc = calculate_xml_digest(params_restart, TRUE); if(safe_str_neq(digest_restart_calc, digest_restart)) { did_change = TRUE; crm_log_xml_info(params_restart, "params:restart"); crm_warn("Parameters to %s on %s changed: recorded %s vs. %s (restart:%s) %s", key, active_node->details->uname, crm_str(digest_restart), digest_restart_calc, op_version, crm_element_value(xml_op, XML_ATTR_TRANSITION_MAGIC)); key = generate_op_key(rsc->id, task, interval); custom_action(rsc, key, task, NULL, FALSE, TRUE, data_set); goto cleanup; } } if(safe_str_neq(digest_all_calc, digest_all)) { action_t *op = NULL; did_change = TRUE; crm_log_xml_info(params_all, "params:all"); crm_warn("Parameters to %s on %s changed: recorded %s vs. %s (all:%s) %s", key, active_node->details->uname, crm_str(digest_all), digest_all_calc, op_version, crm_element_value(xml_op, XML_ATTR_TRANSITION_MAGIC)); key = generate_op_key(rsc->id, task, interval); op = custom_action(rsc, key, task, NULL, FALSE, TRUE, data_set); if(start_op && digest_restart) { op->allow_reload_conversion = TRUE; } else if(interval > 0) { custom_action_order(rsc, start_key(rsc), NULL, NULL, crm_strdup(op->task), op, pe_order_runnable_left, data_set); } } cleanup: free_xml(params_all); free_xml(params_restart); crm_free(digest_all_calc); crm_free(digest_restart_calc); g_hash_table_destroy(local_rsc_params); pe_free_action(action); return did_change; } extern gboolean DeleteRsc(resource_t *rsc, node_t *node, gboolean optional, pe_working_set_t *data_set); static void check_actions_for(crm_data_t *rsc_entry, node_t *node, pe_working_set_t *data_set) { const char *id = NULL; const char *task = NULL; int interval = 0; const char *interval_s = NULL; GListPtr op_list = NULL; GListPtr sorted_op_list = NULL; const char *rsc_id = ID(rsc_entry); gboolean is_probe = FALSE; int start_index = 0, stop_index = 0; resource_t *rsc = pe_find_resource(data_set->resources, rsc_id); CRM_CHECK(rsc != NULL, return); CRM_CHECK(node != NULL, return); CRM_CHECK(rsc_id != NULL, return); if(rsc->orphan) { crm_debug_2("Skipping param check for %s: orphan", rsc->id); return; } else if(pe_find_node_id(rsc->running_on, node->details->id) == NULL) { crm_debug_2("Skipping param check for %s: no longer active on %s", rsc->id, node->details->uname); return; } crm_debug_3("Processing %s on %s", rsc->id, node->details->uname); if(check_rsc_parameters(rsc, node, rsc_entry, data_set)) { DeleteRsc(rsc, node, FALSE, data_set); } xml_child_iter_filter( rsc_entry, rsc_op, XML_LRM_TAG_RSC_OP, op_list = g_list_append(op_list, rsc_op); ); sorted_op_list = g_list_sort(op_list, sort_op_by_callid); calculate_active_ops(sorted_op_list, &start_index, &stop_index); slist_iter( rsc_op, crm_data_t, sorted_op_list, lpc, if(start_index < stop_index) { /* stopped */ continue; } else if(lpc < start_index) { /* action occurred prior to a start */ continue; } id = ID(rsc_op); is_probe = FALSE; task = crm_element_value(rsc_op, XML_LRM_ATTR_TASK); interval_s = crm_element_value(rsc_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(is_probe || safe_str_eq(task, CRMD_ACTION_START) || interval > 0) { check_action_definition(rsc, node, rsc_op, data_set); } ); g_list_free(sorted_op_list); } static void check_actions(pe_working_set_t *data_set) { const char *id = NULL; node_t *node = NULL; crm_data_t *lrm_rscs = NULL; crm_data_t *status = get_object_root(XML_CIB_TAG_STATUS, data_set->input); xml_child_iter_filter( status, node_state, XML_CIB_TAG_STATE, id = crm_element_value(node_state, XML_ATTR_ID); lrm_rscs = find_xml_node(node_state, XML_CIB_TAG_LRM, FALSE); lrm_rscs = find_xml_node(lrm_rscs, XML_LRM_TAG_RESOURCES, FALSE); node = pe_find_node_id(data_set->nodes, id); if(node == NULL) { continue; } else if(can_run_resources(node) == FALSE) { crm_debug_2("Skipping param check for %s: cant run resources", node->details->uname); continue; } crm_debug_2("Processing node %s", node->details->uname); if(node->details->online || data_set->stonith_enabled) { xml_child_iter_filter( lrm_rscs, rsc_entry, XML_LRM_TAG_RESOURCE, if(xml_has_children(rsc_entry)) { check_actions_for(rsc_entry, node, data_set); } ); } ); } static gboolean apply_placement_constraints(pe_working_set_t *data_set) { crm_debug_3("Applying constraints..."); slist_iter( cons, rsc_to_node_t, data_set->placement_constraints, lpc, cons->rsc_lh->cmds->rsc_location(cons->rsc_lh, cons); ); return TRUE; } static void complex_set_cmds(resource_t *rsc) { rsc->cmds = &resource_class_alloc_functions[rsc->variant]; slist_iter( child_rsc, resource_t, rsc->children, lpc, complex_set_cmds(child_rsc); ); } void set_alloc_actions(pe_working_set_t *data_set) { slist_iter( rsc, resource_t, data_set->resources, lpc, complex_set_cmds(rsc); ); } gboolean stage0(pe_working_set_t *data_set) { crm_data_t * cib_constraints = get_object_root( XML_CIB_TAG_CONSTRAINTS, data_set->input); if(data_set->input == NULL) { return FALSE; } cluster_status(data_set); set_alloc_actions(data_set); unpack_constraints(cib_constraints, data_set); return TRUE; } /* * Check nodes for resources started outside of the LRM */ gboolean stage1(pe_working_set_t *data_set) { action_t *probe_complete = NULL; action_t *probe_node_complete = NULL; slist_iter( node, node_t, data_set->nodes, lpc, gboolean force_probe = FALSE; const char *probed = g_hash_table_lookup( node->details->attrs, CRM_OP_PROBED); crm_debug_2("%s probed: %s", node->details->uname, probed); if(node->details->online == FALSE) { continue; } else if(node->details->unclean) { continue; } else if(probe_complete == NULL) { probe_complete = custom_action( NULL, crm_strdup(CRM_OP_PROBED), CRM_OP_PROBED, NULL, FALSE, TRUE, data_set); probe_complete->pseudo = TRUE; probe_complete->optional = TRUE; } if(probed != NULL && crm_is_true(probed) == FALSE) { force_probe = TRUE; } probe_node_complete = custom_action( NULL, crm_strdup(CRM_OP_PROBED), CRM_OP_PROBED, node, FALSE, TRUE, data_set); probe_node_complete->optional = crm_is_true(probed); probe_node_complete->priority = INFINITY; add_hash_param(probe_node_complete->meta, XML_ATTR_TE_NOWAIT, XML_BOOLEAN_TRUE); custom_action_order(NULL, NULL, probe_node_complete, NULL, NULL, probe_complete, pe_order_optional, data_set); slist_iter( rsc, resource_t, data_set->resources, lpc2, if(rsc->cmds->create_probe( rsc, node, probe_node_complete, force_probe, data_set)) { probe_complete->optional = FALSE; probe_node_complete->optional = FALSE; custom_action_order( NULL, NULL, probe_complete, rsc, start_key(rsc), NULL, pe_order_optional, data_set); } ); ); return TRUE; } /* * Count how many valid nodes we have (so we know the maximum number of * colors we can resolve). * * Apply node constraints (ie. filter the "allowed_nodes" part of resources */ gboolean stage2(pe_working_set_t *data_set) { crm_debug_3("Applying placement constraints"); slist_iter( node, node_t, data_set->nodes, lpc, if(node == NULL) { /* error */ } else if(node->weight >= 0.0 /* global weight */ && node->details->online && node->details->type == node_member) { data_set->max_valid_nodes++; } ); apply_placement_constraints(data_set); return TRUE; } /* * Create internal resource constraints before allocation */ gboolean stage3(pe_working_set_t *data_set) { slist_iter( rsc, resource_t, data_set->resources, lpc, rsc->cmds->internal_constraints(rsc, data_set); ); return TRUE; } /* * Check for orphaned or redefined actions */ gboolean stage4(pe_working_set_t *data_set) { check_actions(data_set); return TRUE; } gboolean stage5(pe_working_set_t *data_set) { /* Take (next) highest resource, assign it and create its actions */ slist_iter( rsc, resource_t, data_set->resources, lpc, rsc->cmds->color(rsc, data_set); rsc->cmds->create_actions(rsc, data_set); ); return TRUE; } /* * Create dependancies for stonith and shutdown operations */ gboolean stage6(pe_working_set_t *data_set) { action_t *dc_down = NULL; action_t *stonith_op = NULL; action_t *last_stonith = NULL; gboolean integrity_lost = FALSE; action_t *ready = get_pseudo_op(STONITH_UP, data_set); action_t *all_stopped = get_pseudo_op(ALL_STOPPED, data_set); crm_debug_3("Processing fencing and shutdown cases"); slist_iter( node, node_t, data_set->nodes, lpc, stonith_op = NULL; if(node->details->unclean && data_set->stonith_enabled && (data_set->have_quorum || data_set->no_quorum_policy == no_quorum_ignore)) { pe_warn("Scheduling Node %s for STONITH", node->details->uname); stonith_op = custom_action( NULL, crm_strdup(CRM_OP_FENCE), CRM_OP_FENCE, node, FALSE, TRUE, data_set); add_hash_param( stonith_op->meta, XML_LRM_ATTR_TARGET, node->details->uname); add_hash_param( stonith_op->meta, XML_LRM_ATTR_TARGET_UUID, node->details->id); add_hash_param( stonith_op->meta, "stonith_action", data_set->stonith_action); stonith_constraints(node, stonith_op, data_set); order_actions(ready, stonith_op, pe_order_implies_left); order_actions(stonith_op, all_stopped, pe_order_implies_right); if(node->details->is_dc) { dc_down = stonith_op; } else { if(last_stonith) { order_actions(last_stonith, stonith_op, pe_order_implies_left); } last_stonith = stonith_op; } } else if(node->details->online && node->details->shutdown) { action_t *down_op = NULL; crm_info("Scheduling Node %s for shutdown", node->details->uname); down_op = custom_action( NULL, crm_strdup(CRM_OP_SHUTDOWN), CRM_OP_SHUTDOWN, node, FALSE, TRUE, data_set); shutdown_constraints(node, down_op, data_set); if(node->details->is_dc) { dc_down = down_op; } } if(node->details->unclean && stonith_op == NULL) { integrity_lost = TRUE; pe_warn("Node %s is unclean!", node->details->uname); } ); if(integrity_lost) { if(data_set->have_quorum == FALSE) { crm_notice("Cannot fence unclean nodes until quorum is" " attained (or no_quorum_policy is set to ignore)"); } else if(data_set->stonith_enabled == FALSE) { pe_warn("YOUR RESOURCES ARE NOW LIKELY COMPROMISED"); pe_err("ENABLE STONITH TO KEEP YOUR RESOURCES SAFE"); } } if(dc_down != NULL) { GListPtr shutdown_matches = find_actions( data_set->actions, CRM_OP_SHUTDOWN, NULL); crm_debug_2("Ordering shutdowns before %s on %s (DC)", dc_down->task, dc_down->node->details->uname); add_hash_param(dc_down->meta, XML_ATTR_TE_NOWAIT, XML_BOOLEAN_TRUE); slist_iter( node_stop, action_t, shutdown_matches, lpc, if(node_stop->node->details->is_dc) { continue; } crm_debug("Ordering shutdown on %s before %s on %s", node_stop->node->details->uname, dc_down->task, dc_down->node->details->uname); order_actions(node_stop, dc_down, pe_order_implies_left); ); if(last_stonith && dc_down != last_stonith) { order_actions(last_stonith, dc_down, pe_order_implies_left); } g_list_free(shutdown_matches); } return TRUE; } /* * Determin the sets of independant actions and the correct order for the * actions in each set. * * Mark dependencies of un-runnable actions un-runnable * */ gboolean stage7(pe_working_set_t *data_set) { crm_debug_4("Applying ordering constraints"); slist_iter( order, order_constraint_t, data_set->ordering_constraints, lpc, resource_t *rsc = order->lh_rsc; crm_debug_2("Applying ordering constraint: %d", order->id); if(rsc != NULL) { crm_debug_4("rsc_action-to-*"); rsc->cmds->rsc_order_lh(rsc, order, data_set); continue; } rsc = order->rh_rsc; if(rsc != NULL) { crm_debug_4("action-to-rsc_action"); rsc->cmds->rsc_order_rh(order->lh_action, rsc, order); } else { crm_debug_4("action-to-action"); order_actions( order->lh_action, order->rh_action, order->type); } ); update_action_states(data_set->actions); slist_iter( rsc, resource_t, data_set->resources, lpc, rsc->cmds->migrate_reload(rsc, data_set); ); return TRUE; } int transition_id = -1; /* * Create a dependency graph to send to the transitioner (via the CRMd) */ gboolean stage8(pe_working_set_t *data_set) { const char *value = NULL; char *transition_id_s = NULL; transition_id++; transition_id_s = crm_itoa(transition_id); value = pe_pref(data_set->config_hash, "cluster-delay"); crm_debug_2("Creating transition graph %d.", transition_id); data_set->graph = create_xml_node(NULL, XML_TAG_GRAPH); crm_xml_add(data_set->graph, "cluster-delay", value); crm_xml_add(data_set->graph, "transition_id", transition_id_s); crm_free(transition_id_s); /* errors... slist_iter(action, action_t, action_list, lpc, if(action->optional == FALSE && action->runnable == FALSE) { print_action("Ignoring", action, TRUE); } ); */ slist_iter( rsc, resource_t, data_set->resources, lpc, crm_debug_4("processing actions for rsc=%s", rsc->id); rsc->cmds->expand(rsc, data_set); ); crm_log_xml_debug_3( data_set->graph, "created resource-driven action list"); /* catch any non-resource specific actions */ crm_debug_4("processing non-resource actions"); slist_iter( action, action_t, data_set->actions, lpc, graph_element_from_action(action, data_set); ); crm_log_xml_debug_3(data_set->graph, "created generic action list"); crm_debug_2("Created transition graph %d.", transition_id); return TRUE; } void cleanup_alloc_calculations(pe_working_set_t *data_set) { if(data_set == NULL) { return; } crm_debug_3("deleting order cons: %p", data_set->ordering_constraints); pe_free_ordering(data_set->ordering_constraints); data_set->ordering_constraints = NULL; crm_debug_3("deleting node cons: %p", data_set->placement_constraints); pe_free_rsc_to_node(data_set->placement_constraints); data_set->placement_constraints = NULL; + + crm_debug_3("deleting inter-resource cons: %p", data_set->colocation_constraints); + pe_free_shallow(data_set->colocation_constraints); + data_set->colocation_constraints = NULL; cleanup_calculations(data_set); } gboolean unpack_constraints(crm_data_t * xml_constraints, pe_working_set_t *data_set) { crm_data_t *lifetime = NULL; xml_child_iter( xml_constraints, xml_obj, const char *id = crm_element_value(xml_obj, XML_ATTR_ID); if(id == NULL) { crm_config_err("Constraint <%s...> must have an id", crm_element_name(xml_obj)); continue; } crm_debug_3("Processing constraint %s %s", crm_element_name(xml_obj),id); lifetime = cl_get_struct(xml_obj, "lifetime"); if(test_ruleset(lifetime, NULL, data_set->now) == FALSE) { crm_info("Constraint %s %s is not active", crm_element_name(xml_obj), id); } else if(safe_str_eq(XML_CONS_TAG_RSC_ORDER, crm_element_name(xml_obj))) { unpack_rsc_order(xml_obj, data_set); } else if(safe_str_eq(XML_CONS_TAG_RSC_DEPEND, crm_element_name(xml_obj))) { unpack_rsc_colocation(xml_obj, data_set); } else if(safe_str_eq(XML_CONS_TAG_RSC_LOCATION, crm_element_name(xml_obj))) { unpack_rsc_location(xml_obj, data_set); } else { pe_err("Unsupported constraint type: %s", crm_element_name(xml_obj)); } ); return TRUE; } static const char * invert_action(const char *action) { if(safe_str_eq(action, CRMD_ACTION_START)) { return CRMD_ACTION_STOP; } else if(safe_str_eq(action, CRMD_ACTION_STOP)) { return CRMD_ACTION_START; } else if(safe_str_eq(action, CRMD_ACTION_PROMOTE)) { return CRMD_ACTION_DEMOTE; } else if(safe_str_eq(action, CRMD_ACTION_DEMOTE)) { return CRMD_ACTION_PROMOTE; } else if(safe_str_eq(action, CRMD_ACTION_PROMOTED)) { return CRMD_ACTION_DEMOTED; } else if(safe_str_eq(action, CRMD_ACTION_DEMOTED)) { return CRMD_ACTION_PROMOTED; } else if(safe_str_eq(action, CRMD_ACTION_STARTED)) { return CRMD_ACTION_STOPPED; } else if(safe_str_eq(action, CRMD_ACTION_STOPPED)) { return CRMD_ACTION_STARTED; } crm_config_warn("Unknown action: %s", action); return NULL; } gboolean unpack_rsc_order(crm_data_t * xml_obj, pe_working_set_t *data_set) { int score_i = 0; int order_id = 0; resource_t *rsc_lh = NULL; resource_t *rsc_rh = NULL; gboolean symmetrical_bool = TRUE; enum pe_ordering cons_weight = pe_order_optional; const char *id_rh = NULL; const char *id_lh = NULL; const char *action = NULL; const char *action_rh = NULL; const char *id = crm_element_value(xml_obj, XML_ATTR_ID); const char *type = crm_element_value(xml_obj, XML_ATTR_TYPE); const char *score = crm_element_value(xml_obj, XML_RULE_ATTR_SCORE); const char *symmetrical = crm_element_value( xml_obj, XML_CONS_ATTR_SYMMETRICAL); cl_str_to_boolean(symmetrical, &symmetrical_bool); if(xml_obj == NULL) { crm_config_err("No constraint object to process."); return FALSE; } else if(id == NULL) { crm_config_err("%s constraint must have an id", crm_element_name(xml_obj)); return FALSE; } id_lh = crm_element_value(xml_obj, XML_CONS_ATTR_TO); id_rh = crm_element_value(xml_obj, XML_CONS_ATTR_FROM); action = crm_element_value(xml_obj, XML_CONS_ATTR_ACTION); action_rh = crm_element_value(xml_obj, XML_CONS_ATTR_TOACTION); if(action == NULL) { action = CRMD_ACTION_START; } if(action_rh == NULL) { action_rh = action; } if(safe_str_neq(type, "before")) { /* normalize the input - swap everything over */ const char *tmp = NULL; type = "before"; tmp = id_rh; id_rh = id_lh; id_lh = tmp; tmp = action_rh; action_rh = action; action = tmp; } if(id_lh == NULL || id_rh == NULL) { crm_config_err("Constraint %s needs two sides lh: %s rh: %s", id, crm_str(id_lh), crm_str(id_rh)); return FALSE; } rsc_lh = pe_find_resource(data_set->resources, id_rh); rsc_rh = pe_find_resource(data_set->resources, id_lh); if(rsc_lh == NULL) { crm_config_err("Constraint %s: no resource found for LHS (%s)", id, id_rh); return FALSE; } else if(rsc_rh == NULL) { crm_config_err("Constraint %s: no resource found for RHS of (%s)", id, id_lh); return FALSE; } if(score == NULL) { score = "INFINITY"; } score_i = char2score(score); cons_weight = pe_order_optional; if(score_i == 0 && rsc_rh->restart_type == pe_restart_restart) { crm_debug_2("Upgrade : recovery - implies right"); cons_weight |= pe_order_implies_right; } if(score_i < 0) { crm_debug_2("Upgrade : implies left"); cons_weight |= pe_order_implies_left; } else if(score_i > 0) { crm_debug_2("Upgrade : implies right"); cons_weight |= pe_order_implies_right; if(safe_str_eq(action, CRMD_ACTION_START) || safe_str_eq(action, CRMD_ACTION_PROMOTE)) { crm_debug_2("Upgrade : runnable"); cons_weight |= pe_order_runnable_left; } } order_id = custom_action_order( rsc_lh, generate_op_key(rsc_lh->id, action, 0), NULL, rsc_rh, generate_op_key(rsc_rh->id, action_rh, 0), NULL, cons_weight, data_set); crm_debug("order-%d (%s): %s_%s %s %s_%s flags=0x%.6x", order_id, id, rsc_lh->id, action, type, rsc_rh->id, action_rh, cons_weight); if(symmetrical_bool == FALSE) { return TRUE; } action = invert_action(action); action_rh = invert_action(action_rh); cons_weight = pe_order_optional; if(score_i == 0 && rsc_rh->restart_type == pe_restart_restart) { crm_debug_2("Upgrade : recovery - implies left"); cons_weight |= pe_order_implies_left; } score_i *= -1; if(score_i < 0) { crm_debug_2("Upgrade : implies left"); cons_weight |= pe_order_implies_left; + if(safe_str_eq(action_rh, CRMD_ACTION_DEMOTE)) { + crm_debug_2("Upgrade : demote"); + cons_weight |= pe_order_demote; + } } else if(score_i > 0) { crm_debug_2("Upgrade : implies right"); cons_weight |= pe_order_implies_right; if(safe_str_eq(action, CRMD_ACTION_START) || safe_str_eq(action, CRMD_ACTION_PROMOTE)) { crm_debug_2("Upgrade : runnable"); cons_weight |= pe_order_runnable_left; } } if(action == NULL || action_rh == NULL) { crm_config_err("Cannot invert rsc_order constraint %s." " Please specify the inverse manually.", id); return TRUE; } order_id = custom_action_order( rsc_rh, generate_op_key(rsc_rh->id, action_rh, 0), NULL, rsc_lh, generate_op_key(rsc_lh->id, action, 0), NULL, cons_weight, data_set); crm_debug("order-%d (%s): %s_%s %s %s_%s flags=0x%.6x", order_id, id, rsc_rh->id, action_rh, type, rsc_lh->id, action, cons_weight); return TRUE; } gboolean unpack_rsc_location(crm_data_t * xml_obj, pe_working_set_t *data_set) { gboolean empty = TRUE; const char *id_lh = crm_element_value(xml_obj, "rsc"); const char *id = crm_element_value(xml_obj, XML_ATTR_ID); resource_t *rsc_lh = pe_find_resource(data_set->resources, id_lh); if(rsc_lh == NULL) { /* only a warn as BSC adds the constraint then the resource */ crm_config_warn("No resource (con=%s, rsc=%s)", id, id_lh); return FALSE; } else if(rsc_lh->is_managed == FALSE) { crm_debug_2("Ignoring constraint %s: resource %s not managed", id, id_lh); return FALSE; } xml_child_iter_filter( xml_obj, rule_xml, XML_TAG_RULE, empty = FALSE; crm_debug_2("Unpacking %s/%s", id, ID(rule_xml)); generate_location_rule(rsc_lh, rule_xml, data_set); ); if(empty) { crm_config_err("Invalid location constraint %s:" " rsc_location must contain at least one rule", ID(xml_obj)); } return TRUE; } static int get_node_score(const char *rule, const char *score, gboolean raw, node_t *node) { int score_f = 0; if(score == NULL) { pe_err("Rule %s: no score specified. Assuming 0.", rule); } else if(raw) { score_f = char2score(score); } else { const char *attr_score = g_hash_table_lookup( node->details->attrs, score); if(attr_score == NULL) { crm_debug("Rule %s: node %s did not have a value for %s", rule, node->details->uname, score); score_f = -INFINITY; } else { crm_debug("Rule %s: node %s had value %s for %s", rule, node->details->uname, attr_score, score); score_f = char2score(attr_score); } } return score_f; } rsc_to_node_t * generate_location_rule( resource_t *rsc, crm_data_t *rule_xml, pe_working_set_t *data_set) { const char *rule_id = NULL; const char *score = NULL; const char *boolean = NULL; const char *role = NULL; GListPtr match_L = NULL; int score_f = 0; gboolean do_and = TRUE; gboolean accept = TRUE; gboolean raw_score = TRUE; rsc_to_node_t *location_rule = NULL; rule_id = crm_element_value(rule_xml, XML_ATTR_ID); boolean = crm_element_value(rule_xml, XML_RULE_ATTR_BOOLEAN_OP); role = crm_element_value(rule_xml, XML_RULE_ATTR_ROLE); crm_debug_2("Processing rule: %s", rule_id); if(role != NULL && text2role(role) == RSC_ROLE_UNKNOWN) { pe_err("Bad role specified for %s: %s", rule_id, role); return NULL; } score = crm_element_value(rule_xml, XML_RULE_ATTR_SCORE); if(score != NULL) { score_f = char2score(score); } else { score = crm_element_value( rule_xml, XML_RULE_ATTR_SCORE_ATTRIBUTE); if(score == NULL) { score = crm_element_value( rule_xml, XML_RULE_ATTR_SCORE_MANGLED); } if(score != NULL) { raw_score = FALSE; } } if(safe_str_eq(boolean, "or")) { do_and = FALSE; } location_rule = rsc2node_new(rule_id, rsc, 0, NULL, data_set); if(location_rule == NULL) { return NULL; } if(role != NULL) { crm_debug_2("Setting role filter: %s", role); location_rule->role_filter = text2role(role); } if(do_and) { match_L = node_list_dup(data_set->nodes, TRUE, FALSE); slist_iter( node, node_t, match_L, lpc, node->weight = get_node_score(rule_id, score, raw_score, node); ); } xml_child_iter( rule_xml, expr, enum expression_type type = find_expression_type(expr); crm_debug_2("Processing expression: %s", ID(expr)); if(type == not_expr) { pe_err("Expression <%s id=%s...> is not valid", crm_element_name(expr), crm_str(ID(expr))); continue; } slist_iter( node, node_t, data_set->nodes, lpc, if(type == nested_rule) { accept = test_rule( expr, node->details->attrs, RSC_ROLE_UNKNOWN, data_set->now); } else { accept = test_expression( expr, node->details->attrs, RSC_ROLE_UNKNOWN, data_set->now); } score_f = get_node_score(rule_id, score, raw_score, node); /* if(accept && score_f == -INFINITY) { */ /* accept = FALSE; */ /* } */ if(accept) { node_t *local = pe_find_node_id( match_L, node->details->id); if(local == NULL && do_and) { continue; } else if(local == NULL) { local = node_copy(node); match_L = g_list_append(match_L, local); } if(do_and == FALSE) { local->weight = merge_weights( local->weight, score_f); } crm_debug_2("node %s now has weight %d", node->details->uname, local->weight); } else if(do_and && !accept) { /* remove it */ node_t *delete = pe_find_node_id( match_L, node->details->id); if(delete != NULL) { match_L = g_list_remove(match_L,delete); crm_debug_5("node %s did not match", node->details->uname); } crm_free(delete); } ); ); location_rule->node_list_rh = match_L; if(location_rule->node_list_rh == NULL) { crm_debug_2("No matching nodes for rule %s", rule_id); return NULL; } crm_debug_3("%s: %d nodes matched", rule_id, g_list_length(location_rule->node_list_rh)); return location_rule; } static gint sort_cons_priority_lh(gconstpointer a, gconstpointer b) { const rsc_colocation_t *rsc_constraint1 = (const rsc_colocation_t*)a; const rsc_colocation_t *rsc_constraint2 = (const rsc_colocation_t*)b; if(a == NULL) { return 1; } if(b == NULL) { return -1; } CRM_ASSERT(rsc_constraint1->rsc_lh != NULL); CRM_ASSERT(rsc_constraint1->rsc_rh != NULL); if(rsc_constraint1->rsc_lh->priority > rsc_constraint2->rsc_lh->priority) { return -1; } if(rsc_constraint1->rsc_lh->priority < rsc_constraint2->rsc_lh->priority) { return 1; } return strcmp(rsc_constraint1->rsc_lh->id, rsc_constraint2->rsc_lh->id); } static gint sort_cons_priority_rh(gconstpointer a, gconstpointer b) { const rsc_colocation_t *rsc_constraint1 = (const rsc_colocation_t*)a; const rsc_colocation_t *rsc_constraint2 = (const rsc_colocation_t*)b; if(a == NULL) { return 1; } if(b == NULL) { return -1; } CRM_ASSERT(rsc_constraint1->rsc_lh != NULL); CRM_ASSERT(rsc_constraint1->rsc_rh != NULL); if(rsc_constraint1->rsc_rh->priority > rsc_constraint2->rsc_rh->priority) { return -1; } if(rsc_constraint1->rsc_rh->priority < rsc_constraint2->rsc_rh->priority) { return 1; } return strcmp(rsc_constraint1->rsc_rh->id, rsc_constraint2->rsc_rh->id); } gboolean rsc_colocation_new(const char *id, const char *node_attr, int score, resource_t *rsc_lh, resource_t *rsc_rh, - const char *state_lh, const char *state_rh) + const char *state_lh, const char *state_rh, + pe_working_set_t *data_set) { rsc_colocation_t *new_con = NULL; if(rsc_lh == NULL){ crm_config_err("No resource found for LHS %s", id); return FALSE; } else if(rsc_rh == NULL){ crm_config_err("No resource found for RHS of %s", id); return FALSE; } crm_malloc0(new_con, sizeof(rsc_colocation_t)); if(new_con == NULL) { return FALSE; } if(state_lh == NULL || safe_str_eq(state_lh, RSC_ROLE_STARTED_S)) { state_lh = RSC_ROLE_UNKNOWN_S; } if(state_rh == NULL || safe_str_eq(state_rh, RSC_ROLE_STARTED_S)) { state_rh = RSC_ROLE_UNKNOWN_S; } new_con->id = id; new_con->rsc_lh = rsc_lh; new_con->rsc_rh = rsc_rh; new_con->score = score; new_con->role_lh = text2role(state_lh); new_con->role_rh = text2role(state_rh); new_con->node_attribute = node_attr; crm_debug_4("Adding constraint %s (%p) to %s", new_con->id, new_con, rsc_lh->id); rsc_lh->rsc_cons = g_list_insert_sorted( rsc_lh->rsc_cons, new_con, sort_cons_priority_rh); rsc_rh->rsc_cons_lhs = g_list_insert_sorted( rsc_rh->rsc_cons_lhs, new_con, sort_cons_priority_lh); + + data_set->colocation_constraints = g_list_append( + data_set->colocation_constraints, new_con); return TRUE; } /* LHS before RHS */ int custom_action_order( resource_t *lh_rsc, char *lh_action_task, action_t *lh_action, resource_t *rh_rsc, char *rh_action_task, action_t *rh_action, enum pe_ordering type, pe_working_set_t *data_set) { order_constraint_t *order = NULL; if(lh_rsc == NULL && lh_action) { lh_rsc = lh_action->rsc; } if(rh_rsc == NULL && rh_action) { rh_rsc = rh_action->rsc; } if((lh_action == NULL && lh_rsc == NULL) || (rh_action == NULL && rh_rsc == NULL)){ crm_config_err("Invalid inputs %p.%p %p.%p", lh_rsc, lh_action, rh_rsc, rh_action); crm_free(lh_action_task); crm_free(rh_action_task); return -1; } crm_malloc0(order, sizeof(order_constraint_t)); crm_debug_3("Creating ordering constraint %d", data_set->order_id); order->id = data_set->order_id++; order->type = type; order->lh_rsc = lh_rsc; order->rh_rsc = rh_rsc; order->lh_action = lh_action; order->rh_action = rh_action; order->lh_action_task = lh_action_task; order->rh_action_task = rh_action_task; data_set->ordering_constraints = g_list_append( data_set->ordering_constraints, order); if(lh_rsc != NULL && rh_rsc != NULL) { crm_debug_4("Created ordering constraint %d (%s):" " %s/%s before %s/%s", order->id, ordering_type2text(order->type), lh_rsc->id, lh_action_task, rh_rsc->id, rh_action_task); } else if(lh_rsc != NULL) { crm_debug_4("Created ordering constraint %d (%s):" " %s/%s before action %d (%s)", order->id, ordering_type2text(order->type), lh_rsc->id, lh_action_task, rh_action->id, rh_action_task); } else if(rh_rsc != NULL) { crm_debug_4("Created ordering constraint %d (%s):" " action %d (%s) before %s/%s", order->id, ordering_type2text(order->type), lh_action->id, lh_action_task, rh_rsc->id, rh_action_task); } else { crm_debug_4("Created ordering constraint %d (%s):" " action %d (%s) before action %d (%s)", order->id, ordering_type2text(order->type), lh_action->id, lh_action_task, rh_action->id, rh_action_task); } return order->id; } gboolean unpack_rsc_colocation(crm_data_t * xml_obj, pe_working_set_t *data_set) { int score_i = 0; const char *id = crm_element_value(xml_obj, XML_ATTR_ID); const char *id_rh = crm_element_value(xml_obj, XML_CONS_ATTR_TO); const char *id_lh = crm_element_value(xml_obj, XML_CONS_ATTR_FROM); const char *score = crm_element_value(xml_obj, XML_RULE_ATTR_SCORE); const char *state_lh = crm_element_value(xml_obj, XML_RULE_ATTR_FROMSTATE); const char *state_rh = crm_element_value(xml_obj, XML_RULE_ATTR_TOSTATE); const char *attr = crm_element_value(xml_obj, "node_attribute"); const char *symmetrical = crm_element_value(xml_obj, XML_CONS_ATTR_SYMMETRICAL); resource_t *rsc_lh = pe_find_resource(data_set->resources, id_lh); resource_t *rsc_rh = pe_find_resource(data_set->resources, id_rh); if(rsc_lh == NULL) { crm_config_err("No resource (con=%s, rsc=%s)", id, id_lh); return FALSE; } else if(rsc_rh == NULL) { crm_config_err("No resource (con=%s, rsc=%s)", id, id_rh); return FALSE; } if(score) { score_i = char2score(score); } rsc_colocation_new( - id, attr, score_i, rsc_lh, rsc_rh, state_lh, state_rh); + id, attr, score_i, rsc_lh, rsc_rh, state_lh, state_rh, data_set); if(crm_is_true(symmetrical)) { rsc_colocation_new( - id, attr, score_i, rsc_rh, rsc_lh, state_rh, state_lh); + id, attr, score_i, rsc_rh, rsc_lh, state_rh, state_lh, data_set); } return TRUE; } gboolean is_active(rsc_to_node_t *cons) { return TRUE; } diff --git a/crm/pengine/clone.c b/crm/pengine/clone.c index 81a863d200..7820d478e1 100644 --- a/crm/pengine/clone.c +++ b/crm/pengine/clone.c @@ -1,1256 +1,1270 @@ /* * 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.1 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #define VARIANT_CLONE 1 #include gint sort_clone_instance(gconstpointer a, gconstpointer b); void clone_create_notifications( resource_t *rsc, action_t *action, action_t *action_complete, pe_working_set_t *data_set); void child_stopping_constraints( clone_variant_data_t *clone_data, resource_t *self, resource_t *child, resource_t *last, pe_working_set_t *data_set); void child_starting_constraints( clone_variant_data_t *clone_data, resource_t *self, resource_t *child, resource_t *last, pe_working_set_t *data_set); static node_t * parent_node_instance(const resource_t *rsc, node_t *node) { node_t *ret = NULL; if(node != NULL) { ret = pe_find_node_id( rsc->parent->allowed_nodes, node->details->id); } return ret; } gint sort_clone_instance(gconstpointer a, gconstpointer b) { int level = LOG_DEBUG_3; node_t *node1 = NULL; node_t *node2 = NULL; gboolean can1 = TRUE; gboolean can2 = TRUE; const resource_t *resource1 = (const resource_t*)a; const resource_t *resource2 = (const resource_t*)b; CRM_ASSERT(resource1 != NULL); CRM_ASSERT(resource2 != NULL); /* allocation order: * - active instances * - instances running on nodes with the least copies * - active instances on nodes that cant support them or are to be fenced * - failed instances * - inactive instances */ do_crm_log(level+1, "%s ? %s", resource1->id, resource2->id); if(resource1->running_on && resource2->running_on) { if(g_list_length(resource1->running_on) < g_list_length(resource2->running_on)) { do_crm_log(level, "%s < %s: running_on", resource1->id, resource2->id); return -1; } else if(g_list_length(resource1->running_on) > g_list_length(resource2->running_on)) { do_crm_log(level, "%s > %s: running_on", resource1->id, resource2->id); return 1; } } if(resource1->running_on) { node1 = resource1->running_on->data; } if(resource2->running_on) { node2 = resource2->running_on->data; } if(resource1->priority < resource2->priority) { do_crm_log(level, "%s < %s: score", resource1->id, resource2->id); return 1; } else if(resource1->priority > resource2->priority) { do_crm_log(level, "%s > %s: score", resource1->id, resource2->id); return -1; } if(node1 == NULL && node2 == NULL) { do_crm_log(level, "%s == %s: not active", resource1->id, resource2->id); return 0; } if(node1 != node2) { if(node1 == NULL) { do_crm_log(level, "%s > %s: active", resource1->id, resource2->id); return 1; } else if(node2 == NULL) { do_crm_log(level, "%s < %s: active", resource1->id, resource2->id); return -1; } } can1 = can_run_resources(node1); can2 = can_run_resources(node2); if(can1 != can2) { if(can1) { do_crm_log(level, "%s < %s: can", resource1->id, resource2->id); return -1; } do_crm_log(level, "%s > %s: can", resource1->id, resource2->id); return 1; } node1 = parent_node_instance(resource1, node1); node2 = parent_node_instance(resource2, node2); if(node1 != NULL && node2 == NULL) { do_crm_log(level, "%s < %s: not allowed", resource1->id, resource2->id); return -1; } else if(node1 == NULL && node2 != NULL) { do_crm_log(level, "%s > %s: not allowed", resource1->id, resource2->id); return 1; } if(node1 == NULL) { do_crm_log(level, "%s == %s: not allowed", resource1->id, resource2->id); return 0; } if(node1->count < node2->count) { do_crm_log(level, "%s < %s: count", resource1->id, resource2->id); return -1; } else if(node1->count > node2->count) { do_crm_log(level, "%s > %s: count", resource1->id, resource2->id); return 1; } if(node1->weight < node2->weight) { do_crm_log(level, "%s < %s: node score", resource1->id, resource2->id); return 1; } else if(node1->weight > node2->weight) { do_crm_log(level, "%s > %s: node score", resource1->id, resource2->id); return -1; } - do_crm_log(level, "%s == %s: default", resource1->id, resource2->id); + do_crm_log(level, "%s == %s: default %d", resource1->id, resource2->id, node2->weight); return 0; } static node_t * can_run_instance(resource_t *rsc, node_t *node) { node_t *local_node = NULL; clone_variant_data_t *clone_data = NULL; if(can_run_resources(node) == FALSE) { goto bail; } local_node = parent_node_instance(rsc, node); get_clone_variant_data(clone_data, rsc->parent); if(local_node == NULL) { crm_warn("%s cannot run on %s: node not allowed", rsc->id, node->details->uname); goto bail; } else if(local_node->count < clone_data->clone_node_max) { return local_node; } else { crm_debug_2("%s cannot run on %s: node full", rsc->id, node->details->uname); } bail: if(node) { common_update_score(rsc, node->details->id, -INFINITY); } return NULL; } static node_t * color_instance(resource_t *rsc, pe_working_set_t *data_set) { node_t *local_node = NULL; node_t *chosen = NULL; crm_debug_2("Processing %s", rsc->id); if(rsc->provisional == FALSE) { return rsc->allocated_to; } else if(rsc->is_allocating) { crm_debug("Dependancy loop detected involving %s", rsc->id); return NULL; } if(rsc->allowed_nodes) { slist_iter(try_node, node_t, rsc->allowed_nodes, lpc, can_run_instance(rsc, try_node); ); } chosen = rsc->cmds->color(rsc, data_set); if(chosen) { local_node = pe_find_node_id( rsc->parent->allowed_nodes, chosen->details->id); if(local_node == NULL) { crm_err("%s not found in %s (list=%d)", chosen->details->id, rsc->parent->id, g_list_length(rsc->parent->allowed_nodes)); exit(1); } CRM_ASSERT(local_node); local_node->count++; } return chosen; } +static void append_parent_colocation(resource_t *rsc, resource_t *child) +{ + slist_iter(cons, rsc_colocation_t, rsc->rsc_cons, lpc, + child->rsc_cons = g_list_append(child->rsc_cons, cons)); + slist_iter(cons, rsc_colocation_t, rsc->rsc_cons_lhs, lpc, + child->rsc_cons_lhs = g_list_append(child->rsc_cons_lhs, cons)); +} node_t * clone_color(resource_t *rsc, pe_working_set_t *data_set) { int allocated = 0; - resource_t *first_child = NULL; clone_variant_data_t *clone_data = NULL; get_clone_variant_data(clone_data, rsc); if(rsc->provisional == FALSE) { return NULL; } else if(rsc->is_allocating) { crm_debug("Dependancy loop detected involving %s", rsc->id); return NULL; } rsc->is_allocating = TRUE; crm_debug_2("Processing %s", rsc->id); + + /* this information is used by sort_clone_instance() when deciding in which + * order to allocate clone instances + */ + slist_iter( + constraint, rsc_colocation_t, rsc->rsc_cons_lhs, lpc, + + rsc->allowed_nodes = constraint->rsc_lh->cmds->merge_weights( + constraint->rsc_lh, rsc->id, rsc->allowed_nodes, + constraint->score/INFINITY, TRUE); + ); + + dump_node_scores(LOG_DEBUG_2, rsc, __FUNCTION__, rsc->allowed_nodes); /* count now tracks the number of clones currently allocated */ slist_iter(node, node_t, rsc->allowed_nodes, lpc, node->count = 0; ); slist_iter(child, resource_t, rsc->children, lpc, if(g_list_length(child->running_on) > 0) { node_t *child_node = child->running_on->data; node_t *local_node = parent_node_instance( child, child->running_on->data); if(local_node) { local_node->count++; } else { crm_err("%s is running on %s which isn't allowed", child->id, child_node->details->uname); } } ); rsc->children = g_list_sort(rsc->children, sort_clone_instance); /* count now tracks the number of clones we have allocated */ slist_iter(node, node_t, rsc->allowed_nodes, lpc, node->count = 0; ); - - first_child = rsc->children->data; - first_child->rsc_cons = g_list_concat( - first_child->rsc_cons, rsc->rsc_cons); - rsc->rsc_cons = NULL; - rsc->allowed_nodes = g_list_sort( rsc->allowed_nodes, sort_node_weight); slist_iter(child, resource_t, rsc->children, lpc, if(allocated >= clone_data->clone_max) { crm_debug("Child %s not allocated - limit reached", child->id); resource_location(child, NULL, -INFINITY, "clone_color:limit_reached", data_set); + } else { + append_parent_colocation(rsc, child); } + if(color_instance(child, data_set)) { allocated++; } ); crm_debug("Allocated %d %s instances of a possible %d", allocated, rsc->id, clone_data->clone_max); rsc->provisional = FALSE; rsc->is_allocating = FALSE; return NULL; } static void clone_update_pseudo_status( resource_t *child, gboolean *stopping, gboolean *starting) { CRM_ASSERT(stopping != NULL); CRM_ASSERT(starting != NULL); slist_iter( action, action_t, child->actions, lpc, if(*starting && *stopping) { return; } else if(action->optional) { crm_debug_3("Skipping optional: %s", action->uuid); continue; } else if(action->pseudo == FALSE && action->runnable == FALSE){ crm_debug_3("Skipping unrunnable: %s", action->uuid); continue; } else if(safe_str_eq(CRMD_ACTION_STOP, action->task)) { crm_debug_2("Stopping due to: %s", action->uuid); *stopping = TRUE; } else if(safe_str_eq(CRMD_ACTION_START, action->task)) { if(action->runnable == FALSE) { crm_debug_3("Skipping pseudo-op: %s run=%d, pseudo=%d", action->uuid, action->runnable, action->pseudo); } else { crm_debug_2("Starting due to: %s", action->uuid); crm_debug_3("%s run=%d, pseudo=%d", action->uuid, action->runnable, action->pseudo); *starting = TRUE; } } ); } void clone_create_actions(resource_t *rsc, pe_working_set_t *data_set) { gboolean child_starting = FALSE; gboolean child_stopping = FALSE; action_t *stop = NULL; action_t *start = NULL; action_t *action_complete = NULL; resource_t *last_start_rsc = NULL; resource_t *last_stop_rsc = NULL; clone_variant_data_t *clone_data = NULL; get_clone_variant_data(clone_data, rsc); crm_debug_2("Creating actions for %s", rsc->id); slist_iter( child_rsc, resource_t, rsc->children, lpc, child_rsc->cmds->create_actions(child_rsc, data_set); clone_update_pseudo_status( child_rsc, &child_stopping, &child_starting); if(child_rsc->starting) { last_start_rsc = child_rsc; } if(child_rsc->stopping) { last_stop_rsc = child_rsc; } ); /* start */ start = start_action(rsc, NULL, !child_starting); action_complete = custom_action( rsc, started_key(rsc), CRMD_ACTION_STARTED, NULL, !child_starting, TRUE, data_set); start->pseudo = TRUE; start->runnable = TRUE; action_complete->pseudo = TRUE; action_complete->runnable = TRUE; action_complete->priority = INFINITY; /* crm_err("Upgrading priority for %s to INFINITY", action_complete->uuid); */ child_starting_constraints(clone_data, rsc, NULL, last_start_rsc, data_set); clone_create_notifications( rsc, start, action_complete, data_set); /* stop */ stop = stop_action(rsc, NULL, !child_stopping); action_complete = custom_action( rsc, stopped_key(rsc), CRMD_ACTION_STOPPED, NULL, !child_stopping, TRUE, data_set); stop->pseudo = TRUE; stop->runnable = TRUE; action_complete->pseudo = TRUE; action_complete->runnable = TRUE; action_complete->priority = INFINITY; /* crm_err("Upgrading priority for %s to INFINITY", action_complete->uuid); */ child_stopping_constraints(clone_data, rsc, NULL, last_stop_rsc, data_set); clone_create_notifications(rsc, stop, action_complete, data_set); rsc->actions = rsc->actions; if(stop->post_notified != NULL && start->pre_notify != NULL) { order_actions(stop->post_notified, start->pre_notify, pe_order_optional); } } void clone_create_notifications( resource_t *rsc, action_t *action, action_t *action_complete, pe_working_set_t *data_set) { /* * pre_notify -> pre_notify_complete -> pseudo_action * -> (real actions) -> pseudo_action_complete * -> post_notify -> post_notify_complete * * if the pre_noitfy requires confirmation, * then a list of confirmations will be added as triggers * to pseudo_action in clone_expand() */ action_t *notify = NULL; action_t *notify_complete = NULL; enum action_tasks task; char *notify_key = NULL; clone_variant_data_t *clone_data = NULL; get_clone_variant_data(clone_data, rsc); if(rsc->notify == FALSE) { return; } task = text2task(action->task); /* create pre_notify */ notify_key = generate_notify_key( rsc->id, "pre", action->task); notify = custom_action(rsc, notify_key, CRMD_ACTION_NOTIFY, NULL, action->optional, TRUE, data_set); add_hash_param(notify->meta, "notify_type", "pre"); add_hash_param(notify->meta, "notify_operation", action->task); if(clone_data->notify_confirm) { add_hash_param(notify->meta, "notify_confirm", "yes"); } else { add_hash_param(notify->meta, "notify_confirm", "no"); } /* create pre_notify_complete */ notify_key = generate_notify_key( rsc->id, "confirmed-pre", action->task); notify_complete = custom_action(rsc, notify_key, CRMD_ACTION_NOTIFIED, NULL, action->optional, TRUE, data_set); add_hash_param(notify_complete->meta, "notify_type", "pre"); add_hash_param(notify_complete->meta, "notify_operation", action->task); if(clone_data->notify_confirm) { add_hash_param(notify->meta, "notify_confirm", "yes"); } else { add_hash_param(notify->meta, "notify_confirm", "no"); } notify->pseudo = TRUE; notify->runnable = TRUE; notify_complete->pseudo = TRUE; notify_complete->runnable = TRUE; /* pre_notify before pre_notify_complete */ custom_action_order( rsc, NULL, notify, rsc, NULL, notify_complete, pe_order_implies_left, data_set); /* pre_notify_complete before action */ custom_action_order( rsc, NULL, notify_complete, rsc, NULL, action, pe_order_implies_left, data_set); action->pre_notify = notify; action->pre_notified = notify_complete; /* create post_notify */ notify_key = generate_notify_key (rsc->id, "post", action->task); notify = custom_action(rsc, notify_key, CRMD_ACTION_NOTIFY, NULL, action_complete->optional, TRUE, data_set); add_hash_param(notify->meta, "notify_type", "post"); add_hash_param(notify->meta, "notify_operation", action->task); if(clone_data->notify_confirm) { add_hash_param(notify->meta, "notify_confirm", "yes"); } else { add_hash_param(notify->meta, "notify_confirm", "no"); } /* action_complete before post_notify */ custom_action_order( rsc, NULL, action_complete, rsc, NULL, notify, pe_order_implies_right, data_set); /* create post_notify_complete */ notify_key = generate_notify_key( rsc->id, "confirmed-post", action->task); notify_complete = custom_action(rsc, notify_key, CRMD_ACTION_NOTIFIED, NULL, action->optional, TRUE, data_set); add_hash_param(notify_complete->meta, "notify_type", "pre"); add_hash_param(notify_complete->meta, "notify_operation", action->task); if(clone_data->notify_confirm) { add_hash_param(notify->meta, "notify_confirm", "yes"); } else { add_hash_param(notify->meta, "notify_confirm", "no"); } notify->pseudo = TRUE; notify->runnable = TRUE; notify->priority = INFINITY; notify->runnable = action_complete->runnable; notify_complete->pseudo = TRUE; notify_complete->runnable = TRUE; notify_complete->priority = INFINITY; notify_complete->runnable = action_complete->runnable; /* post_notify before post_notify_complete */ custom_action_order( rsc, NULL, notify, rsc, NULL, notify_complete, pe_order_implies_left, data_set); action->post_notify = notify; action->post_notified = notify_complete; if(safe_str_eq(action->task, CRMD_ACTION_STOP)) { /* post_notify_complete before start */ custom_action_order( rsc, NULL, notify_complete, rsc, start_key(rsc), NULL, pe_order_optional, data_set); } else if(safe_str_eq(action->task, CRMD_ACTION_START)) { /* post_notify_complete before promote */ custom_action_order( rsc, NULL, notify_complete, rsc, promote_key(rsc), NULL, pe_order_optional, data_set); } else if(safe_str_eq(action->task, CRMD_ACTION_DEMOTE)) { /* post_notify_complete before promote */ custom_action_order( rsc, NULL, notify_complete, rsc, stop_key(rsc), NULL, pe_order_optional, data_set); } } void child_starting_constraints( clone_variant_data_t *clone_data, resource_t *rsc, resource_t *child, resource_t *last, pe_working_set_t *data_set) { if(child == NULL && last == NULL) { crm_debug("%s has no active children", rsc->id); return; } if(child != NULL) { order_start_start(rsc, child, pe_order_runnable_left); custom_action_order( child, start_key(child), NULL, rsc, started_key(rsc), NULL, pe_order_optional, data_set); } if(clone_data->ordered) { if(child == NULL) { /* last child start before global started */ custom_action_order( last, start_key(last), NULL, rsc, started_key(rsc), NULL, pe_order_runnable_left, data_set); } else if(last == NULL) { /* global start before first child start */ order_start_start( rsc, child, pe_order_implies_left); } else { /* child/child relative start */ order_start_start(last, child, pe_order_implies_left); } } } void child_stopping_constraints( clone_variant_data_t *clone_data, resource_t *rsc, resource_t *child, resource_t *last, pe_working_set_t *data_set) { if(child == NULL && last == NULL) { crm_debug("%s has no active children", rsc->id); return; } if(child != NULL) { order_stop_stop(rsc, child, pe_order_optional); custom_action_order( child, stop_key(child), NULL, rsc, stopped_key(rsc), NULL, pe_order_optional, data_set); } if(clone_data->ordered) { if(last == NULL) { /* first child stop before global stopped */ custom_action_order( child, stop_key(child), NULL, rsc, stopped_key(rsc), NULL, pe_order_runnable_left, data_set); } else if(child == NULL) { /* global stop before last child stop */ order_stop_stop( rsc, last, pe_order_implies_left); } else { /* child/child relative stop */ order_stop_stop(child, last, pe_order_implies_left); } } } void clone_internal_constraints(resource_t *rsc, pe_working_set_t *data_set) { resource_t *last_rsc = NULL; clone_variant_data_t *clone_data = NULL; get_clone_variant_data(clone_data, rsc); native_internal_constraints(rsc, data_set); /* global stop before stopped */ custom_action_order( rsc, stop_key(rsc), NULL, rsc, stopped_key(rsc), NULL, pe_order_runnable_left, data_set); /* global start before started */ custom_action_order( rsc, start_key(rsc), NULL, rsc, started_key(rsc), NULL, pe_order_runnable_left, data_set); /* global stopped before start */ custom_action_order( rsc, stopped_key(rsc), NULL, rsc, start_key(rsc), NULL, pe_order_optional, data_set); slist_iter( child_rsc, resource_t, rsc->children, lpc, child_rsc->cmds->internal_constraints(child_rsc, data_set); child_starting_constraints( clone_data, rsc, child_rsc, last_rsc, data_set); child_stopping_constraints( clone_data, rsc, child_rsc, last_rsc, data_set); last_rsc = child_rsc; ); } static resource_t* find_compatible_child(resource_t *local_child, resource_t *rsc) { node_t *local_node = NULL; node_t *node = NULL; clone_variant_data_t *clone_data = NULL; get_clone_variant_data(clone_data, rsc); local_node = local_child->allocated_to; if(local_node == NULL) { crm_debug("Can't colocate unrunnable child %s with %s", local_child->id, rsc->id); return NULL; } slist_iter( child_rsc, resource_t, rsc->children, lpc, node = child_rsc->allocated_to; if(node->details == local_node->details) { crm_info("Colocating %s with %s on %s", local_child->id, child_rsc->id, node->details->uname); return child_rsc; } ); crm_debug("Can't colocate child %s with %s", local_child->id, rsc->id); return NULL; } void clone_rsc_colocation_lh( resource_t *rsc_lh, resource_t *rsc_rh, rsc_colocation_t *constraint) { gboolean do_interleave = FALSE; resource_t *rsc = constraint->rsc_lh; clone_variant_data_t *clone_data = NULL; clone_variant_data_t *clone_data_rh = NULL; if(rsc == NULL) { pe_err("rsc_lh was NULL for %s", constraint->id); return; } else if(constraint->rsc_rh == NULL) { pe_err("rsc_rh was NULL for %s", constraint->id); return; } else { crm_debug_4("Processing constraints from %s", rsc->id); } get_clone_variant_data(clone_data, rsc); if(constraint->rsc_rh->variant == pe_clone) { get_clone_variant_data( clone_data_rh, constraint->rsc_rh); if(clone_data->clone_node_max != clone_data_rh->clone_node_max) { crm_config_err("Cannot interleave "XML_CIB_TAG_INCARNATION " %s and %s because" " they do not support the same number of" " resources per node", constraint->rsc_lh->id, constraint->rsc_rh->id); /* only the LHS side needs to be labeled as interleave */ } else if(clone_data->interleave) { do_interleave = TRUE; } else if(constraint->score >= INFINITY) { GListPtr lhs = NULL, rhs = NULL; lhs = rsc_lh->allowed_nodes; slist_iter( child_rsc, resource_t, rsc_rh->children, lpc, if(child_rsc->allocated_to != NULL) { rhs = g_list_append(rhs, child_rsc->allocated_to); } ); rsc_lh->allowed_nodes = node_list_and(lhs, rhs, FALSE); pe_free_shallow_adv(rhs, FALSE); pe_free_shallow(lhs); return; } } else if(constraint->score >= INFINITY) { crm_config_err("Manditory co-location of clones (%s) with other" " non-clone (%s) resources is not supported", rsc_lh->id, rsc_rh->id); return; } if(do_interleave) { resource_t *rh_child = NULL; slist_iter(lh_child, resource_t, rsc->children, lpc, CRM_ASSERT(lh_child != NULL); rh_child = find_compatible_child(lh_child, rsc_rh); if(rh_child == NULL) { continue; } lh_child->cmds->rsc_colocation_lh( lh_child, rh_child, constraint); ); return; } slist_iter( child_rsc, resource_t, rsc->children, lpc, child_rsc->cmds->rsc_colocation_lh(child_rsc, constraint->rsc_rh, constraint); ); } - - void clone_rsc_colocation_rh( resource_t *rsc_lh, resource_t *rsc_rh, rsc_colocation_t *constraint) { clone_variant_data_t *clone_data = NULL; CRM_CHECK(rsc_lh != NULL, return); CRM_CHECK(rsc_lh->variant == pe_native, return); get_clone_variant_data(clone_data, rsc_rh); crm_debug_3("Processing constraint %s: %d", constraint->id, constraint->score); if(rsc_rh == NULL) { pe_err("rsc_rh was NULL for %s", constraint->id); return; } else if(rsc_rh->provisional) { crm_debug_3("%s is still provisional", rsc_rh->id); return; } else if(constraint->score >= INFINITY) { GListPtr lhs = NULL, rhs = NULL; lhs = rsc_lh->allowed_nodes; slist_iter( child_rsc, resource_t, rsc_rh->children, lpc, if(child_rsc->allocated_to != NULL) { rhs = g_list_append(rhs, child_rsc->allocated_to); } ); rsc_lh->allowed_nodes = node_list_and(lhs, rhs, FALSE); pe_free_shallow_adv(rhs, FALSE); pe_free_shallow(lhs); return; } slist_iter( child_rsc, resource_t, rsc_rh->children, lpc, child_rsc->cmds->rsc_colocation_rh(rsc_lh, child_rsc, constraint); ); } void clone_rsc_order_lh(resource_t *rsc, order_constraint_t *order, pe_working_set_t *data_set) { resource_t *r1 = NULL; resource_t *r2 = NULL; clone_variant_data_t *clone_data = NULL; get_clone_variant_data(clone_data, rsc); crm_debug_2("%s->%s", order->lh_action_task, order->rh_action_task); r1 = uber_parent(rsc); r2 = uber_parent(order->rh_rsc); if(r1 == r2) { native_rsc_order_lh(rsc, order, data_set); return; } #if 0 if(order->type != pe_order_optional) { crm_debug("Upgraded ordering constraint %d - 0x%.6x", order->id, order->type); native_rsc_order_lh(rsc, order, data_set); } #endif if(order->type & pe_order_implies_left) { if(rsc->variant == order->rh_rsc->variant) { crm_debug_2("Clone-to-clone ordering: %s -> %s 0x%.6x", order->lh_action_task, order->rh_action_task, order->type); /* stop instances on the same nodes as stopping RHS instances */ slist_iter( child_rsc, resource_t, rsc->children, lpc, native_rsc_order_lh(child_rsc, order, data_set); ); } else { /* stop everything */ crm_debug_2("Clone-to-* ordering: %s -> %s 0x%.6x", order->lh_action_task, order->rh_action_task, order->type); slist_iter( child_rsc, resource_t, rsc->children, lpc, native_rsc_order_lh(child_rsc, order, data_set); ); } } convert_non_atomic_task(rsc, order); native_rsc_order_lh(rsc, order, data_set); } void clone_rsc_order_rh( action_t *lh_action, resource_t *rsc, order_constraint_t *order) { clone_variant_data_t *clone_data = NULL; get_clone_variant_data(clone_data, rsc); crm_debug_2("%s->%s", lh_action->uuid, order->rh_action_task); native_rsc_order_rh(lh_action, rsc, order); } void clone_rsc_location(resource_t *rsc, rsc_to_node_t *constraint) { clone_variant_data_t *clone_data = NULL; get_clone_variant_data(clone_data, rsc); crm_debug_3("Processing location constraint %s for %s", constraint->id, rsc->id); native_rsc_location(rsc, constraint); slist_iter( child_rsc, resource_t, rsc->children, lpc, child_rsc->cmds->rsc_location(child_rsc, constraint); ); } static gint sort_notify_entries(gconstpointer a, gconstpointer b) { int tmp; const notify_entry_t *entry_a = a; const notify_entry_t *entry_b = b; if(entry_a == NULL && entry_b == NULL) { return 0; } if(entry_a == NULL) { return 1; } if(entry_b == NULL) { return -1; } if(entry_a->rsc == NULL && entry_b->rsc == NULL) { return 0; } if(entry_a->rsc == NULL) { return 1; } if(entry_b->rsc == NULL) { return -1; } tmp = strcmp(entry_a->rsc->id, entry_b->rsc->id); if(tmp != 0) { return tmp; } if(entry_a->node == NULL && entry_b->node == NULL) { return 0; } if(entry_a->node == NULL) { return 1; } if(entry_b->node == NULL) { return -1; } return strcmp(entry_a->node->details->id, entry_b->node->details->id); } static void expand_list(GListPtr list, int clones, char **rsc_list, char **node_list, char **uuid_list) { const char *uname = NULL; const char *rsc_id = NULL; const char *last_rsc_id = NULL; CRM_CHECK(list != NULL, return); if(rsc_list) { CRM_CHECK(*rsc_list == NULL, *rsc_list = NULL); } if(node_list) { CRM_CHECK(*node_list == NULL, *node_list = NULL); } slist_iter(entry, notify_entry_t, list, lpc, CRM_CHECK(entry != NULL, continue); CRM_CHECK(entry->rsc != NULL, continue); CRM_CHECK(entry->node != NULL, continue); rsc_id = entry->rsc->id; uname = entry->node->details->uname; CRM_ASSERT(uname != NULL); CRM_ASSERT(rsc_id != NULL); /* filter dups */ if(safe_str_eq(rsc_id, last_rsc_id)) { continue; } last_rsc_id = rsc_id; if(rsc_list != NULL) { int existing_len = 0; int len = 2 + strlen(rsc_id); /* +1 space, +1 EOS */ if(rsc_list && *rsc_list) { existing_len = strlen(*rsc_list); } crm_debug_5("Adding %s (%dc) at offset %d", rsc_id, len-2, existing_len); crm_realloc(*rsc_list, len + existing_len); sprintf(*rsc_list + existing_len, "%s ", rsc_id); } if(node_list != NULL) { int existing_len = 0; int len = 2 + strlen(uname); if(node_list && *node_list) { existing_len = strlen(*node_list); } crm_debug_5("Adding %s (%dc) at offset %d", uname, len-2, existing_len); crm_realloc(*node_list, len + existing_len); sprintf(*node_list + existing_len, "%s ", uname); } ); } void clone_expand(resource_t *rsc, pe_working_set_t *data_set) { char *rsc_list = NULL; char *node_list = NULL; char *uuid_list = NULL; notify_data_t *n_data = NULL; clone_variant_data_t *clone_data = NULL; get_clone_variant_data(clone_data, rsc); crm_malloc0(n_data, sizeof(notify_data_t)); n_data->keys = g_hash_table_new_full( g_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str); crm_debug_2("Processing actions from %s", rsc->id); if(rsc->notify) { slist_iter( child_rsc, resource_t, rsc->children, lpc, slist_iter( op, action_t, rsc->actions, lpc2, child_rsc->cmds->create_notify_element( child_rsc, op, n_data, data_set); ); ); } /* expand the notify data */ if(rsc->notify && n_data->stop) { n_data->stop = g_list_sort( n_data->stop, sort_notify_entries); rsc_list = NULL; node_list = NULL; expand_list(n_data->stop, clone_data->clone_max, &rsc_list, &node_list, &uuid_list); g_hash_table_insert( n_data->keys, crm_strdup("notify_stop_resource"), rsc_list); g_hash_table_insert( n_data->keys, crm_strdup("notify_stop_uname"), node_list); } if(rsc->notify && n_data->start) { n_data->start = g_list_sort( n_data->start, sort_notify_entries); rsc_list = NULL; node_list = NULL; expand_list(n_data->start, clone_data->clone_max, &rsc_list, &node_list, &uuid_list); g_hash_table_insert( n_data->keys, crm_strdup("notify_start_resource"), rsc_list); g_hash_table_insert( n_data->keys, crm_strdup("notify_start_uname"), node_list); } if(rsc->notify && n_data->demote) { n_data->demote = g_list_sort( n_data->demote, sort_notify_entries); rsc_list = NULL; node_list = NULL; expand_list(n_data->demote, clone_data->clone_max, &rsc_list, &node_list, &uuid_list); g_hash_table_insert( n_data->keys, crm_strdup("notify_demote_resource"), rsc_list); g_hash_table_insert( n_data->keys, crm_strdup("notify_demote_uname"), node_list); } if(rsc->notify && n_data->promote) { n_data->promote = g_list_sort( n_data->promote, sort_notify_entries); rsc_list = NULL; node_list = NULL; uuid_list = NULL; expand_list(n_data->promote, clone_data->clone_max, &rsc_list, &node_list, &uuid_list); g_hash_table_insert( n_data->keys, crm_strdup("notify_promote_resource"), rsc_list); g_hash_table_insert( n_data->keys, crm_strdup("notify_promote_uname"), node_list); } if(rsc->notify && n_data->active) { n_data->active = g_list_sort( n_data->active, sort_notify_entries); rsc_list = NULL; node_list = NULL; uuid_list = NULL; expand_list(n_data->active, clone_data->clone_max, &rsc_list, &node_list, &uuid_list); g_hash_table_insert( n_data->keys, crm_strdup("notify_active_resource"), rsc_list); g_hash_table_insert( n_data->keys, crm_strdup("notify_active_uname"), node_list); } if(rsc->notify && n_data->slave) { n_data->slave = g_list_sort( n_data->slave, sort_notify_entries); rsc_list = NULL; node_list = NULL; uuid_list = NULL; expand_list(n_data->slave, clone_data->clone_max, &rsc_list, &node_list, &uuid_list); g_hash_table_insert( n_data->keys, crm_strdup("notify_slave_resource"), rsc_list); g_hash_table_insert( n_data->keys, crm_strdup("notify_slave_uname"), node_list); } if(rsc->notify && n_data->master) { n_data->master = g_list_sort( n_data->master, sort_notify_entries); rsc_list = NULL; node_list = NULL; uuid_list = NULL; expand_list(n_data->master, clone_data->clone_max, &rsc_list, &node_list, &uuid_list); g_hash_table_insert( n_data->keys, crm_strdup("notify_master_resource"), rsc_list); g_hash_table_insert( n_data->keys, crm_strdup("notify_master_uname"), node_list); } if(rsc->notify && n_data->inactive) { n_data->inactive = g_list_sort( n_data->inactive, sort_notify_entries); rsc_list = NULL; node_list = NULL; uuid_list = NULL; expand_list(n_data->inactive, clone_data->clone_max, &rsc_list, &node_list, &uuid_list); g_hash_table_insert( n_data->keys, crm_strdup("notify_inactive_resource"), rsc_list); g_hash_table_insert( n_data->keys, crm_strdup("notify_inactive_uname"), node_list); } /* yes, we DO need this second loop */ slist_iter( child_rsc, resource_t, rsc->children, lpc, child_rsc->cmds->expand(child_rsc, data_set); ); /* slist_iter( */ /* action, action_t, rsc->actions, lpc2, */ /* if(safe_str_eq(action->task, CRMD_ACTION_NOTIFY)) { */ /* action->meta_xml = notify_xml; */ /* } */ /* ); */ native_expand(rsc, data_set); /* destroy the notify_data */ pe_free_shallow(n_data->stop); pe_free_shallow(n_data->start); pe_free_shallow(n_data->demote); pe_free_shallow(n_data->promote); pe_free_shallow(n_data->master); pe_free_shallow(n_data->slave); pe_free_shallow(n_data->active); pe_free_shallow(n_data->inactive); g_hash_table_destroy(n_data->keys); crm_free(n_data); } static gint sort_rsc_id(gconstpointer a, gconstpointer b) { const resource_t *resource1 = (const resource_t*)a; const resource_t *resource2 = (const resource_t*)b; CRM_ASSERT(resource1 != NULL); CRM_ASSERT(resource2 != NULL); return strcmp(resource1->id, resource2->id); } gboolean clone_create_probe(resource_t *rsc, node_t *node, action_t *complete, gboolean force, pe_working_set_t *data_set) { gboolean any_created = FALSE; clone_variant_data_t *clone_data = NULL; get_clone_variant_data(clone_data, rsc); rsc->children = g_list_sort(rsc->children, sort_rsc_id); if(rsc->globally_unique == FALSE && clone_data->clone_node_max == 1) { /* only look for one copy */ slist_iter( child_rsc, resource_t, rsc->children, lpc, if(pe_find_node_id(child_rsc->running_on, node->details->id)) { return child_rsc->cmds->create_probe( child_rsc, node, complete, force, data_set); } ); } slist_iter( child_rsc, resource_t, rsc->children, lpc, if(child_rsc->cmds->create_probe( child_rsc, node, complete, force, data_set)) { any_created = TRUE; } if(any_created && rsc->globally_unique == FALSE && clone_data->clone_node_max == 1) { /* only look for one copy (clone :0) */ break; } ); return any_created; } diff --git a/crm/pengine/graph.c b/crm/pengine/graph.c index b5f47677ac..af1d9686a6 100644 --- a/crm/pengine/graph.c +++ b/crm/pengine/graph.c @@ -1,593 +1,607 @@ /* * 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.1 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #include #include #include #include gboolean update_action(action_t *action); gboolean update_action_states(GListPtr actions) { crm_debug_2("Updating %d actions", g_list_length(actions)); slist_iter( action, action_t, actions, lpc, update_action(action); ); return TRUE; } gboolean update_action(action_t *action) { int local_type = 0; int log_level = LOG_DEBUG_2; gboolean changed = FALSE; do_crm_log(log_level, "Processing action %s: %s %s %s", action->uuid, action->optional?"optional":"required", action->runnable?"runnable":"unrunnable", action->pseudo?"pseudo":action->task); slist_iter( other, action_wrapper_t, action->actions_before, lpc, gboolean other_changed = FALSE; node_t *node = other->action->node; do_crm_log(log_level, " Checking action %s: %s %s %s (flags=0x%.6x)", other->action->uuid, other->action->optional?"optional":"required", other->action->runnable?"runnable":"unrunnable", other->action->pseudo?"pseudo":other->action->task, other->type); local_type = other->type; + + if(local_type & pe_order_demote + && other->action->pseudo == FALSE + && other->action->rsc->role > RSC_ROLE_SLAVE + && node != NULL + && node->details->online) { + local_type |= pe_order_runnable_left; + do_crm_log(log_level,"Upgrading restart constraint to runnable_left"); + } if(local_type & pe_order_restart && other->action->pseudo == FALSE && node != NULL && node->details->online) { local_type |= pe_order_implies_left; do_crm_log(log_level,"Upgrading restart constraint to implies_left"); if(other->action->optional && other->action->runnable && action->runnable == FALSE) { do_crm_log(log_level-1, " * Marking action %s manditory because %s is unrunnable", other->action->uuid, action->uuid); other->action->optional = FALSE; other_changed = TRUE; } } if((local_type & pe_order_runnable_left) && other->action->runnable == FALSE) { if(other->action->implied_by_stonith) { do_crm_log(log_level, "Ignoring un-runnable - implied_by_stonith"); } else if(action->runnable == FALSE) { do_crm_log(log_level+1, "Already un-runnable"); } else { action->runnable = FALSE; do_crm_log(log_level-1, " * Marking action %s un-runnable because of %s", action->uuid, other->action->uuid); changed = TRUE; } } if((local_type & pe_order_runnable_right) && action->runnable == FALSE) { if(action->pseudo) { do_crm_log(log_level, "Ignoring un-runnable - pseudo"); } else if(other->action->runnable == FALSE) { do_crm_log(log_level+1, "Already un-runnable"); } else { other->action->runnable = FALSE; do_crm_log(log_level-1, " * Marking action %s un-runnable because of %s", other->action->uuid, action->uuid); other_changed = TRUE; } } if(local_type & pe_order_implies_left) { if(other->action->optional == FALSE) { /* nothing to do */ do_crm_log(log_level+1, " Ignoring implies left - redundant"); } else if(safe_str_eq(other->action->task, CRMD_ACTION_STOP) && other->action->rsc->fns->state( other->action->rsc, TRUE) == RSC_ROLE_STOPPED) { do_crm_log(log_level-1, " Ignoring implies left - %s already stopped", other->action->rsc->id); + } else if((local_type & pe_order_demote) + && other->action->rsc->role < RSC_ROLE_MASTER) { + do_crm_log(log_level-1, " Ignoring implies left - %s already demoted", + other->action->rsc->id); + } else if(action->optional == FALSE) { other->action->optional = FALSE; do_crm_log(log_level-1, " * (implies left) Marking action %s mandatory because of %s", other->action->uuid, action->uuid); other_changed = TRUE; } else { do_crm_log(log_level, " Ignoring implies left"); } } if(local_type & pe_order_implies_right) { if(action->optional == FALSE) { /* nothing to do */ do_crm_log(log_level+1, " Ignoring implies right - redundant"); } else if(other->action->optional == FALSE) { action->optional = FALSE; do_crm_log(log_level-1, " * (implies right) Marking action %s mandatory because of %s", action->uuid, other->action->uuid); changed = TRUE; } else { do_crm_log(log_level, " Ignoring implies right"); } } if(other_changed) { do_crm_log(log_level, "%s changed, processing after list", other->action->uuid); update_action(other->action); slist_iter( before_other, action_wrapper_t, other->action->actions_after, lpc2, do_crm_log(log_level, "%s changed, processing %s", other->action->uuid, before_other->action->uuid); update_action(before_other->action); ); } ); if(changed) { do_crm_log(log_level, "%s changed, processing after list", action->uuid); slist_iter( other, action_wrapper_t, action->actions_after, lpc, do_crm_log(log_level, "%s changed, processing %s", action->uuid, other->action->uuid); update_action(other->action); ); } return FALSE; } gboolean shutdown_constraints( node_t *node, action_t *shutdown_op, pe_working_set_t *data_set) { /* add the stop to the before lists so it counts as a pre-req * for the shutdown */ slist_iter( rsc, resource_t, node->details->running_rsc, lpc, if(rsc->is_managed == FALSE) { continue; } custom_action_order( rsc, stop_key(rsc), NULL, NULL, crm_strdup(CRM_OP_SHUTDOWN), shutdown_op, pe_order_implies_left, data_set); ); return TRUE; } gboolean stonith_constraints( node_t *node, action_t *stonith_op, pe_working_set_t *data_set) { CRM_CHECK(stonith_op != NULL, return FALSE); /* * Make sure the stonith OP occurs before we start any shared resources */ if(stonith_op != NULL) { slist_iter( rsc, resource_t, data_set->resources, lpc, rsc->cmds->stonith_ordering(rsc, stonith_op, data_set); ); } /* add the stonith OP as a stop pre-req and the mark the stop * as a pseudo op - since its now redundant */ return TRUE; } static void dup_attr(gpointer key, gpointer value, gpointer user_data) { g_hash_table_replace(user_data, crm_strdup(key), crm_strdup(value)); } crm_data_t * action2xml(action_t *action, gboolean as_input) { gboolean needs_node_info = TRUE; crm_data_t * action_xml = NULL; crm_data_t * args_xml = NULL; char *action_id_s = NULL; if(action == NULL) { return NULL; } crm_debug_4("Dumping action %d as XML", action->id); if(safe_str_eq(action->task, CRM_OP_FENCE)) { action_xml = create_xml_node(NULL, XML_GRAPH_TAG_CRM_EVENT); /* needs_node_info = FALSE; */ } else if(safe_str_eq(action->task, CRM_OP_SHUTDOWN)) { action_xml = create_xml_node(NULL, XML_GRAPH_TAG_CRM_EVENT); } else if(safe_str_eq(action->task, CRM_OP_LRM_REFRESH)) { action_xml = create_xml_node(NULL, XML_GRAPH_TAG_CRM_EVENT); /* } else if(safe_str_eq(action->task, CRMD_ACTION_PROBED)) { */ /* action_xml = create_xml_node(NULL, XML_GRAPH_TAG_CRM_EVENT); */ } else if(action->pseudo) { action_xml = create_xml_node(NULL, XML_GRAPH_TAG_PSEUDO_EVENT); needs_node_info = FALSE; } else { action_xml = create_xml_node(NULL, XML_GRAPH_TAG_RSC_OP); } action_id_s = crm_itoa(action->id); crm_xml_add(action_xml, XML_ATTR_ID, action_id_s); crm_free(action_id_s); crm_xml_add(action_xml, XML_LRM_ATTR_TASK, action->task); if(action->rsc != NULL && action->rsc->clone_name != NULL) { char *clone_key = NULL; const char *interval_s = g_hash_table_lookup(action->meta, "interval"); int interval = crm_parse_int(interval_s, "0"); if(safe_str_eq(action->task, CRMD_ACTION_NOTIFY)) { const char *n_type = g_hash_table_lookup( action->extra, crm_meta_name("notify_type")); const char *n_task = g_hash_table_lookup( action->extra, crm_meta_name("notify_operation")); CRM_CHECK(n_type != NULL, ;); CRM_CHECK(n_task != NULL, ;); clone_key = generate_notify_key(action->rsc->clone_name, n_type, n_task); } else { clone_key = generate_op_key(action->rsc->clone_name, action->task, interval); } crm_xml_add(action_xml, XML_LRM_ATTR_TASK_KEY, clone_key); crm_xml_add(action_xml, "internal_"XML_LRM_ATTR_TASK_KEY, action->uuid); crm_free(clone_key); } else { crm_xml_add(action_xml, XML_LRM_ATTR_TASK_KEY, action->uuid); } if(needs_node_info && action->node != NULL) { crm_xml_add(action_xml, XML_LRM_ATTR_TARGET, action->node->details->uname); crm_xml_add(action_xml, XML_LRM_ATTR_TARGET_UUID, action->node->details->id); } if(action->failure_is_fatal == FALSE) { add_hash_param(action->meta, XML_ATTR_TE_ALLOWFAIL, XML_BOOLEAN_TRUE); } if(as_input) { return action_xml; } if(action->notify_keys != NULL) { g_hash_table_foreach( action->notify_keys, dup_attr, action->meta); } if(action->rsc != NULL && action->pseudo == FALSE) { int lpc = 0; crm_data_t *rsc_xml = create_xml_node( action_xml, crm_element_name(action->rsc->xml)); const char *attr_list[] = { XML_AGENT_ATTR_CLASS, XML_AGENT_ATTR_PROVIDER, XML_ATTR_TYPE }; if(action->rsc->clone_name != NULL) { crm_debug("Using clone name %s for %s", action->rsc->clone_name, action->rsc->id); crm_xml_add(rsc_xml, XML_ATTR_ID, action->rsc->clone_name); crm_xml_add(rsc_xml, XML_ATTR_ID_LONG, action->rsc->id); } else { crm_xml_add(rsc_xml, XML_ATTR_ID, action->rsc->id); crm_xml_add(rsc_xml, XML_ATTR_ID_LONG, action->rsc->long_name); } for(lpc = 0; lpc < DIMOF(attr_list); lpc++) { crm_xml_add(rsc_xml, attr_list[lpc], g_hash_table_lookup(action->rsc->meta, attr_list[lpc])); } } args_xml = create_xml_node(action_xml, XML_TAG_ATTRS); crm_xml_add(args_xml, XML_ATTR_CRM_VERSION, CRM_FEATURE_SET); g_hash_table_foreach(action->extra, hash2field, args_xml); if(action->rsc != NULL && safe_str_neq(action->task, CRMD_ACTION_STOP)) { g_hash_table_foreach(action->rsc->parameters, hash2field, args_xml); } g_hash_table_foreach(action->meta, hash2metafield, args_xml); if(action->rsc != NULL) { int lpc = 0; const char *key = NULL; const char *value = NULL; const char *meta_list[] = { XML_RSC_ATTR_UNIQUE, XML_RSC_ATTR_INCARNATION, XML_RSC_ATTR_INCARNATION_MAX, XML_RSC_ATTR_INCARNATION_NODEMAX, XML_RSC_ATTR_MASTER_MAX, XML_RSC_ATTR_MASTER_NODEMAX, }; for(lpc = 0; lpc < DIMOF(meta_list); lpc++) { key = meta_list[lpc]; value = g_hash_table_lookup(action->rsc->meta, key); if(value != NULL) { char *crm_name = crm_concat(CRM_META, key, '_'); crm_xml_add(args_xml, crm_name, value); crm_free(crm_name); } } } crm_log_xml_debug_4(action_xml, "dumped action"); return action_xml; } static gboolean should_dump_action(action_t *action) { const char * interval = NULL; CRM_CHECK(action != NULL, return FALSE); interval = g_hash_table_lookup(action->meta, XML_LRM_ATTR_INTERVAL); if(action->optional) { crm_debug_5("action %d (%s) was optional", action->id, action->uuid); return FALSE; } else if(action->runnable == FALSE) { crm_debug_5("action %d (%s) was not runnable", action->id, action->uuid); return FALSE; } else if(action->dumped) { crm_debug_5("action %d (%s) was already dumped", action->id, action->uuid); return FALSE; } else if(action->rsc != NULL && action->rsc->is_managed == FALSE) { /* make sure probes go through */ if(safe_str_neq(action->task, CRMD_ACTION_STATUS)) { pe_warn("action %d (%s) was for an unmanaged resource (%s)", action->id, action->uuid, action->rsc->id); return FALSE; } if(interval != NULL && safe_str_neq(interval, "0")) { pe_warn("action %d (%s) was for an unmanaged resource (%s)", action->id, action->uuid, action->rsc->id); return FALSE; } } if(action->pseudo || safe_str_eq(action->task, CRM_OP_FENCE) || safe_str_eq(action->task, CRM_OP_SHUTDOWN)) { /* skip the next checks */ return TRUE; } if(action->node == NULL) { pe_err("action %d (%s) was not allocated", action->id, action->uuid); log_action(LOG_DEBUG, "Unallocated action", action, FALSE); return FALSE; } else if(action->node->details->online == FALSE) { pe_err("action %d was (%s) scheduled for offline node", action->id, action->uuid); log_action(LOG_DEBUG, "Action for offline node", action, FALSE); return FALSE; #if 0 /* but this would also affect resources that can be safely * migrated before a fencing op */ } else if(action->node->details->unclean == FALSE) { pe_err("action %d was (%s) scheduled for unclean node", action->id, action->uuid); log_action(LOG_DEBUG, "Action for unclean node", action, FALSE); return FALSE; #endif } return TRUE; } /* lowest to highest */ static gint sort_action_id(gconstpointer a, gconstpointer b) { const action_wrapper_t *action_wrapper2 = (const action_wrapper_t*)a; const action_wrapper_t *action_wrapper1 = (const action_wrapper_t*)b; if(a == NULL) { return 1; } if(b == NULL) { return -1; } if(action_wrapper1->action->id > action_wrapper2->action->id) { return -1; } if(action_wrapper1->action->id < action_wrapper2->action->id) { return 1; } return 0; } static gboolean should_dump_input(int last_action, action_t *action, action_wrapper_t *wrapper) { wrapper->state = pe_link_not_dumped; if(last_action == wrapper->action->id) { crm_debug_2("Input (%d) %s duplicated", wrapper->action->id, wrapper->action->uuid); wrapper->state = pe_link_dup; return FALSE; } else if(wrapper->type == pe_order_none) { crm_debug_2("Input (%d) %s suppressed", wrapper->action->id, wrapper->action->uuid); return FALSE; } else if(wrapper->action->optional == TRUE) { crm_debug_2("Input (%d) %s optional", wrapper->action->id, wrapper->action->uuid); return FALSE; } else if(wrapper->action->runnable == FALSE && wrapper->action->pseudo == FALSE && wrapper->type == pe_order_optional) { crm_debug("Input (%d) %s optional (ordering)", wrapper->action->id, wrapper->action->uuid); return FALSE; } else if(action->pseudo && (wrapper->type & pe_order_stonith_stop)) { crm_debug("Input (%d) %s suppressed", wrapper->action->id, wrapper->action->uuid); return FALSE; } crm_debug_3("Input (%d) %s n=%p p=%d r=%d f=0x%.6x dumped for %s", wrapper->action->id, wrapper->action->uuid, wrapper->action->node, wrapper->action->pseudo, wrapper->action->runnable, wrapper->type, action->uuid); return TRUE; } void graph_element_from_action(action_t *action, pe_working_set_t *data_set) { int last_action = -1; int synapse_priority = 0; crm_data_t * syn = NULL; crm_data_t * set = NULL; crm_data_t * in = NULL; crm_data_t * input = NULL; crm_data_t * xml_action = NULL; if(should_dump_action(action) == FALSE) { return; } action->dumped = TRUE; syn = create_xml_node(data_set->graph, "synapse"); set = create_xml_node(syn, "action_set"); in = create_xml_node(syn, "inputs"); crm_xml_add_int(syn, XML_ATTR_ID, data_set->num_synapse); data_set->num_synapse++; if(action->rsc != NULL) { synapse_priority = action->rsc->priority; } if(action->priority > synapse_priority) { synapse_priority = action->priority; } if(synapse_priority > 0) { crm_xml_add_int(syn, XML_CIB_ATTR_PRIORITY, synapse_priority); } xml_action = action2xml(action, FALSE); add_node_nocopy(set, crm_element_name(xml_action), xml_action); action->actions_before = g_list_sort( action->actions_before, sort_action_id); slist_iter(wrapper,action_wrapper_t,action->actions_before,lpc, if(should_dump_input(last_action, action, wrapper) == FALSE) { continue; } wrapper->state = pe_link_dumped; CRM_CHECK(last_action < wrapper->action->id, ;); last_action = wrapper->action->id; input = create_xml_node(in, "trigger"); xml_action = action2xml(wrapper->action, TRUE); add_node_nocopy(input, crm_element_name(xml_action), xml_action); ); } diff --git a/crm/pengine/group.c b/crm/pengine/group.c index f0a0aeac31..af4a61cf4f 100644 --- a/crm/pengine/group.c +++ b/crm/pengine/group.c @@ -1,399 +1,399 @@ /* * 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.1 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #define VARIANT_GROUP 1 #include node_t * group_color(resource_t *rsc, pe_working_set_t *data_set) { node_t *node = NULL; node_t *group_node = NULL; group_variant_data_t *group_data = NULL; get_group_variant_data(group_data, rsc); if(rsc->provisional == FALSE) { return rsc->allocated_to; } crm_debug_2("Processing %s", rsc->id); if(rsc->is_allocating) { crm_debug("Dependancy loop detected involving %s", rsc->id); return NULL; } if(group_data->first_child == NULL) { /* nothign to allocate */ rsc->provisional = FALSE; return NULL; } rsc->is_allocating = TRUE; rsc->role = group_data->first_child->role; group_data->first_child->rsc_cons = g_list_concat( group_data->first_child->rsc_cons, rsc->rsc_cons); rsc->rsc_cons = NULL; slist_iter( child_rsc, resource_t, rsc->children, lpc, node = child_rsc->cmds->color(child_rsc, data_set); if(group_node == NULL) { group_node = node; } ); rsc->next_role = group_data->first_child->next_role; rsc->is_allocating = FALSE; rsc->provisional = FALSE; if(group_data->colocated) { return group_node; } return NULL; } void group_update_pseudo_status(resource_t *parent, resource_t *child); void group_create_actions(resource_t *rsc, pe_working_set_t *data_set) { action_t *op = NULL; group_variant_data_t *group_data = NULL; get_group_variant_data(group_data, rsc); crm_debug_2("Creating actions for %s", rsc->id); slist_iter( child_rsc, resource_t, rsc->children, lpc, child_rsc->cmds->create_actions(child_rsc, data_set); group_update_pseudo_status(rsc, child_rsc); ); op = start_action(rsc, NULL, !group_data->child_starting); op->pseudo = TRUE; op->runnable = TRUE; op = custom_action(rsc, started_key(rsc), CRMD_ACTION_STARTED, NULL, !group_data->child_starting, TRUE, data_set); op->pseudo = TRUE; op->runnable = TRUE; op = stop_action(rsc, NULL, !group_data->child_stopping); op->pseudo = TRUE; op->runnable = TRUE; op = custom_action(rsc, stopped_key(rsc), CRMD_ACTION_STOPPED, NULL, !group_data->child_stopping, TRUE, data_set); op->pseudo = TRUE; op->runnable = TRUE; rsc->actions = rsc->actions; /* rsc->actions = NULL; */ } void group_update_pseudo_status(resource_t *parent, resource_t *child) { group_variant_data_t *group_data = NULL; get_group_variant_data(group_data, parent); if(group_data->child_stopping && group_data->child_starting) { return; } slist_iter( action, action_t, child->actions, lpc, if(action->optional) { continue; } if(safe_str_eq(CRMD_ACTION_STOP, action->task) && action->runnable) { group_data->child_stopping = TRUE; crm_debug_3("Based on %s the group is stopping", action->uuid); } else if(safe_str_eq(CRMD_ACTION_START, action->task) && action->runnable) { group_data->child_starting = TRUE; crm_debug_3("Based on %s the group is starting", action->uuid); } ); } void group_internal_constraints(resource_t *rsc, pe_working_set_t *data_set) { resource_t *last_rsc = NULL; group_variant_data_t *group_data = NULL; get_group_variant_data(group_data, rsc); native_internal_constraints(rsc, data_set); custom_action_order( rsc, stopped_key(rsc), NULL, rsc, start_key(rsc), NULL, pe_order_optional, data_set); custom_action_order( rsc, stop_key(rsc), NULL, rsc, stopped_key(rsc), NULL, pe_order_runnable_left, data_set); custom_action_order( rsc, start_key(rsc), NULL, rsc, started_key(rsc), NULL, pe_order_runnable_left, data_set); slist_iter( child_rsc, resource_t, rsc->children, lpc, child_rsc->cmds->internal_constraints(child_rsc, data_set); if(group_data->colocated && last_rsc != NULL) { rsc_colocation_new( "group:internal_colocation", NULL, INFINITY, - child_rsc, last_rsc, NULL, NULL); + child_rsc, last_rsc, NULL, NULL, data_set); } custom_action_order(rsc, stop_key(rsc), NULL, child_rsc, stop_key(child_rsc), NULL, pe_order_optional, data_set); custom_action_order(child_rsc, stop_key(child_rsc), NULL, rsc, stopped_key(rsc), NULL, pe_order_optional, data_set); custom_action_order(child_rsc, start_key(child_rsc), NULL, rsc, started_key(rsc), NULL, pe_order_optional, data_set); if(group_data->ordered == FALSE) { order_start_start(rsc, child_rsc, pe_order_implies_right|pe_order_runnable_left); order_stop_stop(rsc, child_rsc, pe_order_implies_right); } else if(last_rsc != NULL) { order_start_start(last_rsc, child_rsc, pe_order_implies_right|pe_order_runnable_left); order_stop_stop(child_rsc, last_rsc, pe_order_implies_left); child_rsc->restart_type = pe_restart_restart; } else { /* If anyone in the group is starting, then * pe_order_implies_right will cause _everyone_ in the group * to be sent a start action * But this is safe since starting something that is already * started is required to be "safe" */ order_start_start(rsc, child_rsc, pe_order_implies_right|pe_order_implies_left|pe_order_runnable_right|pe_order_runnable_left); } last_rsc = child_rsc; ); if(group_data->ordered && last_rsc != NULL) { order_stop_stop(rsc, last_rsc, pe_order_implies_right); } } void group_rsc_colocation_lh( resource_t *rsc_lh, resource_t *rsc_rh, rsc_colocation_t *constraint) { group_variant_data_t *group_data = NULL; if(rsc_lh == NULL) { pe_err("rsc_lh was NULL for %s", constraint->id); return; } else if(rsc_rh == NULL) { pe_err("rsc_rh was NULL for %s", constraint->id); return; } crm_debug_4("Processing constraints from %s", rsc_lh->id); get_group_variant_data(group_data, rsc_lh); if(group_data->colocated) { group_data->first_child->cmds->rsc_colocation_lh( group_data->first_child, rsc_rh, constraint); return; } else if(constraint->score >= INFINITY) { crm_config_err("%s: Cannot perform manditory colocation" " between non-colocated group and %s", rsc_lh->id, rsc_rh->id); return; } slist_iter( child_rsc, resource_t, rsc_lh->children, lpc, child_rsc->cmds->rsc_colocation_lh( child_rsc, rsc_rh, constraint); ); } void group_rsc_colocation_rh( resource_t *rsc_lh, resource_t *rsc_rh, rsc_colocation_t *constraint) { group_variant_data_t *group_data = NULL; get_group_variant_data(group_data, rsc_rh); CRM_CHECK(rsc_lh->variant == pe_native, return); crm_debug_3("Processing RH of constraint %s", constraint->id); print_resource(LOG_DEBUG_3, "LHS", rsc_lh, TRUE); if(rsc_rh->provisional) { return; } else if(group_data->colocated) { group_data->first_child->cmds->rsc_colocation_rh( rsc_lh, group_data->first_child, constraint); return; } else if(constraint->score >= INFINITY) { crm_config_err("%s: Cannot perform manditory colocation with" " non-colocated group: %s", rsc_lh->id, rsc_rh->id); return; } slist_iter( child_rsc, resource_t, rsc_rh->children, lpc, child_rsc->cmds->rsc_colocation_rh( rsc_lh, child_rsc, constraint); ); } void group_rsc_order_lh(resource_t *rsc, order_constraint_t *order, pe_working_set_t *data_set) { group_variant_data_t *group_data = NULL; get_group_variant_data(group_data, rsc); crm_debug_2("%s->%s", order->lh_action_task, order->rh_action_task); if(order->rh_rsc != NULL && (rsc == order->rh_rsc || rsc == order->rh_rsc->parent)) { native_rsc_order_lh(rsc, order, data_set); return; } if(order->type != pe_order_optional) { native_rsc_order_lh(rsc, order, data_set); } if(order->type & pe_order_implies_left) { native_rsc_order_lh(group_data->first_child, order, data_set); } convert_non_atomic_task(rsc, order); native_rsc_order_lh(rsc, order, data_set); } void group_rsc_order_rh( action_t *lh_action, resource_t *rsc, order_constraint_t *order) { group_variant_data_t *group_data = NULL; get_group_variant_data(group_data, rsc); crm_debug_2("%s->%s", lh_action->uuid, order->rh_action_task); if(rsc == NULL) { return; } native_rsc_order_rh(lh_action, rsc, order); } void group_rsc_location(resource_t *rsc, rsc_to_node_t *constraint) { gboolean reset_scores = TRUE; group_variant_data_t *group_data = NULL; get_group_variant_data(group_data, rsc); crm_debug("Processing rsc_location %s for %s", constraint->id, rsc->id); slist_iter( child_rsc, resource_t, rsc->children, lpc, child_rsc->cmds->rsc_location(child_rsc, constraint); if(group_data->colocated && reset_scores) { reset_scores = FALSE; slist_iter(node, node_t, constraint->node_list_rh, lpc2, node->weight = 0; ); } ); } void group_expand(resource_t *rsc, pe_working_set_t *data_set) { group_variant_data_t *group_data = NULL; get_group_variant_data(group_data, rsc); crm_debug_3("Processing actions from %s", rsc->id); CRM_CHECK(rsc != NULL, return); native_expand(rsc, data_set); slist_iter( child_rsc, resource_t, rsc->children, lpc, child_rsc->cmds->expand(child_rsc, data_set); ); } GListPtr group_merge_weights( resource_t *rsc, const char *rhs, GListPtr nodes, int factor, gboolean allow_rollback) { group_variant_data_t *group_data = NULL; get_group_variant_data(group_data, rsc); if(rsc->is_merging) { crm_debug("Breaking dependancy loop with %s at %s", rsc->id, rhs); return nodes; } else if(rsc->provisional == FALSE || can_run_any(nodes) == FALSE) { return nodes; } rsc->is_merging = TRUE; nodes = group_data->first_child->cmds->merge_weights( group_data->first_child, rhs, nodes, factor, allow_rollback); slist_iter( constraint, rsc_colocation_t, rsc->rsc_cons_lhs, lpc, nodes = native_merge_weights( constraint->rsc_lh, rsc->id, nodes, constraint->score/INFINITY, allow_rollback); ); rsc->is_merging = FALSE; return nodes; } diff --git a/crm/pengine/pengine.h b/crm/pengine/pengine.h index d88332b618..2bbfb8fa49 100644 --- a/crm/pengine/pengine.h +++ b/crm/pengine/pengine.h @@ -1,173 +1,174 @@ /* * 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.1 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef PENGINE__H #define PENGINE__H #include typedef struct rsc_to_node_s rsc_to_node_t; typedef struct rsc_colocation_s rsc_colocation_t; typedef struct lrm_agent_s lrm_agent_t; typedef struct order_constraint_s order_constraint_t; #include #include #include #include #include #include #include #include enum pe_stop_fail { pesf_block, pesf_stonith, pesf_ignore }; enum pe_ordering { pe_order_none = 0x0, /* deleted */ pe_order_implies_left = 0x01, /* was: _mandatory */ pe_order_implies_right = 0x02, /* was: _recover */ pe_order_runnable_left = 0x10, /* needs the LHS side to be runnable */ pe_order_runnable_right = 0x20, /* needs the RHS side to be runnable */ pe_order_optional = 0x100, /* pure ordering, nothing implied */ pe_order_stonith_stop = 0x200, /* only applies if the action is non-pseudo */ pe_order_restart = 0x400, /* stop-start constraint */ + pe_order_demote = 0x800, /* stop-start constraint */ pe_order_test = 0x1000 /* test marker */ }; struct rsc_colocation_s { const char *id; const char *node_attribute; resource_t *rsc_lh; resource_t *rsc_rh; int role_lh; int role_rh; int score; }; struct rsc_to_node_s { const char *id; resource_t *rsc_lh; enum rsc_role_e role_filter; GListPtr node_list_rh; /* node_t* */ }; struct order_constraint_s { int id; enum pe_ordering type; void *lh_opaque; resource_t *lh_rsc; action_t *lh_action; char *lh_action_task; void *rh_opaque; resource_t *rh_rsc; action_t *rh_action; char *rh_action_task; /* (soon to be) variant specific */ /* int lh_rsc_incarnation; */ /* int rh_rsc_incarnation; */ }; enum pe_link_state { pe_link_not_dumped, pe_link_dumped, pe_link_dup, }; typedef struct action_wrapper_s action_wrapper_t; struct action_wrapper_s { enum pe_ordering type; enum pe_link_state state; action_t *action; }; extern gboolean stage0(pe_working_set_t *data_set); extern gboolean stage1(pe_working_set_t *data_set); extern gboolean stage2(pe_working_set_t *data_set); extern gboolean stage3(pe_working_set_t *data_set); extern gboolean stage4(pe_working_set_t *data_set); extern gboolean stage5(pe_working_set_t *data_set); extern gboolean stage6(pe_working_set_t *data_set); extern gboolean stage7(pe_working_set_t *data_set); extern gboolean stage8(pe_working_set_t *data_set); extern gboolean summary(GListPtr resources); extern gboolean pe_msg_dispatch(IPC_Channel *sender, void *user_data); extern gboolean process_pe_message( HA_Message *msg, crm_data_t *xml_data, IPC_Channel *sender); extern gboolean unpack_constraints( crm_data_t *xml_constraints, pe_working_set_t *data_set); extern gboolean update_action_states(GListPtr actions); extern gboolean shutdown_constraints( node_t *node, action_t *shutdown_op, pe_working_set_t *data_set); extern gboolean stonith_constraints( node_t *node, action_t *stonith_op, pe_working_set_t *data_set); extern int custom_action_order( resource_t *lh_rsc, char *lh_task, action_t *lh_action, resource_t *rh_rsc, char *rh_task, action_t *rh_action, enum pe_ordering type, pe_working_set_t *data_set); #define order_start_start(rsc1,rsc2, type) \ custom_action_order(rsc1, start_key(rsc1), NULL, \ rsc2, start_key(rsc2) ,NULL, \ type, data_set) #define order_stop_stop(rsc1, rsc2, type) \ custom_action_order(rsc1, stop_key(rsc1), NULL, \ rsc2, stop_key(rsc2) ,NULL, \ type, data_set) #define order_stop_start(rsc1, rsc2, type) \ custom_action_order(rsc1, stop_key(rsc1), NULL, \ rsc2, start_key(rsc2) ,NULL, \ type, data_set) #define order_start_stop(rsc1, rsc2, type) \ custom_action_order(rsc1, start_key(rsc1), NULL, \ rsc2, stop_key(rsc2) ,NULL, \ type, data_set) extern void graph_element_from_action( action_t *action, pe_working_set_t *data_set); extern const char* transition_idle_timeout; #endif diff --git a/crm/pengine/testcases/bug-1572-1.dot b/crm/pengine/testcases/bug-1572-1.dot index 774d076ff7..49b17a8166 100644 --- a/crm/pengine/testcases/bug-1572-1.dot +++ b/crm/pengine/testcases/bug-1572-1.dot @@ -1,147 +1,148 @@ digraph "g" { "IPaddr_147_81_84_133_monitor_25000 arc-tkincaidlx.wsicorp.com" [ style=bold color="green" fontcolor="black" ] "IPaddr_147_81_84_133_start_0 arc-tkincaidlx.wsicorp.com" -> "IPaddr_147_81_84_133_monitor_25000 arc-tkincaidlx.wsicorp.com" [ style = bold] "IPaddr_147_81_84_133_start_0 arc-tkincaidlx.wsicorp.com" [ style=bold color="green" fontcolor="black" ] "IPaddr_147_81_84_133_stop_0 arc-tkincaidlx.wsicorp.com" -> "IPaddr_147_81_84_133_start_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "IPaddr_147_81_84_133_stop_0 arc-tkincaidlx.wsicorp.com" -> "all_stopped" [ style = bold] "IPaddr_147_81_84_133_stop_0 arc-tkincaidlx.wsicorp.com" -> "grp_pgsql_mirror_stopped_0" [ style = bold] "IPaddr_147_81_84_133_stop_0 arc-tkincaidlx.wsicorp.com" -> "pgsql_5555_stop_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "IPaddr_147_81_84_133_stop_0 arc-tkincaidlx.wsicorp.com" [ style=bold color="green" fontcolor="black" ] "all_stopped" [ style=bold color="green" fontcolor="orange" ] "do_shutdown arc-dknightlx" [ style=bold color="green" fontcolor="black" ] "fs_mirror_start_0 arc-tkincaidlx.wsicorp.com" -> "pgsql_5555_start_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "fs_mirror_start_0 arc-tkincaidlx.wsicorp.com" [ style=bold color="green" fontcolor="black" ] "fs_mirror_stop_0 arc-tkincaidlx.wsicorp.com" -> "all_stopped" [ style = bold] "fs_mirror_stop_0 arc-tkincaidlx.wsicorp.com" -> "fs_mirror_start_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "fs_mirror_stop_0 arc-tkincaidlx.wsicorp.com" -> "grp_pgsql_mirror_stopped_0" [ style = bold] "fs_mirror_stop_0 arc-tkincaidlx.wsicorp.com" -> "ms_drbd_7788_demote_0" [ style = bold] "fs_mirror_stop_0 arc-tkincaidlx.wsicorp.com" [ style=bold color="green" fontcolor="black" ] "grp_pgsql_mirror_start_0" -> "fs_mirror_start_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "grp_pgsql_mirror_start_0" [ style=bold color="green" fontcolor="orange" ] "grp_pgsql_mirror_stop_0" -> "IPaddr_147_81_84_133_stop_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "grp_pgsql_mirror_stop_0" -> "fs_mirror_stop_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "grp_pgsql_mirror_stop_0" -> "grp_pgsql_mirror_start_0" [ style = bold] "grp_pgsql_mirror_stop_0" -> "grp_pgsql_mirror_stopped_0" [ style = bold] "grp_pgsql_mirror_stop_0" -> "ms_drbd_7788_demote_0" [ style = bold] "grp_pgsql_mirror_stop_0" -> "pgsql_5555_stop_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "grp_pgsql_mirror_stop_0" [ style=bold color="green" fontcolor="orange" ] "grp_pgsql_mirror_stopped_0" -> "grp_pgsql_mirror_start_0" [ style = bold] "grp_pgsql_mirror_stopped_0" -> "ms_drbd_7788_demote_0" [ style = bold] "grp_pgsql_mirror_stopped_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_confirmed-post_notify_demote_0" -> "ms_drbd_7788_pre_notify_stop_0" [ style = bold] "ms_drbd_7788_confirmed-post_notify_demote_0" -> "ms_drbd_7788_stop_0" [ style = bold] "ms_drbd_7788_confirmed-post_notify_demote_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_confirmed-post_notify_promote_0" -> "grp_pgsql_mirror_start_0" [ style = bold] "ms_drbd_7788_confirmed-post_notify_promote_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_confirmed-post_notify_start_0" -> "ms_drbd_7788_pre_notify_promote_0" [ style = bold] "ms_drbd_7788_confirmed-post_notify_start_0" -> "ms_drbd_7788_promote_0" [ style = bold] "ms_drbd_7788_confirmed-post_notify_start_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_confirmed-post_notify_stop_0" -> "ms_drbd_7788_pre_notify_start_0" [ style = bold] "ms_drbd_7788_confirmed-post_notify_stop_0" -> "ms_drbd_7788_start_0" [ style = bold] "ms_drbd_7788_confirmed-post_notify_stop_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_confirmed-pre_notify_demote_0" -> "ms_drbd_7788_demote_0" [ style = bold] "ms_drbd_7788_confirmed-pre_notify_demote_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_confirmed-pre_notify_promote_0" -> "ms_drbd_7788_promote_0" [ style = bold] "ms_drbd_7788_confirmed-pre_notify_promote_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_confirmed-pre_notify_start_0" -> "ms_drbd_7788_start_0" [ style = bold] "ms_drbd_7788_confirmed-pre_notify_start_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_confirmed-pre_notify_stop_0" -> "ms_drbd_7788_stop_0" [ style = bold] "ms_drbd_7788_confirmed-pre_notify_stop_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_demote_0" -> "ms_drbd_7788_demoted_0" [ style = bold] "ms_drbd_7788_demote_0" -> "ms_drbd_7788_stop_0" [ style = bold] "ms_drbd_7788_demote_0" -> "rsc_drbd_7788:1_demote_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "ms_drbd_7788_demote_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_demoted_0" -> "ms_drbd_7788_post_notify_demote_0" [ style = bold] "ms_drbd_7788_demoted_0" -> "ms_drbd_7788_promote_0" [ style = bold] "ms_drbd_7788_demoted_0" -> "ms_drbd_7788_start_0" [ style = bold] "ms_drbd_7788_demoted_0" -> "ms_drbd_7788_stop_0" [ style = bold] "ms_drbd_7788_demoted_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_post_notify_demote_0" -> "ms_drbd_7788_confirmed-post_notify_demote_0" [ style = bold] "ms_drbd_7788_post_notify_demote_0" -> "rsc_drbd_7788:0_post_notify_demote_0 arc-dknightlx" [ style = bold] "ms_drbd_7788_post_notify_demote_0" -> "rsc_drbd_7788:1_post_notify_demote_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "ms_drbd_7788_post_notify_demote_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_post_notify_promote_0" -> "ms_drbd_7788_confirmed-post_notify_promote_0" [ style = bold] "ms_drbd_7788_post_notify_promote_0" -> "rsc_drbd_7788:1_post_notify_promote_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "ms_drbd_7788_post_notify_promote_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_post_notify_start_0" -> "ms_drbd_7788_confirmed-post_notify_start_0" [ style = bold] "ms_drbd_7788_post_notify_start_0" -> "rsc_drbd_7788:1_post_notify_start_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "ms_drbd_7788_post_notify_start_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_post_notify_stop_0" -> "ms_drbd_7788_confirmed-post_notify_stop_0" [ style = bold] "ms_drbd_7788_post_notify_stop_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_pre_notify_demote_0" -> "ms_drbd_7788_confirmed-pre_notify_demote_0" [ style = bold] "ms_drbd_7788_pre_notify_demote_0" -> "rsc_drbd_7788:0_pre_notify_demote_0 arc-dknightlx" [ style = bold] "ms_drbd_7788_pre_notify_demote_0" -> "rsc_drbd_7788:1_pre_notify_demote_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "ms_drbd_7788_pre_notify_demote_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_pre_notify_promote_0" -> "ms_drbd_7788_confirmed-pre_notify_promote_0" [ style = bold] "ms_drbd_7788_pre_notify_promote_0" -> "rsc_drbd_7788:1_pre_notify_promote_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "ms_drbd_7788_pre_notify_promote_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_pre_notify_start_0" -> "ms_drbd_7788_confirmed-pre_notify_start_0" [ style = bold] "ms_drbd_7788_pre_notify_start_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_pre_notify_stop_0" -> "ms_drbd_7788_confirmed-pre_notify_stop_0" [ style = bold] "ms_drbd_7788_pre_notify_stop_0" -> "rsc_drbd_7788:0_pre_notify_stop_0 arc-dknightlx" [ style = bold] "ms_drbd_7788_pre_notify_stop_0" -> "rsc_drbd_7788:1_pre_notify_stop_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "ms_drbd_7788_pre_notify_stop_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_promote_0" -> "rsc_drbd_7788:1_promote_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "ms_drbd_7788_promote_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_promoted_0" -> "ms_drbd_7788_post_notify_promote_0" [ style = bold] "ms_drbd_7788_promoted_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_running_0" -> "ms_drbd_7788_post_notify_start_0" [ style = bold] "ms_drbd_7788_running_0" -> "ms_drbd_7788_promote_0" [ style = bold] "ms_drbd_7788_running_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_start_0" -> "ms_drbd_7788_promote_0" [ style = bold] "ms_drbd_7788_start_0" -> "ms_drbd_7788_running_0" [ style = bold] "ms_drbd_7788_start_0" -> "rsc_drbd_7788:1_start_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "ms_drbd_7788_start_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_stop_0" -> "ms_drbd_7788_start_0" [ style = bold] "ms_drbd_7788_stop_0" -> "ms_drbd_7788_stopped_0" [ style = bold] "ms_drbd_7788_stop_0" -> "rsc_drbd_7788:0_stop_0 arc-dknightlx" [ style = bold] "ms_drbd_7788_stop_0" -> "rsc_drbd_7788:1_stop_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "ms_drbd_7788_stop_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_7788_stopped_0" -> "ms_drbd_7788_post_notify_stop_0" [ style = bold] +"ms_drbd_7788_stopped_0" -> "ms_drbd_7788_promote_0" [ style = bold] "ms_drbd_7788_stopped_0" -> "ms_drbd_7788_start_0" [ style = bold] "ms_drbd_7788_stopped_0" [ style=bold color="green" fontcolor="orange" ] "pgsql_5555_monitor_30000 arc-tkincaidlx.wsicorp.com" [ style=bold color="green" fontcolor="black" ] "pgsql_5555_start_0 arc-tkincaidlx.wsicorp.com" -> "IPaddr_147_81_84_133_start_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "pgsql_5555_start_0 arc-tkincaidlx.wsicorp.com" -> "pgsql_5555_monitor_30000 arc-tkincaidlx.wsicorp.com" [ style = bold] "pgsql_5555_start_0 arc-tkincaidlx.wsicorp.com" [ style=bold color="green" fontcolor="black" ] "pgsql_5555_stop_0 arc-tkincaidlx.wsicorp.com" -> "all_stopped" [ style = bold] "pgsql_5555_stop_0 arc-tkincaidlx.wsicorp.com" -> "fs_mirror_stop_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "pgsql_5555_stop_0 arc-tkincaidlx.wsicorp.com" -> "grp_pgsql_mirror_stopped_0" [ style = bold] "pgsql_5555_stop_0 arc-tkincaidlx.wsicorp.com" -> "pgsql_5555_start_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "pgsql_5555_stop_0 arc-tkincaidlx.wsicorp.com" [ style=bold color="green" fontcolor="black" ] "rsc_drbd_7788:0_post_notify_demote_0 arc-dknightlx" -> "ms_drbd_7788_confirmed-post_notify_demote_0" [ style = bold] "rsc_drbd_7788:0_post_notify_demote_0 arc-dknightlx" [ style=bold color="green" fontcolor="black" ] "rsc_drbd_7788:0_pre_notify_demote_0 arc-dknightlx" -> "ms_drbd_7788_confirmed-pre_notify_demote_0" [ style = bold] "rsc_drbd_7788:0_pre_notify_demote_0 arc-dknightlx" [ style=bold color="green" fontcolor="black" ] "rsc_drbd_7788:0_pre_notify_stop_0 arc-dknightlx" -> "ms_drbd_7788_confirmed-pre_notify_stop_0" [ style = bold] "rsc_drbd_7788:0_pre_notify_stop_0 arc-dknightlx" [ style=bold color="green" fontcolor="black" ] "rsc_drbd_7788:0_stop_0 arc-dknightlx" -> "all_stopped" [ style = bold] "rsc_drbd_7788:0_stop_0 arc-dknightlx" -> "do_shutdown arc-dknightlx" [ style = bold] "rsc_drbd_7788:0_stop_0 arc-dknightlx" -> "ms_drbd_7788_stopped_0" [ style = bold] "rsc_drbd_7788:0_stop_0 arc-dknightlx" [ style=bold color="green" fontcolor="black" ] "rsc_drbd_7788:1_demote_0 arc-tkincaidlx.wsicorp.com" -> "ms_drbd_7788_demoted_0" [ style = bold] "rsc_drbd_7788:1_demote_0 arc-tkincaidlx.wsicorp.com" -> "rsc_drbd_7788:1_promote_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "rsc_drbd_7788:1_demote_0 arc-tkincaidlx.wsicorp.com" -> "rsc_drbd_7788:1_stop_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "rsc_drbd_7788:1_demote_0 arc-tkincaidlx.wsicorp.com" [ style=bold color="green" fontcolor="black" ] "rsc_drbd_7788:1_post_notify_demote_0 arc-tkincaidlx.wsicorp.com" -> "ms_drbd_7788_confirmed-post_notify_demote_0" [ style = bold] "rsc_drbd_7788:1_post_notify_demote_0 arc-tkincaidlx.wsicorp.com" [ style=bold color="green" fontcolor="black" ] "rsc_drbd_7788:1_post_notify_promote_0 arc-tkincaidlx.wsicorp.com" -> "ms_drbd_7788_confirmed-post_notify_promote_0" [ style = bold] "rsc_drbd_7788:1_post_notify_promote_0 arc-tkincaidlx.wsicorp.com" [ style=bold color="green" fontcolor="black" ] "rsc_drbd_7788:1_post_notify_start_0 arc-tkincaidlx.wsicorp.com" -> "ms_drbd_7788_confirmed-post_notify_start_0" [ style = bold] "rsc_drbd_7788:1_post_notify_start_0 arc-tkincaidlx.wsicorp.com" [ style=bold color="green" fontcolor="black" ] "rsc_drbd_7788:1_pre_notify_demote_0 arc-tkincaidlx.wsicorp.com" -> "ms_drbd_7788_confirmed-pre_notify_demote_0" [ style = bold] "rsc_drbd_7788:1_pre_notify_demote_0 arc-tkincaidlx.wsicorp.com" [ style=bold color="green" fontcolor="black" ] "rsc_drbd_7788:1_pre_notify_promote_0 arc-tkincaidlx.wsicorp.com" -> "ms_drbd_7788_confirmed-pre_notify_promote_0" [ style = bold] "rsc_drbd_7788:1_pre_notify_promote_0 arc-tkincaidlx.wsicorp.com" [ style=bold color="green" fontcolor="black" ] "rsc_drbd_7788:1_pre_notify_stop_0 arc-tkincaidlx.wsicorp.com" -> "ms_drbd_7788_confirmed-pre_notify_stop_0" [ style = bold] "rsc_drbd_7788:1_pre_notify_stop_0 arc-tkincaidlx.wsicorp.com" [ style=bold color="green" fontcolor="black" ] "rsc_drbd_7788:1_promote_0 arc-tkincaidlx.wsicorp.com" -> "ms_drbd_7788_promoted_0" [ style = bold] "rsc_drbd_7788:1_promote_0 arc-tkincaidlx.wsicorp.com" [ style=bold color="green" fontcolor="black" ] "rsc_drbd_7788:1_start_0 arc-tkincaidlx.wsicorp.com" -> "ms_drbd_7788_running_0" [ style = bold] "rsc_drbd_7788:1_start_0 arc-tkincaidlx.wsicorp.com" -> "rsc_drbd_7788:1_promote_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "rsc_drbd_7788:1_start_0 arc-tkincaidlx.wsicorp.com" [ style=bold color="green" fontcolor="black" ] "rsc_drbd_7788:1_stop_0 arc-tkincaidlx.wsicorp.com" -> "all_stopped" [ style = bold] "rsc_drbd_7788:1_stop_0 arc-tkincaidlx.wsicorp.com" -> "ms_drbd_7788_stopped_0" [ style = bold] "rsc_drbd_7788:1_stop_0 arc-tkincaidlx.wsicorp.com" -> "rsc_drbd_7788:1_start_0 arc-tkincaidlx.wsicorp.com" [ style = bold] "rsc_drbd_7788:1_stop_0 arc-tkincaidlx.wsicorp.com" [ style=bold color="green" fontcolor="black" ] } diff --git a/crm/pengine/testcases/bug-1572-1.exp b/crm/pengine/testcases/bug-1572-1.exp index 8008736353..8b81ab2e34 100644 --- a/crm/pengine/testcases/bug-1572-1.exp +++ b/crm/pengine/testcases/bug-1572-1.exp @@ -1,764 +1,767 @@ + + + diff --git a/crm/pengine/testcases/inc8.dot b/crm/pengine/testcases/inc8.dot index 97aac5c190..41248dfa5f 100644 --- a/crm/pengine/testcases/inc8.dot +++ b/crm/pengine/testcases/inc8.dot @@ -1,73 +1,63 @@ digraph "g" { "child_rsc1:0_monitor_0 node1" -> "probe_complete node1" [ style = bold] "child_rsc1:0_monitor_0 node1" [ style=bold color="green" fontcolor="black" ] "child_rsc1:0_monitor_0 node2" -> "probe_complete node2" [ style = bold] "child_rsc1:0_monitor_0 node2" [ style=bold color="green" fontcolor="black" ] "child_rsc1:1_monitor_0 node1" -> "probe_complete node1" [ style = bold] "child_rsc1:1_monitor_0 node1" [ style=bold color="green" fontcolor="black" ] "child_rsc1:1_monitor_0 node2" -> "probe_complete node2" [ style = bold] "child_rsc1:1_monitor_0 node2" [ style=bold color="green" fontcolor="black" ] -"child_rsc1:1_start_0 node2" -> "rsc1_running_0" [ style = bold] -"child_rsc1:1_start_0 node2" [ style=bold color="green" fontcolor="black" ] "child_rsc1:2_monitor_0 node1" -> "probe_complete node1" [ style = bold] "child_rsc1:2_monitor_0 node1" [ style=bold color="green" fontcolor="black" ] "child_rsc1:2_monitor_0 node2" -> "probe_complete node2" [ style = bold] "child_rsc1:2_monitor_0 node2" [ style=bold color="green" fontcolor="black" ] -"child_rsc1:2_start_0 node1" -> "rsc1_running_0" [ style = bold] -"child_rsc1:2_start_0 node1" [ style=bold color="green" fontcolor="black" ] "child_rsc1:3_monitor_0 node1" -> "probe_complete node1" [ style = bold] "child_rsc1:3_monitor_0 node1" [ style=bold color="green" fontcolor="black" ] "child_rsc1:3_monitor_0 node2" -> "probe_complete node2" [ style = bold] "child_rsc1:3_monitor_0 node2" [ style=bold color="green" fontcolor="black" ] "child_rsc1:4_monitor_0 node1" -> "probe_complete node1" [ style = bold] "child_rsc1:4_monitor_0 node1" [ style=bold color="green" fontcolor="black" ] "child_rsc1:4_monitor_0 node2" -> "probe_complete node2" [ style = bold] "child_rsc1:4_monitor_0 node2" [ style=bold color="green" fontcolor="black" ] "child_rsc2:0_monitor_0 node1" -> "probe_complete node1" [ style = bold] "child_rsc2:0_monitor_0 node1" [ style=bold color="green" fontcolor="black" ] "child_rsc2:0_monitor_0 node2" -> "probe_complete node2" [ style = bold] "child_rsc2:0_monitor_0 node2" [ style=bold color="green" fontcolor="black" ] "child_rsc2:0_start_0 node2" -> "rsc2_running_0" [ style = bold] "child_rsc2:0_start_0 node2" [ style=bold color="green" fontcolor="black" ] "child_rsc2:1_monitor_0 node1" -> "probe_complete node1" [ style = bold] "child_rsc2:1_monitor_0 node1" [ style=bold color="green" fontcolor="black" ] "child_rsc2:1_monitor_0 node2" -> "probe_complete node2" [ style = bold] "child_rsc2:1_monitor_0 node2" [ style=bold color="green" fontcolor="black" ] "child_rsc2:1_start_0 node1" -> "rsc2_running_0" [ style = bold] "child_rsc2:1_start_0 node1" [ style=bold color="green" fontcolor="black" ] "child_rsc2:2_monitor_0 node1" -> "probe_complete node1" [ style = bold] "child_rsc2:2_monitor_0 node1" [ style=bold color="green" fontcolor="black" ] "child_rsc2:2_monitor_0 node2" -> "probe_complete node2" [ style = bold] "child_rsc2:2_monitor_0 node2" [ style=bold color="green" fontcolor="black" ] "child_rsc2:3_monitor_0 node1" -> "probe_complete node1" [ style = bold] "child_rsc2:3_monitor_0 node1" [ style=bold color="green" fontcolor="black" ] "child_rsc2:3_monitor_0 node2" -> "probe_complete node2" [ style = bold] "child_rsc2:3_monitor_0 node2" [ style=bold color="green" fontcolor="black" ] "child_rsc2:4_monitor_0 node1" -> "probe_complete node1" [ style = bold] "child_rsc2:4_monitor_0 node1" [ style=bold color="green" fontcolor="black" ] "child_rsc2:4_monitor_0 node2" -> "probe_complete node2" [ style = bold] "child_rsc2:4_monitor_0 node2" [ style=bold color="green" fontcolor="black" ] "probe_complete node1" -> "probe_complete" [ style = bold] "probe_complete node1" [ style=bold color="green" fontcolor="black" ] "probe_complete node2" -> "probe_complete" [ style = bold] "probe_complete node2" [ style=bold color="green" fontcolor="black" ] "probe_complete" -> "rsc0_start_0 node1" [ style = bold] -"probe_complete" -> "rsc1_start_0" [ style = bold] "probe_complete" -> "rsc2_start_0" [ style = bold] "probe_complete" [ style=bold color="green" fontcolor="orange" ] "rsc0_monitor_0 node1" -> "probe_complete node1" [ style = bold] "rsc0_monitor_0 node1" [ style=bold color="green" fontcolor="black" ] "rsc0_monitor_0 node2" -> "probe_complete node2" [ style = bold] "rsc0_monitor_0 node2" [ style=bold color="green" fontcolor="black" ] "rsc0_start_0 node1" [ style=bold color="green" fontcolor="black" ] -"rsc1_running_0" [ style=bold color="green" fontcolor="orange" ] -"rsc1_start_0" -> "child_rsc1:1_start_0 node2" [ style = bold] -"rsc1_start_0" -> "child_rsc1:2_start_0 node1" [ style = bold] -"rsc1_start_0" -> "rsc1_running_0" [ style = bold] -"rsc1_start_0" [ style=bold color="green" fontcolor="orange" ] "rsc2_running_0" [ style=bold color="green" fontcolor="orange" ] "rsc2_start_0" -> "child_rsc2:0_start_0 node2" [ style = bold] "rsc2_start_0" -> "child_rsc2:1_start_0 node1" [ style = bold] "rsc2_start_0" -> "rsc2_running_0" [ style = bold] "rsc2_start_0" [ style=bold color="green" fontcolor="orange" ] } diff --git a/crm/pengine/testcases/inc8.exp b/crm/pengine/testcases/inc8.exp index d5fb6d813d..db037779e1 100644 --- a/crm/pengine/testcases/inc8.exp +++ b/crm/pengine/testcases/inc8.exp @@ -1,425 +1,369 @@ - - - - - - - - - - - - - - + - - - - - - - - - - - - - - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/crm/pengine/testcases/master-demote.dot b/crm/pengine/testcases/master-demote.dot index 53b34fab40..12b863960b 100644 --- a/crm/pengine/testcases/master-demote.dot +++ b/crm/pengine/testcases/master-demote.dot @@ -1,82 +1,86 @@ digraph "g" { "all_stopped" -> "fence_node:0_stop_0 cxa1" [ style = bold] "all_stopped" -> "fence_node:1_stop_0 cxb1" [ style = bold] "all_stopped" [ style=bold color="green" fontcolor="orange" ] "cyrus_address_monitor_0 " [ style=dashed color="red" fontcolor="black" ] "fence_clone_running_0" [ style=bold color="green" fontcolor="orange" ] "fence_clone_start_0" -> "fence_clone_running_0" [ style = bold] "fence_clone_start_0" -> "fence_node:0_start_0 cxa1" [ style = bold] "fence_clone_start_0" -> "fence_node:1_start_0 cxb1" [ style = bold] "fence_clone_start_0" [ style=bold color="green" fontcolor="orange" ] "fence_clone_stop_0" -> "fence_clone_start_0" [ style = bold] "fence_clone_stop_0" -> "fence_clone_stopped_0" [ style = bold] "fence_clone_stop_0" -> "fence_node:0_stop_0 cxa1" [ style = bold] "fence_clone_stop_0" -> "fence_node:1_stop_0 cxb1" [ style = bold] "fence_clone_stop_0" [ style=bold color="green" fontcolor="orange" ] "fence_clone_stopped_0" -> "fence_clone_start_0" [ style = bold] "fence_clone_stopped_0" [ style=bold color="green" fontcolor="orange" ] "fence_node:0_monitor_300000 cxa1" [ style=bold color="green" fontcolor="black" ] "fence_node:0_start_0 cxa1" -> "fence_clone_running_0" [ style = bold] "fence_node:0_start_0 cxa1" -> "fence_node:0_monitor_300000 cxa1" [ style = bold] "fence_node:0_start_0 cxa1" [ style=bold color="green" fontcolor="black" ] "fence_node:0_stop_0 cxa1" -> "fence_clone_stopped_0" [ style = bold] "fence_node:0_stop_0 cxa1" -> "fence_node:0_start_0 cxa1" [ style = bold] "fence_node:0_stop_0 cxa1" [ style=bold color="green" fontcolor="black" ] "fence_node:1_monitor_300000 cxb1" [ style=bold color="green" fontcolor="black" ] "fence_node:1_start_0 cxb1" -> "fence_clone_running_0" [ style = bold] "fence_node:1_start_0 cxb1" -> "fence_node:1_monitor_300000 cxb1" [ style = bold] "fence_node:1_start_0 cxb1" [ style=bold color="green" fontcolor="black" ] "fence_node:1_stop_0 cxb1" -> "fence_clone_stopped_0" [ style = bold] "fence_node:1_stop_0 cxb1" -> "fence_node:1_start_0 cxb1" [ style = bold] "fence_node:1_stop_0 cxb1" [ style=bold color="green" fontcolor="black" ] "named_address_monitor_0 " [ style=dashed color="red" fontcolor="black" ] "named_address_start_0 cxb1" -> "named_drbd_promote_0" [ style = bold] "named_address_start_0 cxb1" [ style=bold color="green" fontcolor="black" ] "named_address_stop_0 cxa1" -> "all_stopped" [ style = bold] "named_address_stop_0 cxa1" -> "named_address_start_0 cxb1" [ style = bold] "named_address_stop_0 cxa1" [ style=bold color="green" fontcolor="black" ] -"named_drbd_confirmed-post_notify_demote_0" -> "named_address_stop_0 cxa1" [ style = bold] -"named_drbd_confirmed-post_notify_demote_0" -> "named_drbd_node:0_monitor_10000 cxb1" [ style = bold] -"named_drbd_confirmed-post_notify_demote_0" [ style=bold color="green" fontcolor="orange" ] "named_drbd_confirmed-post_notify_promote_0" -> "named_drbd_node:0_monitor_10000 cxb1" [ style = bold] "named_drbd_confirmed-post_notify_promote_0" [ style=bold color="green" fontcolor="orange" ] +"named_drbd_confirmed-post_notify_stop_0" -> "named_drbd_node:0_monitor_10000 cxb1" [ style = bold] +"named_drbd_confirmed-post_notify_stop_0" [ style=bold color="green" fontcolor="orange" ] "named_drbd_confirmed-pre_notify_promote_0" -> "named_drbd_promote_0" [ style = bold] "named_drbd_confirmed-pre_notify_promote_0" [ style=bold color="green" fontcolor="orange" ] -"named_drbd_node:0_demote_0 cxb1" -> "named_address_stop_0 cxa1" [ style = bold] -"named_drbd_node:0_demote_0 cxb1" -> "named_drbd_node:0_promote_0 cxb1" [ style = bold] -"named_drbd_node:0_demote_0 cxb1" [ style=bold color="green" fontcolor="black" ] +"named_drbd_confirmed-pre_notify_stop_0" -> "named_drbd_stop_0" [ style = bold] +"named_drbd_confirmed-pre_notify_stop_0" [ style=bold color="green" fontcolor="orange" ] "named_drbd_node:0_monitor_10000 cxb1" [ style=bold color="green" fontcolor="black" ] -"named_drbd_node:0_post_notify_demote_0 cxb1" -> "named_drbd_confirmed-post_notify_demote_0" [ style = bold] -"named_drbd_node:0_post_notify_demote_0 cxb1" [ style=bold color="green" fontcolor="black" ] "named_drbd_node:0_post_notify_promote_0 cxb1" -> "named_drbd_confirmed-post_notify_promote_0" [ style = bold] "named_drbd_node:0_post_notify_promote_0 cxb1" [ style=bold color="green" fontcolor="black" ] +"named_drbd_node:0_post_notify_stop_0 cxb1" -> "named_drbd_confirmed-post_notify_stop_0" [ style = bold] +"named_drbd_node:0_post_notify_stop_0 cxb1" [ style=bold color="green" fontcolor="black" ] "named_drbd_node:0_pre_notify_promote_0 cxb1" -> "named_drbd_confirmed-pre_notify_promote_0" [ style = bold] "named_drbd_node:0_pre_notify_promote_0 cxb1" [ style=bold color="green" fontcolor="black" ] +"named_drbd_node:0_pre_notify_stop_0 cxb1" -> "named_drbd_confirmed-pre_notify_stop_0" [ style = bold] +"named_drbd_node:0_pre_notify_stop_0 cxb1" [ style=bold color="green" fontcolor="black" ] "named_drbd_node:0_promote_0 cxb1" -> "named_drbd_node:0_monitor_10000 cxb1" [ style = bold] "named_drbd_node:0_promote_0 cxb1" -> "named_drbd_promoted_0" [ style = bold] "named_drbd_node:0_promote_0 cxb1" [ style=bold color="green" fontcolor="black" ] -"named_drbd_node:1_demote_0 cxa1" -> "named_address_stop_0 cxa1" [ style = bold] -"named_drbd_node:1_demote_0 cxa1" [ style=bold color="green" fontcolor="black" ] -"named_drbd_node:1_post_notify_demote_0 cxa1" -> "named_drbd_confirmed-post_notify_demote_0" [ style = bold] -"named_drbd_node:1_post_notify_demote_0 cxa1" [ style=bold color="green" fontcolor="black" ] -"named_drbd_node:1_post_notify_promote_0 cxa1" -> "named_drbd_confirmed-post_notify_promote_0" [ style = bold] -"named_drbd_node:1_post_notify_promote_0 cxa1" [ style=bold color="green" fontcolor="black" ] -"named_drbd_node:1_pre_notify_promote_0 cxa1" -> "named_drbd_confirmed-pre_notify_promote_0" [ style = bold] -"named_drbd_node:1_pre_notify_promote_0 cxa1" [ style=bold color="green" fontcolor="black" ] -"named_drbd_post_notify_demote_0" -> "named_drbd_confirmed-post_notify_demote_0" [ style = bold] -"named_drbd_post_notify_demote_0" -> "named_drbd_node:0_post_notify_demote_0 cxb1" [ style = bold] -"named_drbd_post_notify_demote_0" -> "named_drbd_node:1_post_notify_demote_0 cxa1" [ style = bold] -"named_drbd_post_notify_demote_0" [ style=bold color="green" fontcolor="orange" ] +"named_drbd_node:1_pre_notify_stop_0 cxa1" -> "named_drbd_confirmed-pre_notify_stop_0" [ style = bold] +"named_drbd_node:1_pre_notify_stop_0 cxa1" [ style=bold color="green" fontcolor="black" ] +"named_drbd_node:1_stop_0 cxa1" -> "all_stopped" [ style = bold] +"named_drbd_node:1_stop_0 cxa1" -> "named_drbd_stopped_0" [ style = bold] +"named_drbd_node:1_stop_0 cxa1" [ style=bold color="green" fontcolor="black" ] "named_drbd_post_notify_promote_0" -> "named_drbd_confirmed-post_notify_promote_0" [ style = bold] "named_drbd_post_notify_promote_0" -> "named_drbd_node:0_post_notify_promote_0 cxb1" [ style = bold] -"named_drbd_post_notify_promote_0" -> "named_drbd_node:1_post_notify_promote_0 cxa1" [ style = bold] "named_drbd_post_notify_promote_0" [ style=bold color="green" fontcolor="orange" ] +"named_drbd_post_notify_stop_0" -> "named_drbd_confirmed-post_notify_stop_0" [ style = bold] +"named_drbd_post_notify_stop_0" -> "named_drbd_node:0_post_notify_stop_0 cxb1" [ style = bold] +"named_drbd_post_notify_stop_0" [ style=bold color="green" fontcolor="orange" ] "named_drbd_pre_notify_promote_0" -> "named_drbd_confirmed-pre_notify_promote_0" [ style = bold] "named_drbd_pre_notify_promote_0" -> "named_drbd_node:0_pre_notify_promote_0 cxb1" [ style = bold] -"named_drbd_pre_notify_promote_0" -> "named_drbd_node:1_pre_notify_promote_0 cxa1" [ style = bold] "named_drbd_pre_notify_promote_0" [ style=bold color="green" fontcolor="orange" ] +"named_drbd_pre_notify_stop_0" -> "named_drbd_confirmed-pre_notify_stop_0" [ style = bold] +"named_drbd_pre_notify_stop_0" -> "named_drbd_node:0_pre_notify_stop_0 cxb1" [ style = bold] +"named_drbd_pre_notify_stop_0" -> "named_drbd_node:1_pre_notify_stop_0 cxa1" [ style = bold] +"named_drbd_pre_notify_stop_0" [ style=bold color="green" fontcolor="orange" ] "named_drbd_promote_0" -> "named_drbd_node:0_promote_0 cxb1" [ style = bold] "named_drbd_promote_0" [ style=bold color="green" fontcolor="orange" ] "named_drbd_promoted_0" -> "named_drbd_post_notify_promote_0" [ style = bold] "named_drbd_promoted_0" [ style=bold color="green" fontcolor="orange" ] +"named_drbd_stop_0" -> "named_drbd_node:1_stop_0 cxa1" [ style = bold] +"named_drbd_stop_0" -> "named_drbd_stopped_0" [ style = bold] +"named_drbd_stop_0" [ style=bold color="green" fontcolor="orange" ] +"named_drbd_stopped_0" -> "named_drbd_post_notify_stop_0" [ style = bold] +"named_drbd_stopped_0" -> "named_drbd_promote_0" [ style = bold] +"named_drbd_stopped_0" [ style=bold color="green" fontcolor="orange" ] } diff --git a/crm/pengine/testcases/master-demote.exp b/crm/pengine/testcases/master-demote.exp index fefbc21aa9..e8e69a5013 100644 --- a/crm/pengine/testcases/master-demote.exp +++ b/crm/pengine/testcases/master-demote.exp @@ -1,436 +1,459 @@ - - - - - - - - - - - + - + - + - + + + + + - + - + - + + + + - + - + - + - - - - - - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + - + - + - + - + - - - - + + + - + - - - - + + + - + + + + - - + + + + + + + + + + - + - + + + + - + - - + + - + - + - - + + - + + + + + + + + - + - - + + - + - + - + - + - - + + - + - + + + + + + + + + - + - + - - - - + - + - - + + - + + + + + - + - - + + - + - - - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + diff --git a/crm/pengine/testcases/master-demote.xml b/crm/pengine/testcases/master-demote.xml index 34524b7b78..2d2a17b8ff 100644 --- a/crm/pengine/testcases/master-demote.xml +++ b/crm/pengine/testcases/master-demote.xml @@ -1,424 +1,424 @@ - + diff --git a/crm/pengine/testcases/master-ordering.dot b/crm/pengine/testcases/master-ordering.dot index e7fb096ebe..6538049bb6 100644 --- a/crm/pengine/testcases/master-ordering.dot +++ b/crm/pengine/testcases/master-ordering.dot @@ -1,120 +1,91 @@ digraph "g" { "apache2:0_monitor_0 webcluster01" -> "probe_complete webcluster01" [ style = bold] "apache2:0_monitor_0 webcluster01" [ style=bold color="green" fontcolor="black" ] -"apache2:0_monitor_60000 webcluster01" [ style=dashed color="red" fontcolor="black" ] -"apache2:0_start_0 webcluster01" -> "apache2:0_monitor_60000 webcluster01" [ style = dashed] -"apache2:0_start_0 webcluster01" -> "group_webservice:0_running_0" [ style = dashed] -"apache2:0_start_0 webcluster01" -> "mysql-proxy:0_start_0 webcluster01" [ style = dashed] -"apache2:0_start_0 webcluster01" [ style=dashed color="red" fontcolor="black" ] "apache2:1_monitor_0 webcluster01" -> "probe_complete webcluster01" [ style = bold] "apache2:1_monitor_0 webcluster01" [ style=bold color="green" fontcolor="black" ] -"clone_ocfs2_www_running_0" -> "clone_webservice_start_0" [ style = dashed] -"clone_ocfs2_www_running_0" [ style=dashed color="red" fontcolor="orange" ] -"clone_ocfs2_www_start_0" -> "clone_ocfs2_www_running_0" [ style = dashed] -"clone_ocfs2_www_start_0" -> "ocfs2_www:1_start_0 webcluster01" [ style = dashed] -"clone_ocfs2_www_start_0" [ style=dashed color="red" fontcolor="orange" ] -"clone_webservice_running_0" [ style=dashed color="red" fontcolor="orange" ] -"clone_webservice_start_0" -> "clone_webservice_running_0" [ style = dashed] -"clone_webservice_start_0" -> "group_webservice:0_start_0" [ style = dashed] -"clone_webservice_start_0" [ style=dashed color="red" fontcolor="orange" ] "drbd_mysql:0_monitor_0 webcluster01" -> "probe_complete webcluster01" [ style = bold] "drbd_mysql:0_monitor_0 webcluster01" [ style=bold color="green" fontcolor="black" ] "drbd_mysql:0_post_notify_start_0 webcluster01" -> "ms_drbd_mysql_confirmed-post_notify_start_0" [ style = bold] "drbd_mysql:0_post_notify_start_0 webcluster01" [ style=bold color="green" fontcolor="black" ] "drbd_mysql:0_start_0 webcluster01" -> "ms_drbd_mysql_running_0" [ style = bold] "drbd_mysql:0_start_0 webcluster01" [ style=bold color="green" fontcolor="black" ] "drbd_www:0_monitor_0 webcluster01" -> "probe_complete webcluster01" [ style = bold] "drbd_www:0_monitor_0 webcluster01" [ style=bold color="green" fontcolor="black" ] "drbd_www:0_post_notify_start_0 webcluster01" -> "ms_drbd_www_confirmed-post_notify_start_0" [ style = bold] "drbd_www:0_post_notify_start_0 webcluster01" [ style=bold color="green" fontcolor="black" ] "drbd_www:0_start_0 webcluster01" -> "ms_drbd_www_running_0" [ style = bold] "drbd_www:0_start_0 webcluster01" [ style=bold color="green" fontcolor="black" ] "extip_1_monitor_0 webcluster01" -> "probe_complete webcluster01" [ style = bold] "extip_1_monitor_0 webcluster01" [ style=bold color="green" fontcolor="black" ] "extip_1_monitor_30000 webcluster01" [ style=bold color="green" fontcolor="black" ] "extip_1_start_0 webcluster01" -> "extip_1_monitor_30000 webcluster01" [ style = bold] "extip_1_start_0 webcluster01" [ style=bold color="green" fontcolor="black" ] "extip_2_monitor_0 webcluster01" -> "probe_complete webcluster01" [ style = bold] "extip_2_monitor_0 webcluster01" [ style=bold color="green" fontcolor="black" ] "extip_2_monitor_30000 webcluster01" [ style=bold color="green" fontcolor="black" ] "extip_2_start_0 webcluster01" -> "extip_2_monitor_30000 webcluster01" [ style = bold] "extip_2_start_0 webcluster01" [ style=bold color="green" fontcolor="black" ] "fs_mysql_monitor_0 webcluster01" -> "probe_complete webcluster01" [ style = bold] "fs_mysql_monitor_0 webcluster01" [ style=bold color="green" fontcolor="black" ] -"group_webservice:0_running_0" -> "clone_webservice_running_0" [ style = dashed] -"group_webservice:0_running_0" [ style=dashed color="red" fontcolor="orange" ] -"group_webservice:0_start_0" -> "apache2:0_start_0 webcluster01" [ style = dashed] -"group_webservice:0_start_0" -> "group_webservice:0_running_0" [ style = dashed] -"group_webservice:0_start_0" [ style=dashed color="red" fontcolor="orange" ] "intip_0_main_monitor_0 webcluster01" -> "probe_complete webcluster01" [ style = bold] "intip_0_main_monitor_0 webcluster01" [ style=bold color="green" fontcolor="black" ] "intip_1_master_monitor_0 webcluster01" -> "probe_complete webcluster01" [ style = bold] "intip_1_master_monitor_0 webcluster01" [ style=bold color="green" fontcolor="black" ] "intip_1_master_monitor_30000 webcluster01" [ style=bold color="green" fontcolor="black" ] "intip_1_master_start_0 webcluster01" -> "intip_1_master_monitor_30000 webcluster01" [ style = bold] "intip_1_master_start_0 webcluster01" -> "ms_drbd_mysql_start_0" [ style = bold] "intip_1_master_start_0 webcluster01" -> "ms_drbd_www_start_0" [ style = bold] "intip_1_master_start_0 webcluster01" [ style=bold color="green" fontcolor="black" ] "intip_2_slave_monitor_0 webcluster01" -> "probe_complete webcluster01" [ style = bold] "intip_2_slave_monitor_0 webcluster01" [ style=bold color="green" fontcolor="black" ] "intip_2_slave_monitor_30000 webcluster01" [ style=bold color="green" fontcolor="black" ] "intip_2_slave_start_0 webcluster01" -> "intip_2_slave_monitor_30000 webcluster01" [ style = bold] "intip_2_slave_start_0 webcluster01" -> "ms_drbd_mysql_start_0" [ style = bold] "intip_2_slave_start_0 webcluster01" -> "ms_drbd_www_start_0" [ style = bold] "intip_2_slave_start_0 webcluster01" [ style=bold color="green" fontcolor="black" ] "ms_drbd_mysql_confirmed-post_notify_start_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_mysql_confirmed-pre_notify_start_0" -> "ms_drbd_mysql_start_0" [ style = bold] "ms_drbd_mysql_confirmed-pre_notify_start_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_mysql_post_notify_start_0" -> "drbd_mysql:0_post_notify_start_0 webcluster01" [ style = bold] "ms_drbd_mysql_post_notify_start_0" -> "ms_drbd_mysql_confirmed-post_notify_start_0" [ style = bold] "ms_drbd_mysql_post_notify_start_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_mysql_pre_notify_start_0" -> "ms_drbd_mysql_confirmed-pre_notify_start_0" [ style = bold] "ms_drbd_mysql_pre_notify_start_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_mysql_running_0" -> "ms_drbd_mysql_post_notify_start_0" [ style = bold] "ms_drbd_mysql_running_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_mysql_start_0" -> "drbd_mysql:0_start_0 webcluster01" [ style = bold] "ms_drbd_mysql_start_0" -> "ms_drbd_mysql_running_0" [ style = bold] "ms_drbd_mysql_start_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_www_confirmed-post_notify_start_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_www_confirmed-pre_notify_start_0" -> "ms_drbd_www_start_0" [ style = bold] "ms_drbd_www_confirmed-pre_notify_start_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_www_post_notify_start_0" -> "drbd_www:0_post_notify_start_0 webcluster01" [ style = bold] "ms_drbd_www_post_notify_start_0" -> "ms_drbd_www_confirmed-post_notify_start_0" [ style = bold] "ms_drbd_www_post_notify_start_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_www_pre_notify_start_0" -> "ms_drbd_www_confirmed-pre_notify_start_0" [ style = bold] "ms_drbd_www_pre_notify_start_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_www_running_0" -> "ms_drbd_www_post_notify_start_0" [ style = bold] "ms_drbd_www_running_0" [ style=bold color="green" fontcolor="orange" ] "ms_drbd_www_start_0" -> "drbd_www:0_start_0 webcluster01" [ style = bold] "ms_drbd_www_start_0" -> "ms_drbd_www_running_0" [ style = bold] "ms_drbd_www_start_0" [ style=bold color="green" fontcolor="orange" ] "mysql-proxy:0_monitor_0 webcluster01" -> "probe_complete webcluster01" [ style = bold] "mysql-proxy:0_monitor_0 webcluster01" [ style=bold color="green" fontcolor="black" ] -"mysql-proxy:0_monitor_10000 webcluster01" [ style=dashed color="red" fontcolor="black" ] -"mysql-proxy:0_start_0 webcluster01" -> "group_webservice:0_running_0" [ style = dashed] -"mysql-proxy:0_start_0 webcluster01" -> "mysql-proxy:0_monitor_10000 webcluster01" [ style = dashed] -"mysql-proxy:0_start_0 webcluster01" [ style=dashed color="red" fontcolor="black" ] "mysql-proxy:1_monitor_0 webcluster01" -> "probe_complete webcluster01" [ style = bold] "mysql-proxy:1_monitor_0 webcluster01" [ style=bold color="green" fontcolor="black" ] "mysql-server_monitor_0 webcluster01" -> "probe_complete webcluster01" [ style = bold] "mysql-server_monitor_0 webcluster01" [ style=bold color="green" fontcolor="black" ] "ocfs2_www:0_monitor_0 webcluster01" -> "probe_complete webcluster01" [ style = bold] "ocfs2_www:0_monitor_0 webcluster01" [ style=bold color="green" fontcolor="black" ] "ocfs2_www:1_monitor_0 webcluster01" -> "probe_complete webcluster01" [ style = bold] "ocfs2_www:1_monitor_0 webcluster01" [ style=bold color="green" fontcolor="black" ] -"ocfs2_www:1_monitor_120000 webcluster01" [ style=dashed color="red" fontcolor="black" ] -"ocfs2_www:1_start_0 webcluster01" -> "clone_ocfs2_www_running_0" [ style = dashed] -"ocfs2_www:1_start_0 webcluster01" -> "ocfs2_www:1_monitor_120000 webcluster01" [ style = dashed] -"ocfs2_www:1_start_0 webcluster01" [ style=dashed color="red" fontcolor="black" ] "probe_complete webcluster01" -> "probe_complete" [ style = bold] "probe_complete webcluster01" [ style=bold color="green" fontcolor="black" ] -"probe_complete" -> "clone_ocfs2_www_start_0" [ style = dashed] -"probe_complete" -> "clone_webservice_start_0" [ style = dashed] "probe_complete" -> "extip_1_start_0 webcluster01" [ style = bold] "probe_complete" -> "extip_2_start_0 webcluster01" [ style = bold] "probe_complete" -> "intip_1_master_start_0 webcluster01" [ style = bold] "probe_complete" -> "intip_2_slave_start_0 webcluster01" [ style = bold] "probe_complete" -> "ms_drbd_mysql_start_0" [ style = bold] "probe_complete" -> "ms_drbd_www_start_0" [ style = bold] "probe_complete" [ style=bold color="green" fontcolor="orange" ] } diff --git a/crm/pengine/testcases/master-ordering.exp b/crm/pengine/testcases/master-ordering.exp index 4df2c11721..177d61ab0b 100644 --- a/crm/pengine/testcases/master-ordering.exp +++ b/crm/pengine/testcases/master-ordering.exp @@ -1,526 +1,526 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/crm/pengine/testcases/novell-239082.dot b/crm/pengine/testcases/novell-239082.dot index 1f6493d825..eb391508df 100644 --- a/crm/pengine/testcases/novell-239082.dot +++ b/crm/pengine/testcases/novell-239082.dot @@ -1,87 +1,88 @@ digraph "g" { "all_stopped" [ style=bold color="green" fontcolor="orange" ] "do_shutdown xen-1" [ style=bold color="green" fontcolor="black" ] "drbd0:0_post_notify_demote_0 xen-2" -> "ms-drbd0_confirmed-post_notify_demote_0" [ style = bold] "drbd0:0_post_notify_demote_0 xen-2" [ style=bold color="green" fontcolor="black" ] "drbd0:0_post_notify_promote_0 xen-2" -> "ms-drbd0_confirmed-post_notify_promote_0" [ style = bold] "drbd0:0_post_notify_promote_0 xen-2" [ style=bold color="green" fontcolor="black" ] "drbd0:0_post_notify_stop_0 xen-2" -> "ms-drbd0_confirmed-post_notify_stop_0" [ style = bold] "drbd0:0_post_notify_stop_0 xen-2" [ style=bold color="green" fontcolor="black" ] "drbd0:0_pre_notify_demote_0 xen-2" -> "ms-drbd0_confirmed-pre_notify_demote_0" [ style = bold] "drbd0:0_pre_notify_demote_0 xen-2" [ style=bold color="green" fontcolor="black" ] "drbd0:0_pre_notify_promote_0 xen-2" -> "ms-drbd0_confirmed-pre_notify_promote_0" [ style = bold] "drbd0:0_pre_notify_promote_0 xen-2" [ style=bold color="green" fontcolor="black" ] "drbd0:0_pre_notify_stop_0 xen-2" -> "ms-drbd0_confirmed-pre_notify_stop_0" [ style = bold] "drbd0:0_pre_notify_stop_0 xen-2" [ style=bold color="green" fontcolor="black" ] "drbd0:0_promote_0 xen-2" -> "ms-drbd0_promoted_0" [ style = bold] "drbd0:0_promote_0 xen-2" [ style=bold color="green" fontcolor="black" ] "drbd0:1_demote_0 xen-1" -> "drbd0:1_stop_0 xen-1" [ style = bold] "drbd0:1_demote_0 xen-1" -> "ms-drbd0_demoted_0" [ style = bold] "drbd0:1_demote_0 xen-1" [ style=bold color="green" fontcolor="black" ] "drbd0:1_post_notify_demote_0 xen-1" -> "ms-drbd0_confirmed-post_notify_demote_0" [ style = bold] "drbd0:1_post_notify_demote_0 xen-1" [ style=bold color="green" fontcolor="black" ] "drbd0:1_pre_notify_demote_0 xen-1" -> "ms-drbd0_confirmed-pre_notify_demote_0" [ style = bold] "drbd0:1_pre_notify_demote_0 xen-1" [ style=bold color="green" fontcolor="black" ] "drbd0:1_pre_notify_stop_0 xen-1" -> "ms-drbd0_confirmed-pre_notify_stop_0" [ style = bold] "drbd0:1_pre_notify_stop_0 xen-1" [ style=bold color="green" fontcolor="black" ] "drbd0:1_stop_0 xen-1" -> "all_stopped" [ style = bold] "drbd0:1_stop_0 xen-1" -> "do_shutdown xen-1" [ style = bold] "drbd0:1_stop_0 xen-1" -> "ms-drbd0_stopped_0" [ style = bold] "drbd0:1_stop_0 xen-1" [ style=bold color="green" fontcolor="black" ] "fs_1_start_0 xen-2" [ style=bold color="green" fontcolor="black" ] "fs_1_stop_0 xen-1" -> "all_stopped" [ style = bold] "fs_1_stop_0 xen-1" -> "do_shutdown xen-1" [ style = bold] "fs_1_stop_0 xen-1" -> "fs_1_start_0 xen-2" [ style = bold] "fs_1_stop_0 xen-1" -> "ms-drbd0_demote_0" [ style = bold] "fs_1_stop_0 xen-1" [ style=bold color="green" fontcolor="black" ] "ms-drbd0_confirmed-post_notify_demote_0" -> "ms-drbd0_pre_notify_stop_0" [ style = bold] "ms-drbd0_confirmed-post_notify_demote_0" -> "ms-drbd0_stop_0" [ style = bold] "ms-drbd0_confirmed-post_notify_demote_0" [ style=bold color="green" fontcolor="orange" ] "ms-drbd0_confirmed-post_notify_promote_0" -> "fs_1_start_0 xen-2" [ style = bold] "ms-drbd0_confirmed-post_notify_promote_0" [ style=bold color="green" fontcolor="orange" ] "ms-drbd0_confirmed-post_notify_stop_0" [ style=bold color="green" fontcolor="orange" ] "ms-drbd0_confirmed-pre_notify_demote_0" -> "ms-drbd0_demote_0" [ style = bold] "ms-drbd0_confirmed-pre_notify_demote_0" [ style=bold color="green" fontcolor="orange" ] "ms-drbd0_confirmed-pre_notify_promote_0" -> "ms-drbd0_promote_0" [ style = bold] "ms-drbd0_confirmed-pre_notify_promote_0" [ style=bold color="green" fontcolor="orange" ] "ms-drbd0_confirmed-pre_notify_stop_0" -> "ms-drbd0_stop_0" [ style = bold] "ms-drbd0_confirmed-pre_notify_stop_0" [ style=bold color="green" fontcolor="orange" ] "ms-drbd0_demote_0" -> "drbd0:1_demote_0 xen-1" [ style = bold] "ms-drbd0_demote_0" -> "ms-drbd0_demoted_0" [ style = bold] "ms-drbd0_demote_0" -> "ms-drbd0_stop_0" [ style = bold] "ms-drbd0_demote_0" [ style=bold color="green" fontcolor="orange" ] "ms-drbd0_demoted_0" -> "ms-drbd0_post_notify_demote_0" [ style = bold] "ms-drbd0_demoted_0" -> "ms-drbd0_promote_0" [ style = bold] "ms-drbd0_demoted_0" -> "ms-drbd0_stop_0" [ style = bold] "ms-drbd0_demoted_0" [ style=bold color="green" fontcolor="orange" ] "ms-drbd0_post_notify_demote_0" -> "drbd0:0_post_notify_demote_0 xen-2" [ style = bold] "ms-drbd0_post_notify_demote_0" -> "drbd0:1_post_notify_demote_0 xen-1" [ style = bold] "ms-drbd0_post_notify_demote_0" -> "ms-drbd0_confirmed-post_notify_demote_0" [ style = bold] "ms-drbd0_post_notify_demote_0" [ style=bold color="green" fontcolor="orange" ] "ms-drbd0_post_notify_promote_0" -> "drbd0:0_post_notify_promote_0 xen-2" [ style = bold] "ms-drbd0_post_notify_promote_0" -> "ms-drbd0_confirmed-post_notify_promote_0" [ style = bold] "ms-drbd0_post_notify_promote_0" [ style=bold color="green" fontcolor="orange" ] "ms-drbd0_post_notify_stop_0" -> "drbd0:0_post_notify_stop_0 xen-2" [ style = bold] "ms-drbd0_post_notify_stop_0" -> "ms-drbd0_confirmed-post_notify_stop_0" [ style = bold] "ms-drbd0_post_notify_stop_0" [ style=bold color="green" fontcolor="orange" ] "ms-drbd0_pre_notify_demote_0" -> "drbd0:0_pre_notify_demote_0 xen-2" [ style = bold] "ms-drbd0_pre_notify_demote_0" -> "drbd0:1_pre_notify_demote_0 xen-1" [ style = bold] "ms-drbd0_pre_notify_demote_0" -> "ms-drbd0_confirmed-pre_notify_demote_0" [ style = bold] "ms-drbd0_pre_notify_demote_0" [ style=bold color="green" fontcolor="orange" ] "ms-drbd0_pre_notify_promote_0" -> "drbd0:0_pre_notify_promote_0 xen-2" [ style = bold] "ms-drbd0_pre_notify_promote_0" -> "ms-drbd0_confirmed-pre_notify_promote_0" [ style = bold] "ms-drbd0_pre_notify_promote_0" [ style=bold color="green" fontcolor="orange" ] "ms-drbd0_pre_notify_stop_0" -> "drbd0:0_pre_notify_stop_0 xen-2" [ style = bold] "ms-drbd0_pre_notify_stop_0" -> "drbd0:1_pre_notify_stop_0 xen-1" [ style = bold] "ms-drbd0_pre_notify_stop_0" -> "ms-drbd0_confirmed-pre_notify_stop_0" [ style = bold] "ms-drbd0_pre_notify_stop_0" [ style=bold color="green" fontcolor="orange" ] "ms-drbd0_promote_0" -> "drbd0:0_promote_0 xen-2" [ style = bold] "ms-drbd0_promote_0" [ style=bold color="green" fontcolor="orange" ] "ms-drbd0_promoted_0" -> "ms-drbd0_post_notify_promote_0" [ style = bold] "ms-drbd0_promoted_0" [ style=bold color="green" fontcolor="orange" ] "ms-drbd0_stop_0" -> "drbd0:1_stop_0 xen-1" [ style = bold] "ms-drbd0_stop_0" -> "ms-drbd0_stopped_0" [ style = bold] "ms-drbd0_stop_0" [ style=bold color="green" fontcolor="orange" ] "ms-drbd0_stopped_0" -> "ms-drbd0_post_notify_stop_0" [ style = bold] +"ms-drbd0_stopped_0" -> "ms-drbd0_promote_0" [ style = bold] "ms-drbd0_stopped_0" [ style=bold color="green" fontcolor="orange" ] } diff --git a/crm/pengine/testcases/novell-239082.exp b/crm/pengine/testcases/novell-239082.exp index c11c568bfd..02b2ae337f 100644 --- a/crm/pengine/testcases/novell-239082.exp +++ b/crm/pengine/testcases/novell-239082.exp @@ -1,473 +1,476 @@ + + + diff --git a/crm/pengine/utils.h b/crm/pengine/utils.h index 900a5ee064..1aaf4d6cab 100644 --- a/crm/pengine/utils.h +++ b/crm/pengine/utils.h @@ -1,68 +1,69 @@ /* * 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.1 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef PENGINE_AUTILS__H #define PENGINE_AUTILS__H /* Constraint helper functions */ extern rsc_colocation_t *invert_constraint(rsc_colocation_t *constraint); extern rsc_to_node_t *copy_constraint(rsc_to_node_t *constraint); extern void print_rsc_to_node( const char *pre_text, rsc_to_node_t *cons, gboolean details); extern void print_rsc_colocation( const char *pre_text, rsc_colocation_t *cons, gboolean details); extern rsc_to_node_t *rsc2node_new( const char *id, resource_t *rsc, int weight, node_t *node, pe_working_set_t *data_set); extern void pe_free_rsc_to_node(GListPtr constraints); extern void pe_free_ordering(GListPtr constraints); extern const char *ordering_type2text(enum pe_ordering type); extern gboolean rsc_colocation_new( const char *id, const char *node_attr, int score, resource_t *rsc_lh, resource_t *rsc_rh, - const char *state_lh, const char *state_rh); + const char *state_lh, const char *state_rh, + pe_working_set_t *data_set); extern rsc_to_node_t *generate_location_rule( resource_t *rsc, crm_data_t *location_rule, pe_working_set_t *data_set); extern gint sort_node_weight(gconstpointer a, gconstpointer b); extern gboolean can_run_resources(const node_t *node); extern gboolean native_assign_node(resource_t *rsc, GListPtr candidates, node_t *chosen); extern void convert_non_atomic_task(resource_t *rsc, order_constraint_t *order); extern void order_actions( action_t *lh_action, action_t *rh_action, enum pe_ordering order); extern void log_action(unsigned int log_level, const char *pre_text, action_t *action, gboolean details); extern resource_t *uber_parent(resource_t *rsc); extern action_t *get_pseudo_op(const char *name, pe_working_set_t *data_set); extern gboolean can_run_any(GListPtr nodes); #define STONITH_UP "stonith_up" #define ALL_STOPPED "all_stopped" #endif diff --git a/include/crm/pengine/status.h b/include/crm/pengine/status.h index 764c7eb8a7..f7e2f8a016 100644 --- a/include/crm/pengine/status.h +++ b/include/crm/pengine/status.h @@ -1,220 +1,221 @@ /* * 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.1 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef PENGINE_STATUS__H #define PENGINE_STATUS__H #include #include #include typedef struct node_s node_t; typedef struct action_s action_t; typedef struct resource_s resource_t; typedef enum no_quorum_policy_e { no_quorum_freeze, no_quorum_stop, no_quorum_ignore } no_quorum_policy_t; enum node_type { node_ping, node_member }; enum pe_restart { pe_restart_restart, pe_restart_ignore }; typedef struct pe_working_set_s { crm_data_t *input; ha_time_t *now; /* options extracted from the input */ char *transition_idle_timeout; char *dc_uuid; node_t *dc_node; gboolean have_quorum; gboolean stonith_enabled; const char *stonith_action; gboolean symmetric_cluster; gboolean is_managed_default; gboolean remove_after_stop; gboolean stop_rsc_orphans; gboolean stop_action_orphans; int default_resource_stickiness; int default_resource_fail_stickiness; no_quorum_policy_t no_quorum_policy; GHashTable *config_hash; GListPtr nodes; GListPtr resources; GListPtr placement_constraints; GListPtr ordering_constraints; + GListPtr colocation_constraints; GListPtr actions; crm_data_t *failed; /* stats */ int num_synapse; int max_valid_nodes; int order_id; int action_id; /* final output */ crm_data_t *graph; } pe_working_set_t; struct node_shared_s { const char *id; const char *uname; gboolean online; gboolean standby; gboolean unclean; gboolean shutdown; gboolean expected_up; gboolean is_dc; int num_resources; GListPtr running_rsc; /* resource_t* */ GListPtr allocated_rsc; /* resource_t* */ GHashTable *attrs; /* char* => char* */ enum node_type type; }; struct node_s { int weight; gboolean fixed; int count; struct node_shared_s *details; }; #include struct resource_s { char *id; char *clone_name; char *long_name; crm_data_t *xml; crm_data_t *ops_xml; resource_t *parent; void *variant_opaque; enum pe_obj_types variant; resource_object_functions_t *fns; resource_alloc_functions_t *cmds; enum rsc_recovery_type recovery_type; enum pe_restart restart_type; int priority; int stickiness; int sort_index; int fail_stickiness; int effective_priority; gboolean notify; gboolean is_managed; gboolean can_migrate; gboolean starting; gboolean stopping; gboolean runnable; gboolean provisional; gboolean globally_unique; gboolean is_allocating; gboolean is_merging; gboolean failed; gboolean start_pending; gboolean orphan; GListPtr rsc_cons_lhs; /* rsc_colocation_t* */ GListPtr rsc_cons; /* rsc_colocation_t* */ GListPtr rsc_location; /* rsc_to_node_t* */ GListPtr actions; /* action_t* */ node_t *allocated_to; GListPtr running_on; /* node_t* */ GListPtr known_on; /* node_t* */ GListPtr allowed_nodes; /* node_t* */ enum rsc_role_e role; enum rsc_role_e next_role; GHashTable *meta; GHashTable *parameters; GListPtr children; /* resource_t* */ }; struct action_s { int id; int priority; resource_t *rsc; void *rsc_opaque; node_t *node; char *task; char *uuid; crm_data_t *op_entry; gboolean pseudo; gboolean runnable; gboolean optional; gboolean failure_is_fatal; gboolean implied_by_stonith; gboolean allow_reload_conversion; enum rsc_start_requirement needs; enum action_fail_response on_fail; enum rsc_role_e fail_role; gboolean dumped; gboolean processed; action_t *pre_notify; action_t *pre_notified; action_t *post_notify; action_t *post_notified; int seen_count; GHashTable *meta; GHashTable *extra; GHashTable *notify_keys; /* do NOT free */ GListPtr actions_before; /* action_warpper_t* */ GListPtr actions_after; /* action_warpper_t* */ }; gboolean cluster_status(pe_working_set_t *data_set); extern void set_working_set_defaults(pe_working_set_t *data_set); extern void cleanup_calculations(pe_working_set_t *data_set); extern resource_t *pe_find_resource(GListPtr rsc_list, const char *id_rh); extern node_t *pe_find_node(GListPtr node_list, const char *uname); extern node_t *pe_find_node_id(GListPtr node_list, const char *id); #endif diff --git a/lib/crm/pengine/complex.c b/lib/crm/pengine/complex.c index 587dd4f126..7e0ad47726 100644 --- a/lib/crm/pengine/complex.c +++ b/lib/crm/pengine/complex.c @@ -1,406 +1,406 @@ /* * 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.1 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include void populate_hash(crm_data_t *nvpair_list, GHashTable *hash, const char **attrs, int attrs_length); resource_object_functions_t resource_class_functions[] = { { native_unpack, native_find_child, native_children, native_parameter, native_print, native_active, native_resource_state, native_free }, { group_unpack, native_find_child, native_children, native_parameter, group_print, group_active, group_resource_state, group_free }, { clone_unpack, native_find_child, native_children, native_parameter, clone_print, clone_active, clone_resource_state, clone_free }, { master_unpack, native_find_child, native_children, native_parameter, clone_print, clone_active, clone_resource_state, clone_free } }; int get_resource_type(const char *name) { if(safe_str_eq(name, XML_CIB_TAG_RESOURCE)) { return pe_native; } else if(safe_str_eq(name, XML_CIB_TAG_GROUP)) { return pe_group; } else if(safe_str_eq(name, XML_CIB_TAG_INCARNATION)) { return pe_clone; } else if(safe_str_eq(name, XML_CIB_TAG_MASTER)) { return pe_master; } return pe_unknown; } static void dup_attr(gpointer key, gpointer value, gpointer user_data) { add_hash_param(user_data, key, value); } void get_meta_attributes(GHashTable *meta_hash, resource_t *rsc, node_t *node, pe_working_set_t *data_set) { GHashTable *node_hash = NULL; if(node) { node_hash = node->details->attrs; } xml_prop_iter(rsc->xml, prop_name, prop_value, add_hash_param(meta_hash, prop_name, prop_value); ); unpack_instance_attributes(rsc->xml, XML_TAG_META_SETS, node_hash, meta_hash, NULL, data_set->now); /* populate from the regular attributes until the GUI can create * meta attributes */ unpack_instance_attributes(rsc->xml, XML_TAG_ATTR_SETS, node_hash, meta_hash, NULL, data_set->now); /* set anything else based on the parent */ if(rsc->parent != NULL) { g_hash_table_foreach(rsc->parent->meta, dup_attr, meta_hash); } } gboolean common_unpack(crm_data_t * xml_obj, resource_t **rsc, resource_t *parent, pe_working_set_t *data_set) { const char *value = NULL; const char *id = crm_element_value(xml_obj, XML_ATTR_ID); crm_log_xml_debug_3(xml_obj, "Processing resource input..."); if(id == NULL) { pe_err("Must specify id tag in "); return FALSE; } else if(rsc == NULL) { pe_err("Nowhere to unpack resource into"); return FALSE; } crm_malloc0(*rsc, sizeof(resource_t)); if(*rsc == NULL) { return FALSE; } (*rsc)->xml = xml_obj; (*rsc)->parent = parent; (*rsc)->ops_xml = find_xml_node(xml_obj, "operations", FALSE); (*rsc)->variant = get_resource_type(crm_element_name(xml_obj)); if((*rsc)->variant == pe_unknown) { pe_err("Unknown resource type: %s", crm_element_name(xml_obj)); crm_free(*rsc); return FALSE; } (*rsc)->parameters = g_hash_table_new_full( g_str_hash,g_str_equal, g_hash_destroy_str,g_hash_destroy_str); (*rsc)->meta = g_hash_table_new_full( g_str_hash,g_str_equal, g_hash_destroy_str,g_hash_destroy_str); value = crm_element_value(xml_obj, XML_RSC_ATTR_INCARNATION); if(value) { (*rsc)->id = crm_concat(id, value, ':'); add_hash_param((*rsc)->meta, XML_RSC_ATTR_INCARNATION, value); } else { (*rsc)->id = crm_strdup(id); } if(parent) { (*rsc)->long_name = crm_concat(parent->long_name, (*rsc)->id, ':'); } else { (*rsc)->long_name = crm_strdup((*rsc)->id); } (*rsc)->fns = &resource_class_functions[(*rsc)->variant]; crm_debug_3("Unpacking resource..."); get_meta_attributes((*rsc)->meta, *rsc, NULL, data_set); if(parent != NULL) { g_hash_table_foreach( parent->parameters, dup_attr, (*rsc)->parameters); } (*rsc)->runnable = TRUE; (*rsc)->provisional = TRUE; (*rsc)->starting = FALSE; (*rsc)->stopping = FALSE; (*rsc)->rsc_cons = NULL; (*rsc)->actions = NULL; (*rsc)->failed = FALSE; (*rsc)->start_pending = FALSE; (*rsc)->globally_unique = TRUE; (*rsc)->role = RSC_ROLE_STOPPED; (*rsc)->next_role = RSC_ROLE_UNKNOWN; (*rsc)->is_managed = data_set->is_managed_default; (*rsc)->recovery_type = recovery_stop_start; (*rsc)->stickiness = data_set->default_resource_stickiness; (*rsc)->fail_stickiness = data_set->default_resource_fail_stickiness; value = g_hash_table_lookup((*rsc)->meta, XML_CIB_ATTR_PRIORITY); (*rsc)->priority = crm_parse_int(value, "0"); (*rsc)->effective_priority = (*rsc)->priority; value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_NOTIFY); (*rsc)->notify = crm_is_true(value); value = g_hash_table_lookup((*rsc)->meta, "is_managed"); if(value != NULL && safe_str_neq("default", value)) { cl_str_to_boolean(value, &((*rsc)->is_managed)); } crm_debug_2("Options for %s", (*rsc)->id); value = g_hash_table_lookup((*rsc)->meta, "globally_unique"); if(value != NULL) { cl_str_to_boolean(value, &((*rsc)->globally_unique)); } value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_RESTART); if(safe_str_eq(value, "restart")) { (*rsc)->restart_type = pe_restart_restart; crm_debug_2("\tDependancy restart handling: restart"); } else { (*rsc)->restart_type = pe_restart_ignore; crm_debug_2("\tDependancy restart handling: ignore"); } value = g_hash_table_lookup((*rsc)->meta, "multiple_active"); if(safe_str_eq(value, "stop_only")) { (*rsc)->recovery_type = recovery_stop_only; crm_debug_2("\tMultiple running resource recovery: stop only"); } else if(safe_str_eq(value, "block")) { (*rsc)->recovery_type = recovery_block; crm_debug_2("\tMultiple running resource recovery: block"); } else { (*rsc)->recovery_type = recovery_stop_start; crm_debug_2("\tMultiple running resource recovery: stop/start"); } value = g_hash_table_lookup((*rsc)->meta, "resource_stickiness"); if(value != NULL && safe_str_neq("default", value)) { (*rsc)->stickiness = char2score(value); } value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_FAIL_STICKINESS); if(value != NULL) { (*rsc)->fail_stickiness = char2score(value); } value = g_hash_table_lookup((*rsc)->meta, XML_RSC_ATTR_TARGET_ROLE); if(value != NULL && safe_str_neq("default", value)) { (*rsc)->next_role = text2role(value); if((*rsc)->next_role == RSC_ROLE_UNKNOWN) { crm_config_err("%s: Unknown value for " XML_RSC_ATTR_TARGET_ROLE": %s", (*rsc)->id, value); } } crm_debug_2("\tDesired next state: %s", (*rsc)->next_role!=RSC_ROLE_UNKNOWN?role2text((*rsc)->next_role):"default"); if((*rsc)->fns->unpack(*rsc, data_set) == FALSE) { return FALSE; } if((*rsc)->is_managed == FALSE) { crm_warn("Resource %s is currently not managed", (*rsc)->id); } else if(data_set->symmetric_cluster) { resource_location(*rsc, NULL, 0, "symmetric_default", data_set); } crm_debug_2("\tAction notification: %s", (*rsc)->notify?"required":"not required"); /* data_set->resources = g_list_append(data_set->resources, (*rsc)); */ return TRUE; } void common_update_score(resource_t *rsc, const char *id, int score) { node_t *node = NULL; node = pe_find_node_id(rsc->allowed_nodes, id); if(node != NULL) { crm_debug_2("Updating score for %s on %s: %d + %d", rsc->id, id, node->weight, score); node->weight = merge_weights(node->weight, score); } if(rsc->children) { slist_iter( child_rsc, resource_t, rsc->children, lpc, common_update_score(child_rsc, id, score); ); } } void common_apply_stickiness(resource_t *rsc, node_t *node, pe_working_set_t *data_set) { int fail_count = 0; char *fail_attr = NULL; const char *value = NULL; GHashTable *meta_hash = NULL; if(rsc->children) { slist_iter( child_rsc, resource_t, rsc->children, lpc, common_apply_stickiness(child_rsc, node, data_set); ); return; } meta_hash = g_hash_table_new_full( g_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str); get_meta_attributes(meta_hash, rsc, node, data_set); /* update resource preferences that relate to the current node */ value = g_hash_table_lookup(meta_hash, "resource_stickiness"); if(value != NULL && safe_str_neq("default", value)) { rsc->stickiness = char2score(value); } else { rsc->stickiness = data_set->default_resource_stickiness; } value = g_hash_table_lookup(meta_hash, XML_RSC_ATTR_FAIL_STICKINESS); if(value != NULL && safe_str_neq("default", value)) { rsc->fail_stickiness = char2score(value); } else { rsc->fail_stickiness = data_set->default_resource_fail_stickiness; } /* process failure stickiness */ fail_attr = crm_concat("fail-count", rsc->id, '-'); value = g_hash_table_lookup(node->details->attrs, fail_attr); if(value != NULL) { crm_debug("%s: %s", fail_attr, value); fail_count = crm_parse_int(value, "0"); } crm_free(fail_attr); if(fail_count > 0 && rsc->fail_stickiness != 0) { resource_location(rsc, node, fail_count * rsc->fail_stickiness, "fail_stickiness", data_set); crm_info("Setting failure stickiness for %s on %s: %d", rsc->id, node->details->uname, fail_count * rsc->fail_stickiness); } g_hash_table_destroy(meta_hash); } void common_free(resource_t *rsc) { if(rsc == NULL) { return; } crm_debug_5("Freeing %s %d", rsc->id, rsc->variant); - pe_free_shallow(rsc->rsc_cons); + g_list_free(rsc->rsc_cons); g_list_free(rsc->rsc_cons_lhs); if(rsc->parameters != NULL) { g_hash_table_destroy(rsc->parameters); } if(rsc->meta != NULL) { g_hash_table_destroy(rsc->meta); } if(rsc->orphan) { free_xml(rsc->xml); } if(rsc->running_on) { g_list_free(rsc->running_on); rsc->running_on = NULL; } if(rsc->known_on) { g_list_free(rsc->known_on); rsc->known_on = NULL; } if(rsc->actions) { g_list_free(rsc->actions); rsc->actions = NULL; } pe_free_shallow_adv(rsc->rsc_location, FALSE); pe_free_shallow_adv(rsc->allowed_nodes, TRUE); crm_free(rsc->id); crm_free(rsc->long_name); crm_free(rsc->clone_name); crm_free(rsc->allocated_to); crm_free(rsc->variant_opaque); crm_free(rsc); crm_debug_5("Resource freed"); } diff --git a/lib/crm/pengine/status.c b/lib/crm/pengine/status.c index 45a59432df..0d97c43d27 100644 --- a/lib/crm/pengine/status.c +++ b/lib/crm/pengine/status.c @@ -1,311 +1,312 @@ /* * 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.1 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #include #include #include #include #include crm_data_t * do_calculations( pe_working_set_t *data_set, crm_data_t *xml_input, ha_time_t *now); unsigned int pengine_input_loglevel = LOG_INFO; #define PE_WORKING_DIR HA_VARLIBDIR"/heartbeat/pengine" #define MEMCHECK_STAGE_0 0 #define check_and_exit(stage) cleanup_calculations(data_set); \ crm_mem_stats(NULL); \ crm_err("Exiting: stage %d", stage); \ exit(1); /* * Unpack everything * At the end you'll have: * - A list of nodes * - A list of resources (each with any dependencies on other resources) * - A list of constraints between resources and nodes * - A list of constraints between start/stop actions * - A list of nodes that need to be stonith'd * - A list of nodes that need to be shutdown * - A list of the possible stop/start actions (without dependencies) */ gboolean cluster_status(pe_working_set_t *data_set) { crm_data_t * config = get_object_root( XML_CIB_TAG_CRMCONFIG, data_set->input); crm_data_t * cib_nodes = get_object_root( XML_CIB_TAG_NODES, data_set->input); crm_data_t * cib_resources = get_object_root( XML_CIB_TAG_RESOURCES, data_set->input); crm_data_t * cib_status = get_object_root( XML_CIB_TAG_STATUS, data_set->input); const char *value = crm_element_value( data_set->input, XML_ATTR_HAVE_QUORUM); crm_debug_3("Beginning unpack"); /* reset remaining global variables */ if(data_set->input == NULL) { return FALSE; } if(data_set->input != NULL && crm_element_value(data_set->input, XML_ATTR_DC_UUID) != NULL) { /* this should always be present */ data_set->dc_uuid = crm_element_value_copy( data_set->input, XML_ATTR_DC_UUID); } unpack_config(config, data_set); if(value != NULL) { cl_str_to_boolean(value, &data_set->have_quorum); } if(data_set->have_quorum == FALSE && data_set->no_quorum_policy != no_quorum_ignore) { crm_warn("We do not have quorum" " - fencing and resource management disabled"); } unpack_nodes(cib_nodes, data_set); unpack_resources(cib_resources, data_set); unpack_status(cib_status, data_set); return TRUE; } static void pe_free_resources(GListPtr resources) { resource_t *rsc = NULL; GListPtr iterator = resources; while(iterator != NULL) { iterator = iterator; rsc = (resource_t *)iterator->data; iterator = iterator->next; rsc->fns->free(rsc); } if(resources != NULL) { g_list_free(resources); } } static void pe_free_actions(GListPtr actions) { GListPtr iterator = actions; while(iterator != NULL) { pe_free_action(iterator->data); iterator = iterator->next; } if(actions != NULL) { g_list_free(actions); } } static void pe_free_nodes(GListPtr nodes) { GListPtr iterator = nodes; while(iterator != NULL) { node_t *node = (node_t*)iterator->data; struct node_shared_s *details = node->details; iterator = iterator->next; crm_debug_5("deleting node"); crm_debug_5("%s is being deleted", details->uname); print_node("delete", node, FALSE); if(details != NULL) { if(details->attrs != NULL) { g_hash_table_destroy(details->attrs); } pe_free_shallow_adv(details->running_rsc, FALSE); pe_free_shallow_adv(details->allocated_rsc, FALSE); crm_free(details); } crm_free(node); } if(nodes != NULL) { g_list_free(nodes); } } void cleanup_calculations(pe_working_set_t *data_set) { if(data_set == NULL) { return; } if(data_set->config_hash != NULL) { g_hash_table_destroy(data_set->config_hash); } crm_free(data_set->dc_uuid); crm_free(data_set->transition_idle_timeout); crm_debug_3("deleting resources"); pe_free_resources(data_set->resources); crm_debug_3("deleting actions"); pe_free_actions(data_set->actions); crm_debug_3("deleting nodes"); pe_free_nodes(data_set->nodes); free_xml(data_set->graph); free_ha_date(data_set->now); free_xml(data_set->input); free_xml(data_set->failed); data_set->stonith_action = NULL; CRM_CHECK(data_set->ordering_constraints == NULL, ;); CRM_CHECK(data_set->placement_constraints == NULL, ;); } void set_working_set_defaults(pe_working_set_t *data_set) { data_set->input = NULL; data_set->now = NULL; data_set->graph = NULL; data_set->failed = create_xml_node(NULL, "failed-ops"); data_set->transition_idle_timeout = NULL; data_set->dc_uuid = NULL; data_set->dc_node = NULL; data_set->have_quorum = FALSE; data_set->stonith_enabled = FALSE; data_set->stonith_action = NULL; data_set->symmetric_cluster = TRUE; data_set->is_managed_default = TRUE; data_set->no_quorum_policy = no_quorum_freeze; data_set->remove_after_stop = FALSE; data_set->stop_action_orphans = TRUE; data_set->stop_rsc_orphans = TRUE; data_set->config_hash = NULL; data_set->nodes = NULL; data_set->resources = NULL; data_set->ordering_constraints = NULL; data_set->placement_constraints = NULL; + data_set->colocation_constraints = NULL; data_set->actions = NULL; data_set->num_synapse = 0; data_set->max_valid_nodes = 0; data_set->order_id = 1; data_set->action_id = 1; data_set->default_resource_stickiness = 0; data_set->default_resource_fail_stickiness = 0; } resource_t * pe_find_resource(GListPtr rsc_list, const char *id) { unsigned lpc = 0; resource_t *rsc = NULL; resource_t *child_rsc = NULL; if(id == NULL) { return NULL; } crm_debug_4("Looking for %s in %d objects", id, g_list_length(rsc_list)); for(lpc = 0; lpc < g_list_length(rsc_list); lpc++) { rsc = g_list_nth_data(rsc_list, lpc); if(rsc == NULL) { } else if(rsc->id && strcmp(rsc->id, id) == 0){ crm_debug_4("Found a match for %s", id); return rsc; } else if(rsc->long_name && strcmp(rsc->long_name, id) == 0) { crm_debug_4("Found a match for %s", id); return rsc; } else if(rsc->clone_name && strcmp(rsc->clone_name, id) == 0) { crm_debug_4("Found a match for %s", id); return rsc; } } for(lpc = 0; lpc < g_list_length(rsc_list); lpc++) { rsc = g_list_nth_data(rsc_list, lpc); child_rsc = rsc->fns->find_child(rsc, id); if(child_rsc != NULL) { return child_rsc; } } crm_debug_2("No match for %s", id); return NULL; } node_t * pe_find_node_id(GListPtr nodes, const char *id) { unsigned lpc = 0; node_t *node = NULL; for(lpc = 0; lpc < g_list_length(nodes); lpc++) { node = g_list_nth_data(nodes, lpc); if(safe_str_eq(node->details->id, id)) { return node; } } /* error */ return NULL; } node_t * pe_find_node(GListPtr nodes, const char *uname) { unsigned lpc = 0; node_t *node = NULL; for(lpc = 0; lpc < g_list_length(nodes); lpc++) { node = g_list_nth_data(nodes, lpc); if(safe_str_eq(node->details->uname, uname)) { return node; } } /* error */ return NULL; }