diff --git a/crm/pengine/clone.c b/crm/pengine/clone.c index 5e5f5b516a..42f81d5576 100644 --- a/crm/pengine/clone.c +++ b/crm/pengine/clone.c @@ -1,1297 +1,1310 @@ /* $Id: clone.c,v 1.6 2006/07/18 06:19:33 andrew Exp $ */ /* * 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 void clone_create_notifications( resource_t *rsc, action_t *action, action_t *action_complete, pe_working_set_t *data_set); typedef struct clone_variant_data_s { resource_t *self; int clone_max; int clone_node_max; int active_clones; int max_nodes; gboolean interleave; gboolean ordered; crm_data_t *xml_obj_child; gboolean notify_confirm; GListPtr child_list; /* resource_t* */ } clone_variant_data_t; void child_stopping_constraints( clone_variant_data_t *clone_data, enum pe_ordering type, resource_t *child, resource_t *last, pe_working_set_t *data_set); void child_starting_constraints( clone_variant_data_t *clone_data, enum pe_ordering type, resource_t *child, resource_t *last, pe_working_set_t *data_set); #define get_clone_variant_data(data, rsc) \ CRM_ASSERT(rsc->variant == pe_clone || rsc->variant == pe_master); \ data = (clone_variant_data_t *)rsc->variant_opaque; void clone_set_cmds(resource_t *rsc) { clone_variant_data_t *clone_data = NULL; get_clone_variant_data(clone_data, rsc); clone_data->self->cmds = &resource_class_alloc_functions[clone_data->self->variant]; slist_iter( child_rsc, resource_t, clone_data->child_list, lpc, child_rsc->cmds = &resource_class_alloc_functions[child_rsc->variant]; child_rsc->cmds->set_cmds(child_rsc); ); } int clone_num_allowed_nodes(resource_t *rsc) { int num_nodes = 0; clone_variant_data_t *clone_data = NULL; get_clone_variant_data(clone_data, rsc); /* what *should* we return here? */ slist_iter( child_rsc, resource_t, clone_data->child_list, lpc, int tmp_num_nodes = child_rsc->cmds->num_allowed_nodes(child_rsc); if(tmp_num_nodes > num_nodes) { num_nodes = tmp_num_nodes; } ); return num_nodes; } static gint sort_rsc_provisional(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); if(resource1->provisional == resource2->provisional) { return 0; } else if(resource1->provisional) { return 1; } else if(resource2->provisional) { return -1; } CRM_CHECK(FALSE, return 0); return 0; } static resource_t * find_clone_child(resource_t *rsc, GListPtr resource_list) { crm_debug("foo"); slist_iter( child, resource_t, resource_list, lpc, if(child->parent) { crm_debug("%p / %p vs. %s / %s", rsc, child->parent, rsc->id, child->parent->id); if(child->parent == rsc) { return child; } } else { crm_debug("Child %s has no parent", child->id); } ); return NULL; } node_t * clone_color(resource_t *rsc, pe_working_set_t *data_set) { int local_node_max = 0; GListPtr node_list = NULL; int reverse_pointer = 0; int allocated = 0, pre_allocated = 0; +/* int level = LOG_ERR; */ clone_variant_data_t *clone_data = NULL; get_clone_variant_data(clone_data, rsc); if(clone_data->self->provisional == FALSE) { return NULL; } local_node_max = clone_data->clone_node_max; clone_data->max_nodes = rsc->cmds->num_allowed_nodes(rsc); /* give already allocated resources every chance to run on the node * specified. other resources can be moved/started where we want * as required */ clone_data->child_list = g_list_sort( clone_data->child_list, sort_rsc_provisional); crm_debug_2("Coloring children of: %s", rsc->id); +/* rsc->fns->print(rsc, "alloc: ", */ +/* pe_print_details|pe_print_dev|pe_print_log, &level); */ + clone_data->self->allowed_nodes = g_list_sort( clone_data->self->allowed_nodes, sort_node_weight); if(rsc->stickiness <= 0) { while(local_node_max > 1 && clone_data->max_nodes * (local_node_max -1) >= clone_data->clone_max) { local_node_max--; crm_debug("Dropped the effective value of" " clone_node_max to: %d", local_node_max); } } slist_iter(child, resource_t, clone_data->child_list, lpc2, node_t *current = NULL; + node_t *chosen = NULL; + if(child->running_on != NULL) { current = child->running_on->data; } if(current == NULL) { crm_debug_2("Not active: %s", child->id); continue; } else if(can_run_resources(current) == FALSE) { crm_debug_2("Node cant run resources: %s", current->details->uname); continue; } else if(g_list_length(child->running_on) != 1) { crm_debug("active != 1: %s", child->id); continue; } else if(current->count >= local_node_max) { crm_warn("Node %s too full for: %s", current->details->uname, child->id); continue; } if(allocated >= clone_data->clone_max) { crm_debug_2("Reached maximum allocation: %s", child->id); break; } - crm_debug("Foo: %s", child->id); - current = pe_find_node_id( + chosen = pe_find_node_id( clone_data->self->allowed_nodes, current->details->id); - current->weight = merge_weights(current->weight, child->stickiness); - - if(native_assign_node(child, NULL, current)) { + if(chosen == NULL) { + /* unmanaged mode */ + chosen = current; + } + + chosen->weight = merge_weights(chosen->weight, child->stickiness); + if(native_assign_node(child, NULL, chosen)) { allocated++; } + /* native_assign_node(clone_data->self, NULL, current); */ ); crm_debug("Running: Total=%d, New=%d, Max=%d", pre_allocated+allocated, allocated, clone_data->clone_max); - - local_node_max = (int) (clone_data->clone_max / clone_data->max_nodes); - if(local_node_max < 1) { - local_node_max = 1; + + if(clone_data->max_nodes) { + local_node_max = (int) (clone_data->clone_max / clone_data->max_nodes); + if(local_node_max < 1) { + local_node_max = 1; + } } + if(local_node_max > clone_data->clone_node_max) { local_node_max = clone_data->clone_node_max; } pre_allocated = allocated; allocated = 0; if(rsc->stickiness != 0) { clone_data->self->allowed_nodes = g_list_sort( clone_data->self->allowed_nodes, sort_node_weight); } /* distribute a constant spread */ node_list = clone_data->self->allowed_nodes; slist_iter(child, resource_t, clone_data->child_list, lpc2, if(allocated+pre_allocated >= clone_data->clone_max) { break; } if(child->provisional == FALSE) { crm_debug_3("Spread: Skipping allocated resource: %s", child->id); continue; } while(node_list && local_node_max <= ((node_t*)node_list->data)->count) { node_list = node_list->next; } if(node_list) { allocated++; native_assign_node(child, NULL, node_list->data); } ); crm_debug("Spread: Total=%d, New=%d, Max=%d", pre_allocated+allocated, allocated, clone_data->clone_max); CRM_ASSERT(pre_allocated+allocated <= clone_data->clone_max); pre_allocated += allocated; allocated = 0; /* allocate the rest - if possible */ if(local_node_max < clone_data->clone_node_max) { local_node_max++; node_list = clone_data->self->allowed_nodes; slist_iter(child, resource_t, clone_data->child_list, lpc2, if(child->provisional == FALSE) { crm_debug_3("Remainder: Skipping allocated resource: %s", child->id); continue; } if(node_list && (pre_allocated+allocated) >= clone_data->clone_max) { crm_debug("Allocated maximum possible clone instances"); node_list = NULL; } while(node_list && local_node_max <= ((node_t*)node_list->data)->count) { node_list = node_list->next; } if(node_list) { allocated++; native_assign_node(child, NULL, node_list->data); } else { crm_debug("Child %s not allocated", child->id); native_assign_node(child, NULL, NULL); } ); crm_debug("Rest: Total=%d, New=%d, Max=%d", pre_allocated, allocated, clone_data->clone_max); CRM_ASSERT(pre_allocated+allocated <= clone_data->clone_max); } clone_data->self->provisional = FALSE; if(rsc->stickiness >= INFINITY) { return NULL; } /* observe node preferences */ reverse_pointer = g_list_length(clone_data->self->allowed_nodes) - 1; slist_iter(a_node, node_t, clone_data->self->allowed_nodes, lpc, node_t *replace_node = NULL; resource_t *replace_rsc = NULL; CRM_ASSERT(a_node != NULL); if(a_node->count != 0) { crm_debug_4("Node %s has %d resources", a_node->details->uname, a_node->count); break; } else if(lpc >= reverse_pointer) { crm_debug_3("lpc %d, reverse lpc %d", lpc, reverse_pointer); break; } crm_debug_3("Node %s has %d resources, stealing one from...", a_node->details->uname, a_node->count); while(replace_rsc == NULL) { crm_debug_3("lpc %d, reverse lpc %d", lpc, reverse_pointer); if(lpc >= reverse_pointer) { return NULL; } replace_node = g_list_nth_data(clone_data->self->allowed_nodes, reverse_pointer); reverse_pointer--; crm_debug("Trying to reallocated an instance of %s to %s from %s", rsc->id, a_node->details->uname, replace_node->details->uname); replace_rsc = find_clone_child(rsc, replace_node->details->allocated_rsc); if(replace_rsc == NULL) { CRM_ASSERT(replace_node->count == 0); crm_debug("nothing on %s", replace_node->details->uname); } } crm_debug("Reallocating %s to %s from %s", replace_rsc->id, a_node->details->uname, replace_node->details->uname); native_assign_node(replace_rsc, NULL, a_node); ); 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 pseduo-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); slist_iter( child_rsc, resource_t, clone_data->child_list, 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(clone_data->self, NULL, !child_starting); action_complete = custom_action( clone_data->self, started_key(rsc), CRMD_ACTION_STARTED, NULL, !child_starting, TRUE, data_set); start->pseudo = TRUE; action_complete->pseudo = TRUE; action_complete->priority = INFINITY; child_starting_constraints(clone_data, pe_ordering_optional, NULL, last_start_rsc, data_set); clone_create_notifications( rsc, start, action_complete, data_set); /* stop */ stop = stop_action(clone_data->self, NULL, !child_stopping); action_complete = custom_action( clone_data->self, stopped_key(rsc), CRMD_ACTION_STOPPED, NULL, !child_stopping, TRUE, data_set); stop->pseudo = TRUE; action_complete->pseudo = TRUE; action_complete->priority = INFINITY; child_stopping_constraints(clone_data, pe_ordering_optional, NULL, last_stop_rsc, data_set); clone_create_notifications(rsc, stop, action_complete, data_set); rsc->actions = clone_data->self->actions; if(stop->post_notified != NULL && start->pre_notify != NULL) { order_actions(stop->post_notified, start->pre_notify, pe_ordering_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( clone_data->self->id, "pre", action->task); notify = custom_action(clone_data->self, 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"); } notify->pseudo = TRUE; /* create pre_notify_complete */ notify_key = generate_notify_key( clone_data->self->id, "confirmed-pre", action->task); notify_complete = custom_action(clone_data->self, 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_complete->pseudo = TRUE; /* pre_notify before pre_notify_complete */ custom_action_order( clone_data->self, NULL, notify, clone_data->self, NULL, notify_complete, pe_ordering_manditory, data_set); /* pre_notify_complete before action */ custom_action_order( clone_data->self, NULL, notify_complete, clone_data->self, NULL, action, pe_ordering_manditory, data_set); action->pre_notify = notify; action->pre_notified = notify_complete; /* create post_notify */ notify_key = generate_notify_key (clone_data->self->id, "post", action->task); notify = custom_action(clone_data->self, 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"); } notify->pseudo = TRUE; /* action_complete before post_notify */ custom_action_order( clone_data->self, NULL, action_complete, clone_data->self, NULL, notify, pe_ordering_postnotify, data_set); /* create post_notify_complete */ notify_key = generate_notify_key( clone_data->self->id, "confirmed-post", action->task); notify_complete = custom_action(clone_data->self, 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_complete->pseudo = TRUE; /* post_notify before post_notify_complete */ custom_action_order( clone_data->self, NULL, notify, clone_data->self, NULL, notify_complete, pe_ordering_manditory, 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( clone_data->self, NULL, notify_complete, clone_data->self, start_key(clone_data->self), NULL, pe_ordering_optional, data_set); } else if(safe_str_eq(action->task, CRMD_ACTION_START)) { /* post_notify_complete before promote */ custom_action_order( clone_data->self, NULL, notify_complete, clone_data->self, promote_key(clone_data->self), NULL, pe_ordering_optional, data_set); } else if(safe_str_eq(action->task, CRMD_ACTION_DEMOTE)) { /* post_notify_complete before promote */ custom_action_order( clone_data->self, NULL, notify_complete, clone_data->self, stop_key(clone_data->self), NULL, pe_ordering_optional, data_set); } } void child_starting_constraints( clone_variant_data_t *clone_data, enum pe_ordering type, resource_t *child, resource_t *last, pe_working_set_t *data_set) { if(clone_data->ordered || clone_data->self->restart_type == pe_restart_restart) { type = pe_ordering_manditory; } if(child == NULL) { if(clone_data->ordered && last != NULL) { crm_debug_4("Ordered version (last node)"); /* last child start before global started */ custom_action_order( last, start_key(last), NULL, clone_data->self, started_key(clone_data->self), NULL, type, data_set); } } else if(clone_data->ordered) { crm_debug_4("Ordered version"); if(last == NULL) { /* global start before first child start */ last = clone_data->self; } /* else: child/child relative start */ order_start_start(last, child, type); } else { crm_debug_4("Un-ordered version"); /* child start before global started */ custom_action_order( child, start_key(child), NULL, clone_data->self, started_key(clone_data->self), NULL, type, data_set); /* global start before child start */ /* order_start_start(clone_data->self, child, type); */ order_start_start( clone_data->self, child, pe_ordering_manditory); } } void child_stopping_constraints( clone_variant_data_t *clone_data, enum pe_ordering type, resource_t *child, resource_t *last, pe_working_set_t *data_set) { if(clone_data->ordered || clone_data->self->restart_type == pe_restart_restart) { type = pe_ordering_manditory; } if(child == NULL) { if(clone_data->ordered && last != NULL) { crm_debug_4("Ordered version (last node)"); /* global stop before first child stop */ order_stop_stop(clone_data->self, last, pe_ordering_manditory); } } else if(clone_data->ordered && last != NULL) { crm_debug_4("Ordered version"); /* child/child relative stop */ order_stop_stop(child, last, type); } else if(clone_data->ordered) { crm_debug_4("Ordered version (1st node)"); /* first child stop before global stopped */ custom_action_order( child, stop_key(child), NULL, clone_data->self, stopped_key(clone_data->self), NULL, type, data_set); } else { crm_debug_4("Un-ordered version"); /* child stop before global stopped */ custom_action_order( child, stop_key(child), NULL, clone_data->self, stopped_key(clone_data->self), NULL, type, data_set); /* global stop before child stop */ order_stop_stop(clone_data->self, child, type); } } 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); clone_data->self->cmds->internal_constraints(clone_data->self, data_set); /* global stop before stopped */ custom_action_order( clone_data->self, stop_key(clone_data->self), NULL, clone_data->self, stopped_key(clone_data->self), NULL, pe_ordering_optional, data_set); /* global start before started */ custom_action_order( clone_data->self, start_key(clone_data->self), NULL, clone_data->self, started_key(clone_data->self), NULL, pe_ordering_optional, data_set); /* global stopped before start */ custom_action_order( clone_data->self, stopped_key(clone_data->self), NULL, clone_data->self, start_key(clone_data->self), NULL, pe_ordering_optional, data_set); slist_iter( child_rsc, resource_t, clone_data->child_list, lpc, child_rsc->cmds->internal_constraints(child_rsc, data_set); child_starting_constraints( clone_data, pe_ordering_optional, child_rsc, last_rsc, data_set); child_stopping_constraints( clone_data, pe_ordering_optional, child_rsc, last_rsc, data_set); last_rsc = child_rsc; ); child_starting_constraints( clone_data, pe_ordering_optional, NULL, last_rsc, data_set); child_stopping_constraints( clone_data, pe_ordering_optional, NULL, last_rsc, data_set); } static resource_t* find_compatible_child(resource_t *local_child, resource_t *rsc) { #if 0 node_t *local_node = NULL; node_t *node = NULL; clone_variant_data_t *clone_data = NULL; get_clone_variant_data(clone_data, rsc); CRM_ASSERT(local_child->color != NULL); local_node = local_child->color->details->candidate_nodes->data; 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, clone_data->child_list, lpc, CRM_ASSERT(child_rsc->color != NULL); node = child_rsc->color->details->candidate_nodes->data; 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); #endif 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) { pe_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) { pe_warn("rsc_colocations other than \"-INFINITY\"" " are not supported for non-interleaved " XML_CIB_TAG_INCARNATION" resources"); return; } } else if(constraint->score != -INFINITY) { pe_warn("Co-location scores other than \"-INFINITY\" are not " " allowed for non-"XML_CIB_TAG_INCARNATION" resources"); return; } if(do_interleave) { resource_t *rh_child = NULL; slist_iter(lh_child, resource_t, clone_data->child_list, 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, clone_data->child_list, 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); crm_debug_3("Processing RH of constraint %s", constraint->id); if(rsc_rh == NULL) { pe_err("rsc_rh was NULL for %s", constraint->id); return; } else if(constraint->score != -INFINITY) { pe_warn("rsc_dependencies other than \"must_not\" " "are not supported for clone resources"); return; } else { print_resource(LOG_DEBUG_3, "LHS", rsc_lh, FALSE); } get_clone_variant_data(clone_data, rsc_rh); slist_iter( child_rsc, resource_t, clone_data->child_list, lpc, print_resource(LOG_DEBUG_3, "RHS", child_rsc, FALSE); child_rsc->cmds->rsc_colocation_rh(rsc_lh, child_rsc, constraint); ); } void clone_rsc_order_lh(resource_t *rsc, order_constraint_t *order) { char *stop_id = NULL; char *start_id = NULL; clone_variant_data_t *clone_data = NULL; get_clone_variant_data(clone_data, rsc); crm_debug_3("Processing LH of ordering constraint %d", order->id); stop_id = stop_key(rsc); start_id = start_key(rsc); if(safe_str_eq(order->lh_action_task, start_id)) { crm_free(order->lh_action_task); order->lh_action_task = started_key(rsc); } else if(safe_str_eq(order->lh_action_task, stop_id)) { crm_free(order->lh_action_task); order->lh_action_task = stopped_key(rsc); } crm_free(start_id); crm_free(stop_id); clone_data->self->cmds->rsc_order_lh(clone_data->self, order); } 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_3("Processing RH of ordering constraint %d", order->id); clone_data->self->cmds->rsc_order_rh(lh_action, clone_data->self, 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); clone_data->self->cmds->rsc_location(clone_data->self, constraint); slist_iter( child_rsc, resource_t, clone_data->child_list, 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); rsc_id = entry->rsc->id; CRM_CHECK(rsc_id != NULL, rsc_id = "__none__"); uname = NULL; if(entry->node) { uname = entry->node->details->uname; } CRM_CHECK(uname != NULL, uname = "__none__"); /* 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, clone_data->child_list, lpc, slist_iter( op, action_t, clone_data->self->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, clone_data->child_list, lpc, child_rsc->cmds->expand(child_rsc, data_set); ); /* slist_iter( */ /* action, action_t, clone_data->self->actions, lpc2, */ /* if(safe_str_eq(action->task, CRMD_ACTION_NOTIFY)) { */ /* action->meta_xml = notify_xml; */ /* } */ /* ); */ clone_data->self->cmds->expand(clone_data->self, 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); } void clone_agent_constraints(resource_t *rsc) { clone_variant_data_t *clone_data = NULL; get_clone_variant_data(clone_data, rsc); slist_iter( child_rsc, resource_t, clone_data->child_list, lpc, child_rsc->cmds->agent_constraints(child_rsc); ); } void clone_create_notify_element(resource_t *rsc, action_t *op, notify_data_t *n_data, pe_working_set_t *data_set) { clone_variant_data_t *clone_data = NULL; get_clone_variant_data(clone_data, rsc); slist_iter( child_rsc, resource_t, clone_data->child_list, lpc, child_rsc->cmds->create_notify_element( child_rsc, op, n_data, data_set); ); } 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); clone_data->child_list = g_list_sort( clone_data->child_list, 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, clone_data->child_list, 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, clone_data->child_list, 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; } void clone_stonith_ordering( resource_t *rsc, action_t *stonith_op, pe_working_set_t *data_set) { clone_variant_data_t *clone_data = NULL; get_clone_variant_data(clone_data, rsc); slist_iter( child_rsc, resource_t, clone_data->child_list, lpc, child_rsc->cmds->stonith_ordering( child_rsc, stonith_op, data_set); ); } diff --git a/crm/pengine/testcases/group11.dot b/crm/pengine/testcases/group11.dot index 0fcba38ddb..5bfddfb560 100644 --- a/crm/pengine/testcases/group11.dot +++ b/crm/pengine/testcases/group11.dot @@ -1,14 +1,8 @@ digraph "g" { size = "30,30" "probe_complete node1" [ style=bold color="green" fontcolor="black" ] -"rsc1_stop_0 node1" [ style=bold color="green" fontcolor="black" ] "rsc2_stop_0 node1" [ style=bold color="green" fontcolor="black" ] -"rsc3_stop_0 node1" [ style=bold color="green" fontcolor="black" ] "1_stop_0" [ style=bold color="green" fontcolor="orange" ] "1_stopped_0" [ style=bold color="green" fontcolor="orange" ] -"rsc2_stop_0 node1" -> "rsc1_stop_0 node1" [ style = bold] -"rsc3_stop_0 node1" -> "rsc2_stop_0 node1" [ style = bold] -"1_stop_0" -> "rsc3_stop_0 node1" [ style = bold] -"rsc1_stop_0 node1" -> "1_stopped_0" [ style = bold] "1_stop_0" -> "1_stopped_0" [ style = bold] } diff --git a/crm/pengine/testcases/managed-0.xml b/crm/pengine/testcases/managed-0.xml index 17d906a222..b15c82328d 100644 --- a/crm/pengine/testcases/managed-0.xml +++ b/crm/pengine/testcases/managed-0.xml @@ -1,613 +1,613 @@ - - - - - - - - + + + + + + + + diff --git a/crm/pengine/testcases/managed-1.xml b/crm/pengine/testcases/managed-1.xml index 67b4c57dfb..5fbe349dcc 100644 --- a/crm/pengine/testcases/managed-1.xml +++ b/crm/pengine/testcases/managed-1.xml @@ -1,613 +1,613 @@ - - - - - - - - + + + + + + + + diff --git a/crm/pengine/testcases/managed-2.dot b/crm/pengine/testcases/managed-2.dot index e3c6ba0299..17ba4d54be 100644 --- a/crm/pengine/testcases/managed-2.dot +++ b/crm/pengine/testcases/managed-2.dot @@ -1,262 +1,254 @@ digraph "g" { size = "30,30" "probe_complete" [ style=bold color="green" fontcolor="orange" ] "probe_complete c001n09" [ style=bold color="green" fontcolor="black" ] "rsc_c001n02_monitor_0 c001n09" [ style=bold color="green" fontcolor="black" ] "rsc_c001n03_monitor_0 c001n09" [ style=bold color="green" fontcolor="black" ] "rsc_c001n04_monitor_0 c001n09" [ style=bold color="green" fontcolor="black" ] "rsc_c001n05_monitor_0 c001n09" [ style=bold color="green" fontcolor="black" ] "rsc_c001n06_monitor_0 c001n09" [ style=bold color="green" fontcolor="black" ] "rsc_c001n07_monitor_0 c001n09" [ style=bold color="green" fontcolor="black" ] "rsc_c001n08_monitor_0 c001n09" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:0_monitor_0 c001n09" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:1_monitor_0 c001n09" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:2_monitor_0 c001n09" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:3_monitor_0 c001n09" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:4_monitor_0 c001n09" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:5_monitor_0 c001n09" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:6_monitor_0 c001n09" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:7_monitor_0 c001n09" [ style=bold color="green" fontcolor="black" ] "probe_complete c001n02" [ style=bold color="green" fontcolor="black" ] "DcIPaddr_monitor_0 c001n02" [ style=bold color="green" fontcolor="black" ] "rsc_c001n09_monitor_0 c001n02" [ style=bold color="green" fontcolor="black" ] "rsc_c001n03_monitor_0 c001n02" [ style=bold color="green" fontcolor="black" ] "rsc_c001n04_monitor_0 c001n02" [ style=bold color="green" fontcolor="black" ] "rsc_c001n05_monitor_0 c001n02" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:0_monitor_0 c001n02" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:1_monitor_0 c001n02" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:2_monitor_0 c001n02" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:3_monitor_0 c001n02" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:4_monitor_0 c001n02" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:5_monitor_0 c001n02" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:6_monitor_0 c001n02" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:7_monitor_0 c001n02" [ style=bold color="green" fontcolor="black" ] "probe_complete c001n03" [ style=bold color="green" fontcolor="black" ] "DcIPaddr_monitor_0 c001n03" [ style=bold color="green" fontcolor="black" ] "rsc_c001n09_monitor_0 c001n03" [ style=bold color="green" fontcolor="black" ] "rsc_c001n04_monitor_0 c001n03" [ style=bold color="green" fontcolor="black" ] "rsc_c001n05_monitor_0 c001n03" [ style=bold color="green" fontcolor="black" ] "rsc_c001n06_monitor_0 c001n03" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:0_monitor_0 c001n03" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:1_monitor_0 c001n03" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:2_monitor_0 c001n03" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:3_monitor_0 c001n03" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:4_monitor_0 c001n03" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:5_monitor_0 c001n03" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:6_monitor_0 c001n03" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:7_monitor_0 c001n03" [ style=bold color="green" fontcolor="black" ] "probe_complete c001n04" [ style=bold color="green" fontcolor="black" ] "DcIPaddr_monitor_0 c001n04" [ style=bold color="green" fontcolor="black" ] "rsc_c001n09_monitor_0 c001n04" [ style=bold color="green" fontcolor="black" ] "rsc_c001n02_monitor_0 c001n04" [ style=bold color="green" fontcolor="black" ] "rsc_c001n03_monitor_0 c001n04" [ style=bold color="green" fontcolor="black" ] "rsc_c001n05_monitor_0 c001n04" [ style=bold color="green" fontcolor="black" ] "rsc_c001n06_monitor_0 c001n04" [ style=bold color="green" fontcolor="black" ] "rsc_c001n07_monitor_0 c001n04" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:0_monitor_0 c001n04" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:1_monitor_0 c001n04" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:2_monitor_0 c001n04" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:3_monitor_0 c001n04" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:4_monitor_0 c001n04" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:5_monitor_0 c001n04" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:6_monitor_0 c001n04" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:7_monitor_0 c001n04" [ style=bold color="green" fontcolor="black" ] "probe_complete c001n05" [ style=bold color="green" fontcolor="black" ] "DcIPaddr_monitor_0 c001n05" [ style=bold color="green" fontcolor="black" ] "rsc_c001n09_monitor_0 c001n05" [ style=bold color="green" fontcolor="black" ] "rsc_c001n02_monitor_0 c001n05" [ style=bold color="green" fontcolor="black" ] "rsc_c001n03_monitor_0 c001n05" [ style=bold color="green" fontcolor="black" ] "rsc_c001n04_monitor_0 c001n05" [ style=bold color="green" fontcolor="black" ] "rsc_c001n06_monitor_0 c001n05" [ style=bold color="green" fontcolor="black" ] "rsc_c001n07_monitor_0 c001n05" [ style=bold color="green" fontcolor="black" ] "rsc_c001n08_monitor_0 c001n05" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:0_monitor_0 c001n05" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:1_monitor_0 c001n05" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:2_monitor_0 c001n05" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:3_monitor_0 c001n05" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:4_monitor_0 c001n05" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:5_monitor_0 c001n05" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:6_monitor_0 c001n05" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:7_monitor_0 c001n05" [ style=bold color="green" fontcolor="black" ] "probe_complete c001n06" [ style=bold color="green" fontcolor="black" ] "DcIPaddr_monitor_0 c001n06" [ style=bold color="green" fontcolor="black" ] "rsc_c001n05_monitor_0 c001n06" [ style=bold color="green" fontcolor="black" ] "rsc_c001n07_monitor_0 c001n06" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:0_monitor_0 c001n06" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:1_monitor_0 c001n06" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:2_monitor_0 c001n06" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:3_monitor_0 c001n06" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:4_monitor_0 c001n06" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:5_monitor_0 c001n06" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:6_monitor_0 c001n06" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:7_monitor_0 c001n06" [ style=bold color="green" fontcolor="black" ] "probe_complete c001n07" [ style=bold color="green" fontcolor="black" ] "DcIPaddr_monitor_0 c001n07" [ style=bold color="green" fontcolor="black" ] "rsc_c001n09_monitor_0 c001n07" [ style=bold color="green" fontcolor="black" ] "rsc_c001n02_monitor_0 c001n07" [ style=bold color="green" fontcolor="black" ] "rsc_c001n03_monitor_0 c001n07" [ style=bold color="green" fontcolor="black" ] "rsc_c001n04_monitor_0 c001n07" [ style=bold color="green" fontcolor="black" ] "rsc_c001n05_monitor_0 c001n07" [ style=bold color="green" fontcolor="black" ] "rsc_c001n06_monitor_0 c001n07" [ style=bold color="green" fontcolor="black" ] "rsc_c001n08_monitor_0 c001n07" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:0_monitor_0 c001n07" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:1_monitor_0 c001n07" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:2_monitor_0 c001n07" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:3_monitor_0 c001n07" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:4_monitor_0 c001n07" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:5_monitor_0 c001n07" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:6_monitor_0 c001n07" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:7_monitor_0 c001n07" [ style=bold color="green" fontcolor="black" ] "probe_complete c001n08" [ style=bold color="green" fontcolor="black" ] "DcIPaddr_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "rsc_c001n09_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "rsc_c001n02_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "rsc_c001n03_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "rsc_c001n04_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "rsc_c001n05_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "rsc_c001n06_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "rsc_c001n07_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:0_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:1_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:2_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:3_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:4_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:5_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:6_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:7_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] -"rsc_c001n09_stop_0 c001n09" [ style=bold color="green" fontcolor="black" ] -"rsc_c001n02_stop_0 c001n02" [ style=bold color="green" fontcolor="black" ] -"rsc_c001n03_stop_0 c001n03" [ style=bold color="green" fontcolor="black" ] -"rsc_c001n04_stop_0 c001n04" [ style=bold color="green" fontcolor="black" ] -"rsc_c001n05_stop_0 c001n05" [ style=bold color="green" fontcolor="black" ] -"rsc_c001n06_stop_0 c001n06" [ style=bold color="green" fontcolor="black" ] -"rsc_c001n07_stop_0 c001n07" [ style=bold color="green" fontcolor="black" ] -"rsc_c001n08_stop_0 c001n08" [ style=bold color="green" fontcolor="black" ] "DoFencing_start_0" [ font_color=black style=filled fillcolor=purple ] "DoFencing_running_0" [ font_color=black style=filled fillcolor=purple ] "DoFencing_stop_0" [ font_color=black style=filled fillcolor=purple ] "DoFencing_stopped_0" [ font_color=black style=filled fillcolor=purple ] "probe_complete c001n09" -> "probe_complete" [ style = bold] "probe_complete c001n02" -> "probe_complete" [ style = bold] "probe_complete c001n03" -> "probe_complete" [ style = bold] "probe_complete c001n04" -> "probe_complete" [ style = bold] "probe_complete c001n05" -> "probe_complete" [ style = bold] "probe_complete c001n06" -> "probe_complete" [ style = bold] "probe_complete c001n07" -> "probe_complete" [ style = bold] "probe_complete c001n08" -> "probe_complete" [ style = bold] "rsc_c001n02_monitor_0 c001n09" -> "probe_complete c001n09" [ style = bold] "rsc_c001n03_monitor_0 c001n09" -> "probe_complete c001n09" [ style = bold] "rsc_c001n04_monitor_0 c001n09" -> "probe_complete c001n09" [ style = bold] "rsc_c001n05_monitor_0 c001n09" -> "probe_complete c001n09" [ style = bold] "rsc_c001n06_monitor_0 c001n09" -> "probe_complete c001n09" [ style = bold] "rsc_c001n07_monitor_0 c001n09" -> "probe_complete c001n09" [ style = bold] "rsc_c001n08_monitor_0 c001n09" -> "probe_complete c001n09" [ style = bold] "child_DoFencing:0_monitor_0 c001n09" -> "probe_complete c001n09" [ style = bold] "child_DoFencing:1_monitor_0 c001n09" -> "probe_complete c001n09" [ style = bold] "child_DoFencing:2_monitor_0 c001n09" -> "probe_complete c001n09" [ style = bold] "child_DoFencing:3_monitor_0 c001n09" -> "probe_complete c001n09" [ style = bold] "child_DoFencing:4_monitor_0 c001n09" -> "probe_complete c001n09" [ style = bold] "child_DoFencing:5_monitor_0 c001n09" -> "probe_complete c001n09" [ style = bold] "child_DoFencing:6_monitor_0 c001n09" -> "probe_complete c001n09" [ style = bold] "child_DoFencing:7_monitor_0 c001n09" -> "probe_complete c001n09" [ style = bold] "DcIPaddr_monitor_0 c001n02" -> "probe_complete c001n02" [ style = bold] "rsc_c001n09_monitor_0 c001n02" -> "probe_complete c001n02" [ style = bold] "rsc_c001n03_monitor_0 c001n02" -> "probe_complete c001n02" [ style = bold] "rsc_c001n04_monitor_0 c001n02" -> "probe_complete c001n02" [ style = bold] "rsc_c001n05_monitor_0 c001n02" -> "probe_complete c001n02" [ style = bold] "child_DoFencing:0_monitor_0 c001n02" -> "probe_complete c001n02" [ style = bold] "child_DoFencing:1_monitor_0 c001n02" -> "probe_complete c001n02" [ style = bold] "child_DoFencing:2_monitor_0 c001n02" -> "probe_complete c001n02" [ style = bold] "child_DoFencing:3_monitor_0 c001n02" -> "probe_complete c001n02" [ style = bold] "child_DoFencing:4_monitor_0 c001n02" -> "probe_complete c001n02" [ style = bold] "child_DoFencing:5_monitor_0 c001n02" -> "probe_complete c001n02" [ style = bold] "child_DoFencing:6_monitor_0 c001n02" -> "probe_complete c001n02" [ style = bold] "child_DoFencing:7_monitor_0 c001n02" -> "probe_complete c001n02" [ style = bold] "DcIPaddr_monitor_0 c001n03" -> "probe_complete c001n03" [ style = bold] "rsc_c001n09_monitor_0 c001n03" -> "probe_complete c001n03" [ style = bold] "rsc_c001n04_monitor_0 c001n03" -> "probe_complete c001n03" [ style = bold] "rsc_c001n05_monitor_0 c001n03" -> "probe_complete c001n03" [ style = bold] "rsc_c001n06_monitor_0 c001n03" -> "probe_complete c001n03" [ style = bold] "child_DoFencing:0_monitor_0 c001n03" -> "probe_complete c001n03" [ style = bold] "child_DoFencing:1_monitor_0 c001n03" -> "probe_complete c001n03" [ style = bold] "child_DoFencing:2_monitor_0 c001n03" -> "probe_complete c001n03" [ style = bold] "child_DoFencing:3_monitor_0 c001n03" -> "probe_complete c001n03" [ style = bold] "child_DoFencing:4_monitor_0 c001n03" -> "probe_complete c001n03" [ style = bold] "child_DoFencing:5_monitor_0 c001n03" -> "probe_complete c001n03" [ style = bold] "child_DoFencing:6_monitor_0 c001n03" -> "probe_complete c001n03" [ style = bold] "child_DoFencing:7_monitor_0 c001n03" -> "probe_complete c001n03" [ style = bold] "DcIPaddr_monitor_0 c001n04" -> "probe_complete c001n04" [ style = bold] "rsc_c001n09_monitor_0 c001n04" -> "probe_complete c001n04" [ style = bold] "rsc_c001n02_monitor_0 c001n04" -> "probe_complete c001n04" [ style = bold] "rsc_c001n03_monitor_0 c001n04" -> "probe_complete c001n04" [ style = bold] "rsc_c001n05_monitor_0 c001n04" -> "probe_complete c001n04" [ style = bold] "rsc_c001n06_monitor_0 c001n04" -> "probe_complete c001n04" [ style = bold] "rsc_c001n07_monitor_0 c001n04" -> "probe_complete c001n04" [ style = bold] "child_DoFencing:0_monitor_0 c001n04" -> "probe_complete c001n04" [ style = bold] "child_DoFencing:1_monitor_0 c001n04" -> "probe_complete c001n04" [ style = bold] "child_DoFencing:2_monitor_0 c001n04" -> "probe_complete c001n04" [ style = bold] "child_DoFencing:3_monitor_0 c001n04" -> "probe_complete c001n04" [ style = bold] "child_DoFencing:4_monitor_0 c001n04" -> "probe_complete c001n04" [ style = bold] "child_DoFencing:5_monitor_0 c001n04" -> "probe_complete c001n04" [ style = bold] "child_DoFencing:6_monitor_0 c001n04" -> "probe_complete c001n04" [ style = bold] "child_DoFencing:7_monitor_0 c001n04" -> "probe_complete c001n04" [ style = bold] "DcIPaddr_monitor_0 c001n05" -> "probe_complete c001n05" [ style = bold] "rsc_c001n09_monitor_0 c001n05" -> "probe_complete c001n05" [ style = bold] "rsc_c001n02_monitor_0 c001n05" -> "probe_complete c001n05" [ style = bold] "rsc_c001n03_monitor_0 c001n05" -> "probe_complete c001n05" [ style = bold] "rsc_c001n04_monitor_0 c001n05" -> "probe_complete c001n05" [ style = bold] "rsc_c001n06_monitor_0 c001n05" -> "probe_complete c001n05" [ style = bold] "rsc_c001n07_monitor_0 c001n05" -> "probe_complete c001n05" [ style = bold] "rsc_c001n08_monitor_0 c001n05" -> "probe_complete c001n05" [ style = bold] "child_DoFencing:0_monitor_0 c001n05" -> "probe_complete c001n05" [ style = bold] "child_DoFencing:1_monitor_0 c001n05" -> "probe_complete c001n05" [ style = bold] "child_DoFencing:2_monitor_0 c001n05" -> "probe_complete c001n05" [ style = bold] "child_DoFencing:3_monitor_0 c001n05" -> "probe_complete c001n05" [ style = bold] "child_DoFencing:4_monitor_0 c001n05" -> "probe_complete c001n05" [ style = bold] "child_DoFencing:5_monitor_0 c001n05" -> "probe_complete c001n05" [ style = bold] "child_DoFencing:6_monitor_0 c001n05" -> "probe_complete c001n05" [ style = bold] "child_DoFencing:7_monitor_0 c001n05" -> "probe_complete c001n05" [ style = bold] "DcIPaddr_monitor_0 c001n06" -> "probe_complete c001n06" [ style = bold] "rsc_c001n05_monitor_0 c001n06" -> "probe_complete c001n06" [ style = bold] "rsc_c001n07_monitor_0 c001n06" -> "probe_complete c001n06" [ style = bold] "child_DoFencing:0_monitor_0 c001n06" -> "probe_complete c001n06" [ style = bold] "child_DoFencing:1_monitor_0 c001n06" -> "probe_complete c001n06" [ style = bold] "child_DoFencing:2_monitor_0 c001n06" -> "probe_complete c001n06" [ style = bold] "child_DoFencing:3_monitor_0 c001n06" -> "probe_complete c001n06" [ style = bold] "child_DoFencing:4_monitor_0 c001n06" -> "probe_complete c001n06" [ style = bold] "child_DoFencing:5_monitor_0 c001n06" -> "probe_complete c001n06" [ style = bold] "child_DoFencing:6_monitor_0 c001n06" -> "probe_complete c001n06" [ style = bold] "child_DoFencing:7_monitor_0 c001n06" -> "probe_complete c001n06" [ style = bold] "DcIPaddr_monitor_0 c001n07" -> "probe_complete c001n07" [ style = bold] "rsc_c001n09_monitor_0 c001n07" -> "probe_complete c001n07" [ style = bold] "rsc_c001n02_monitor_0 c001n07" -> "probe_complete c001n07" [ style = bold] "rsc_c001n03_monitor_0 c001n07" -> "probe_complete c001n07" [ style = bold] "rsc_c001n04_monitor_0 c001n07" -> "probe_complete c001n07" [ style = bold] "rsc_c001n05_monitor_0 c001n07" -> "probe_complete c001n07" [ style = bold] "rsc_c001n06_monitor_0 c001n07" -> "probe_complete c001n07" [ style = bold] "rsc_c001n08_monitor_0 c001n07" -> "probe_complete c001n07" [ style = bold] "child_DoFencing:0_monitor_0 c001n07" -> "probe_complete c001n07" [ style = bold] "child_DoFencing:1_monitor_0 c001n07" -> "probe_complete c001n07" [ style = bold] "child_DoFencing:2_monitor_0 c001n07" -> "probe_complete c001n07" [ style = bold] "child_DoFencing:3_monitor_0 c001n07" -> "probe_complete c001n07" [ style = bold] "child_DoFencing:4_monitor_0 c001n07" -> "probe_complete c001n07" [ style = bold] "child_DoFencing:5_monitor_0 c001n07" -> "probe_complete c001n07" [ style = bold] "child_DoFencing:6_monitor_0 c001n07" -> "probe_complete c001n07" [ style = bold] "child_DoFencing:7_monitor_0 c001n07" -> "probe_complete c001n07" [ style = bold] "DcIPaddr_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "rsc_c001n09_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "rsc_c001n02_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "rsc_c001n03_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "rsc_c001n04_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "rsc_c001n05_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "rsc_c001n06_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "rsc_c001n07_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "child_DoFencing:0_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "child_DoFencing:1_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "child_DoFencing:2_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "child_DoFencing:3_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "child_DoFencing:4_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "child_DoFencing:5_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "child_DoFencing:6_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "child_DoFencing:7_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] } diff --git a/crm/pengine/testcases/managed-2.exp b/crm/pengine/testcases/managed-2.exp index 3a85a718de..55b826df8a 100644 --- a/crm/pengine/testcases/managed-2.exp +++ b/crm/pengine/testcases/managed-2.exp @@ -1,1560 +1,1488 @@ - - - - - - - - - - + - + - + - + - + - - - - - - - - - - + - + - + - + - + - + - - - - - - - - - - + - + - + - + - + - + - - - - - - - - - - + - + - + - + - + - + - + - - - - - - - - - - + - + - + - + - + - + - - - - - - - - - - + - + - + - + - + - - - - - - - - - - + - + - + - - - - - - - - - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/crm/pengine/testcases/managed-2.xml b/crm/pengine/testcases/managed-2.xml index fcc99b44b9..9d1c3aee4c 100644 --- a/crm/pengine/testcases/managed-2.xml +++ b/crm/pengine/testcases/managed-2.xml @@ -1,411 +1,411 @@ - - - - - - - - + + + + + + + + diff --git a/crm/pengine/testcases/rec-node-12.dot b/crm/pengine/testcases/rec-node-12.dot index dee9b12204..25710d11ce 100644 --- a/crm/pengine/testcases/rec-node-12.dot +++ b/crm/pengine/testcases/rec-node-12.dot @@ -1,107 +1,107 @@ digraph "g" { size = "30,30" "probe_complete" [ style=bold color="green" fontcolor="orange" ] "probe_complete c001n08" [ style=bold color="green" fontcolor="black" ] "DcIPaddr_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "rsc_c001n08_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "rsc_c001n02_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "rsc_c001n03_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "rsc_c001n01_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:0_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:1_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:2_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:3_monitor_0 c001n08" [ style=bold color="green" fontcolor="black" ] "probe_complete c001n03" [ style=bold color="green" fontcolor="black" ] "DcIPaddr_monitor_0 c001n03" [ style=bold color="green" fontcolor="black" ] "rsc_c001n08_monitor_0 c001n03" [ style=bold color="green" fontcolor="black" ] "rsc_c001n02_monitor_0 c001n03" [ style=bold color="green" fontcolor="black" ] "rsc_c001n03_monitor_0 c001n03" [ style=bold color="green" fontcolor="black" ] "rsc_c001n01_monitor_0 c001n03" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:0_monitor_0 c001n03" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:1_monitor_0 c001n03" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:2_monitor_0 c001n03" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:3_monitor_0 c001n03" [ style=bold color="green" fontcolor="black" ] "probe_complete c001n01" [ style=bold color="green" fontcolor="black" ] "DcIPaddr_monitor_0 c001n01" [ style=bold color="green" fontcolor="black" ] "rsc_c001n08_monitor_0 c001n01" [ style=bold color="green" fontcolor="black" ] "rsc_c001n02_monitor_0 c001n01" [ style=bold color="green" fontcolor="black" ] "rsc_c001n03_monitor_0 c001n01" [ style=bold color="green" fontcolor="black" ] "rsc_c001n01_monitor_0 c001n01" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:0_monitor_0 c001n01" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:1_monitor_0 c001n01" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:2_monitor_0 c001n01" [ style=bold color="green" fontcolor="black" ] "child_DoFencing:3_monitor_0 c001n01" [ style=bold color="green" fontcolor="black" ] "DcIPaddr_start_0 c001n08" [ style=bold color="green" fontcolor="black" ] "DcIPaddr_monitor_5000 c001n08" [ style=bold color="green" fontcolor="black" ] "rsc_c001n08_start_0 c001n08" [ style=bold color="green" fontcolor="black" ] "rsc_c001n08_monitor_5000 c001n08" [ style=bold color="green" fontcolor="black" ] "rsc_c001n02_start_0 c001n03" [ style=bold color="green" fontcolor="black" ] "rsc_c001n02_monitor_5000 c001n03" [ style=bold color="green" fontcolor="black" ] "rsc_c001n03_start_0 c001n03" [ style=bold color="green" fontcolor="black" ] "rsc_c001n03_monitor_5000 c001n03" [ style=bold color="green" fontcolor="black" ] "rsc_c001n01_start_0 c001n01" [ style=bold color="green" fontcolor="black" ] "rsc_c001n01_monitor_5000 c001n01" [ style=bold color="green" fontcolor="black" ] -"child_DoFencing:0_start_0 c001n08" [ style=bold color="green" fontcolor="black" ] -"child_DoFencing:0_monitor_5000 c001n08" [ style=bold color="green" fontcolor="black" ] -"child_DoFencing:1_start_0 c001n03" [ style=bold color="green" fontcolor="black" ] -"child_DoFencing:1_monitor_5000 c001n03" [ style=bold color="green" fontcolor="black" ] -"child_DoFencing:2_start_0 c001n01" [ style=bold color="green" fontcolor="black" ] -"child_DoFencing:2_monitor_5000 c001n01" [ style=bold color="green" fontcolor="black" ] +"child_DoFencing:0_start_0 c001n01" [ style=bold color="green" fontcolor="black" ] +"child_DoFencing:0_monitor_5000 c001n01" [ style=bold color="green" fontcolor="black" ] +"child_DoFencing:1_start_0 c001n08" [ style=bold color="green" fontcolor="black" ] +"child_DoFencing:1_monitor_5000 c001n08" [ style=bold color="green" fontcolor="black" ] +"child_DoFencing:2_start_0 c001n03" [ style=bold color="green" fontcolor="black" ] +"child_DoFencing:2_monitor_5000 c001n03" [ style=bold color="green" fontcolor="black" ] "DoFencing_start_0" [ style=bold color="green" fontcolor="orange" ] "DoFencing_running_0" [ style=bold color="green" fontcolor="orange" ] "stonith c001n02" [ style=bold color="green" fontcolor="black" ] "probe_complete c001n08" -> "probe_complete" [ style = bold] "probe_complete c001n03" -> "probe_complete" [ style = bold] "probe_complete c001n01" -> "probe_complete" [ style = bold] "DcIPaddr_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "rsc_c001n08_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "rsc_c001n02_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "rsc_c001n03_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "rsc_c001n01_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "child_DoFencing:0_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "child_DoFencing:1_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "child_DoFencing:2_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "child_DoFencing:3_monitor_0 c001n08" -> "probe_complete c001n08" [ style = bold] "DcIPaddr_monitor_0 c001n03" -> "probe_complete c001n03" [ style = bold] "rsc_c001n08_monitor_0 c001n03" -> "probe_complete c001n03" [ style = bold] "rsc_c001n02_monitor_0 c001n03" -> "probe_complete c001n03" [ style = bold] "rsc_c001n03_monitor_0 c001n03" -> "probe_complete c001n03" [ style = bold] "rsc_c001n01_monitor_0 c001n03" -> "probe_complete c001n03" [ style = bold] "child_DoFencing:0_monitor_0 c001n03" -> "probe_complete c001n03" [ style = bold] "child_DoFencing:1_monitor_0 c001n03" -> "probe_complete c001n03" [ style = bold] "child_DoFencing:2_monitor_0 c001n03" -> "probe_complete c001n03" [ style = bold] "child_DoFencing:3_monitor_0 c001n03" -> "probe_complete c001n03" [ style = bold] "DcIPaddr_monitor_0 c001n01" -> "probe_complete c001n01" [ style = bold] "rsc_c001n08_monitor_0 c001n01" -> "probe_complete c001n01" [ style = bold] "rsc_c001n02_monitor_0 c001n01" -> "probe_complete c001n01" [ style = bold] "rsc_c001n03_monitor_0 c001n01" -> "probe_complete c001n01" [ style = bold] "rsc_c001n01_monitor_0 c001n01" -> "probe_complete c001n01" [ style = bold] "child_DoFencing:0_monitor_0 c001n01" -> "probe_complete c001n01" [ style = bold] "child_DoFencing:1_monitor_0 c001n01" -> "probe_complete c001n01" [ style = bold] "child_DoFencing:2_monitor_0 c001n01" -> "probe_complete c001n01" [ style = bold] "child_DoFencing:3_monitor_0 c001n01" -> "probe_complete c001n01" [ style = bold] "probe_complete" -> "DcIPaddr_start_0 c001n08" [ style = bold] "DcIPaddr_start_0 c001n08" -> "DcIPaddr_monitor_5000 c001n08" [ style = bold] "probe_complete" -> "rsc_c001n08_start_0 c001n08" [ style = bold] "rsc_c001n08_start_0 c001n08" -> "rsc_c001n08_monitor_5000 c001n08" [ style = bold] "probe_complete" -> "rsc_c001n02_start_0 c001n03" [ style = bold] "rsc_c001n02_start_0 c001n03" -> "rsc_c001n02_monitor_5000 c001n03" [ style = bold] "probe_complete" -> "rsc_c001n03_start_0 c001n03" [ style = bold] "rsc_c001n03_start_0 c001n03" -> "rsc_c001n03_monitor_5000 c001n03" [ style = bold] "probe_complete" -> "rsc_c001n01_start_0 c001n01" [ style = bold] "rsc_c001n01_start_0 c001n01" -> "rsc_c001n01_monitor_5000 c001n01" [ style = bold] -"DoFencing_start_0" -> "child_DoFencing:0_start_0 c001n08" [ style = bold] -"child_DoFencing:0_start_0 c001n08" -> "child_DoFencing:0_monitor_5000 c001n08" [ style = bold] -"DoFencing_start_0" -> "child_DoFencing:1_start_0 c001n03" [ style = bold] -"child_DoFencing:1_start_0 c001n03" -> "child_DoFencing:1_monitor_5000 c001n03" [ style = bold] -"DoFencing_start_0" -> "child_DoFencing:2_start_0 c001n01" [ style = bold] -"child_DoFencing:2_start_0 c001n01" -> "child_DoFencing:2_monitor_5000 c001n01" [ style = bold] +"DoFencing_start_0" -> "child_DoFencing:0_start_0 c001n01" [ style = bold] +"child_DoFencing:0_start_0 c001n01" -> "child_DoFencing:0_monitor_5000 c001n01" [ style = bold] +"DoFencing_start_0" -> "child_DoFencing:1_start_0 c001n08" [ style = bold] +"child_DoFencing:1_start_0 c001n08" -> "child_DoFencing:1_monitor_5000 c001n08" [ style = bold] +"DoFencing_start_0" -> "child_DoFencing:2_start_0 c001n03" [ style = bold] +"child_DoFencing:2_start_0 c001n03" -> "child_DoFencing:2_monitor_5000 c001n03" [ style = bold] "probe_complete" -> "DoFencing_start_0" [ style = bold] -"child_DoFencing:0_start_0 c001n08" -> "DoFencing_running_0" [ style = bold] -"child_DoFencing:1_start_0 c001n03" -> "DoFencing_running_0" [ style = bold] -"child_DoFencing:2_start_0 c001n01" -> "DoFencing_running_0" [ style = bold] +"child_DoFencing:0_start_0 c001n01" -> "DoFencing_running_0" [ style = bold] +"child_DoFencing:1_start_0 c001n08" -> "DoFencing_running_0" [ style = bold] +"child_DoFencing:2_start_0 c001n03" -> "DoFencing_running_0" [ style = bold] "DoFencing_start_0" -> "DoFencing_running_0" [ style = bold] -"child_DoFencing:0_start_0 c001n08" -> "stonith c001n02" [ style = bold] -"child_DoFencing:1_start_0 c001n03" -> "stonith c001n02" [ style = bold] -"child_DoFencing:2_start_0 c001n01" -> "stonith c001n02" [ style = bold] +"child_DoFencing:0_start_0 c001n01" -> "stonith c001n02" [ style = bold] +"child_DoFencing:1_start_0 c001n08" -> "stonith c001n02" [ style = bold] +"child_DoFencing:2_start_0 c001n03" -> "stonith c001n02" [ style = bold] } diff --git a/crm/pengine/testcases/rec-node-12.exp b/crm/pengine/testcases/rec-node-12.exp index c46bc430ac..8f0730da0e 100644 --- a/crm/pengine/testcases/rec-node-12.exp +++ b/crm/pengine/testcases/rec-node-12.exp @@ -1,631 +1,631 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/crm/pengine/testcases/rsc_dep10.dot b/crm/pengine/testcases/rsc_dep10.dot index 3c015d350a..fcce0c3986 100644 --- a/crm/pengine/testcases/rsc_dep10.dot +++ b/crm/pengine/testcases/rsc_dep10.dot @@ -1,16 +1,18 @@ digraph "g" { size = "30,30" "probe_complete" [ style=bold color="green" fontcolor="orange" ] "probe_complete node1" [ style=bold color="green" fontcolor="black" ] "rsc1_monitor_0 node1" [ style=bold color="green" fontcolor="black" ] "rsc2_monitor_0 node1" [ style=bold color="green" fontcolor="black" ] "probe_complete node2" [ style=bold color="green" fontcolor="black" ] "rsc1_monitor_0 node2" [ style=bold color="green" fontcolor="black" ] "rsc2_monitor_0 node2" [ style=bold color="green" fontcolor="black" ] +"rsc2_start_0 node1" [ style=bold color="green" fontcolor="black" ] "probe_complete node1" -> "probe_complete" [ style = bold] "probe_complete node2" -> "probe_complete" [ style = bold] "rsc1_monitor_0 node1" -> "probe_complete node1" [ style = bold] "rsc2_monitor_0 node1" -> "probe_complete node1" [ style = bold] "rsc1_monitor_0 node2" -> "probe_complete node2" [ style = bold] "rsc2_monitor_0 node2" -> "probe_complete node2" [ style = bold] +"probe_complete" -> "rsc2_start_0 node1" [ style = bold] } diff --git a/crm/pengine/testcases/rsc_dep10.exp b/crm/pengine/testcases/rsc_dep10.exp index d380cdb873..c75cf04520 100644 --- a/crm/pengine/testcases/rsc_dep10.exp +++ b/crm/pengine/testcases/rsc_dep10.exp @@ -1,84 +1,97 @@ + + + + + + + + + + + + + - + - + diff --git a/crm/pengine/testcases/rsc_dep10.xml b/crm/pengine/testcases/rsc_dep10.xml index 0ec68cc1e3..c19d95241e 100644 --- a/crm/pengine/testcases/rsc_dep10.xml +++ b/crm/pengine/testcases/rsc_dep10.xml @@ -1,44 +1,36 @@ - - - - - - - - - - + + diff --git a/crm/pengine/testcases/rsc_dep5.xml b/crm/pengine/testcases/rsc_dep5.xml index bb6a1508ad..27a42e8657 100644 --- a/crm/pengine/testcases/rsc_dep5.xml +++ b/crm/pengine/testcases/rsc_dep5.xml @@ -1,46 +1,46 @@ - + diff --git a/lib/crm/pengine/utils.c b/lib/crm/pengine/utils.c index e3d0480d55..ec362d983f 100644 --- a/lib/crm/pengine/utils.c +++ b/lib/crm/pengine/utils.c @@ -1,1281 +1,1279 @@ /* $Id: utils.c,v 1.11 2006/08/14 09:14:45 andrew Exp $ */ /* * 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 void print_str_str(gpointer key, gpointer value, gpointer user_data); gboolean ghash_free_str_str(gpointer key, gpointer value, gpointer user_data); void unpack_operation( action_t *action, crm_data_t *xml_obj, pe_working_set_t* data_set); void pe_free_shallow(GListPtr alist) { pe_free_shallow_adv(alist, TRUE); } void pe_free_shallow_adv(GListPtr alist, gboolean with_data) { GListPtr item; GListPtr item_next = alist; while(item_next != NULL) { item = item_next; item_next = item_next->next; if(with_data) { /* crm_debug_5("freeing %p", item->data); */ crm_free(item->data); } item->data = NULL; item->next = NULL; g_list_free(item); } } 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 * node_copy(node_t *this_node) { node_t *new_node = NULL; CRM_CHECK(this_node != NULL, return NULL); crm_malloc0(new_node, sizeof(node_t)); CRM_CHECK(new_node != NULL, return NULL); crm_debug_5("Copying %p (%s) to %p", this_node, this_node->details->uname, new_node); new_node->weight = this_node->weight; new_node->fixed = this_node->fixed; new_node->details = this_node->details; return new_node; } /* are the contents of list1 and list2 equal * nodes with weight < 0 are ignored if filter == TRUE * * slow but linear * */ gboolean node_list_eq(GListPtr list1, GListPtr list2, gboolean filter) { node_t *other_node; GListPtr lhs = list1; GListPtr rhs = list2; slist_iter( node, node_t, lhs, lpc, if(node == NULL || (filter && node->weight < 0)) { continue; } other_node = (node_t*) pe_find_node_id(rhs, node->details->id); if(other_node == NULL || other_node->weight < 0) { return FALSE; } ); lhs = list2; rhs = list1; slist_iter( node, node_t, lhs, lpc, if(node == NULL || (filter && node->weight < 0)) { continue; } other_node = (node_t*) pe_find_node_id(rhs, node->details->id); if(other_node == NULL || other_node->weight < 0) { return FALSE; } ); return TRUE; } /* the intersection of list1 and list2 */ GListPtr node_list_and(GListPtr list1, GListPtr list2, gboolean filter) { GListPtr result = NULL; unsigned lpc = 0; for(lpc = 0; lpc < g_list_length(list1); lpc++) { node_t *node = (node_t*)g_list_nth_data(list1, lpc); node_t *other_node = pe_find_node_id(list2, node->details->id); node_t *new_node = NULL; if(other_node != NULL) { new_node = node_copy(node); } if(new_node != NULL) { crm_debug_4("%s: %d + %d", node->details->uname, other_node->weight, new_node->weight); new_node->weight = merge_weights( new_node->weight, other_node->weight); crm_debug_3("New node weight for %s: %d", new_node->details->uname, new_node->weight); if(filter && new_node->weight < 0) { crm_free(new_node); new_node = NULL; } } if(new_node != NULL) { result = g_list_append(result, new_node); } } return result; } /* list1 - list2 */ GListPtr node_list_minus(GListPtr list1, GListPtr list2, gboolean filter) { GListPtr result = NULL; slist_iter( node, node_t, list1, lpc, node_t *other_node = pe_find_node_id(list2, node->details->id); node_t *new_node = NULL; if(node == NULL || other_node != NULL || (filter && node->weight < 0)) { continue; } new_node = node_copy(node); result = g_list_append(result, new_node); ); crm_debug_3("Minus result len: %d", g_list_length(result)); return result; } /* list1 + list2 - (intersection of list1 and list2) */ GListPtr node_list_xor(GListPtr list1, GListPtr list2, gboolean filter) { GListPtr result = NULL; slist_iter( node, node_t, list1, lpc, node_t *new_node = NULL; node_t *other_node = (node_t*) pe_find_node_id(list2, node->details->id); if(node == NULL || other_node != NULL || (filter && node->weight < 0)) { continue; } new_node = node_copy(node); result = g_list_append(result, new_node); ); slist_iter( node, node_t, list2, lpc, node_t *new_node = NULL; node_t *other_node = (node_t*) pe_find_node_id(list1, node->details->id); if(node == NULL || other_node != NULL || (filter && node->weight < 0)) { continue; } new_node = node_copy(node); result = g_list_append(result, new_node); ); crm_debug_3("Xor result len: %d", g_list_length(result)); return result; } GListPtr node_list_or(GListPtr list1, GListPtr list2, gboolean filter) { node_t *other_node = NULL; GListPtr result = NULL; gboolean needs_filter = FALSE; result = node_list_dup(list1, FALSE, filter); slist_iter( node, node_t, list2, lpc, if(node == NULL) { continue; } other_node = (node_t*)pe_find_node_id( result, node->details->id); if(other_node != NULL) { crm_debug_4("%s + %s: %d + %d", node->details->uname, other_node->details->uname, node->weight, other_node->weight); other_node->weight = merge_weights( other_node->weight, node->weight); if(filter && node->weight < 0) { needs_filter = TRUE; } } else if(filter == FALSE || node->weight >= 0) { node_t *new_node = node_copy(node); result = g_list_append(result, new_node); } ); /* not the neatest way, but the most expedient for now */ if(filter && needs_filter) { GListPtr old_result = result; result = node_list_dup(old_result, FALSE, filter); pe_free_shallow_adv(old_result, TRUE); } return result; } GListPtr node_list_dup(GListPtr list1, gboolean reset, gboolean filter) { GListPtr result = NULL; slist_iter( this_node, node_t, list1, lpc, node_t *new_node = NULL; if(filter && this_node->weight < 0) { continue; } new_node = node_copy(this_node); if(reset) { new_node->weight = 0; } if(new_node != NULL) { result = g_list_append(result, new_node); } ); return result; } gint sort_rsc_priority(gconstpointer a, gconstpointer b) { const resource_t *resource1 = (const resource_t*)a; const resource_t *resource2 = (const resource_t*)b; if(a == NULL && b == NULL) { return 0; } if(a == NULL) { return 1; } if(b == NULL) { return -1; } if(resource1->priority > resource2->priority) { return -1; } if(resource1->priority < resource2->priority) { return 1; } return 0; } action_t * custom_action(resource_t *rsc, char *key, const char *task, node_t *on_node, gboolean optional, gboolean save_action, pe_working_set_t *data_set) { action_t *action = NULL; GListPtr possible_matches = NULL; CRM_CHECK(key != NULL, return NULL); CRM_CHECK(task != NULL, return NULL); if(save_action && rsc != NULL) { possible_matches = find_actions(rsc->actions, key, on_node); } if(possible_matches != NULL) { crm_free(key); if(g_list_length(possible_matches) > 1) { pe_warn("Action %s for %s on %s exists %d times", task, rsc?rsc->id:"", on_node?on_node->details->uname:"", g_list_length(possible_matches)); } action = g_list_nth_data(possible_matches, 0); crm_debug_4("Found existing action (%d) %s for %s on %s", action->id, task, rsc?rsc->id:"", on_node?on_node->details->uname:""); } if(action == NULL) { if(save_action) { crm_debug_2("Creating%s action %d: %s for %s on %s", optional?"":" manditory", data_set->action_id, key, rsc?rsc->id:"", on_node?on_node->details->uname:""); } crm_malloc0(action, sizeof(action_t)); if(action != NULL) { if(save_action) { action->id = data_set->action_id++; } else { action->id = 0; } action->rsc = rsc; action->task = task; action->node = on_node; action->actions_before = NULL; action->actions_after = NULL; action->failure_is_fatal = TRUE; action->pseudo = FALSE; action->dumped = FALSE; action->runnable = TRUE; action->processed = FALSE; action->optional = optional; action->seen_count = 0; action->extra = g_hash_table_new_full( g_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str); action->meta = g_hash_table_new_full( g_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str); if(save_action) { data_set->actions = g_list_append( data_set->actions, action); } action->uuid = key; if(rsc != NULL) { action->op_entry = find_rsc_op_entry(rsc, key); unpack_operation( action, action->op_entry, data_set); if(save_action) { rsc->actions = g_list_append( rsc->actions, action); } } if(save_action) { crm_debug_4("Action %d created", action->id); } } } if(optional == FALSE && action->optional) { crm_debug_2("Action %d (%s) marked manditory", action->id, action->uuid); action->optional = FALSE; } if(rsc != NULL) { enum action_tasks a_task = text2task(action->task); int warn_level = LOG_DEBUG_3; if(save_action) { warn_level = LOG_WARNING; } if(action->node != NULL && action->op_entry != NULL) { unpack_instance_attributes( action->op_entry, XML_TAG_ATTR_SETS, action->node->details->attrs, action->extra, NULL, data_set->now); } if(action->node == NULL) { action->runnable = FALSE; } else if(rsc->is_managed == FALSE) { crm_log_maybe(warn_level, "Action %s %s is for %s (unmanaged)", action->uuid, task, rsc->id); action->optional = TRUE; /* action->runnable = FALSE; */ #if 0 } else if(action->node->details->unclean) { crm_log_maybe(warn_level, "Action %s on %s is unrunnable (unclean)", action->uuid, action->node?action->node->details->uname:""); action->runnable = FALSE; #endif } else if(action->node->details->online == FALSE) { action->runnable = FALSE; crm_log_maybe(warn_level, "Action %s on %s is unrunnable (offline)", action->uuid, action->node->details->uname); if(action->rsc->is_managed && save_action && a_task == stop_rsc) { crm_log_maybe(warn_level, "Marking node %s unclean", action->node->details->uname); action->node->details->unclean = TRUE; } } else if(action->needs == rsc_req_nothing) { crm_debug_3("Action %s doesnt require anything", action->uuid); action->runnable = TRUE; #if 0 /* * No point checking this * - if we dont have quorum we cant stonith anyway */ } else if(action->needs == rsc_req_stonith) { crm_debug_3("Action %s requires only stonith", action->uuid); action->runnable = TRUE; #endif } else if(data_set->have_quorum == FALSE && data_set->no_quorum_policy == no_quorum_stop) { action->runnable = FALSE; crm_debug("%s\t%s %s (cancelled : quorum)", action->node->details->uname, action->task, rsc->id); } else if(data_set->have_quorum == FALSE && data_set->no_quorum_policy == no_quorum_freeze) { crm_debug_3("Check resource is already active"); if(rsc->fns->active(rsc, TRUE) == FALSE) { action->runnable = FALSE; crm_debug("%s\t%s %s (cancelled : quorum freeze)", action->node->details->uname, action->task, rsc->id); } } else { crm_debug_3("Action %s is runnable", action->uuid); action->runnable = TRUE; } if(save_action) { switch(a_task) { case stop_rsc: rsc->stopping = TRUE; break; case start_rsc: rsc->starting = FALSE; if(action->runnable) { rsc->starting = TRUE; } break; default: break; } } } return action; } void unpack_operation( action_t *action, crm_data_t *xml_obj, pe_working_set_t* data_set) { int lpc = 0; const char *class = NULL; const char *value = NULL; const char *fields[] = { XML_LRM_ATTR_INTERVAL, "timeout", "start_delay", }; CRM_CHECK(action->rsc != NULL, return); if(xml_obj != NULL) { value = crm_element_value(xml_obj, "prereq"); } if(value == NULL && safe_str_eq(action->task, CRMD_ACTION_START)) { value = g_hash_table_lookup( action->rsc->meta, "start_prereq"); } if(value == NULL && safe_str_neq(action->task, CRMD_ACTION_START)) { /* todo: integrate stop as an option? */ action->needs = rsc_req_nothing; value = "nothing (default)"; } else if(safe_str_eq(value, "nothing")) { action->needs = rsc_req_nothing; } else if(safe_str_eq(value, "quorum")) { action->needs = rsc_req_quorum; } else if(safe_str_eq(value, "fencing")) { action->needs = rsc_req_stonith; } else if(data_set->no_quorum_policy == no_quorum_ignore) { action->needs = rsc_req_nothing; value = "nothing (default)"; } else if(data_set->no_quorum_policy == no_quorum_freeze && data_set->stonith_enabled) { action->needs = rsc_req_stonith; value = "fencing (default)"; } else { action->needs = rsc_req_quorum; value = "quorum (default)"; } class = g_hash_table_lookup(action->rsc->meta, "class"); if(safe_str_eq(class, "stonith")) { if(action->needs == rsc_req_stonith) { crm_config_err("Stonith resources (eg. %s) cannot require" " fencing to start", action->rsc->id); } action->needs = rsc_req_nothing; value = "nothing (fencing override)"; } crm_debug_3("\tAction %s requires: %s", action->task, value); value = NULL; if(xml_obj != NULL) { value = crm_element_value(xml_obj, "on_fail"); } if(value == NULL && safe_str_eq(action->task, CRMD_ACTION_STOP)) { value = g_hash_table_lookup( action->rsc->meta, "on_stopfail"); if(value != NULL) { #if CRM_DEPRECATED_SINCE_2_0_2 crm_config_err("The \"on_stopfail\" attribute used in" " %s has been deprecated since 2.0.2", action->rsc->id); #else crm_config_err("The \"on_stopfail\" attribute used in" " %s has been deprecated since 2.0.2" " and is now disabled", action->rsc->id); value = NULL; #endif crm_config_err("Please use specify the \"on_fail\"" " attribute on the \"stop\" operation" " instead"); } } if(value == NULL) { } else if(safe_str_eq(value, "block")) { action->on_fail = action_fail_block; } else if(safe_str_eq(value, "fence")) { action->on_fail = action_fail_fence; value = "node fencing"; } else if(safe_str_eq(value, "ignore")) { action->on_fail = action_fail_ignore; value = "ignore"; } else if(safe_str_eq(value, "migrate")) { action->on_fail = action_fail_migrate; value = "force migration"; } else if(safe_str_eq(value, "stop")) { action->fail_role = RSC_ROLE_STOPPED; value = "stop resource"; } else if(safe_str_eq(value, "restart") || safe_str_eq(value, "nothing")) { action->on_fail = action_fail_recover; value = "restart (and possibly migrate)"; } else { pe_err("Resource %s: Unknown failure type (%s)", action->rsc->id, value); value = NULL; } /* defaults */ if(value == NULL && safe_str_eq(action->task, CRMD_ACTION_STOP)) { if(data_set->stonith_enabled) { action->on_fail = action_fail_fence; value = "resource fence (default)"; } else { action->on_fail = action_fail_block; value = "resource block (default)"; } } else if(value == NULL) { action->on_fail = action_fail_recover; value = "restart (and possibly migrate) (default)"; } crm_debug_3("\t%s failure handling: %s", action->task, value); value = NULL; if(xml_obj != NULL) { value = crm_element_value(xml_obj, "role_after_failure"); } if(value != NULL && action->fail_role == RSC_ROLE_UNKNOWN) { action->fail_role = text2role(value); } /* defaults */ if(action->fail_role == RSC_ROLE_UNKNOWN) { if(safe_str_eq(action->task, CRMD_ACTION_PROMOTE)) { action->fail_role = RSC_ROLE_SLAVE; } else { action->fail_role = RSC_ROLE_STARTED; } } crm_debug_3("\t%s failure results in: %s", action->task, role2text(action->fail_role)); if(xml_obj != NULL) { xml_prop_iter(xml_obj, p_name, p_value, if(p_value != NULL) { g_hash_table_insert(action->meta, crm_strdup(p_name), crm_strdup(p_value)); } ); unpack_instance_attributes(xml_obj, XML_TAG_META_SETS, NULL, action->meta, NULL, data_set->now); unpack_instance_attributes(xml_obj, XML_TAG_ATTR_SETS, NULL, action->meta, NULL, data_set->now); } if(g_hash_table_lookup(action->meta, "timeout") == NULL) { g_hash_table_insert( action->meta, crm_strdup("timeout"), crm_strdup(pe_pref(data_set->config_hash, "default-action-timeout"))); } for(;lpc < DIMOF(fields); lpc++) { value = g_hash_table_lookup(action->meta, fields[lpc]); if(value != NULL) { char *tmp_ms = NULL; int tmp_i = crm_get_msec(value); if(tmp_i < 0) { tmp_i = 0; } tmp_ms = crm_itoa(tmp_i); g_hash_table_replace( action->meta, crm_strdup(fields[lpc]), tmp_ms); } } } crm_data_t * find_rsc_op_entry(resource_t *rsc, const char *key) { const char *name = NULL; const char *value = NULL; const char *interval = NULL; char *match_key = NULL; crm_data_t *op = NULL; xml_child_iter_filter( rsc->ops_xml, operation, "op", name = crm_element_value(operation, "name"); interval = crm_element_value(operation, XML_LRM_ATTR_INTERVAL); value = crm_element_value(operation, "disabled"); if(crm_is_true(value)) { crm_debug_2("%s disabled", ID(operation)); continue; } match_key = generate_op_key( rsc->id, name, crm_get_msec(interval)); if(safe_str_eq(key, match_key)) { op = operation; } crm_free(match_key); if(op != NULL) { return op; } ); crm_debug_3("No match for %s", key); return op; } void print_node(const char *pre_text, node_t *node, gboolean details) { if(node == NULL) { crm_debug_4("%s%s: ", pre_text==NULL?"":pre_text, pre_text==NULL?"":": "); return; } crm_debug_4("%s%s%sNode %s: (weight=%d, fixed=%s)", pre_text==NULL?"":pre_text, pre_text==NULL?"":": ", node->details==NULL?"error ":node->details->online?"":"Unavailable/Unclean ", node->details->uname, node->weight, node->fixed?"True":"False"); if(details && node != NULL && node->details != NULL) { char *pe_mutable = crm_strdup("\t\t"); crm_debug_4("\t\t===Node Attributes"); g_hash_table_foreach(node->details->attrs, print_str_str, pe_mutable); crm_free(pe_mutable); crm_debug_4("\t\t=== Resources"); slist_iter( rsc, resource_t, node->details->running_rsc, lpc, print_resource(LOG_DEBUG_4, "\t\t", rsc, FALSE); ); } } /* * Used by the HashTable for-loop */ void print_str_str(gpointer key, gpointer value, gpointer user_data) { crm_debug_4("%s%s %s ==> %s", user_data==NULL?"":(char*)user_data, user_data==NULL?"":": ", (char*)key, (char*)value); } void print_resource( int log_level, const char *pre_text, resource_t *rsc, gboolean details) { long options = pe_print_log; if(rsc == NULL) { crm_log_maybe(log_level-1, "%s%s: ", pre_text==NULL?"":pre_text, pre_text==NULL?"":": "); return; } if(details) { options |= pe_print_details; } rsc->fns->print(rsc, pre_text, options, &log_level); } void log_action(unsigned int log_level, const char *pre_text, action_t *action, gboolean details) { const char *node_uname = NULL; const char *node_uuid = NULL; if(action == NULL) { crm_log_maybe(log_level, "%s%s: ", pre_text==NULL?"":pre_text, pre_text==NULL?"":": "); return; } if(action->pseudo) { node_uname = NULL; node_uuid = NULL; } else if(action->node != NULL) { node_uname = action->node->details->uname; node_uuid = action->node->details->id; } else { node_uname = ""; node_uuid = NULL; } switch(text2task(action->task)) { case stonith_node: case shutdown_crm: crm_log_maybe(log_level, "%s%s%sAction %d: %s%s%s%s%s%s", pre_text==NULL?"":pre_text, pre_text==NULL?"":": ", action->pseudo?"Pseduo ":action->optional?"Optional ":action->runnable?action->processed?"":"(Provisional) ":"!!Non-Startable!! ", action->id, action->uuid, node_uname?"\ton ":"", node_uname?node_uname:"", node_uuid?"\t\t(":"", node_uuid?node_uuid:"", node_uuid?")":""); break; default: crm_log_maybe(log_level, "%s%s%sAction %d: %s %s%s%s%s%s%s", pre_text==NULL?"":pre_text, pre_text==NULL?"":": ", action->optional?"Optional ":action->pseudo?"Pseduo ":action->runnable?action->processed?"":"(Provisional) ":"!!Non-Startable!! ", action->id, action->uuid, safe_val3("", action, rsc, id), node_uname?"\ton ":"", node_uname?node_uname:"", node_uuid?"\t\t(":"", node_uuid?node_uuid:"", node_uuid?")":""); break; } if(details) { crm_log_maybe(log_level+1, "\t\t====== Preceeding Actions"); slist_iter( other, action_wrapper_t, action->actions_before, lpc, log_action(log_level+1, "\t\t", other->action, FALSE); ); #if 1 crm_log_maybe(log_level+1, "\t\t====== Subsequent Actions"); slist_iter( other, action_wrapper_t, action->actions_after, lpc, log_action(log_level+1, "\t\t", other->action, FALSE); ); #endif crm_log_maybe(log_level+1, "\t\t====== End"); } else { crm_log_maybe(log_level, "\t\t(seen=%d, before=%d, after=%d)", action->seen_count, g_list_length(action->actions_before), g_list_length(action->actions_after)); } } void pe_free_action(action_t *action) { if(action == NULL) { return; } pe_free_shallow(action->actions_before);/* action_warpper_t* */ pe_free_shallow(action->actions_after); /* action_warpper_t* */ g_hash_table_destroy(action->extra); g_hash_table_destroy(action->meta); crm_free(action->uuid); crm_free(action); } GListPtr find_recurring_actions(GListPtr input, node_t *not_on_node) { const char *value = NULL; GListPtr result = NULL; CRM_CHECK(input != NULL, return NULL); slist_iter( action, action_t, input, lpc, value = g_hash_table_lookup(action->meta, XML_LRM_ATTR_INTERVAL); if(value == NULL) { /* skip */ } else if(safe_str_eq(value, "0")) { /* skip */ } else if(safe_str_eq(CRMD_ACTION_CANCEL, action->task)) { /* skip */ } else if(not_on_node == NULL) { crm_debug_5("(null) Found: %s", action->uuid); result = g_list_append(result, action); } else if(action->node == NULL) { /* skip */ } else if(action->node->details != not_on_node->details) { crm_debug_5("Found: %s", action->uuid); result = g_list_append(result, action); } ); return result; } GListPtr find_actions(GListPtr input, const char *key, node_t *on_node) { GListPtr result = NULL; CRM_CHECK(key != NULL, return NULL); slist_iter( action, action_t, input, lpc, crm_debug_5("Matching %s against %s", key, action->uuid); if(safe_str_neq(key, action->uuid)) { continue; } else if(on_node == NULL) { result = g_list_append(result, action); } else if(action->node == NULL) { /* skip */ crm_debug_2("While looking for %s action on %s, " "found an unallocated one. Assigning" " it to the requested node...", key, on_node->details->uname); action->node = on_node; result = g_list_append(result, action); } else if(safe_str_eq(on_node->details->id, action->node->details->id)) { result = g_list_append(result, action); } ); return result; } GListPtr find_actions_exact(GListPtr input, const char *key, node_t *on_node) { GListPtr result = NULL; CRM_CHECK(key != NULL, return NULL); slist_iter( action, action_t, input, lpc, crm_debug_5("Matching %s against %s", key, action->uuid); if(safe_str_neq(key, action->uuid)) { crm_debug_3("Key mismatch: %s vs. %s", key, action->uuid); continue; } else if(on_node == NULL || action->node == NULL) { crm_debug_3("on_node=%p, action->node=%p", on_node, action->node); continue; } else if(safe_str_eq(on_node->details->id, action->node->details->id)) { result = g_list_append(result, action); } crm_debug_2("Node mismatch: %s vs. %s", on_node->details->id, action->node->details->id); ); return result; } void set_id(crm_data_t * xml_obj, const char *prefix, int child) { int id_len = 0; gboolean use_prefix = TRUE; gboolean use_child = TRUE; char *new_id = NULL; const char *id = crm_element_value(xml_obj, XML_ATTR_ID); id_len = 1 + strlen(id); if(child > 999) { pe_err("Are you insane?!?" " The CRM does not support > 1000 children per resource"); return; } else if(child < 0) { use_child = FALSE; } else { id_len += 4; /* child */ } if(prefix == NULL || safe_str_eq(id, prefix)) { use_prefix = FALSE; } else { id_len += (1 + strlen(prefix)); } crm_malloc0(new_id, id_len); if(use_child) { snprintf(new_id, id_len, "%s%s%s:%d", use_prefix?prefix:"", use_prefix?":":"", id, child); } else { snprintf(new_id, id_len, "%s%s%s", use_prefix?prefix:"", use_prefix?":":"", id); } crm_xml_add(xml_obj, XML_ATTR_ID, new_id); crm_free(new_id); } static void resource_node_score(resource_t *rsc, node_t *node, int score, const char *tag) { node_t *match = NULL; crm_debug_2("Setting %s for %s on %s: %d", tag, rsc->id, node->details->uname, score); match = pe_find_node_id(rsc->allowed_nodes, node->details->id); if(match == NULL) { match = node_copy(node); match->weight = 0; rsc->allowed_nodes = g_list_append(rsc->allowed_nodes, match); } match->weight = merge_weights(match->weight, score); } void resource_location(resource_t *rsc, node_t *node, int score, const char *tag, pe_working_set_t *data_set) { CRM_CHECK(rsc->variant == pe_native, return); if(node != NULL) { resource_node_score(rsc, node, score, tag); } else if(data_set != NULL) { slist_iter( node, node_t, data_set->nodes, lpc, resource_node_score(rsc, node, score, tag); ); } else { slist_iter( node, node_t, rsc->allowed_nodes, lpc, resource_node_score(rsc, node, score, tag); ); } if(node == NULL && score == -INFINITY) { rsc->provisional = FALSE; - if(rsc->allocated_to) { - crm_free(rsc->allocated_to); - rsc->allocated_to = NULL; - } + crm_free(rsc->allocated_to); + rsc->allocated_to = NULL; } } void order_actions( action_t *lh_action, action_t *rh_action, enum pe_ordering order) { action_wrapper_t *wrapper = NULL; GListPtr list = NULL; crm_debug_2("Ordering Action %s before %s", lh_action->uuid, rh_action->uuid); log_action(LOG_DEBUG_4, "LH (order_actions)", lh_action, FALSE); log_action(LOG_DEBUG_4, "RH (order_actions)", rh_action, FALSE); crm_malloc0(wrapper, sizeof(action_wrapper_t)); if(wrapper != NULL) { wrapper->action = rh_action; wrapper->type = order; list = lh_action->actions_after; list = g_list_append(list, wrapper); lh_action->actions_after = list; wrapper = NULL; } if(order != pe_ordering_recover) { crm_malloc0(wrapper, sizeof(action_wrapper_t)); if(wrapper != NULL) { wrapper->action = lh_action; wrapper->type = order; list = rh_action->actions_before; list = g_list_append(list, wrapper); rh_action->actions_before = list; } } } const char * get_interval(crm_data_t *xml_op) { const char *interval_s = NULL; interval_s = crm_element_value(xml_op, XML_LRM_ATTR_INTERVAL); #if CRM_DEPRECATED_SINCE_2_0_4 if(interval_s == NULL) { crm_data_t *params = NULL; params = find_xml_node(xml_op, XML_TAG_PARAMS, FALSE); if(params != NULL) { interval_s = crm_element_value( params, XML_LRM_ATTR_INTERVAL); } } #endif CRM_CHECK(interval_s != NULL, crm_err("Invalid rsc op: %s", ID(xml_op)); return "0"); return interval_s; } #define sort_return(an_int) crm_free(a_uuid); crm_free(b_uuid); return an_int gint sort_op_by_callid(gconstpointer a, gconstpointer b) { char *a_uuid = NULL; char *b_uuid = NULL; const char *a_task_id = cl_get_string(a, XML_LRM_ATTR_CALLID); const char *b_task_id = cl_get_string(b, XML_LRM_ATTR_CALLID); const char *a_key = cl_get_string(a, XML_ATTR_TRANSITION_MAGIC); const char *b_key = cl_get_string(b, XML_ATTR_TRANSITION_MAGIC); const char *a_xml_id = ID(a); const char *b_xml_id = ID(b); int a_id = -1; int b_id = -1; int a_rc = -1; int b_rc = -1; int a_status = -1; int b_status = -1; int a_call_id = -1; int b_call_id = -1; if(safe_str_eq(a_xml_id, b_xml_id)) { /* We have duplicate lrm_rsc_op entries in the status * section which is unliklely to be a good thing * - we can handle it easily enough, but we need to get * to the bottom of why its happening. */ pe_err("Duplicate lrm_rsc_op entries named %s", a_xml_id); sort_return(0); } CRM_CHECK(a_task_id != NULL && b_task_id != NULL, sort_return(0)); a_call_id = crm_parse_int(a_task_id, NULL); b_call_id = crm_parse_int(b_task_id, NULL); if(a_call_id == -1 && b_call_id == -1) { /* both are pending ops so it doesnt matter since * stops are never pending */ sort_return(0); } else if(a_call_id >= 0 && a_call_id < b_call_id) { crm_debug_4("%s (%d) < %s (%d) : call id", ID(a), a_call_id, ID(b), b_call_id); sort_return(-1); } else if(b_call_id >= 0 && a_call_id > b_call_id) { crm_debug_4("%s (%d) > %s (%d) : call id", ID(a), a_call_id, ID(b), b_call_id); sort_return(1); } crm_debug_5("%s (%d) == %s (%d) : continuing", ID(a), a_call_id, ID(b), b_call_id); /* now process pending ops */ CRM_CHECK(a_key != NULL && b_key != NULL, sort_return(0)); CRM_CHECK(decode_transition_magic( a_key,&a_uuid,&a_id,&a_status, &a_rc), sort_return(0)); CRM_CHECK(decode_transition_magic( b_key,&b_uuid,&b_id,&b_status, &b_rc), sort_return(0)); /* try and determin the relative age of the operation... * some pending operations (ie. a start) may have been supuerceeded * by a subsequent stop * * [a|b]_id == -1 means its a shutdown operation and _always_ comes last */ if(safe_str_neq(a_uuid, b_uuid) || a_id == b_id) { /* * some of the logic in here may be redundant... * * if the UUID from the TE doesnt match then one better * be a pending operation. * pending operations dont survive between elections and joins * because we query the LRM directly */ CRM_CHECK(a_call_id == -1 || b_call_id == -1, sort_return(0)); CRM_CHECK(a_call_id >= 0 || b_call_id >= 0, sort_return(0)); if(b_call_id == -1) { crm_debug_2("%s (%d) < %s (%d) : transition + call id", ID(a), a_call_id, ID(b), b_call_id); sort_return(-1); } if(a_call_id == -1) { crm_debug_2("%s (%d) > %s (%d) : transition + call id", ID(a), a_call_id, ID(b), b_call_id); sort_return(1); } } else if((a_id >= 0 && a_id < b_id) || b_id == -1) { crm_debug_3("%s (%d) < %s (%d) : transition", ID(a), a_id, ID(b), b_id); sort_return(-1); } else if((b_id >= 0 && a_id > b_id) || a_id == -1) { crm_debug_3("%s (%d) > %s (%d) : transition", ID(a), a_id, ID(b), b_id); sort_return(1); } /* we should never end up here */ crm_err("%s (%d:%d:%s) ?? %s (%d:%d:%s) : default", ID(a), a_call_id, a_id, a_uuid, ID(b), b_call_id, b_id, b_uuid); CRM_CHECK(FALSE, sort_return(0)); }