diff --git a/pengine/graph.c b/pengine/graph.c index 635805d235..7c06cf4dde 100644 --- a/pengine/graph.c +++ b/pengine/graph.c @@ -1,895 +1,895 @@ /* * Copyright (C) 2004 Andrew Beekhof * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include #include #include #include gboolean update_action(action_t * action); gboolean rsc_update_action(action_t * first, action_t * then, enum pe_ordering type); static enum pe_action_flags get_action_flags(action_t * action, node_t * node) { enum pe_action_flags flags = action->flags; if (action->rsc) { flags = action->rsc->cmds->action_flags(action, NULL); if (action->rsc->variant >= pe_clone && node) { /* We only care about activity on $node */ enum pe_action_flags clone_flags = action->rsc->cmds->action_flags(action, node); /* Go to great lengths to ensure the correct value for pe_action_runnable... * * If we are a clone, then for _ordering_ constraints, its only relevant * if we are runnable _anywhere_. * * This only applies to _runnable_ though, and only for ordering constraints. * If this function is ever used during colocation, then we'll need additional logic * * Not very satisfying, but its logical and appears to work well. */ if (is_not_set(clone_flags, pe_action_runnable) && is_set(flags, pe_action_runnable)) { crm_trace("Fixing up runnable flag for %s", action->uuid); set_bit(clone_flags, pe_action_runnable); } flags = clone_flags; } } return flags; } static char * convert_non_atomic_uuid(char *old_uuid, resource_t * rsc, gboolean allow_notify, gboolean free_original) { int interval = 0; char *uuid = NULL; char *rid = NULL; char *raw_task = NULL; int task = no_action; crm_trace("Processing %s", old_uuid); if (old_uuid == NULL) { return NULL; } else if (strstr(old_uuid, "notify") != NULL) { goto done; /* no conversion */ } else if (rsc->variant < pe_group) { goto done; /* no conversion */ } CRM_ASSERT(parse_op_key(old_uuid, &rid, &raw_task, &interval)); if (interval > 0) { goto done; /* no conversion */ } task = text2task(raw_task); switch (task) { case stop_rsc: case start_rsc: case action_notify: case action_promote: case action_demote: break; case stopped_rsc: case started_rsc: case action_notified: case action_promoted: case action_demoted: task--; break; case monitor_rsc: case shutdown_crm: case stonith_node: task = no_action; break; default: crm_err("Unknown action: %s", raw_task); task = no_action; break; } if (task != no_action) { if (is_set(rsc->flags, pe_rsc_notify) && allow_notify) { uuid = generate_notify_key(rid, "confirmed-post", task2text(task + 1)); } else { uuid = generate_op_key(rid, task2text(task + 1), 0); } crm_trace("Converted %s -> %s", old_uuid, uuid); } done: if (uuid == NULL) { uuid = strdup(old_uuid); } if (free_original) { free(old_uuid); } free(raw_task); free(rid); return uuid; } static action_t * rsc_expand_action(action_t * action) { action_t *result = action; if (action->rsc && action->rsc->variant >= pe_group) { /* Expand 'start' -> 'started' */ char *uuid = NULL; gboolean notify = FALSE; if (action->rsc->parent == NULL) { /* Only outter-most resources have notification actions */ notify = is_set(action->rsc->flags, pe_rsc_notify); } uuid = convert_non_atomic_uuid(action->uuid, action->rsc, notify, FALSE); if (uuid) { crm_trace("Converting %s to %s %d", action->uuid, uuid, is_set(action->rsc->flags, pe_rsc_notify)); result = find_first_action(action->rsc->actions, uuid, NULL, NULL); if (result == NULL) { crm_err("Couldn't expand %s", action->uuid); result = action; } free(uuid); } } return result; } static enum pe_graph_flags graph_update_action(action_t * first, action_t * then, node_t * node, enum pe_action_flags flags, enum pe_ordering type) { enum pe_graph_flags changed = pe_graph_none; gboolean processed = FALSE; /* TODO: Do as many of these in parallel as possible */ if (type & pe_order_implies_then) { processed = TRUE; if (then->rsc) { changed |= then->rsc->cmds->update_actions(first, then, node, flags & pe_action_optional, pe_action_optional, pe_order_implies_then); } else if (is_set(flags, pe_action_optional) == FALSE) { if (update_action_flags(then, pe_action_optional | pe_action_clear)) { changed |= pe_graph_updated_then; } } crm_trace("implies right: %s then %s%s", first->uuid, then->uuid, changed?": changed":""); } if ((type & pe_order_restart) && then->rsc) { enum pe_action_flags restart = (pe_action_optional | pe_action_runnable); processed = TRUE; changed |= then->rsc->cmds->update_actions(first, then, node, flags, restart, pe_order_restart); crm_trace("restart: %s then %s%s", first->uuid, then->uuid, changed?": changed":""); } if (type & pe_order_implies_first) { processed = TRUE; if (first->rsc) { changed |= first->rsc->cmds->update_actions(first, then, node, flags, pe_action_optional, pe_order_implies_first); } else if (is_set(flags, pe_action_optional) == FALSE) { if (update_action_flags(first, pe_action_runnable | pe_action_clear)) { changed |= pe_graph_updated_first; } } crm_trace("implies left: %s then %s%s", first->uuid, then->uuid, changed?": changed":""); } if (type & pe_order_implies_first_master) { processed = TRUE; if (then->rsc) { changed |= then->rsc->cmds->update_actions(first, then, node, flags & pe_action_optional, pe_action_optional, pe_order_implies_first_master); } crm_trace("implies left when right rsc is Master role: %s then %s%s", first->uuid, then->uuid, changed?": changed":""); } if (type & pe_order_one_or_more) { processed = TRUE; if (then->rsc) { changed |= then->rsc->cmds->update_actions(first, then, node, flags, pe_action_runnable, pe_order_one_or_more); } else if (is_set(flags, pe_action_runnable)) { if (update_action_flags(then, pe_action_runnable)) { changed |= pe_graph_updated_then; } } crm_trace("runnable_one_or_more: %s then %s%s", first->uuid, then->uuid, changed?": changed":""); } if (type & pe_order_runnable_left) { processed = TRUE; if (then->rsc) { changed |= then->rsc->cmds->update_actions(first, then, node, flags, pe_action_runnable, pe_order_runnable_left); } else if (is_set(flags, pe_action_runnable) == FALSE) { if (update_action_flags(then, pe_action_runnable | pe_action_clear)) { changed |= pe_graph_updated_then; } } crm_trace("runnable: %s then %s%s", first->uuid, then->uuid, changed?": changed":""); } if (type & pe_order_optional) { processed = TRUE; if (then->rsc) { changed |= then->rsc->cmds->update_actions(first, then, node, flags, pe_action_runnable, pe_order_optional); } crm_trace("optional: %s then %s%s", first->uuid, then->uuid, changed?": changed":""); } if (type & pe_order_asymmetrical) { crm_trace("asymmetrical: %s then %s", first->uuid, then->uuid); processed = TRUE; if (then->rsc) { changed |= then->rsc->cmds->update_actions(first, then, node, flags, pe_action_runnable, pe_order_asymmetrical); } } if ((first->flags & pe_action_runnable) && (type & pe_order_implies_then_printed) && (flags & pe_action_optional) == 0) { processed = TRUE; crm_trace("%s implies %s printed", first->uuid, then->uuid); update_action_flags(then, pe_action_print_always); /* dont care about changed */ } if ((type & pe_order_implies_first_printed) && (flags & pe_action_optional) == 0) { processed = TRUE; crm_trace("%s implies %s printed", then->uuid, first->uuid); update_action_flags(first, pe_action_print_always); /* dont care about changed */ } if (processed == FALSE) { crm_trace("Constraint 0x%.6x not applicable", type); } return changed; } gboolean update_action(action_t * then) { GListPtr lpc = NULL; enum pe_graph_flags changed = pe_graph_none; int last_flags = then->flags; crm_trace("Processing %s (%s %s %s)", then->uuid, is_set(then->flags, pe_action_optional) ? "optional" : "required", is_set(then->flags, pe_action_runnable) ? "runnable" : "unrunnable", is_set(then->flags, pe_action_pseudo) ? "pseudo" : then->node ? then->node->details->uname : ""); if (is_set(then->flags, pe_action_requires_any)) { clear_bit(then->flags, pe_action_runnable); } for (lpc = then->actions_before; lpc != NULL; lpc = lpc->next) { action_wrapper_t *other = (action_wrapper_t *) lpc->data; action_t *first = other->action; node_t *then_node = then->node; node_t *first_node = first->node; enum pe_action_flags then_flags = 0; enum pe_action_flags first_flags = 0; if (first->rsc && first->rsc->variant == pe_group && safe_str_eq(first->task, RSC_START)) { first_node = first->rsc->fns->location(first->rsc, NULL, FALSE); if (first_node) { crm_trace("First: Found node %s for %s", first_node->details->uname, first->uuid); } } if (then->rsc && then->rsc->variant == pe_group && safe_str_eq(then->task, RSC_START)) { then_node = then->rsc->fns->location(then->rsc, NULL, FALSE); if (then_node) { crm_trace("Then: Found node %s for %s", then_node->details->uname, then->uuid); } } clear_bit(changed, pe_graph_updated_first); if (first->rsc != then->rsc && first->rsc != NULL && then->rsc != NULL && first->rsc != then->rsc->parent) { first = rsc_expand_action(first); } if (first != other->action) { crm_trace("Ordering %s afer %s instead of %s", then->uuid, first->uuid, other->action->uuid); } first_flags = get_action_flags(first, then_node); then_flags = get_action_flags(then, first_node); crm_trace("Checking %s (%s %s %s) against %s (%s %s %s) 0x%.6x", then->uuid, is_set(then_flags, pe_action_optional) ? "optional" : "required", is_set(then_flags, pe_action_runnable) ? "runnable" : "unrunnable", is_set(then_flags, pe_action_pseudo) ? "pseudo" : then->node ? then->node->details-> uname : "", first->uuid, is_set(first_flags, pe_action_optional) ? "optional" : "required", is_set(first_flags, pe_action_runnable) ? "runnable" : "unrunnable", is_set(first_flags, pe_action_pseudo) ? "pseudo" : first->node ? first->node->details-> uname : "", other->type); if (first == other->action) { clear_bit(first_flags, pe_action_pseudo); changed |= graph_update_action(first, then, then->node, first_flags, other->type); } else if (order_actions(first, then, other->type)) { /* Start again to get the new actions_before list */ changed |= (pe_graph_updated_then | pe_graph_disable); } if (changed & pe_graph_disable) { crm_trace("Disabled constraint %s -> %s", other->action->uuid, then->uuid); clear_bit(changed, pe_graph_disable); other->type = pe_order_none; } if (changed & pe_graph_updated_first) { GListPtr lpc2 = NULL; crm_trace("Updated %s (first %s %s %s), processing dependants ", first->uuid, is_set(first->flags, pe_action_optional) ? "optional" : "required", is_set(first->flags, pe_action_runnable) ? "runnable" : "unrunnable", is_set(first->flags, pe_action_pseudo) ? "pseudo" : first->node ? first->node->details-> uname : ""); for (lpc2 = first->actions_after; lpc2 != NULL; lpc2 = lpc2->next) { action_wrapper_t *other = (action_wrapper_t *) lpc2->data; update_action(other->action); } update_action(first); } } if (is_set(then->flags, pe_action_requires_any)) { if (last_flags != then->flags) { changed |= pe_graph_updated_then; } else { clear_bit(changed, pe_graph_updated_then); } } if (changed & pe_graph_updated_then) { crm_trace("Updated %s (then %s %s %s), processing dependants ", then->uuid, is_set(then->flags, pe_action_optional) ? "optional" : "required", is_set(then->flags, pe_action_runnable) ? "runnable" : "unrunnable", is_set(then->flags, pe_action_pseudo) ? "pseudo" : then->node ? then->node->details-> uname : ""); update_action(then); for (lpc = then->actions_after; lpc != NULL; lpc = lpc->next) { action_wrapper_t *other = (action_wrapper_t *) lpc->data; update_action(other->action); } } return FALSE; } gboolean shutdown_constraints(node_t * node, action_t * shutdown_op, pe_working_set_t * data_set) { /* add the stop to the before lists so it counts as a pre-req * for the shutdown */ GListPtr lpc = NULL; for (lpc = data_set->actions; lpc != NULL; lpc = lpc->next) { action_t *action = (action_t *) lpc->data; if (action->rsc == NULL || action->node == NULL) { continue; } else if(action->node->details != node->details) { continue; } else if(is_set(data_set->flags, pe_flag_maintenance_mode)) { crm_trace("Skipping %s: maintainence mode", action->uuid); continue; } else if(safe_str_neq(action->task, RSC_STOP)) { continue; } else if(is_not_set(action->rsc->flags, pe_rsc_managed) && is_not_set(action->rsc->flags, pe_rsc_block)) { /* * If another action depends on this one, we may still end up blocking */ crm_trace("Skipping %s: unmanaged", action->uuid); continue; } crm_trace("Ordering %s before shutdown on %s", action->uuid, node->details->uname); clear_bit(action->flags, pe_action_optional); custom_action_order(action->rsc, NULL, action, NULL, strdup(CRM_OP_SHUTDOWN), shutdown_op, pe_order_optional|pe_order_runnable_left, data_set); } return TRUE; } gboolean stonith_constraints(node_t * node, action_t * stonith_op, pe_working_set_t * data_set) { CRM_CHECK(stonith_op != NULL, return FALSE); /* * Make sure the stonith OP occurs before we start any shared resources */ if (stonith_op != NULL) { GListPtr lpc = NULL; for (lpc = data_set->resources; lpc != NULL; lpc = lpc->next) { resource_t *rsc = (resource_t *) lpc->data; rsc_stonith_ordering(rsc, stonith_op, data_set); } } /* add the stonith OP as a stop pre-req and the mark the stop * as a pseudo op - since its now redundant */ return TRUE; } xmlNode * action2xml(action_t * action, gboolean as_input) { gboolean needs_node_info = TRUE; xmlNode *action_xml = NULL; xmlNode *args_xml = NULL; char *action_id_s = NULL; if (action == NULL) { return NULL; } crm_trace("Dumping action %d as XML", action->id); if (safe_str_eq(action->task, CRM_OP_FENCE)) { action_xml = create_xml_node(NULL, XML_GRAPH_TAG_CRM_EVENT); /* needs_node_info = FALSE; */ } else if (safe_str_eq(action->task, CRM_OP_SHUTDOWN)) { action_xml = create_xml_node(NULL, XML_GRAPH_TAG_CRM_EVENT); } else if (safe_str_eq(action->task, CRM_OP_CLEAR_FAILCOUNT)) { action_xml = create_xml_node(NULL, XML_GRAPH_TAG_CRM_EVENT); } else if (safe_str_eq(action->task, CRM_OP_LRM_REFRESH)) { action_xml = create_xml_node(NULL, XML_GRAPH_TAG_CRM_EVENT); /* } else if(safe_str_eq(action->task, RSC_PROBED)) { */ /* action_xml = create_xml_node(NULL, XML_GRAPH_TAG_CRM_EVENT); */ } else if (is_set(action->flags, pe_action_pseudo)) { action_xml = create_xml_node(NULL, XML_GRAPH_TAG_PSEUDO_EVENT); needs_node_info = FALSE; } else { action_xml = create_xml_node(NULL, XML_GRAPH_TAG_RSC_OP); } action_id_s = crm_itoa(action->id); crm_xml_add(action_xml, XML_ATTR_ID, action_id_s); free(action_id_s); crm_xml_add(action_xml, XML_LRM_ATTR_TASK, action->task); if (action->rsc != NULL && action->rsc->clone_name != NULL) { char *clone_key = NULL; - const char *interval_s = g_hash_table_lookup(action->meta, "interval"); + const char *interval_s = g_hash_table_lookup(action->meta, XML_LRM_ATTR_INTERVAL); int interval = crm_parse_int(interval_s, "0"); if (safe_str_eq(action->task, RSC_NOTIFY)) { const char *n_type = g_hash_table_lookup(action->meta, "notify_type"); const char *n_task = g_hash_table_lookup(action->meta, "notify_operation"); CRM_CHECK(n_type != NULL, crm_err("No notify type value found for %s", action->uuid)); CRM_CHECK(n_task != NULL, crm_err("No notify operation value found for %s", action->uuid)); clone_key = generate_notify_key(action->rsc->clone_name, n_type, n_task); } else { clone_key = generate_op_key(action->rsc->clone_name, action->task, interval); } CRM_CHECK(clone_key != NULL, crm_err("Could not generate a key for %s", action->uuid)); crm_xml_add(action_xml, XML_LRM_ATTR_TASK_KEY, clone_key); crm_xml_add(action_xml, "internal_" XML_LRM_ATTR_TASK_KEY, action->uuid); free(clone_key); } else { crm_xml_add(action_xml, XML_LRM_ATTR_TASK_KEY, action->uuid); } if (needs_node_info && action->node != NULL) { crm_xml_add(action_xml, XML_LRM_ATTR_TARGET, action->node->details->uname); crm_xml_add(action_xml, XML_LRM_ATTR_TARGET_UUID, action->node->details->id); } if (is_set(action->flags, pe_action_failure_is_fatal) == FALSE) { add_hash_param(action->meta, XML_ATTR_TE_ALLOWFAIL, XML_BOOLEAN_TRUE); } if (as_input) { return action_xml; } if (action->rsc) { if (is_set(action->flags, pe_action_pseudo) == FALSE) { int lpc = 0; xmlNode *rsc_xml = create_xml_node(action_xml, crm_element_name(action->rsc->xml)); const char *attr_list[] = { XML_AGENT_ATTR_CLASS, XML_AGENT_ATTR_PROVIDER, XML_ATTR_TYPE }; if (action->rsc->clone_name != NULL) { crm_debug("Using clone name %s for %s", action->rsc->clone_name, action->rsc->id); crm_xml_add(rsc_xml, XML_ATTR_ID, action->rsc->clone_name); crm_xml_add(rsc_xml, XML_ATTR_ID_LONG, action->rsc->id); } else { crm_xml_add(rsc_xml, XML_ATTR_ID, action->rsc->id); } for (lpc = 0; lpc < DIMOF(attr_list); lpc++) { crm_xml_add(rsc_xml, attr_list[lpc], g_hash_table_lookup(action->rsc->meta, attr_list[lpc])); } } } args_xml = create_xml_node(NULL, XML_TAG_ATTRS); crm_xml_add(args_xml, XML_ATTR_CRM_VERSION, CRM_FEATURE_SET); g_hash_table_foreach(action->extra, hash2field, args_xml); if (action->rsc != NULL) { g_hash_table_foreach(action->rsc->parameters, hash2smartfield, args_xml); } g_hash_table_foreach(action->meta, hash2metafield, args_xml); if (action->rsc != NULL) { resource_t *parent = action->rsc; while (parent != NULL) { parent->cmds->append_meta(parent, args_xml); parent = parent->parent; } } else if (safe_str_eq(action->task, CRM_OP_FENCE)) { g_hash_table_foreach(action->node->details->attrs, hash2metafield, args_xml); } sorted_xml(args_xml, action_xml, FALSE); crm_log_xml_trace(action_xml, "dumped action"); free_xml(args_xml); return action_xml; } static gboolean should_dump_action(action_t * action) { CRM_CHECK(action != NULL, return FALSE); if (is_set(action->flags, pe_action_dumped)) { crm_trace( "action %d (%s) was already dumped", action->id, action->uuid); return FALSE; } else if (is_set(action->flags, pe_action_runnable) == FALSE) { crm_trace( "action %d (%s) was not runnable", action->id, action->uuid); return FALSE; } else if (is_set(action->flags, pe_action_optional) && is_set(action->flags, pe_action_print_always) == FALSE) { crm_trace( "action %d (%s) was optional", action->id, action->uuid); return FALSE; } else if (action->rsc != NULL && is_not_set(action->rsc->flags, pe_rsc_managed)) { const char *interval = NULL; interval = g_hash_table_lookup(action->meta, XML_LRM_ATTR_INTERVAL); /* make sure probes and recurring monitors go through */ if (safe_str_neq(action->task, RSC_STATUS) && interval == NULL) { crm_trace( "action %d (%s) was for an unmanaged resource (%s)", action->id, action->uuid, action->rsc->id); return FALSE; } } if (is_set(action->flags, pe_action_pseudo) || safe_str_eq(action->task, CRM_OP_FENCE) || safe_str_eq(action->task, CRM_OP_SHUTDOWN)) { /* skip the next checks */ return TRUE; } if (action->node == NULL) { pe_err("action %d (%s) was not allocated", action->id, action->uuid); log_action(LOG_DEBUG, "Unallocated action", action, FALSE); return FALSE; } else if (action->node->details->online == FALSE) { pe_err("action %d was (%s) scheduled for offline node", action->id, action->uuid); log_action(LOG_DEBUG, "Action for offline node", action, FALSE); return FALSE; #if 0 /* but this would also affect resources that can be safely * migrated before a fencing op */ } else if (action->node->details->unclean == FALSE) { pe_err("action %d was (%s) scheduled for unclean node", action->id, action->uuid); log_action(LOG_DEBUG, "Action for unclean node", action, FALSE); return FALSE; #endif } return TRUE; } /* lowest to highest */ static gint sort_action_id(gconstpointer a, gconstpointer b) { const action_wrapper_t *action_wrapper2 = (const action_wrapper_t *)a; const action_wrapper_t *action_wrapper1 = (const action_wrapper_t *)b; if (a == NULL) { return 1; } if (b == NULL) { return -1; } if (action_wrapper1->action->id > action_wrapper2->action->id) { return -1; } if (action_wrapper1->action->id < action_wrapper2->action->id) { return 1; } return 0; } static gboolean should_dump_input(int last_action, action_t * action, action_wrapper_t * wrapper) { int type = wrapper->type; type &= ~pe_order_implies_first_printed; type &= ~pe_order_implies_then_printed; type &= ~pe_order_optional; wrapper->state = pe_link_not_dumped; if (last_action == wrapper->action->id) { crm_trace( "Input (%d) %s duplicated for %s", wrapper->action->id, wrapper->action->uuid, action->uuid); wrapper->state = pe_link_dup; return FALSE; } else if (wrapper->type == pe_order_none) { crm_trace( "Input (%d) %s suppressed for %s", wrapper->action->id, wrapper->action->uuid, action->uuid); return FALSE; } else if (is_set(wrapper->action->flags, pe_action_runnable) == FALSE && type == pe_order_none && safe_str_neq(wrapper->action->uuid, CRM_OP_PROBED)) { crm_trace( "Input (%d) %s optional (ordering) for %s", wrapper->action->id, wrapper->action->uuid, action->uuid); return FALSE; } else if (is_set(action->flags, pe_action_pseudo) && (wrapper->type & pe_order_stonith_stop)) { crm_trace( "Input (%d) %s suppressed for %s", wrapper->action->id, wrapper->action->uuid, action->uuid); return FALSE; } else if (wrapper->type == pe_order_load) { crm_trace("check load filter %s.%s -> %s.%s", wrapper->action->uuid, wrapper->action->node->details->uname, action->uuid, action->node->details->uname); if (action->rsc && safe_str_eq(action->task, RSC_MIGRATE)) { /* For migrate_to ops, we care about where it has been * allocated to, not where the action will be executed */ if(wrapper->action->node == NULL || action->rsc->allocated_to == NULL || wrapper->action->node->details != action->rsc->allocated_to->details) { /* Check if the actions are for the same node, ignore otherwise */ crm_trace("load filter - migrate"); wrapper->type = pe_order_none; return FALSE; } } else if (wrapper->action->node == NULL || action->node == NULL || wrapper->action->node->details != action->node->details) { /* Check if the actions are for the same node, ignore otherwise */ crm_trace("load filter - node"); wrapper->type = pe_order_none; return FALSE; } else if(is_set(wrapper->action->flags, pe_action_optional)) { /* Check if the pre-req is optional, ignore if so */ crm_trace("load filter - optional"); wrapper->type = pe_order_none; return FALSE; } } else if (wrapper->action->rsc && wrapper->action->rsc != action->rsc && is_set(wrapper->action->rsc->flags, pe_rsc_failed) && is_not_set(wrapper->action->rsc->flags, pe_rsc_managed) && strstr(wrapper->action->uuid, "_stop_0") && action->rsc && action->rsc->variant >= pe_clone) { crm_warn("Ignoring requirement that %s comeplete before %s:" " unmanaged failed resources cannot prevent clone shutdown", wrapper->action->uuid, action->uuid); return FALSE; } else if (is_set(wrapper->action->flags, pe_action_dumped) || should_dump_action(wrapper->action)) { crm_trace( "Input (%d) %s should be dumped for %s", wrapper->action->id, wrapper->action->uuid, action->uuid); goto dump; #if 0 } else if (is_set(wrapper->action->flags, pe_action_runnable) && is_set(wrapper->action->flags, pe_action_pseudo) && wrapper->action->rsc->variant != pe_native) { crm_crit("Input (%d) %s should be dumped for %s", wrapper->action->id, wrapper->action->uuid, action->uuid); goto dump; #endif } else if (is_set(wrapper->action->flags, pe_action_optional) == TRUE && is_set(wrapper->action->flags, pe_action_print_always) == FALSE) { crm_trace( "Input (%d) %s optional for %s", wrapper->action->id, wrapper->action->uuid, action->uuid); crm_trace( "Input (%d) %s n=%p p=%d r=%d o=%d a=%d f=0x%.6x", wrapper->action->id, wrapper->action->uuid, wrapper->action->node, is_set(wrapper->action->flags, pe_action_pseudo), is_set(wrapper->action->flags, pe_action_runnable), is_set(wrapper->action->flags, pe_action_optional), is_set(wrapper->action->flags, pe_action_print_always), wrapper->type); return FALSE; } dump: crm_trace( "Input (%d) %s n=%p p=%d r=%d o=%d a=%d f=0x%.6x dumped for %s", wrapper->action->id, wrapper->action->uuid, wrapper->action->node, is_set(wrapper->action->flags, pe_action_pseudo), is_set(wrapper->action->flags, pe_action_runnable), is_set(wrapper->action->flags, pe_action_optional), is_set(wrapper->action->flags, pe_action_print_always), wrapper->type, action->uuid); return TRUE; } void graph_element_from_action(action_t * action, pe_working_set_t * data_set) { GListPtr lpc = NULL; int last_action = -1; int synapse_priority = 0; xmlNode *syn = NULL; xmlNode *set = NULL; xmlNode *in = NULL; xmlNode *input = NULL; xmlNode *xml_action = NULL; if (should_dump_action(action) == FALSE) { return; } set_bit(action->flags, pe_action_dumped); syn = create_xml_node(data_set->graph, "synapse"); set = create_xml_node(syn, "action_set"); in = create_xml_node(syn, "inputs"); crm_xml_add_int(syn, XML_ATTR_ID, data_set->num_synapse); data_set->num_synapse++; if (action->rsc != NULL) { synapse_priority = action->rsc->priority; } if (action->priority > synapse_priority) { synapse_priority = action->priority; } if (synapse_priority > 0) { crm_xml_add_int(syn, XML_CIB_ATTR_PRIORITY, synapse_priority); } xml_action = action2xml(action, FALSE); add_node_nocopy(set, crm_element_name(xml_action), xml_action); action->actions_before = g_list_sort(action->actions_before, sort_action_id); for (lpc = action->actions_before; lpc != NULL; lpc = lpc->next) { action_wrapper_t *wrapper = (action_wrapper_t *) lpc->data; if (should_dump_input(last_action, action, wrapper) == FALSE) { continue; } wrapper->state = pe_link_dumped; CRM_CHECK(last_action < wrapper->action->id,; ); last_action = wrapper->action->id; input = create_xml_node(in, "trigger"); xml_action = action2xml(wrapper->action, TRUE); add_node_nocopy(input, crm_element_name(xml_action), xml_action); } } diff --git a/pengine/test10/bug-lf-2106.dot b/pengine/test10/bug-lf-2106.dot index 3a91c8cbaf..dc36dcf574 100644 --- a/pengine/test10/bug-lf-2106.dot +++ b/pengine/test10/bug-lf-2106.dot @@ -1,32 +1,32 @@ digraph "g" { "all_stopped" [ style=bold color="green" fontcolor="orange" ] "pingd:0_clear_failcount cl-virt-1" [ style=bold color="green" fontcolor="black" ] +"pingd:0_clear_failcount_0 cl-virt-2" [ style=bold color="green" fontcolor="black"] "pingd:0_monitor_30000 cl-virt-1" [ style=bold color="green" fontcolor="black" ] +"pingd:0_monitor_30000 cl-virt-2" [ style=bold color="green" fontcolor="black"] "pingd:0_start_0 cl-virt-1" -> "pingd:0_monitor_30000 cl-virt-1" [ style = bold] "pingd:0_start_0 cl-virt-1" -> "pingdclone_running_0" [ style = bold] "pingd:0_start_0 cl-virt-1" [ style=bold color="green" fontcolor="black" ] +"pingd:0_start_0 cl-virt-2" -> "pingd:0_monitor_30000 cl-virt-2" [ style = bold] +"pingd:0_start_0 cl-virt-2" -> "pingdclone_running_0" [ style = bold] +"pingd:0_start_0 cl-virt-2" [ style=bold color="green" fontcolor="black"] "pingd:0_stop_0 cl-virt-1" -> "all_stopped" [ style = bold] "pingd:0_stop_0 cl-virt-1" -> "pingd:0_start_0 cl-virt-1" [ style = bold] "pingd:0_stop_0 cl-virt-1" -> "pingdclone_stopped_0" [ style = bold] "pingd:0_stop_0 cl-virt-1" [ style=bold color="green" fontcolor="black" ] -"pingd:1_clear_failcount cl-virt-2" [ style=bold color="green" fontcolor="black" ] -"pingd:1_monitor_30000 cl-virt-2" [ style=bold color="green" fontcolor="black" ] -"pingd:1_start_0 cl-virt-2" -> "pingd:1_monitor_30000 cl-virt-2" [ style = bold] -"pingd:1_start_0 cl-virt-2" -> "pingdclone_running_0" [ style = bold] -"pingd:1_start_0 cl-virt-2" [ style=bold color="green" fontcolor="black" ] -"pingd:1_stop_0 cl-virt-2" -> "all_stopped" [ style = bold] -"pingd:1_stop_0 cl-virt-2" -> "pingd:1_start_0 cl-virt-2" [ style = bold] -"pingd:1_stop_0 cl-virt-2" -> "pingdclone_stopped_0" [ style = bold] -"pingd:1_stop_0 cl-virt-2" [ style=bold color="green" fontcolor="black" ] +"pingd:0_stop_0 cl-virt-2" -> "all_stopped" [ style = bold] +"pingd:0_stop_0 cl-virt-2" -> "pingd:0_start_0 cl-virt-2" [ style = bold] +"pingd:0_stop_0 cl-virt-2" -> "pingdclone_stopped_0" [ style = bold] +"pingd:0_stop_0 cl-virt-2" [ style=bold color="green" fontcolor="black"] "pingdclone_running_0" [ style=bold color="green" fontcolor="orange" ] "pingdclone_start_0" -> "pingd:0_start_0 cl-virt-1" [ style = bold] -"pingdclone_start_0" -> "pingd:1_start_0 cl-virt-2" [ style = bold] +"pingdclone_start_0" -> "pingd:0_start_0 cl-virt-2" [ style = bold] "pingdclone_start_0" -> "pingdclone_running_0" [ style = bold] "pingdclone_start_0" [ style=bold color="green" fontcolor="orange" ] "pingdclone_stop_0" -> "pingd:0_stop_0 cl-virt-1" [ style = bold] -"pingdclone_stop_0" -> "pingd:1_stop_0 cl-virt-2" [ style = bold] +"pingdclone_stop_0" -> "pingd:0_stop_0 cl-virt-2" [ style = bold] "pingdclone_stop_0" -> "pingdclone_stopped_0" [ style = bold] "pingdclone_stop_0" [ style=bold color="green" fontcolor="orange" ] "pingdclone_stopped_0" -> "pingdclone_start_0" [ style = bold] "pingdclone_stopped_0" [ style=bold color="green" fontcolor="orange" ] } diff --git a/pengine/test10/bug-lf-2508.dot b/pengine/test10/bug-lf-2508.dot index 11c20dbde9..4134f39836 100644 --- a/pengine/test10/bug-lf-2508.dot +++ b/pengine/test10/bug-lf-2508.dot @@ -1,101 +1,101 @@ digraph "g" { "Dummy01_monitor_10000 srv01" [ style=bold color="green" fontcolor="black" ] "Dummy01_start_0 srv01" -> "Dummy01_monitor_10000 srv01" [ style = bold] "Dummy01_start_0 srv01" -> "Group01_running_0" [ style = bold] "Dummy01_start_0 srv01" [ style=bold color="green" fontcolor="black" ] "Dummy02_monitor_10000 srv04" [ style=bold color="green" fontcolor="black" ] "Dummy02_start_0 srv04" -> "Dummy02_monitor_10000 srv04" [ style = bold] "Dummy02_start_0 srv04" -> "Group02_running_0" [ style = bold] "Dummy02_start_0 srv04" [ style=bold color="green" fontcolor="black" ] "Dummy02_stop_0 srv02" -> "Dummy02_start_0 srv04" [ style = bold] "Dummy02_stop_0 srv02" -> "Group02_stopped_0" [ style = bold] "Dummy02_stop_0 srv02" -> "all_stopped" [ style = bold] "Dummy02_stop_0 srv02" [ style=bold color="green" fontcolor="orange" ] "Group01_running_0" [ style=bold color="green" fontcolor="orange" ] "Group01_start_0" -> "Dummy01_start_0 srv01" [ style = bold] "Group01_start_0" -> "Group01_running_0" [ style = bold] "Group01_start_0" [ style=bold color="green" fontcolor="orange" ] "Group02_running_0" [ style=bold color="green" fontcolor="orange" ] "Group02_start_0" -> "Dummy02_start_0 srv04" [ style = bold] "Group02_start_0" -> "Group02_running_0" [ style = bold] "Group02_start_0" [ style=bold color="green" fontcolor="orange" ] "Group02_stop_0" -> "Dummy02_stop_0 srv02" [ style = bold] "Group02_stop_0" -> "Group02_stopped_0" [ style = bold] "Group02_stop_0" [ style=bold color="green" fontcolor="orange" ] "Group02_stopped_0" -> "Group02_start_0" [ style = bold] "Group02_stopped_0" [ style=bold color="green" fontcolor="orange" ] "all_stopped" [ style=bold color="green" fontcolor="orange" ] "clnStonith1_stop_0" -> "clnStonith1_stopped_0" [ style = bold] "clnStonith1_stop_0" -> "grpStonith1:1_stop_0" [ style = bold] "clnStonith1_stop_0" [ style=bold color="green" fontcolor="orange" ] "clnStonith1_stopped_0" [ style=bold color="green" fontcolor="orange" ] "clnStonith3_running_0" [ style=bold color="green" fontcolor="orange" ] "clnStonith3_start_0" -> "clnStonith3_running_0" [ style = bold] "clnStonith3_start_0" -> "grpStonith3:1_start_0" [ style = bold] "clnStonith3_start_0" [ style=bold color="green" fontcolor="orange" ] "clnStonith3_stop_0" -> "clnStonith3_stopped_0" [ style = bold] "clnStonith3_stop_0" -> "grpStonith3:3_stop_0" [ style = bold] "clnStonith3_stop_0" [ style=bold color="green" fontcolor="orange" ] "clnStonith3_stopped_0" -> "clnStonith3_start_0" [ style = bold] "clnStonith3_stopped_0" [ style=bold color="green" fontcolor="orange" ] "clnStonith4_stop_0" -> "clnStonith4_stopped_0" [ style = bold] "clnStonith4_stop_0" -> "grpStonith4:3_stop_0" [ style = bold] "clnStonith4_stop_0" [ style=bold color="green" fontcolor="orange" ] "clnStonith4_stopped_0" [ style=bold color="green" fontcolor="orange" ] "grpStonith1:1_stop_0" -> "grpStonith1:1_stopped_0" [ style = bold] "grpStonith1:1_stop_0" -> "prmStonith1-1:1_stop_0 srv02" [ style = bold] "grpStonith1:1_stop_0" -> "prmStonith1-3:1_stop_0 srv02" [ style = bold] "grpStonith1:1_stop_0" [ style=bold color="green" fontcolor="orange" ] "grpStonith1:1_stopped_0" -> "clnStonith1_stopped_0" [ style = bold] "grpStonith1:1_stopped_0" [ style=bold color="green" fontcolor="orange" ] "grpStonith3:1_running_0" -> "clnStonith3_running_0" [ style = bold] "grpStonith3:1_running_0" [ style=bold color="green" fontcolor="orange" ] "grpStonith3:1_start_0" -> "grpStonith3:1_running_0" [ style = bold] "grpStonith3:1_start_0" -> "prmStonith3-3:1_start_0 srv01" [ style = bold] "grpStonith3:1_start_0" [ style=bold color="green" fontcolor="orange" ] "grpStonith3:3_stop_0" -> "grpStonith3:3_stopped_0" [ style = bold] -"grpStonith3:3_stop_0" -> "prmStonith3-1:3_stop_0 srv02" [ style = bold] -"grpStonith3:3_stop_0" -> "prmStonith3-3:3_stop_0 srv02" [ style = bold] +"grpStonith3:3_stop_0" -> "prmStonith3-1:1_stop_0 srv02" [ style = bold] +"grpStonith3:3_stop_0" -> "prmStonith3-3:1_stop_0 srv02" [ style = bold] "grpStonith3:3_stop_0" [ style=bold color="green" fontcolor="orange" ] "grpStonith3:3_stopped_0" -> "clnStonith3_stopped_0" [ style = bold] "grpStonith3:3_stopped_0" [ style=bold color="green" fontcolor="orange" ] "grpStonith4:3_stop_0" -> "grpStonith4:3_stopped_0" [ style = bold] -"grpStonith4:3_stop_0" -> "prmStonith4-1:3_stop_0 srv02" [ style = bold] -"grpStonith4:3_stop_0" -> "prmStonith4-3:3_stop_0 srv02" [ style = bold] +"grpStonith4:3_stop_0" -> "prmStonith4-1:1_stop_0 srv02" [ style = bold] +"grpStonith4:3_stop_0" -> "prmStonith4-3:1_stop_0 srv02" [ style = bold] "grpStonith4:3_stop_0" [ style=bold color="green" fontcolor="orange" ] "grpStonith4:3_stopped_0" -> "clnStonith4_stopped_0" [ style = bold] "grpStonith4:3_stopped_0" [ style=bold color="green" fontcolor="orange" ] "prmStonith1-1:1_stop_0 srv02" -> "grpStonith1:1_stopped_0" [ style = bold] "prmStonith1-1:1_stop_0 srv02" [ style=bold color="green" fontcolor="orange" ] "prmStonith1-3:1_stop_0 srv02" -> "grpStonith1:1_stopped_0" [ style = bold] "prmStonith1-3:1_stop_0 srv02" -> "prmStonith1-1:1_stop_0 srv02" [ style = bold] "prmStonith1-3:1_stop_0 srv02" [ style=bold color="green" fontcolor="orange" ] "prmStonith3-1:1_monitor_3600000 srv01" [ style=bold color="green" fontcolor="black" ] -"prmStonith3-1:3_stop_0 srv02" -> "grpStonith3:3_stopped_0" [ style = bold] -"prmStonith3-1:3_stop_0 srv02" [ style=bold color="green" fontcolor="orange" ] +"prmStonith3-1:1_stop_0 srv02" -> "grpStonith3:3_stopped_0" [ style = bold] +"prmStonith3-1:1_stop_0 srv02" [ style=bold color="green" fontcolor="orange"] "prmStonith3-3:1_monitor_3600000 srv01" [ style=bold color="green" fontcolor="black" ] "prmStonith3-3:1_start_0 srv01" -> "grpStonith3:1_running_0" [ style = bold] "prmStonith3-3:1_start_0 srv01" -> "prmStonith3-3:1_monitor_3600000 srv01" [ style = bold] "prmStonith3-3:1_start_0 srv01" -> "stonith_up" [ style = bold] "prmStonith3-3:1_start_0 srv01" [ style=bold color="green" fontcolor="black" ] -"prmStonith3-3:3_stop_0 srv02" -> "grpStonith3:3_stopped_0" [ style = bold] -"prmStonith3-3:3_stop_0 srv02" -> "prmStonith3-1:3_stop_0 srv02" [ style = bold] -"prmStonith3-3:3_stop_0 srv02" [ style=bold color="green" fontcolor="orange" ] -"prmStonith4-1:3_stop_0 srv02" -> "grpStonith4:3_stopped_0" [ style = bold] -"prmStonith4-1:3_stop_0 srv02" [ style=bold color="green" fontcolor="orange" ] -"prmStonith4-3:3_stop_0 srv02" -> "grpStonith4:3_stopped_0" [ style = bold] -"prmStonith4-3:3_stop_0 srv02" -> "prmStonith4-1:3_stop_0 srv02" [ style = bold] -"prmStonith4-3:3_stop_0 srv02" [ style=bold color="green" fontcolor="orange" ] +"prmStonith3-3:1_stop_0 srv02" -> "grpStonith3:3_stopped_0" [ style = bold] +"prmStonith3-3:1_stop_0 srv02" -> "prmStonith3-1:1_stop_0 srv02" [ style = bold] +"prmStonith3-3:1_stop_0 srv02" [ style=bold color="green" fontcolor="orange"] +"prmStonith4-1:1_stop_0 srv02" -> "grpStonith4:3_stopped_0" [ style = bold] +"prmStonith4-1:1_stop_0 srv02" [ style=bold color="green" fontcolor="orange"] +"prmStonith4-3:1_stop_0 srv02" -> "grpStonith4:3_stopped_0" [ style = bold] +"prmStonith4-3:1_stop_0 srv02" -> "prmStonith4-1:1_stop_0 srv02" [ style = bold] +"prmStonith4-3:1_stop_0 srv02" [ style=bold color="green" fontcolor="orange"] "stonith srv02" -> "Dummy02_stop_0 srv02" [ style = bold] "stonith srv02" -> "Group02_stop_0" [ style = bold] "stonith srv02" -> "all_stopped" [ style = bold] "stonith srv02" -> "stonith_complete" [ style = bold] "stonith srv02" [ style=bold color="green" fontcolor="black" ] "stonith_complete" -> "Dummy01_start_0 srv01" [ style = bold] "stonith_complete" -> "Dummy02_start_0 srv04" [ style = bold] "stonith_complete" -> "Dummy02_stop_0 srv02" [ style = bold] "stonith_complete" [ style=bold color="green" fontcolor="orange" ] "stonith_up" -> "stonith srv02" [ style = bold] "stonith_up" -> "stonith_complete" [ style = bold] "stonith_up" [ style=bold color="green" fontcolor="orange" ] } diff --git a/pengine/test10/clone-anon-dup.dot b/pengine/test10/clone-anon-dup.dot index 74e1b79653..85c7fcc6e4 100644 --- a/pengine/test10/clone-anon-dup.dot +++ b/pengine/test10/clone-anon-dup.dot @@ -1,31 +1,31 @@ digraph "g" { "all_stopped" [ style=bold color="green" fontcolor="orange" ] -"apache2:2_stop_0 wc02" -> "all_stopped" [ style = bold] -"apache2:2_stop_0 wc02" -> "group_webservice:2_stopped_0" [ style = bold] -"apache2:2_stop_0 wc02" [ style=bold color="green" fontcolor="black" ] +"apache2:0_stop_0 wc02" -> "all_stopped" [ style = bold] +"apache2:0_stop_0 wc02" -> "group_webservice:2_stopped_0" [ style = bold] +"apache2:0_stop_0 wc02" [ style=bold color="green" fontcolor="black"] "clone_webservice_stop_0" -> "clone_webservice_stopped_0" [ style = bold] "clone_webservice_stop_0" -> "group_webservice:2_stop_0" [ style = bold] "clone_webservice_stop_0" [ style=bold color="green" fontcolor="orange" ] "clone_webservice_stopped_0" [ style=bold color="green" fontcolor="orange" ] -"group_webservice:2_stop_0" -> "apache2:2_stop_0 wc02" [ style = bold] +"group_webservice:2_stop_0" -> "apache2:0_stop_0 wc02" [ style = bold] "group_webservice:2_stop_0" -> "group_webservice:2_stopped_0" [ style = bold] "group_webservice:2_stop_0" [ style=bold color="green" fontcolor="orange" ] "group_webservice:2_stopped_0" -> "clone_webservice_stopped_0" [ style = bold] "group_webservice:2_stopped_0" [ style=bold color="green" fontcolor="orange" ] "probe_complete wc01" -> "probe_complete" [ style = bold] "probe_complete wc01" [ style=bold color="green" fontcolor="black" ] "probe_complete wc02" -> "probe_complete" [ style = bold] "probe_complete wc02" [ style=bold color="green" fontcolor="black" ] "probe_complete wc03" -> "probe_complete" [ style = bold] "probe_complete wc03" [ style=bold color="green" fontcolor="black" ] -"probe_complete" -> "apache2:2_stop_0 wc02" [ style = bold] +"probe_complete" -> "apache2:0_stop_0 wc02" [ style = bold] "probe_complete" -> "stonith-1_start_0 wc01" [ style = bold] "probe_complete" [ style=bold color="green" fontcolor="orange" ] "stonith-1_monitor_0 wc01" -> "probe_complete wc01" [ style = bold] "stonith-1_monitor_0 wc01" [ style=bold color="green" fontcolor="black" ] "stonith-1_monitor_0 wc02" -> "probe_complete wc02" [ style = bold] "stonith-1_monitor_0 wc02" [ style=bold color="green" fontcolor="black" ] "stonith-1_monitor_0 wc03" -> "probe_complete wc03" [ style = bold] "stonith-1_monitor_0 wc03" [ style=bold color="green" fontcolor="black" ] "stonith-1_start_0 wc01" [ style=bold color="green" fontcolor="black" ] } diff --git a/pengine/test10/clone-max-zero.dot b/pengine/test10/clone-max-zero.dot index 647336ea6f..33cec0a502 100644 --- a/pengine/test10/clone-max-zero.dot +++ b/pengine/test10/clone-max-zero.dot @@ -1,42 +1,42 @@ digraph "g" { "all_stopped" [ style=bold color="green" fontcolor="orange" ] "c-ocfs2-1_stop_0" -> "c-ocfs2-1_stopped_0" [ style = bold] "c-ocfs2-1_stop_0" -> "ocfs2-1:0_stop_0 c001n11" [ style = bold] "c-ocfs2-1_stop_0" -> "ocfs2-1:1_stop_0 c001n12" [ style = bold] "c-ocfs2-1_stop_0" [ style=bold color="green" fontcolor="orange" ] "c-ocfs2-1_stopped_0" -> "o2cb-clone_stop_0" [ style = bold] "c-ocfs2-1_stopped_0" [ style=bold color="green" fontcolor="orange" ] "dlm-clone_stop_0" -> "dlm-clone_stopped_0" [ style = bold] -"dlm-clone_stop_0" -> "dlm:0_stop_0 c001n12" [ style = bold] -"dlm-clone_stop_0" -> "dlm:1_stop_0 c001n11" [ style = bold] +"dlm-clone_stop_0" -> "dlm:0_stop_0 c001n11" [ style = bold] +"dlm-clone_stop_0" -> "dlm:1_stop_0 c001n12" [ style = bold] "dlm-clone_stop_0" [ style=bold color="green" fontcolor="orange" ] "dlm-clone_stopped_0" [ style=bold color="green" fontcolor="orange" ] -"dlm:0_stop_0 c001n12" -> "all_stopped" [ style = bold] -"dlm:0_stop_0 c001n12" -> "dlm-clone_stopped_0" [ style = bold] -"dlm:0_stop_0 c001n12" [ style=bold color="green" fontcolor="black"] -"dlm:1_stop_0 c001n11" -> "all_stopped" [ style = bold] -"dlm:1_stop_0 c001n11" -> "dlm-clone_stopped_0" [ style = bold] -"dlm:1_stop_0 c001n11" [ style=bold color="green" fontcolor="black"] +"dlm:0_stop_0 c001n11" -> "all_stopped" [ style = bold] +"dlm:0_stop_0 c001n11" -> "dlm-clone_stopped_0" [ style = bold] +"dlm:0_stop_0 c001n11" [ style=bold color="green" fontcolor="black"] +"dlm:1_stop_0 c001n12" -> "all_stopped" [ style = bold] +"dlm:1_stop_0 c001n12" -> "dlm-clone_stopped_0" [ style = bold] +"dlm:1_stop_0 c001n12" [ style=bold color="green" fontcolor="black"] "o2cb-clone_stop_0" -> "o2cb-clone_stopped_0" [ style = bold] "o2cb-clone_stop_0" -> "o2cb:0_stop_0 c001n11" [ style = bold] "o2cb-clone_stop_0" -> "o2cb:1_stop_0 c001n12" [ style = bold] "o2cb-clone_stop_0" [ style=bold color="green" fontcolor="orange" ] "o2cb-clone_stopped_0" -> "dlm-clone_stop_0" [ style = bold] "o2cb-clone_stopped_0" [ style=bold color="green" fontcolor="orange" ] "o2cb:0_stop_0 c001n11" -> "all_stopped" [ style = bold] -"o2cb:0_stop_0 c001n11" -> "dlm:1_stop_0 c001n11" [ style = bold] +"o2cb:0_stop_0 c001n11" -> "dlm:0_stop_0 c001n11" [ style = bold] "o2cb:0_stop_0 c001n11" -> "o2cb-clone_stopped_0" [ style = bold] "o2cb:0_stop_0 c001n11" [ style=bold color="green" fontcolor="black" ] "o2cb:1_stop_0 c001n12" -> "all_stopped" [ style = bold] -"o2cb:1_stop_0 c001n12" -> "dlm:0_stop_0 c001n12" [ style = bold] +"o2cb:1_stop_0 c001n12" -> "dlm:1_stop_0 c001n12" [ style = bold] "o2cb:1_stop_0 c001n12" -> "o2cb-clone_stopped_0" [ style = bold] "o2cb:1_stop_0 c001n12" [ style=bold color="green" fontcolor="black" ] "ocfs2-1:0_stop_0 c001n11" -> "all_stopped" [ style = bold] "ocfs2-1:0_stop_0 c001n11" -> "c-ocfs2-1_stopped_0" [ style = bold] "ocfs2-1:0_stop_0 c001n11" -> "o2cb:0_stop_0 c001n11" [ style = bold] "ocfs2-1:0_stop_0 c001n11" [ style=bold color="green" fontcolor="black" ] "ocfs2-1:1_stop_0 c001n12" -> "all_stopped" [ style = bold] "ocfs2-1:1_stop_0 c001n12" -> "c-ocfs2-1_stopped_0" [ style = bold] "ocfs2-1:1_stop_0 c001n12" -> "o2cb:1_stop_0 c001n12" [ style = bold] "ocfs2-1:1_stop_0 c001n12" [ style=bold color="green" fontcolor="black" ] } diff --git a/pengine/test10/cloned-group.dot b/pengine/test10/cloned-group.dot index b9b16299f5..a0f8751da6 100644 --- a/pengine/test10/cloned-group.dot +++ b/pengine/test10/cloned-group.dot @@ -1,57 +1,57 @@ digraph "g" { "all_stopped" [ style=bold color="green" fontcolor="orange" ] +"apache2:0_stop_0 webcluster01" -> "all_stopped" [ style = bold] +"apache2:0_stop_0 webcluster01" -> "grrr:2_stopped_0" [ style = bold] +"apache2:0_stop_0 webcluster01" [ style=bold color="green" fontcolor="black"] "apache2:1_monitor_10000 webcluster01" [ style=bold color="green" fontcolor="black" ] "apache2:1_start_0 webcluster01" -> "apache2:1_monitor_10000 webcluster01" [ style = bold] "apache2:1_start_0 webcluster01" -> "grrr:1_running_0" [ style = bold] "apache2:1_start_0 webcluster01" -> "mysql-proxy:1_start_0 webcluster01" [ style = bold] "apache2:1_start_0 webcluster01" [ style=bold color="green" fontcolor="black" ] "apache2:1_stop_0 webcluster01" -> "all_stopped" [ style = bold] "apache2:1_stop_0 webcluster01" -> "apache2:1_start_0 webcluster01" [ style = bold] "apache2:1_stop_0 webcluster01" -> "grrr:1_stopped_0" [ style = bold] "apache2:1_stop_0 webcluster01" [ style=bold color="green" fontcolor="black" ] -"apache2:2_stop_0 webcluster01" -> "all_stopped" [ style = bold] -"apache2:2_stop_0 webcluster01" -> "grrr:2_stopped_0" [ style = bold] -"apache2:2_stop_0 webcluster01" [ style=bold color="green" fontcolor="black" ] "apache2_clone_running_0" [ style=bold color="green" fontcolor="orange" ] "apache2_clone_start_0" -> "apache2_clone_running_0" [ style = bold] "apache2_clone_start_0" -> "grrr:1_start_0" [ style = bold] "apache2_clone_start_0" [ style=bold color="green" fontcolor="orange" ] "apache2_clone_stop_0" -> "apache2_clone_stopped_0" [ style = bold] "apache2_clone_stop_0" -> "grrr:1_stop_0" [ style = bold] "apache2_clone_stop_0" -> "grrr:2_stop_0" [ style = bold] "apache2_clone_stop_0" [ style=bold color="green" fontcolor="orange" ] "apache2_clone_stopped_0" -> "apache2_clone_start_0" [ style = bold] "apache2_clone_stopped_0" [ style=bold color="green" fontcolor="orange" ] "grrr:1_running_0" -> "apache2_clone_running_0" [ style = bold] "grrr:1_running_0" [ style=bold color="green" fontcolor="orange" ] "grrr:1_start_0" -> "apache2:1_start_0 webcluster01" [ style = bold] "grrr:1_start_0" -> "grrr:1_running_0" [ style = bold] "grrr:1_start_0" -> "mysql-proxy:1_start_0 webcluster01" [ style = bold] "grrr:1_start_0" [ style=bold color="green" fontcolor="orange" ] "grrr:1_stop_0" -> "apache2:1_stop_0 webcluster01" [ style = bold] "grrr:1_stop_0" -> "grrr:1_stopped_0" [ style = bold] "grrr:1_stop_0" -> "mysql-proxy:1_stop_0 webcluster01" [ style = bold] "grrr:1_stop_0" [ style=bold color="green" fontcolor="orange" ] "grrr:1_stopped_0" -> "apache2_clone_stopped_0" [ style = bold] "grrr:1_stopped_0" -> "grrr:1_start_0" [ style = bold] "grrr:1_stopped_0" [ style=bold color="green" fontcolor="orange" ] -"grrr:2_stop_0" -> "apache2:2_stop_0 webcluster01" [ style = bold] +"grrr:2_stop_0" -> "apache2:0_stop_0 webcluster01" [ style = bold] "grrr:2_stop_0" -> "grrr:2_stopped_0" [ style = bold] -"grrr:2_stop_0" -> "mysql-proxy:2_stop_0 webcluster01" [ style = bold] +"grrr:2_stop_0" -> "mysql-proxy:0_stop_0 webcluster01" [ style = bold] "grrr:2_stop_0" [ style=bold color="green" fontcolor="orange" ] "grrr:2_stopped_0" -> "apache2_clone_stopped_0" [ style = bold] "grrr:2_stopped_0" [ style=bold color="green" fontcolor="orange" ] +"mysql-proxy:0_stop_0 webcluster01" -> "all_stopped" [ style = bold] +"mysql-proxy:0_stop_0 webcluster01" -> "apache2:0_stop_0 webcluster01" [ style = bold] +"mysql-proxy:0_stop_0 webcluster01" -> "grrr:2_stopped_0" [ style = bold] +"mysql-proxy:0_stop_0 webcluster01" [ style=bold color="green" fontcolor="black"] "mysql-proxy:1_monitor_10000 webcluster01" [ style=bold color="green" fontcolor="black" ] "mysql-proxy:1_start_0 webcluster01" -> "grrr:1_running_0" [ style = bold] "mysql-proxy:1_start_0 webcluster01" -> "mysql-proxy:1_monitor_10000 webcluster01" [ style = bold] "mysql-proxy:1_start_0 webcluster01" [ style=bold color="green" fontcolor="black" ] "mysql-proxy:1_stop_0 webcluster01" -> "all_stopped" [ style = bold] "mysql-proxy:1_stop_0 webcluster01" -> "apache2:1_stop_0 webcluster01" [ style = bold] "mysql-proxy:1_stop_0 webcluster01" -> "grrr:1_stopped_0" [ style = bold] "mysql-proxy:1_stop_0 webcluster01" -> "mysql-proxy:1_start_0 webcluster01" [ style = bold] "mysql-proxy:1_stop_0 webcluster01" [ style=bold color="green" fontcolor="black" ] -"mysql-proxy:2_stop_0 webcluster01" -> "all_stopped" [ style = bold] -"mysql-proxy:2_stop_0 webcluster01" -> "apache2:2_stop_0 webcluster01" [ style = bold] -"mysql-proxy:2_stop_0 webcluster01" -> "grrr:2_stopped_0" [ style = bold] -"mysql-proxy:2_stop_0 webcluster01" [ style=bold color="green" fontcolor="black" ] } diff --git a/pengine/test10/inc10.dot b/pengine/test10/inc10.dot index ab31b7eefd..6424739b1b 100644 --- a/pengine/test10/inc10.dot +++ b/pengine/test10/inc10.dot @@ -1,48 +1,48 @@ digraph "g" { "DoFencing_stop_0" -> "DoFencing_stopped_0" [ style = bold] "DoFencing_stop_0" -> "child_DoFencing:2_stop_0 xen-2" [ style = bold] "DoFencing_stop_0" [ style=bold color="green" fontcolor="orange" ] "DoFencing_stopped_0" [ style=bold color="green" fontcolor="orange" ] "all_stopped" -> "child_DoFencing:2_stop_0 xen-2" [ style = bold] "all_stopped" [ style=bold color="green" fontcolor="orange" ] "child_DoFencing:2_stop_0 xen-2" -> "DoFencing_stopped_0" [ style = bold] "child_DoFencing:2_stop_0 xen-2" [ style=bold color="green" fontcolor="black" ] "ocfs2-clone_confirmed-post_notify_stopped_0" -> "all_stopped" [ style = bold] "ocfs2-clone_confirmed-post_notify_stopped_0" [ style=bold color="green" fontcolor="orange" ] "ocfs2-clone_confirmed-pre_notify_stop_0" -> "ocfs2-clone_post_notify_stopped_0" [ style = bold] "ocfs2-clone_confirmed-pre_notify_stop_0" -> "ocfs2-clone_stop_0" [ style = bold] "ocfs2-clone_confirmed-pre_notify_stop_0" [ style=bold color="green" fontcolor="orange" ] "ocfs2-clone_post_notify_stopped_0" -> "ocfs2-clone_confirmed-post_notify_stopped_0" [ style = bold] "ocfs2-clone_post_notify_stopped_0" -> "ocfs2:0_post_notify_stop_0 xen-4" [ style = bold] "ocfs2-clone_post_notify_stopped_0" -> "ocfs2:1_post_notify_stop_0 xen-3" [ style = bold] "ocfs2-clone_post_notify_stopped_0" -> "ocfs2:3_post_notify_stop_0 xen-1" [ style = bold] "ocfs2-clone_post_notify_stopped_0" [ style=bold color="green" fontcolor="orange" ] "ocfs2-clone_pre_notify_stop_0" -> "ocfs2-clone_confirmed-pre_notify_stop_0" [ style = bold] "ocfs2-clone_pre_notify_stop_0" -> "ocfs2:0_pre_notify_stop_0 xen-4" [ style = bold] +"ocfs2-clone_pre_notify_stop_0" -> "ocfs2:1_pre_notify_stop_0 xen-2" [ style = bold] "ocfs2-clone_pre_notify_stop_0" -> "ocfs2:1_pre_notify_stop_0 xen-3" [ style = bold] -"ocfs2-clone_pre_notify_stop_0" -> "ocfs2:2_pre_notify_stop_0 xen-2" [ style = bold] "ocfs2-clone_pre_notify_stop_0" -> "ocfs2:3_pre_notify_stop_0 xen-1" [ style = bold] "ocfs2-clone_pre_notify_stop_0" [ style=bold color="green" fontcolor="orange" ] "ocfs2-clone_stop_0" -> "ocfs2-clone_stopped_0" [ style = bold] -"ocfs2-clone_stop_0" -> "ocfs2:2_stop_0 xen-2" [ style = bold] +"ocfs2-clone_stop_0" -> "ocfs2:1_stop_0 xen-2" [ style = bold] "ocfs2-clone_stop_0" [ style=bold color="green" fontcolor="orange" ] "ocfs2-clone_stopped_0" -> "ocfs2-clone_post_notify_stopped_0" [ style = bold] "ocfs2-clone_stopped_0" [ style=bold color="green" fontcolor="orange" ] "ocfs2:0_post_notify_stop_0 xen-4" -> "ocfs2-clone_confirmed-post_notify_stopped_0" [ style = bold] "ocfs2:0_post_notify_stop_0 xen-4" [ style=bold color="green" fontcolor="black" ] "ocfs2:0_pre_notify_stop_0 xen-4" -> "ocfs2-clone_confirmed-pre_notify_stop_0" [ style = bold] "ocfs2:0_pre_notify_stop_0 xen-4" [ style=bold color="green" fontcolor="black" ] "ocfs2:1_post_notify_stop_0 xen-3" -> "ocfs2-clone_confirmed-post_notify_stopped_0" [ style = bold] "ocfs2:1_post_notify_stop_0 xen-3" [ style=bold color="green" fontcolor="black" ] +"ocfs2:1_pre_notify_stop_0 xen-2" -> "ocfs2-clone_confirmed-pre_notify_stop_0" [ style = bold] +"ocfs2:1_pre_notify_stop_0 xen-2" [ style=bold color="green" fontcolor="black"] "ocfs2:1_pre_notify_stop_0 xen-3" -> "ocfs2-clone_confirmed-pre_notify_stop_0" [ style = bold] "ocfs2:1_pre_notify_stop_0 xen-3" [ style=bold color="green" fontcolor="black" ] -"ocfs2:2_pre_notify_stop_0 xen-2" -> "ocfs2-clone_confirmed-pre_notify_stop_0" [ style = bold] -"ocfs2:2_pre_notify_stop_0 xen-2" [ style=bold color="green" fontcolor="black" ] -"ocfs2:2_stop_0 xen-2" -> "all_stopped" [ style = bold] -"ocfs2:2_stop_0 xen-2" -> "ocfs2-clone_stopped_0" [ style = bold] -"ocfs2:2_stop_0 xen-2" [ style=bold color="green" fontcolor="black" ] +"ocfs2:1_stop_0 xen-2" -> "all_stopped" [ style = bold] +"ocfs2:1_stop_0 xen-2" -> "ocfs2-clone_stopped_0" [ style = bold] +"ocfs2:1_stop_0 xen-2" [ style=bold color="green" fontcolor="black"] "ocfs2:3_post_notify_stop_0 xen-1" -> "ocfs2-clone_confirmed-post_notify_stopped_0" [ style = bold] "ocfs2:3_post_notify_stop_0 xen-1" [ style=bold color="green" fontcolor="black" ] "ocfs2:3_pre_notify_stop_0 xen-1" -> "ocfs2-clone_confirmed-pre_notify_stop_0" [ style = bold] "ocfs2:3_pre_notify_stop_0 xen-1" [ style=bold color="green" fontcolor="black" ] } diff --git a/pengine/test10/inc9.dot b/pengine/test10/inc9.dot index 9edcce6622..f4d6649003 100644 --- a/pengine/test10/inc9.dot +++ b/pengine/test10/inc9.dot @@ -1,18 +1,18 @@ digraph "g" { "all_stopped" [ style=bold color="green" fontcolor="orange" ] -"child_rsc1:5_stop_0 node1" -> "all_stopped" [ style = bold] -"child_rsc1:5_stop_0 node1" -> "rsc1_stopped_0" [ style = bold] -"child_rsc1:5_stop_0 node1" [ style=bold color="green" fontcolor="black" ] -"child_rsc1:6_stop_0 node1" -> "all_stopped" [ style = bold] -"child_rsc1:6_stop_0 node1" -> "rsc1_stopped_0" [ style = bold] -"child_rsc1:6_stop_0 node1" [ style=bold color="green" fontcolor="black" ] -"child_rsc1:7_stop_0 node2" -> "all_stopped" [ style = bold] -"child_rsc1:7_stop_0 node2" -> "rsc1_stopped_0" [ style = bold] -"child_rsc1:7_stop_0 node2" [ style=bold color="green" fontcolor="black" ] -"rsc1_stop_0" -> "child_rsc1:5_stop_0 node1" [ style = bold] -"rsc1_stop_0" -> "child_rsc1:6_stop_0 node1" [ style = bold] -"rsc1_stop_0" -> "child_rsc1:7_stop_0 node2" [ style = bold] +"child_rsc1:1_stop_0 node1" -> "all_stopped" [ style = bold] +"child_rsc1:1_stop_0 node1" -> "rsc1_stopped_0" [ style = bold] +"child_rsc1:1_stop_0 node1" [ style=bold color="green" fontcolor="black"] +"child_rsc1:1_stop_0 node2" -> "all_stopped" [ style = bold] +"child_rsc1:1_stop_0 node2" -> "rsc1_stopped_0" [ style = bold] +"child_rsc1:1_stop_0 node2" [ style=bold color="green" fontcolor="black"] +"child_rsc1:2_stop_0 node1" -> "all_stopped" [ style = bold] +"child_rsc1:2_stop_0 node1" -> "rsc1_stopped_0" [ style = bold] +"child_rsc1:2_stop_0 node1" [ style=bold color="green" fontcolor="black"] +"rsc1_stop_0" -> "child_rsc1:1_stop_0 node1" [ style = bold] +"rsc1_stop_0" -> "child_rsc1:1_stop_0 node2" [ style = bold] +"rsc1_stop_0" -> "child_rsc1:2_stop_0 node1" [ style = bold] "rsc1_stop_0" -> "rsc1_stopped_0" [ style = bold] "rsc1_stop_0" [ style=bold color="green" fontcolor="orange" ] "rsc1_stopped_0" [ style=bold color="green" fontcolor="orange" ] } diff --git a/pengine/test10/master-reattach.dot b/pengine/test10/master-reattach.dot index ca43764b4e..4a7c61310d 100644 --- a/pengine/test10/master-reattach.dot +++ b/pengine/test10/master-reattach.dot @@ -1,9 +1,9 @@ digraph "g" { "apache-vip_monitor_60000 dktest1" [ style=bold color="green" fontcolor="black" ] "drbd1:0_monitor_10000 dktest1" [ style=bold color="green" fontcolor="black" ] -"drbd1:1_monitor_11000 dktest2" [ style=bold color="green" fontcolor="black" ] +"drbd1:0_monitor_11000 dktest2" [ style=bold color="green" fontcolor="black"] "mount_monitor_10000 dktest1" [ style=bold color="green" fontcolor="black" ] "probe_complete dktest1" [ style=bold color="green" fontcolor="black" ] "probe_complete dktest2" [ style=bold color="green" fontcolor="black" ] "webserver_monitor_30000 dktest1" [ style=bold color="green" fontcolor="black" ] } diff --git a/pengine/test10/master-unmanaged-monitor.dot b/pengine/test10/master-unmanaged-monitor.dot index 468b2138b8..88d2aa97f5 100644 --- a/pengine/test10/master-unmanaged-monitor.dot +++ b/pengine/test10/master-unmanaged-monitor.dot @@ -1,16 +1,16 @@ digraph "g" { "lsb-dummy_monitor_5000 pcmk-3" [ style=bold color="green" fontcolor="black"] "migrator_monitor_10000 pcmk-4" [ style=bold color="green" fontcolor="black"] +"ping-1:0_monitor_60000 pcmk-1" [ style=bold color="green" fontcolor="black"] "ping-1:0_monitor_60000 pcmk-2" [ style=bold color="green" fontcolor="black"] -"ping-1:1_monitor_60000 pcmk-3" [ style=bold color="green" fontcolor="black"] -"ping-1:2_monitor_60000 pcmk-4" [ style=bold color="green" fontcolor="black"] -"ping-1:3_monitor_60000 pcmk-1" [ style=bold color="green" fontcolor="black"] +"ping-1:0_monitor_60000 pcmk-3" [ style=bold color="green" fontcolor="black"] +"ping-1:0_monitor_60000 pcmk-4" [ style=bold color="green" fontcolor="black"] "probe_complete pcmk-1" -> "probe_complete" [ style = bold] "probe_complete pcmk-1" [ style=bold color="green" fontcolor="black"] "probe_complete" [ style=bold color="green" fontcolor="orange"] "stateful-1:0_monitor_0 pcmk-1" -> "probe_complete pcmk-1" [ style = bold] "stateful-1:0_monitor_0 pcmk-1" [ style=bold color="green" fontcolor="black"] "stateful-1:0_monitor_15000 pcmk-2" [ style=bold color="green" fontcolor="black"] -"stateful-1:1_monitor_16000 pcmk-3" [ style=bold color="green" fontcolor="black"] -"stateful-1:2_monitor_15000 pcmk-4" [ style=bold color="green" fontcolor="black"] +"stateful-1:0_monitor_15000 pcmk-4" [ style=bold color="green" fontcolor="black"] +"stateful-1:0_monitor_16000 pcmk-3" [ style=bold color="green" fontcolor="black"] } diff --git a/pengine/test10/migrate-stop-complex.dot b/pengine/test10/migrate-stop-complex.dot index 35289c1d12..e0db51253a 100644 --- a/pengine/test10/migrate-stop-complex.dot +++ b/pengine/test10/migrate-stop-complex.dot @@ -1,39 +1,39 @@ digraph "g" { "all_stopped" [ style=bold color="green" fontcolor="orange" ] -"bottom:1_stop_0 dom0-02" -> "all_stopped" [ style = bold] -"bottom:1_stop_0 dom0-02" -> "clone-bottom_stopped_0" [ style = bold] -"bottom:1_stop_0 dom0-02" [ style=bold color="green" fontcolor="black" ] -"clone-bottom_stop_0" -> "bottom:1_stop_0 dom0-02" [ style = bold] +"bottom:0_stop_0 dom0-02" -> "all_stopped" [ style = bold] +"bottom:0_stop_0 dom0-02" -> "clone-bottom_stopped_0" [ style = bold] +"bottom:0_stop_0 dom0-02" [ style=bold color="green" fontcolor="black"] +"clone-bottom_stop_0" -> "bottom:0_stop_0 dom0-02" [ style = bold] "clone-bottom_stop_0" -> "clone-bottom_stopped_0" [ style = bold] "clone-bottom_stop_0" [ style=bold color="green" fontcolor="orange" ] "clone-bottom_stopped_0" [ style=bold color="green" fontcolor="orange" ] "clone-dom0-iscsi1_stop_0" -> "clone-dom0-iscsi1_stopped_0" [ style = bold] "clone-dom0-iscsi1_stop_0" -> "dom0-iscsi1:0_stop_0" [ style = bold] "clone-dom0-iscsi1_stop_0" [ style=bold color="green" fontcolor="orange" ] "clone-dom0-iscsi1_stopped_0" [ style=bold color="green" fontcolor="orange" ] "dom0-iscsi1-cnx1:0_stop_0 dom0-02" -> "all_stopped" [ style = bold] "dom0-iscsi1-cnx1:0_stop_0 dom0-02" -> "dom0-iscsi1:0_stopped_0" [ style = bold] "dom0-iscsi1-cnx1:0_stop_0 dom0-02" [ style=bold color="green" fontcolor="black" ] "dom0-iscsi1:0_stop_0" -> "dom0-iscsi1-cnx1:0_stop_0 dom0-02" [ style = bold] "dom0-iscsi1:0_stop_0" -> "dom0-iscsi1:0_stopped_0" [ style = bold] "dom0-iscsi1:0_stop_0" [ style=bold color="green" fontcolor="orange" ] "dom0-iscsi1:0_stopped_0" -> "clone-dom0-iscsi1_stopped_0" [ style = bold] "dom0-iscsi1:0_stopped_0" [ style=bold color="green" fontcolor="orange" ] "domU-test01_migrate_from_0 dom0-01" -> "domU-test01_stop_0 dom0-02" [ style = bold] "domU-test01_migrate_from_0 dom0-01" [ style=bold color="green" fontcolor="black" ] "domU-test01_migrate_to_0 dom0-02" -> "domU-test01_migrate_from_0 dom0-01" [ style = bold] "domU-test01_migrate_to_0 dom0-02" [ style=bold color="green" fontcolor="black" ] "domU-test01_start_0 dom0-01" -> "top_start_0 dom0-01" [ style = bold] "domU-test01_start_0 dom0-01" [ style=bold color="green" fontcolor="orange" ] "domU-test01_stop_0 dom0-02" -> "all_stopped" [ style = bold] "domU-test01_stop_0 dom0-02" -> "clone-bottom_stop_0" [ style = bold] "domU-test01_stop_0 dom0-02" -> "clone-dom0-iscsi1_stop_0" [ style = bold] "domU-test01_stop_0 dom0-02" -> "domU-test01_start_0 dom0-01" [ style = bold] "domU-test01_stop_0 dom0-02" [ style=bold color="green" fontcolor="black" ] "top_start_0 dom0-01" [ style=bold color="green" fontcolor="black" ] "top_stop_0 dom0-02" -> "all_stopped" [ style = bold] "top_stop_0 dom0-02" -> "domU-test01_migrate_to_0 dom0-02" [ style = bold] "top_stop_0 dom0-02" -> "domU-test01_stop_0 dom0-02" [ style = bold] "top_stop_0 dom0-02" -> "top_start_0 dom0-01" [ style = bold] "top_stop_0 dom0-02" [ style=bold color="green" fontcolor="black" ] } diff --git a/pengine/test10/novell-252693.dot b/pengine/test10/novell-252693.dot index 5195eee29b..f976139faf 100644 --- a/pengine/test10/novell-252693.dot +++ b/pengine/test10/novell-252693.dot @@ -1,117 +1,117 @@ digraph "g" { "all_stopped" -> "stonithclone:1_stop_0 node1" [ style = bold] "all_stopped" [ style=bold color="green" fontcolor="orange" ] "configstoreclone:0_post_notify_stop_0 node2" -> "configstorecloneset_confirmed-post_notify_stopped_0" [ style = bold] "configstoreclone:0_post_notify_stop_0 node2" [ style=bold color="green" fontcolor="black" ] +"configstoreclone:0_pre_notify_stop_0 node1" -> "configstorecloneset_confirmed-pre_notify_stop_0" [ style = bold] +"configstoreclone:0_pre_notify_stop_0 node1" [ style=bold color="green" fontcolor="black"] "configstoreclone:0_pre_notify_stop_0 node2" -> "configstorecloneset_confirmed-pre_notify_stop_0" [ style = bold] "configstoreclone:0_pre_notify_stop_0 node2" [ style=bold color="green" fontcolor="black" ] -"configstoreclone:1_pre_notify_stop_0 node1" -> "configstorecloneset_confirmed-pre_notify_stop_0" [ style = bold] -"configstoreclone:1_pre_notify_stop_0 node1" [ style=bold color="green" fontcolor="black" ] -"configstoreclone:1_stop_0 node1" -> "all_stopped" [ style = bold] -"configstoreclone:1_stop_0 node1" -> "configstorecloneset_stopped_0" [ style = bold] -"configstoreclone:1_stop_0 node1" -> "do_shutdown node1" [ style = bold] -"configstoreclone:1_stop_0 node1" [ style=bold color="green" fontcolor="black" ] +"configstoreclone:0_stop_0 node1" -> "all_stopped" [ style = bold] +"configstoreclone:0_stop_0 node1" -> "configstorecloneset_stopped_0" [ style = bold] +"configstoreclone:0_stop_0 node1" -> "do_shutdown node1" [ style = bold] +"configstoreclone:0_stop_0 node1" [ style=bold color="green" fontcolor="black"] "configstorecloneset_confirmed-post_notify_stopped_0" -> "all_stopped" [ style = bold] "configstorecloneset_confirmed-post_notify_stopped_0" -> "evmscloneset_stop_0" [ style = bold] "configstorecloneset_confirmed-post_notify_stopped_0" [ style=bold color="green" fontcolor="orange" ] "configstorecloneset_confirmed-pre_notify_stop_0" -> "configstorecloneset_post_notify_stopped_0" [ style = bold] "configstorecloneset_confirmed-pre_notify_stop_0" -> "configstorecloneset_stop_0" [ style = bold] "configstorecloneset_confirmed-pre_notify_stop_0" [ style=bold color="green" fontcolor="orange" ] "configstorecloneset_post_notify_stopped_0" -> "configstoreclone:0_post_notify_stop_0 node2" [ style = bold] "configstorecloneset_post_notify_stopped_0" -> "configstorecloneset_confirmed-post_notify_stopped_0" [ style = bold] "configstorecloneset_post_notify_stopped_0" [ style=bold color="green" fontcolor="orange" ] +"configstorecloneset_pre_notify_stop_0" -> "configstoreclone:0_pre_notify_stop_0 node1" [ style = bold] "configstorecloneset_pre_notify_stop_0" -> "configstoreclone:0_pre_notify_stop_0 node2" [ style = bold] -"configstorecloneset_pre_notify_stop_0" -> "configstoreclone:1_pre_notify_stop_0 node1" [ style = bold] "configstorecloneset_pre_notify_stop_0" -> "configstorecloneset_confirmed-pre_notify_stop_0" [ style = bold] "configstorecloneset_pre_notify_stop_0" [ style=bold color="green" fontcolor="orange" ] -"configstorecloneset_stop_0" -> "configstoreclone:1_stop_0 node1" [ style = bold] +"configstorecloneset_stop_0" -> "configstoreclone:0_stop_0 node1" [ style = bold] "configstorecloneset_stop_0" -> "configstorecloneset_stopped_0" [ style = bold] "configstorecloneset_stop_0" [ style=bold color="green" fontcolor="orange" ] "configstorecloneset_stopped_0" -> "configstorecloneset_post_notify_stopped_0" [ style = bold] "configstorecloneset_stopped_0" [ style=bold color="green" fontcolor="orange" ] "do_shutdown node1" [ style=bold color="green" fontcolor="black" ] "evmsclone:0_post_notify_stop_0 node2" -> "evmscloneset_confirmed-post_notify_stopped_0" [ style = bold] "evmsclone:0_post_notify_stop_0 node2" [ style=bold color="green" fontcolor="black" ] "evmsclone:0_pre_notify_stop_0 node2" -> "evmscloneset_confirmed-pre_notify_stop_0" [ style = bold] "evmsclone:0_pre_notify_stop_0 node2" [ style=bold color="green" fontcolor="black" ] "evmsclone:1_pre_notify_stop_0 node1" -> "evmscloneset_confirmed-pre_notify_stop_0" [ style = bold] "evmsclone:1_pre_notify_stop_0 node1" [ style=bold color="green" fontcolor="black" ] "evmsclone:1_stop_0 node1" -> "all_stopped" [ style = bold] "evmsclone:1_stop_0 node1" -> "do_shutdown node1" [ style = bold] "evmsclone:1_stop_0 node1" -> "evmscloneset_stopped_0" [ style = bold] "evmsclone:1_stop_0 node1" [ style=bold color="green" fontcolor="black" ] "evmscloneset_confirmed-post_notify_stopped_0" -> "all_stopped" [ style = bold] "evmscloneset_confirmed-post_notify_stopped_0" -> "evmsdcloneset_stop_0" [ style = bold] "evmscloneset_confirmed-post_notify_stopped_0" [ style=bold color="green" fontcolor="orange" ] "evmscloneset_confirmed-pre_notify_stop_0" -> "evmscloneset_post_notify_stopped_0" [ style = bold] "evmscloneset_confirmed-pre_notify_stop_0" -> "evmscloneset_stop_0" [ style = bold] "evmscloneset_confirmed-pre_notify_stop_0" [ style=bold color="green" fontcolor="orange" ] "evmscloneset_post_notify_stopped_0" -> "evmsclone:0_post_notify_stop_0 node2" [ style = bold] "evmscloneset_post_notify_stopped_0" -> "evmscloneset_confirmed-post_notify_stopped_0" [ style = bold] "evmscloneset_post_notify_stopped_0" [ style=bold color="green" fontcolor="orange" ] "evmscloneset_pre_notify_stop_0" -> "evmsclone:0_pre_notify_stop_0 node2" [ style = bold] "evmscloneset_pre_notify_stop_0" -> "evmsclone:1_pre_notify_stop_0 node1" [ style = bold] "evmscloneset_pre_notify_stop_0" -> "evmscloneset_confirmed-pre_notify_stop_0" [ style = bold] "evmscloneset_pre_notify_stop_0" [ style=bold color="green" fontcolor="orange" ] "evmscloneset_stop_0" -> "evmsclone:1_stop_0 node1" [ style = bold] "evmscloneset_stop_0" -> "evmscloneset_stopped_0" [ style = bold] "evmscloneset_stop_0" [ style=bold color="green" fontcolor="orange" ] "evmscloneset_stopped_0" -> "evmscloneset_post_notify_stopped_0" [ style = bold] "evmscloneset_stopped_0" [ style=bold color="green" fontcolor="orange" ] "evmsdclone:1_stop_0 node1" -> "all_stopped" [ style = bold] "evmsdclone:1_stop_0 node1" -> "do_shutdown node1" [ style = bold] "evmsdclone:1_stop_0 node1" -> "evmsdcloneset_stopped_0" [ style = bold] "evmsdclone:1_stop_0 node1" [ style=bold color="green" fontcolor="black" ] "evmsdcloneset_stop_0" -> "evmsdclone:1_stop_0 node1" [ style = bold] "evmsdcloneset_stop_0" -> "evmsdcloneset_stopped_0" [ style = bold] "evmsdcloneset_stop_0" [ style=bold color="green" fontcolor="orange" ] "evmsdcloneset_stopped_0" [ style=bold color="green" fontcolor="orange" ] "imagestoreclone:0_post_notify_stop_0 node2" -> "imagestorecloneset_confirmed-post_notify_stopped_0" [ style = bold] "imagestoreclone:0_post_notify_stop_0 node2" [ style=bold color="green" fontcolor="black" ] +"imagestoreclone:0_pre_notify_stop_0 node1" -> "imagestorecloneset_confirmed-pre_notify_stop_0" [ style = bold] +"imagestoreclone:0_pre_notify_stop_0 node1" [ style=bold color="green" fontcolor="black"] "imagestoreclone:0_pre_notify_stop_0 node2" -> "imagestorecloneset_confirmed-pre_notify_stop_0" [ style = bold] "imagestoreclone:0_pre_notify_stop_0 node2" [ style=bold color="green" fontcolor="black" ] -"imagestoreclone:1_pre_notify_stop_0 node1" -> "imagestorecloneset_confirmed-pre_notify_stop_0" [ style = bold] -"imagestoreclone:1_pre_notify_stop_0 node1" [ style=bold color="green" fontcolor="black" ] -"imagestoreclone:1_stop_0 node1" -> "all_stopped" [ style = bold] -"imagestoreclone:1_stop_0 node1" -> "do_shutdown node1" [ style = bold] -"imagestoreclone:1_stop_0 node1" -> "imagestorecloneset_stopped_0" [ style = bold] -"imagestoreclone:1_stop_0 node1" [ style=bold color="green" fontcolor="black" ] +"imagestoreclone:0_stop_0 node1" -> "all_stopped" [ style = bold] +"imagestoreclone:0_stop_0 node1" -> "do_shutdown node1" [ style = bold] +"imagestoreclone:0_stop_0 node1" -> "imagestorecloneset_stopped_0" [ style = bold] +"imagestoreclone:0_stop_0 node1" [ style=bold color="green" fontcolor="black"] "imagestorecloneset_confirmed-post_notify_stopped_0" -> "all_stopped" [ style = bold] "imagestorecloneset_confirmed-post_notify_stopped_0" -> "evmscloneset_stop_0" [ style = bold] "imagestorecloneset_confirmed-post_notify_stopped_0" [ style=bold color="green" fontcolor="orange" ] "imagestorecloneset_confirmed-pre_notify_stop_0" -> "imagestorecloneset_post_notify_stopped_0" [ style = bold] "imagestorecloneset_confirmed-pre_notify_stop_0" -> "imagestorecloneset_stop_0" [ style = bold] "imagestorecloneset_confirmed-pre_notify_stop_0" [ style=bold color="green" fontcolor="orange" ] "imagestorecloneset_post_notify_stopped_0" -> "imagestoreclone:0_post_notify_stop_0 node2" [ style = bold] "imagestorecloneset_post_notify_stopped_0" -> "imagestorecloneset_confirmed-post_notify_stopped_0" [ style = bold] "imagestorecloneset_post_notify_stopped_0" [ style=bold color="green" fontcolor="orange" ] +"imagestorecloneset_pre_notify_stop_0" -> "imagestoreclone:0_pre_notify_stop_0 node1" [ style = bold] "imagestorecloneset_pre_notify_stop_0" -> "imagestoreclone:0_pre_notify_stop_0 node2" [ style = bold] -"imagestorecloneset_pre_notify_stop_0" -> "imagestoreclone:1_pre_notify_stop_0 node1" [ style = bold] "imagestorecloneset_pre_notify_stop_0" -> "imagestorecloneset_confirmed-pre_notify_stop_0" [ style = bold] "imagestorecloneset_pre_notify_stop_0" [ style=bold color="green" fontcolor="orange" ] -"imagestorecloneset_stop_0" -> "imagestoreclone:1_stop_0 node1" [ style = bold] +"imagestorecloneset_stop_0" -> "imagestoreclone:0_stop_0 node1" [ style = bold] "imagestorecloneset_stop_0" -> "imagestorecloneset_stopped_0" [ style = bold] "imagestorecloneset_stop_0" [ style=bold color="green" fontcolor="orange" ] "imagestorecloneset_stopped_0" -> "imagestorecloneset_post_notify_stopped_0" [ style = bold] "imagestorecloneset_stopped_0" [ style=bold color="green" fontcolor="orange" ] "sles10_migrate_from_0 node2" -> "sles10_stop_0 node1" [ style = bold] "sles10_migrate_from_0 node2" [ style=bold color="green" fontcolor="black" ] "sles10_migrate_to_0 node1" -> "sles10_migrate_from_0 node2" [ style = bold] "sles10_migrate_to_0 node1" [ style=bold color="green" fontcolor="black" ] "sles10_monitor_10000 node2" [ style=bold color="green" fontcolor="black" ] "sles10_start_0 node2" -> "sles10_monitor_10000 node2" [ style = bold] "sles10_start_0 node2" [ style=bold color="green" fontcolor="orange" ] "sles10_stop_0 node1" -> "all_stopped" [ style = bold] "sles10_stop_0 node1" -> "configstorecloneset_stop_0" [ style = bold] "sles10_stop_0 node1" -> "do_shutdown node1" [ style = bold] "sles10_stop_0 node1" -> "imagestorecloneset_stop_0" [ style = bold] "sles10_stop_0 node1" -> "sles10_start_0 node2" [ style = bold] "sles10_stop_0 node1" [ style=bold color="green" fontcolor="black" ] "stonithclone:1_stop_0 node1" -> "do_shutdown node1" [ style = bold] "stonithclone:1_stop_0 node1" -> "stonithcloneset_stopped_0" [ style = bold] "stonithclone:1_stop_0 node1" [ style=bold color="green" fontcolor="black" ] "stonithcloneset_stop_0" -> "stonithclone:1_stop_0 node1" [ style = bold] "stonithcloneset_stop_0" -> "stonithcloneset_stopped_0" [ style = bold] "stonithcloneset_stop_0" [ style=bold color="green" fontcolor="orange" ] "stonithcloneset_stopped_0" [ style=bold color="green" fontcolor="orange" ] } diff --git a/tools/crm_inject.c b/tools/crm_inject.c index 61f668741f..e47a946c16 100644 --- a/tools/crm_inject.c +++ b/tools/crm_inject.c @@ -1,1486 +1,1514 @@ /* * Copyright (C) 2009 Andrew Beekhof * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include cib_t *global_cib = NULL; GListPtr op_fail = NULL; gboolean quiet = FALSE; #define new_node_template "//"XML_CIB_TAG_NODE"[@uname='%s']" #define node_template "//"XML_CIB_TAG_STATE"[@uname='%s']" #define rsc_template "//"XML_CIB_TAG_STATE"[@uname='%s']//"XML_LRM_TAG_RESOURCE"[@id='%s']" #define op_template "//"XML_CIB_TAG_STATE"[@uname='%s']//"XML_LRM_TAG_RESOURCE"[@id='%s']/"XML_LRM_TAG_RSC_OP"[@id='%s']" /* #define op_template "//"XML_CIB_TAG_STATE"[@uname='%s']//"XML_LRM_TAG_RESOURCE"[@id='%s']/"XML_LRM_TAG_RSC_OP"[@id='%s' and @"XML_LRM_ATTR_CALLID"='%d']" */ #define FAKE_TE_ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" #define quiet_log(fmt, args...) do { \ if(quiet == FALSE) { \ printf(fmt , ##args); \ } \ } while(0) extern void cleanup_alloc_calculations(pe_working_set_t * data_set); extern xmlNode *do_calculations(pe_working_set_t * data_set, xmlNode * xml_input, ha_time_t * now); char *use_date = NULL; static ha_time_t * get_date(void) { if (use_date) { char *date_m = use_date; return parse_date(&date_m); } return NULL; } static xmlNode * find_resource(xmlNode * cib_node, const char *resource) { char *xpath = NULL; xmlNode *match = NULL; const char *node = crm_element_value(cib_node, XML_ATTR_UNAME); int max = strlen(rsc_template) + strlen(resource) + strlen(node) + 1; xpath = calloc(1, max); snprintf(xpath, max, rsc_template, node, resource); match = get_xpath_object(xpath, cib_node, LOG_DEBUG_2); free(xpath); return match; } static void create_node_entry(cib_t * cib_conn, char *node) { int rc = pcmk_ok; int max = strlen(new_node_template) + strlen(node) + 1; char *xpath = NULL; xpath = calloc(1, max); snprintf(xpath, max, new_node_template, node); rc = cib_conn->cmds->query(cib_conn, xpath, NULL, cib_xpath | cib_sync_call | cib_scope_local); if (rc == -ENXIO) { xmlNode *cib_object = create_xml_node(NULL, XML_CIB_TAG_NODE); /* Using node uname as uuid ala corosync/openais */ crm_xml_add(cib_object, XML_ATTR_ID, node); crm_xml_add(cib_object, XML_ATTR_UNAME, node); cib_conn->cmds->create(cib_conn, XML_CIB_TAG_NODES, cib_object, cib_sync_call | cib_scope_local); /* Not bothering with subsequent query to see if it exists, we'll bomb out later in the call to determine_host... */ free_xml(cib_object); } free(xpath); } static xmlNode * inject_node_state(cib_t * cib_conn, char *node) { int rc = pcmk_ok; int max = strlen(rsc_template) + strlen(node) + 1; char *xpath = NULL; xmlNode *cib_object = NULL; xpath = calloc(1, max); create_node_entry(cib_conn, node); snprintf(xpath, max, node_template, node); rc = cib_conn->cmds->query(cib_conn, xpath, &cib_object, cib_xpath | cib_sync_call | cib_scope_local); if(cib_object && ID(cib_object) == NULL) { crm_err("Detected multiple node_state entries for xpath=%s, bailing", xpath); crm_log_xml_warn(cib_object, "Duplicates"); exit(1); } if (rc == -ENXIO) { char *uuid = NULL; cib_object = create_xml_node(NULL, XML_CIB_TAG_STATE); determine_host(cib_conn, &node, &uuid); crm_xml_add(cib_object, XML_ATTR_UUID, uuid); crm_xml_add(cib_object, XML_ATTR_UNAME, node); cib_conn->cmds->create(cib_conn, XML_CIB_TAG_STATUS, cib_object, cib_sync_call | cib_scope_local); free_xml(cib_object); free(uuid); rc = cib_conn->cmds->query(cib_conn, xpath, &cib_object, cib_xpath | cib_sync_call | cib_scope_local); } free(xpath); CRM_ASSERT(rc == pcmk_ok); return cib_object; } static xmlNode * modify_node(cib_t * cib_conn, char *node, gboolean up) { xmlNode *cib_node = inject_node_state(cib_conn, node); if (up) { crm_xml_add(cib_node, XML_NODE_IN_CLUSTER, XML_BOOLEAN_YES); crm_xml_add(cib_node, XML_NODE_IS_PEER, ONLINESTATUS); crm_xml_add(cib_node, XML_NODE_JOIN_STATE, CRMD_JOINSTATE_MEMBER); crm_xml_add(cib_node, XML_NODE_EXPECTED, CRMD_JOINSTATE_MEMBER); } else { crm_xml_add(cib_node, XML_NODE_IN_CLUSTER, XML_BOOLEAN_NO); crm_xml_add(cib_node, XML_NODE_IS_PEER, OFFLINESTATUS); crm_xml_add(cib_node, XML_NODE_JOIN_STATE, CRMD_JOINSTATE_DOWN); crm_xml_add(cib_node, XML_NODE_EXPECTED, CRMD_JOINSTATE_DOWN); } crm_xml_add(cib_node, XML_ATTR_ORIGIN, crm_system_name); return cib_node; } static void inject_transient_attr(xmlNode * cib_node, const char *name, const char *value) { xmlNode *attrs = NULL; xmlNode *container = NULL; xmlNode *nvp = NULL; const char *node_uuid = ID(cib_node); char *nvp_id = crm_concat(name, node_uuid, '-'); crm_info("Injecting attribute %s=%s into %s '%s'", name, value, xmlGetNodePath(cib_node), ID(cib_node)); attrs = first_named_child(cib_node, XML_TAG_TRANSIENT_NODEATTRS); if (attrs == NULL) { attrs = create_xml_node(cib_node, XML_TAG_TRANSIENT_NODEATTRS); crm_xml_add(attrs, XML_ATTR_ID, node_uuid); } container = first_named_child(attrs, XML_TAG_ATTR_SETS); if (container == NULL) { container = create_xml_node(attrs, XML_TAG_ATTR_SETS); crm_xml_add(container, XML_ATTR_ID, node_uuid); } nvp = create_xml_node(container, XML_CIB_TAG_NVPAIR); crm_xml_add(nvp, XML_ATTR_ID, nvp_id); crm_xml_add(nvp, XML_NVPAIR_ATTR_NAME, name); crm_xml_add(nvp, XML_NVPAIR_ATTR_VALUE, value); free(nvp_id); } static xmlNode * inject_resource(xmlNode * cib_node, const char *resource, const char *rclass, const char *rtype, const char *rprovider) { xmlNode *lrm = NULL; xmlNode *container = NULL; xmlNode *cib_resource = NULL; char *xpath = NULL; cib_resource = find_resource(cib_node, resource); if (cib_resource != NULL) { return cib_resource; } /* One day, add query for class, provider, type */ if (rclass == NULL || rtype == NULL) { fprintf(stderr, "Resource %s not found in the status section of %s." " Please supply the class and type to continue\n", resource, ID(cib_node)); return NULL; } else if (safe_str_neq(rclass, "ocf") && safe_str_neq(rclass, "stonith") && safe_str_neq(rclass, "heartbeat") && safe_str_neq(rclass, "lsb")) { fprintf(stderr, "Invalid class for %s: %s\n", resource, rclass); return NULL; } else if (safe_str_eq(rclass, "ocf") && rprovider == NULL) { fprintf(stderr, "Please specify the provider for resource %s\n", resource); return NULL; } xpath = (char *)xmlGetNodePath(cib_node); crm_info("Injecting new resource %s into %s '%s'", resource, xpath, ID(cib_node)); free(xpath); lrm = first_named_child(cib_node, XML_CIB_TAG_LRM); if (lrm == NULL) { const char *node_uuid = ID(cib_node); lrm = create_xml_node(cib_node, XML_CIB_TAG_LRM); crm_xml_add(lrm, XML_ATTR_ID, node_uuid); } container = first_named_child(lrm, XML_LRM_TAG_RESOURCES); if (container == NULL) { container = create_xml_node(lrm, XML_LRM_TAG_RESOURCES); } cib_resource = create_xml_node(container, XML_LRM_TAG_RESOURCE); crm_xml_add(cib_resource, XML_ATTR_ID, resource); crm_xml_add(cib_resource, XML_AGENT_ATTR_CLASS, rclass); crm_xml_add(cib_resource, XML_AGENT_ATTR_PROVIDER, rprovider); crm_xml_add(cib_resource, XML_ATTR_TYPE, rtype); return cib_resource; } static lrmd_event_data_t * create_op(xmlNode * cib_resource, const char *task, int interval, int outcome) { lrmd_event_data_t *op = NULL; xmlNode *xop = NULL; op = calloc(1, sizeof(lrmd_event_data_t)); op->rsc_id = strdup(ID(cib_resource)); op->interval = interval; op->op_type = strdup(task); op->rc = outcome; op->op_status = 0; op->params = NULL; /* TODO: Fill me in */ op->call_id = 0; for (xop = __xml_first_child(cib_resource); xop != NULL; xop = __xml_next(xop)) { int tmp = 0; crm_element_value_int(xop, XML_LRM_ATTR_CALLID, &tmp); if (tmp > op->call_id) { op->call_id = tmp; } } op->call_id++; return op; } static xmlNode * inject_op(xmlNode * cib_resource, lrmd_event_data_t * op, int target_rc) { return create_operation_update(cib_resource, op, CRM_FEATURE_SET, target_rc, crm_system_name, LOG_DEBUG_2); } static void update_failcounts(xmlNode * cib_node, const char *resource, int interval, int rc) { if (rc == 0) { return; } else if (rc == 7 && interval == 0) { return; } else { char *name = NULL; char *now = crm_itoa(time(NULL)); name = crm_concat("fail-count", resource, '-'); inject_transient_attr(cib_node, name, "value++"); name = crm_concat("last-failure", resource, '-'); inject_transient_attr(cib_node, name, now); free(name); free(now); } } static gboolean exec_pseudo_action(crm_graph_t * graph, crm_action_t * action) { const char *node = crm_element_value(action->xml, XML_LRM_ATTR_TARGET); const char *task = crm_element_value(action->xml, XML_LRM_ATTR_TASK_KEY); action->confirmed = TRUE; quiet_log(" * Pseudo action: %s%s%s\n", task, node?" on ":"", node?node:""); update_graph(graph, action); return TRUE; } static gboolean exec_rsc_action(crm_graph_t * graph, crm_action_t * action) { int rc = 0; GListPtr gIter = NULL; lrmd_event_data_t *op = NULL; int target_outcome = 0; const char *rtype = NULL; const char *rclass = NULL; const char *resource = NULL; const char *rprovider = NULL; const char *target_rc_s = crm_meta_value(action->params, XML_ATTR_TE_TARGET_RC); xmlNode *cib_node = NULL; xmlNode *cib_resource = NULL; xmlNode *action_rsc = first_named_child(action->xml, XML_CIB_TAG_RESOURCE); char *node = crm_element_value_copy(action->xml, XML_LRM_ATTR_TARGET); if (safe_str_eq(crm_element_value(action->xml, "operation"), "probe_complete")) { crm_info("Skipping %s op for %s\n", crm_element_value(action->xml, "operation"), node); goto done; } if (action_rsc == NULL) { crm_log_xml_err(action->xml, "Bad"); free(node); return FALSE; } resource = ID(action_rsc); rclass = crm_element_value(action_rsc, XML_AGENT_ATTR_CLASS); rtype = crm_element_value(action_rsc, XML_ATTR_TYPE); rprovider = crm_element_value(action_rsc, XML_AGENT_ATTR_PROVIDER); if (target_rc_s != NULL) { target_outcome = crm_parse_int(target_rc_s, "0"); } CRM_ASSERT(global_cib->cmds->query(global_cib, NULL, NULL, cib_sync_call | cib_scope_local) == pcmk_ok); cib_node = inject_node_state(global_cib, node); CRM_ASSERT(cib_node != NULL); cib_resource = inject_resource(cib_node, resource, rclass, rtype, rprovider); CRM_ASSERT(cib_resource != NULL); op = convert_graph_action(cib_resource, action, 0, target_outcome); if(op->interval) { quiet_log(" * Resource action: %-15s %s=%d on %s\n", resource, op->op_type, op->interval, node); } else { quiet_log(" * Resource action: %-15s %s on %s\n", resource, op->op_type, node); } for (gIter = op_fail; gIter != NULL; gIter = gIter->next) { char *spec = (char *)gIter->data; char *key = NULL; key = calloc(1, 1 + strlen(spec)); snprintf(key, strlen(spec), "%s_%s_%d@%s=", resource, op->op_type, op->interval, node); if (strncasecmp(key, spec, strlen(key)) == 0) { rc = sscanf(spec, "%*[^=]=%d", (int *) &op->rc); action->failed = TRUE; graph->abort_priority = INFINITY; printf("\tPretending action %d failed with rc=%d\n", action->id, op->rc); update_failcounts(cib_node, resource, op->interval, op->rc); free(key); break; } free(key); } inject_op(cib_resource, op, target_outcome); lrmd_free_event(op); rc = global_cib->cmds->modify(global_cib, XML_CIB_TAG_STATUS, cib_node, cib_sync_call | cib_scope_local); CRM_ASSERT(rc == pcmk_ok); done: free(node); free_xml(cib_node); action->confirmed = TRUE; update_graph(graph, action); return TRUE; } static gboolean exec_crmd_action(crm_graph_t * graph, crm_action_t * action) { const char *node = crm_element_value(action->xml, XML_LRM_ATTR_TARGET); const char *task = crm_element_value(action->xml, XML_LRM_ATTR_TASK); action->confirmed = TRUE; quiet_log(" * Cluster action: %s on %s\n", task, node); update_graph(graph, action); return TRUE; } #define STATUS_PATH_MAX 512 static gboolean exec_stonith_action(crm_graph_t * graph, crm_action_t * action) { int rc = 0; char xpath[STATUS_PATH_MAX]; char *target = crm_element_value_copy(action->xml, XML_LRM_ATTR_TARGET); xmlNode *cib_node = modify_node(global_cib, target, FALSE); crm_xml_add(cib_node, XML_ATTR_ORIGIN, __FUNCTION__); CRM_ASSERT(cib_node != NULL); quiet_log(" * Fencing %s\n", target); rc = global_cib->cmds->replace(global_cib, XML_CIB_TAG_STATUS, cib_node, cib_sync_call | cib_scope_local); CRM_ASSERT(rc == pcmk_ok); snprintf(xpath, STATUS_PATH_MAX, "//node_state[@uname='%s']/%s", target, XML_CIB_TAG_LRM); rc = global_cib->cmds->delete(global_cib, xpath, NULL, cib_xpath | cib_sync_call | cib_scope_local); snprintf(xpath, STATUS_PATH_MAX, "//node_state[@uname='%s']/%s", target, XML_TAG_TRANSIENT_NODEATTRS); rc = global_cib->cmds->delete(global_cib, xpath, NULL, cib_xpath | cib_sync_call | cib_scope_local); action->confirmed = TRUE; update_graph(graph, action); free_xml(cib_node); free(target); return TRUE; } static char * add_list_element(char *list, const char *value) { int len = 0; int last = 0; if (value == NULL) { return list; } if (list) { last = strlen(list); } len = last + 2; /* +1 space, +1 EOS */ len += strlen(value); list = realloc(list, len); sprintf(list + last, " %s", value); return list; } static void print_cluster_status(pe_working_set_t * data_set) { char *online_nodes = NULL; char *offline_nodes = NULL; GListPtr gIter = NULL; for (gIter = data_set->nodes; gIter != NULL; gIter = gIter->next) { node_t *node = (node_t *) gIter->data; const char *node_mode = NULL; if (node->details->unclean) { if (node->details->online && node->details->unclean) { node_mode = "UNCLEAN (online)"; } else if (node->details->pending) { node_mode = "UNCLEAN (pending)"; } else { node_mode = "UNCLEAN (offline)"; } } else if (node->details->pending) { node_mode = "pending"; } else if (node->details->standby_onfail && node->details->online) { node_mode = "standby (on-fail)"; } else if (node->details->standby) { if (node->details->online) { node_mode = "standby"; } else { node_mode = "OFFLINE (standby)"; } } else if (node->details->online) { node_mode = "online"; online_nodes = add_list_element(online_nodes, node->details->uname); continue; } else { node_mode = "OFFLINE"; offline_nodes = add_list_element(offline_nodes, node->details->uname); continue; } if (safe_str_eq(node->details->uname, node->details->id)) { printf("Node %s: %s\n", node->details->uname, node_mode); } else { printf("Node %s (%s): %s\n", node->details->uname, node->details->id, node_mode); } } if (online_nodes) { printf("Online: [%s ]\n", online_nodes); free(online_nodes); } if (offline_nodes) { printf("OFFLINE: [%s ]\n", offline_nodes); free(offline_nodes); } fprintf(stdout, "\n"); for (gIter = data_set->resources; gIter != NULL; gIter = gIter->next) { resource_t *rsc = (resource_t *) gIter->data; if (is_set(rsc->flags, pe_rsc_orphan) && rsc->role == RSC_ROLE_STOPPED) { continue; } rsc->fns->print(rsc, NULL, pe_print_printf, stdout); } fprintf(stdout, "\n"); } static int run_simulation(pe_working_set_t * data_set) { crm_graph_t *transition = NULL; enum transition_status graph_rc = -1; crm_graph_functions_t exec_fns = { exec_pseudo_action, exec_rsc_action, exec_crmd_action, exec_stonith_action, }; set_graph_functions(&exec_fns); quiet_log("\nExecuting cluster transition:\n"); transition = unpack_graph(data_set->graph, crm_system_name); print_graph(LOG_DEBUG, transition); do { graph_rc = run_graph(transition); } while (graph_rc == transition_active); if (graph_rc != transition_complete) { fprintf(stdout, "Transition failed: %s\n", transition_status(graph_rc)); print_graph(LOG_ERR, transition); } destroy_graph(transition); if (graph_rc != transition_complete) { fprintf(stdout, "An invalid transition was produced\n"); } if (quiet == FALSE) { xmlNode *cib_object = NULL; int rc = global_cib->cmds->query(global_cib, NULL, &cib_object, cib_sync_call | cib_scope_local); CRM_ASSERT(rc == pcmk_ok); quiet_log("\nRevised cluster status:\n"); cleanup_alloc_calculations(data_set); data_set->input = cib_object; data_set->now = get_date(); cluster_status(data_set); print_cluster_status(data_set); } if (graph_rc != transition_complete) { return graph_rc; } return 0; } static char * create_action_name(action_t * action) { char *action_name = NULL; + const char *prefix = NULL; const char *action_host = NULL; + const char *task = action->task; if (action->node) { action_host = action->node->details->uname; - action_name = crm_concat(action->uuid, action_host, ' '); - - } else if (is_set(action->flags, pe_action_pseudo)) { - action_name = strdup(action->uuid); - - } else { + } else if(is_not_set(action->flags, pe_action_pseudo)) { action_host = ""; - action_name = crm_concat(action->uuid, action_host, ' '); } + if (safe_str_eq(action->task, RSC_CANCEL)) { - char *tmp_action_name = action_name; + prefix = "Cancel "; + task = "monitor"; /* TO-DO: Hack! */ + } + + if(action->rsc && action->rsc->clone_name) { + char *key = NULL; + const char *name = action->rsc->clone_name; + const char *interval_s = g_hash_table_lookup(action->meta, XML_LRM_ATTR_INTERVAL); + + int interval = crm_parse_int(interval_s, "0"); + + if (safe_str_eq(action->task, RSC_NOTIFY)) { + const char *n_type = g_hash_table_lookup(action->meta, "notify_type"); + const char *n_task = g_hash_table_lookup(action->meta, "notify_operation"); + + CRM_ASSERT(n_type != NULL); + CRM_ASSERT(n_task != NULL); + key = generate_notify_key(name, n_type, n_task); - action_name = crm_concat("Cancel", tmp_action_name, ' '); - free(tmp_action_name); + } else { + key = generate_op_key(name, task, interval); + } + + if(action_host) { + action_name = g_strdup_printf("%s%s %s", prefix?prefix:"", key, action_host); + } else { + action_name = g_strdup_printf("%s%s", prefix?prefix:"", key); + } + + } else if(action_host) { + action_name = g_strdup_printf("%s%s %s", prefix?prefix:"", action->uuid, action_host); + + } else { + action_name = g_strdup_printf("%s", action->uuid); } + return action_name; } static void create_dotfile(pe_working_set_t * data_set, const char *dot_file, gboolean all_actions) { GListPtr gIter = NULL; FILE *dot_strm = fopen(dot_file, "w"); if (dot_strm == NULL) { crm_perror(LOG_ERR, "Could not open %s for writing", dot_file); return; } fprintf(dot_strm, " digraph \"g\" {\n"); for (gIter = data_set->actions; gIter != NULL; gIter = gIter->next) { action_t *action = (action_t *) gIter->data; const char *style = "dashed"; const char *font = "black"; const char *color = "black"; char *action_name = create_action_name(action); crm_trace("Action %d: %p", action->id, action); if (is_set(action->flags, pe_action_pseudo)) { font = "orange"; } if (is_set(action->flags, pe_action_dumped)) { style = "bold"; color = "green"; } else if (action->rsc != NULL && is_not_set(action->rsc->flags, pe_rsc_managed)) { color = "red"; font = "purple"; if (all_actions == FALSE) { goto dont_write; } } else if (is_set(action->flags, pe_action_optional)) { color = "blue"; if (all_actions == FALSE) { goto dont_write; } } else { color = "red"; CRM_CHECK(is_set(action->flags, pe_action_runnable) == FALSE,; ); } set_bit(action->flags, pe_action_dumped); fprintf(dot_strm, "\"%s\" [ style=%s color=\"%s\" fontcolor=\"%s\"]\n", action_name, style, color, font); dont_write: free(action_name); } for (gIter = data_set->actions; gIter != NULL; gIter = gIter->next) { action_t *action = (action_t *) gIter->data; GListPtr gIter2 = NULL; for (gIter2 = action->actions_before; gIter2 != NULL; gIter2 = gIter2->next) { action_wrapper_t *before = (action_wrapper_t *) gIter2->data; char *before_name = NULL; char *after_name = NULL; const char *style = "dashed"; gboolean optional = TRUE; if (before->state == pe_link_dumped) { optional = FALSE; style = "bold"; } else if (is_set(action->flags, pe_action_pseudo) && (before->type & pe_order_stonith_stop)) { continue; } else if (before->state == pe_link_dup) { continue; } else if (before->type == pe_order_none) { continue; } else if (is_set(before->action->flags, pe_action_dumped) && is_set(action->flags, pe_action_dumped) && before->type != pe_order_load) { optional = FALSE; } if (all_actions || optional == FALSE) { before_name = create_action_name(before->action); after_name = create_action_name(action); fprintf(dot_strm, "\"%s\" -> \"%s\" [ style = %s]\n", before_name, after_name, style); free(before_name); free(after_name); } } } fprintf(dot_strm, "}\n"); if (dot_strm != NULL) { fflush(dot_strm); fclose(dot_strm); } } static int find_ticket_state(cib_t * the_cib, const char * ticket_id, xmlNode ** ticket_state_xml) { int offset = 0; static int xpath_max = 1024; int rc = pcmk_ok; xmlNode *xml_search = NULL; char *xpath_string = NULL; CRM_ASSERT(ticket_state_xml != NULL); *ticket_state_xml = NULL; xpath_string = calloc(1, xpath_max); offset += snprintf(xpath_string + offset, xpath_max - offset, "%s", "/cib/status/tickets"); if (ticket_id) { offset += snprintf(xpath_string + offset, xpath_max - offset, "/%s[@id=\"%s\"]", XML_CIB_TAG_TICKET_STATE, ticket_id); } rc = the_cib->cmds->query(the_cib, xpath_string, &xml_search, cib_sync_call | cib_scope_local | cib_xpath); if (rc != pcmk_ok) { goto bail; } crm_log_xml_debug(xml_search, "Match"); if (xml_has_children(xml_search)) { if (ticket_id) { fprintf(stdout, "Multiple ticket_states match ticket_id=%s\n", ticket_id); } *ticket_state_xml = xml_search; } else { *ticket_state_xml = xml_search; } bail: free(xpath_string); return rc; } static int set_ticket_state_attr(const char *ticket_id, const char *attr_name, const char *attr_value, cib_t * cib, int cib_options) { int rc = pcmk_ok; xmlNode *xml_top = NULL; xmlNode *ticket_state_xml = NULL; rc = find_ticket_state(cib, ticket_id, &ticket_state_xml); if (rc == pcmk_ok) { crm_debug("Found a match state for ticket: id=%s", ticket_id); xml_top = ticket_state_xml; } else if (rc != -ENXIO) { return rc; } else { xmlNode *xml_obj = NULL; xml_top = create_xml_node(NULL, XML_CIB_TAG_STATUS); xml_obj = create_xml_node(xml_top, XML_CIB_TAG_TICKETS); ticket_state_xml = create_xml_node(xml_obj, XML_CIB_TAG_TICKET_STATE); crm_xml_add(ticket_state_xml, XML_ATTR_ID, ticket_id); } crm_xml_add(ticket_state_xml, attr_name, attr_value); crm_log_xml_debug(xml_top, "Update"); rc = cib->cmds->modify(cib, XML_CIB_TAG_STATUS, xml_top, cib_options); free_xml(xml_top); return rc; } static void modify_configuration(pe_working_set_t * data_set, const char *quorum, GListPtr node_up, GListPtr node_down, GListPtr node_fail, GListPtr op_inject, GListPtr ticket_grant, GListPtr ticket_revoke, GListPtr ticket_standby, GListPtr ticket_activate) { int rc = pcmk_ok; GListPtr gIter = NULL; xmlNode *cib_op = NULL; xmlNode *cib_node = NULL; xmlNode *cib_resource = NULL; lrmd_event_data_t *op = NULL; if (quorum) { xmlNode *top = create_xml_node(NULL, XML_TAG_CIB); quiet_log(" + Setting quorum: %s\n", quorum); /* crm_xml_add(top, XML_ATTR_DC_UUID, dc_uuid); */ crm_xml_add(top, XML_ATTR_HAVE_QUORUM, quorum); rc = global_cib->cmds->modify(global_cib, NULL, top, cib_sync_call | cib_scope_local); CRM_ASSERT(rc == pcmk_ok); } for (gIter = node_up; gIter != NULL; gIter = gIter->next) { char *node = (char *)gIter->data; quiet_log(" + Bringing node %s online\n", node); cib_node = modify_node(global_cib, node, TRUE); CRM_ASSERT(cib_node != NULL); rc = global_cib->cmds->modify(global_cib, XML_CIB_TAG_STATUS, cib_node, cib_sync_call | cib_scope_local); CRM_ASSERT(rc == pcmk_ok); } for (gIter = node_down; gIter != NULL; gIter = gIter->next) { char *node = (char *)gIter->data; quiet_log(" + Taking node %s offline\n", node); cib_node = modify_node(global_cib, node, FALSE); CRM_ASSERT(cib_node != NULL); rc = global_cib->cmds->modify(global_cib, XML_CIB_TAG_STATUS, cib_node, cib_sync_call | cib_scope_local); CRM_ASSERT(rc == pcmk_ok); } for (gIter = node_fail; gIter != NULL; gIter = gIter->next) { char *node = (char *)gIter->data; quiet_log(" + Failing node %s\n", node); cib_node = modify_node(global_cib, node, TRUE); crm_xml_add(cib_node, XML_NODE_IN_CLUSTER, XML_BOOLEAN_NO); CRM_ASSERT(cib_node != NULL); rc = global_cib->cmds->modify(global_cib, XML_CIB_TAG_STATUS, cib_node, cib_sync_call | cib_scope_local); CRM_ASSERT(rc == pcmk_ok); } for (gIter = ticket_grant; gIter != NULL; gIter = gIter->next) { char *ticket_id = (char *)gIter->data; quiet_log(" + Granting ticket %s\n", ticket_id); rc = set_ticket_state_attr(ticket_id, "granted", "true", global_cib, cib_sync_call | cib_scope_local); CRM_ASSERT(rc == pcmk_ok); } for (gIter = ticket_revoke; gIter != NULL; gIter = gIter->next) { char *ticket_id = (char *)gIter->data; quiet_log(" + Revoking ticket %s\n", ticket_id); rc = set_ticket_state_attr(ticket_id, "granted", "false", global_cib, cib_sync_call | cib_scope_local); CRM_ASSERT(rc == pcmk_ok); } for (gIter = ticket_standby; gIter != NULL; gIter = gIter->next) { char *ticket_id = (char *)gIter->data; quiet_log(" + Making ticket %s standby\n", ticket_id); rc = set_ticket_state_attr(ticket_id, "standby", "true", global_cib, cib_sync_call | cib_scope_local); CRM_ASSERT(rc == pcmk_ok); } for (gIter = ticket_activate; gIter != NULL; gIter = gIter->next) { char *ticket_id = (char *)gIter->data; quiet_log(" + Activating ticket %s\n", ticket_id); rc = set_ticket_state_attr(ticket_id, "standby", "false", global_cib, cib_sync_call | cib_scope_local); CRM_ASSERT(rc == pcmk_ok); } for (gIter = op_inject; gIter != NULL; gIter = gIter->next) { char *spec = (char *)gIter->data; int rc = 0; int outcome = 0; int interval = 0; char *key = NULL; char *node = NULL; char *task = NULL; char *resource = NULL; const char *rtype = NULL; const char *rclass = NULL; const char *rprovider = NULL; resource_t *rsc = NULL; quiet_log(" + Injecting %s into the configuration\n", spec); key = calloc(1, strlen(spec) + 1); node = calloc(1, strlen(spec) + 1); rc = sscanf(spec, "%[^@]@%[^=]=%d", key, node, &outcome); CRM_CHECK(rc == 3, fprintf(stderr, "Invalid operation spec: %s. Only found %d fields\n", spec, rc); continue); parse_op_key(key, &resource, &task, &interval); rsc = pe_find_resource(data_set->resources, resource); if (rsc == NULL) { fprintf(stderr, " - Invalid resource name: %s\n", resource); } else { rclass = crm_element_value(rsc->xml, XML_AGENT_ATTR_CLASS); rtype = crm_element_value(rsc->xml, XML_ATTR_TYPE); rprovider = crm_element_value(rsc->xml, XML_AGENT_ATTR_PROVIDER); cib_node = inject_node_state(global_cib, node); CRM_ASSERT(cib_node != NULL); update_failcounts(cib_node, resource, interval, outcome); cib_resource = inject_resource(cib_node, resource, rclass, rtype, rprovider); CRM_ASSERT(cib_resource != NULL); op = create_op(cib_resource, task, interval, outcome); CRM_ASSERT(op != NULL); cib_op = inject_op(cib_resource, op, 0); CRM_ASSERT(cib_op != NULL); lrmd_free_event(op); rc = global_cib->cmds->modify(global_cib, XML_CIB_TAG_STATUS, cib_node, cib_sync_call | cib_scope_local); CRM_ASSERT(rc == pcmk_ok); } free(task); free(node); free(key); } } static void setup_input(const char *input, const char *output) { int rc = pcmk_ok; cib_t *cib_conn = NULL; xmlNode *cib_object = NULL; char *local_output = NULL; if (input == NULL) { /* Use live CIB */ cib_conn = cib_new(); rc = cib_conn->cmds->signon(cib_conn, crm_system_name, cib_command); if (rc == pcmk_ok) { cib_object = get_cib_copy(cib_conn); } cib_conn->cmds->signoff(cib_conn); cib_delete(cib_conn); cib_conn = NULL; if (cib_object == NULL) { fprintf(stderr, "Live CIB query failed: empty result\n"); exit(3); } } else if (safe_str_eq(input, "-")) { cib_object = filename2xml(NULL); } else { cib_object = filename2xml(input); } if (get_object_root(XML_CIB_TAG_STATUS, cib_object) == NULL) { create_xml_node(cib_object, XML_CIB_TAG_STATUS); } if (cli_config_update(&cib_object, NULL, FALSE) == FALSE) { free_xml(cib_object); exit(-ENOKEY); } if (validate_xml(cib_object, NULL, FALSE) != TRUE) { free_xml(cib_object); exit(-pcmk_err_dtd_validation); } if (output == NULL) { char *pid = crm_itoa(getpid()); local_output = get_shadow_file(pid); output = local_output; free(pid); } rc = write_xml_file(cib_object, output, FALSE); free_xml(cib_object); cib_object = NULL; if (rc < 0) { fprintf(stderr, "Could not create '%s': %s\n", output, strerror(errno)); exit(rc); } setenv("CIB_file", output, 1); free(local_output); } /* *INDENT-OFF* */ static struct crm_option long_options[] = { /* Top-level Options */ {"help", 0, 0, '?', "\tThis text"}, {"version", 0, 0, '$', "\tVersion information" }, {"quiet", 0, 0, 'Q', "\tDisplay only essentialoutput"}, {"verbose", 0, 0, 'V', "\tIncrease debug output"}, {"-spacer-", 0, 0, '-', "\nOperations:"}, {"run", 0, 0, 'R', "\tDetermine the cluster's response to the given configuration and status"}, {"simulate", 0, 0, 'S', "Simulate the transition's execution and display the resulting cluster status"}, {"in-place", 0, 0, 'X', "Simulate the transition's execution and store the result back to the input file"}, {"show-scores", 0, 0, 's', "Show allocation scores"}, {"show-utilization", 0, 0, 'U', "Show utilization information"}, {"profile", 1, 0, 'P', "Run all tests in the named directory to create profiling data"}, {"-spacer-", 0, 0, '-', "\nSynthetic Cluster Events:"}, {"node-up", 1, 0, 'u', "\tBring a node online"}, {"node-down", 1, 0, 'd', "\tTake a node offline"}, {"node-fail", 1, 0, 'f', "\tMark a node as failed"}, {"op-inject", 1, 0, 'i', "\t$rsc_$task_$interval@$node=$rc - Inject the specified task before running the simulation"}, {"op-fail", 1, 0, 'F', "\t$rsc_$task_$interval@$node=$rc - Fail the specified task while running the simulation"}, {"set-datetime", 1, 0, 't', "Set date/time"}, {"quorum", 1, 0, 'q', "\tSpecify a value for quorum"}, {"ticket-grant", 1, 0, 'g', "Grant a ticket"}, {"ticket-revoke", 1, 0, 'r', "Revoke a ticket"}, {"ticket-standby", 1, 0, 'b', "Make a ticket standby"}, {"ticket-activate", 1, 0, 'e', "Activate a ticket"}, {"-spacer-", 0, 0, '-', "\nOutput Options:"}, {"save-input", 1, 0, 'I', "\tSave the input configuration to the named file"}, {"save-output", 1, 0, 'O', "Save the output configuration to the named file"}, {"save-graph", 1, 0, 'G', "\tSave the transition graph (XML format) to the named file"}, {"save-dotfile", 1, 0, 'D', "Save the transition graph (DOT format) to the named file"}, {"all-actions", 0, 0, 'a', "\tDisplay all possible actions in the DOT graph - even ones not part of the transition"}, {"-spacer-", 0, 0, '-', "\nData Source:"}, {"live-check", 0, 0, 'L', "\tConnect to the CIB and use the current contents as input"}, {"xml-file", 1, 0, 'x', "\tRetrieve XML from the named file"}, {"xml-pipe", 0, 0, 'p', "\tRetrieve XML from stdin"}, {0, 0, 0, 0} }; /* *INDENT-ON* */ static void profile_one(const char *xml_file) { xmlNode *cib_object = NULL; pe_working_set_t data_set; printf("* Testing %s\n", xml_file); cib_object = filename2xml(xml_file); if (get_object_root(XML_CIB_TAG_STATUS, cib_object) == NULL) { create_xml_node(cib_object, XML_CIB_TAG_STATUS); } if (cli_config_update(&cib_object, NULL, FALSE) == FALSE) { free_xml(cib_object); return; } if (validate_xml(cib_object, NULL, FALSE) != TRUE) { free_xml(cib_object); return; } set_working_set_defaults(&data_set); data_set.input = cib_object; data_set.now = get_date(); do_calculations(&data_set, cib_object, NULL); cleanup_alloc_calculations(&data_set); } #ifndef FILENAME_MAX # define FILENAME_MAX 512 #endif static int profile_all(const char *dir) { struct dirent **namelist; int lpc = 0; int file_num = scandir(dir, &namelist, 0, alphasort); if (file_num > 0) { struct stat prop; char buffer[FILENAME_MAX + 1]; while (file_num--) { if ('.' == namelist[file_num]->d_name[0]) { free(namelist[file_num]); continue; } else if (strstr(namelist[file_num]->d_name, ".xml") == NULL) { free(namelist[file_num]); continue; } lpc++; snprintf(buffer, FILENAME_MAX, "%s/%s", dir, namelist[file_num]->d_name); if (stat(buffer, &prop) == 0 && S_ISREG(prop.st_mode)) { profile_one(buffer); } free(namelist[file_num]); } free(namelist); } return lpc; } int main(int argc, char **argv) { int rc = 0; guint modified = 0; gboolean store = FALSE; gboolean process = FALSE; gboolean verbose = FALSE; gboolean simulate = FALSE; gboolean all_actions = FALSE; gboolean have_stdout = FALSE; pe_working_set_t data_set; const char *xml_file = "-"; const char *quorum = NULL; const char *test_dir = NULL; const char *dot_file = NULL; const char *graph_file = NULL; const char *input_file = NULL; const char *output_file = NULL; int flag = 0; int index = 0; int argerr = 0; GListPtr node_up = NULL; GListPtr node_down = NULL; GListPtr node_fail = NULL; GListPtr op_inject = NULL; GListPtr ticket_grant = NULL; GListPtr ticket_revoke = NULL; GListPtr ticket_standby = NULL; GListPtr ticket_activate = NULL; xmlNode *input = NULL; crm_log_cli_init("crm_simulate"); crm_set_options(NULL, "datasource operation [additional options]", long_options, "Tool for simulating the cluster's response to events"); if (argc < 2) { crm_help('?', EX_USAGE); } while (1) { flag = crm_get_option(argc, argv, &index); if (flag == -1) break; switch (flag) { case 'V': verbose = TRUE; if(have_stdout == FALSE) { /* Redirect stderr to stdout so we can grep the output */ have_stdout = TRUE; close(STDERR_FILENO); dup2(STDOUT_FILENO, STDERR_FILENO); } crm_bump_log_level(); break; case '?': case '$': crm_help(flag, EX_OK); break; case 'p': xml_file = "-"; break; case 'Q': quiet = TRUE; break; case 'L': xml_file = NULL; break; case 'x': xml_file = optarg; break; case 'u': modified++; node_up = g_list_append(node_up, optarg); break; case 'd': modified++; node_down = g_list_append(node_down, optarg); break; case 'f': modified++; node_fail = g_list_append(node_fail, optarg); break; case 't': use_date = strdup(optarg); break; case 'i': modified++; op_inject = g_list_append(op_inject, optarg); break; case 'F': process = TRUE; simulate = TRUE; op_fail = g_list_append(op_fail, optarg); break; case 'q': modified++; quorum = optarg; break; case 'g': modified++; ticket_grant = g_list_append(ticket_grant, optarg); break; case 'r': modified++; ticket_revoke = g_list_append(ticket_revoke, optarg); break; case 'b': modified++; ticket_standby = g_list_append(ticket_standby, optarg); break; case 'e': modified++; ticket_activate = g_list_append(ticket_activate, optarg); break; case 'a': all_actions = TRUE; break; case 's': process = TRUE; show_scores = TRUE; break; case 'U': process = TRUE; show_utilization = TRUE; break; case 'S': process = TRUE; simulate = TRUE; break; case 'X': store = TRUE; process = TRUE; simulate = TRUE; break; case 'R': process = TRUE; break; case 'D': process = TRUE; dot_file = optarg; break; case 'G': process = TRUE; graph_file = optarg; break; case 'I': input_file = optarg; break; case 'O': output_file = optarg; break; case 'P': test_dir = optarg; break; default: ++argerr; break; } } if (optind > argc) { ++argerr; } if (argerr) { crm_help('?', EX_USAGE); } if(test_dir != NULL) { return profile_all(test_dir); } setup_input(xml_file, store ? xml_file : output_file); global_cib = cib_new(); global_cib->cmds->signon(global_cib, crm_system_name, cib_command); set_working_set_defaults(&data_set); if (data_set.now != NULL) { quiet_log(" + Setting effective cluster time: %s", use_date); log_date(LOG_WARNING, "Set fake 'now' to", data_set.now, ha_log_date | ha_log_time); } rc = global_cib->cmds->query(global_cib, NULL, &input, cib_sync_call | cib_scope_local); CRM_ASSERT(rc == pcmk_ok); data_set.input = input; data_set.now = get_date(); cluster_status(&data_set); if (quiet == FALSE) { quiet_log("\nCurrent cluster status:\n"); print_cluster_status(&data_set); } if (modified) { quiet_log("Performing requested modifications\n"); modify_configuration(&data_set, quorum, node_up, node_down, node_fail, op_inject, ticket_grant, ticket_revoke, ticket_standby, ticket_activate); rc = global_cib->cmds->query(global_cib, NULL, &input, cib_sync_call); if (rc != pcmk_ok) { fprintf(stderr, "Could not connect to the CIB for input: %s\n", pcmk_strerror(rc)); goto done; } cleanup_alloc_calculations(&data_set); data_set.now = get_date(); data_set.input = input; } if (input_file != NULL) { rc = write_xml_file(input, input_file, FALSE); if (rc < 0) { fprintf(stderr, "Could not create '%s': %s\n", input_file, strerror(errno)); goto done; } } rc = 0; if (process || simulate) { ha_time_t *local_date = NULL; if (show_scores && show_utilization) { printf("Allocation scores and utilization information:\n"); } else if (show_scores) { fprintf(stdout, "Allocation scores:\n"); } else if (show_utilization) { printf("Utilization information:\n"); } do_calculations(&data_set, input, local_date); input = NULL; /* Don't try and free it twice */ if (graph_file != NULL) { char *msg_buffer = dump_xml_formatted(data_set.graph); FILE *graph_strm = fopen(graph_file, "w"); if (graph_strm == NULL) { crm_perror(LOG_ERR, "Could not open %s for writing", graph_file); } else { if (fprintf(graph_strm, "%s\n\n", msg_buffer) < 0) { crm_perror(LOG_ERR, "Write to %s failed", graph_file); } fflush(graph_strm); fclose(graph_strm); } free(msg_buffer); } if (dot_file != NULL) { create_dotfile(&data_set, dot_file, all_actions); } if (quiet == FALSE) { GListPtr gIter = NULL; quiet_log("%sTransition Summary:\n", show_scores || show_utilization || modified ? "\n" : ""); fflush(stdout); for (gIter = data_set.resources; gIter != NULL; gIter = gIter->next) { resource_t *rsc = (resource_t *) gIter->data; LogActions(rsc, &data_set, TRUE); } } } if (simulate) { rc = run_simulation(&data_set); } done: cleanup_alloc_calculations(&data_set); global_cib->cmds->signoff(global_cib); cib_delete(global_cib); free(use_date); crm_xml_cleanup(); fflush(stderr); qb_log_fini(); return rc; }