Send Linux-ha-cvs mailing list submissions to linux-ha-cvs@lists.linux-ha.org
To subscribe or unsubscribe via the World Wide Web, visit http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs or, via email, send a message with subject or body 'help' to [EMAIL PROTECTED] You can reach the person managing the list at [EMAIL PROTECTED] When replying, please edit your Subject line so it is more specific than "Re: Contents of Linux-ha-cvs digest..." Today's Topics: 1. Linux-HA CVS: crm by andrew from (linux-ha-cvs@lists.linux-ha.org) ---------------------------------------------------------------------- Message: 1 Date: Tue, 18 Jul 2006 00:19:34 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org Subject: [Linux-ha-cvs] Linux-HA CVS: crm by andrew from To: [EMAIL PROTECTED] Message-ID: <[EMAIL PROTECTED]> linux-ha CVS committal Author : andrew Host : Project : linux-ha Module : crm Dir : linux-ha/crm/pengine Modified Files: clone.c graph.c native.c Log Message: OSDL #1376 - Prevent graph loops due to STONITH Stopping of stonith resources can never require stonith, even if the node its running on failed. --- crm/pengine/clone.c | 19 --- crm/pengine/graph.c | 90 ----------------- crm/pengine/native.c | 180 ++++++++++++++++++++++++++++------ crm/pengine/testcases/829.dot | 1 crm/pengine/testcases/829.exp | 3 crm/pengine/testcases/master-7.dot | 1 crm/pengine/testcases/master-7.exp | 3 crm/pengine/testcases/master-8.dot | 1 crm/pengine/testcases/master-8.exp | 3 crm/pengine/testcases/rec-node-12.dot | 4 crm/pengine/testcases/rec-node-12.exp | 8 + 11 files changed, 164 insertions(+), 149 deletions(-) =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/clone.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- clone.c 5 Jul 2006 14:20:02 -0000 1.5 +++ clone.c 18 Jul 2006 06:19:33 -0000 1.6 @@ -1,4 +1,4 @@ -/* $Id: clone.c,v 1.5 2006/07/05 14:20:02 andrew Exp $ */ +/* $Id: clone.c,v 1.6 2006/07/18 06:19:33 andrew Exp $ */ /* * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]> * @@ -1295,28 +1295,13 @@ clone_stonith_ordering( resource_t *rsc, action_t *stonith_op, pe_working_set_t *data_set) { - gboolean is_fencing = FALSE; clone_variant_data_t *clone_data = NULL; get_clone_variant_data(clone_data, rsc); slist_iter( child_rsc, resource_t, clone_data->child_list, lpc, - const char *class = crm_element_value( - child_rsc->xml, XML_AGENT_ATTR_CLASS); - - if(safe_str_eq(class, "stonith")) { - is_fencing = TRUE; - break; - } + child_rsc->cmds->stonith_ordering( + child_rsc, stonith_op, data_set); ); - - if(is_fencing && stonith_op != NULL) { - char *key = started_key(rsc); - crm_debug("Ordering %s before stonith op", key); - custom_action_order( - rsc, key, NULL, - NULL, crm_strdup(CRM_OP_FENCE), stonith_op, - pe_ordering_optional, data_set); - } } =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/graph.c,v retrieving revision 1.103 retrieving revision 1.104 diff -u -3 -r1.103 -r1.104 --- graph.c 23 Jun 2006 12:34:51 -0000 1.103 +++ graph.c 18 Jul 2006 06:19:33 -0000 1.104 @@ -1,4 +1,4 @@ -/* $Id: graph.c,v 1.103 2006/06/23 12:34:51 andrew Exp $ */ +/* $Id: graph.c,v 1.104 2006/07/18 06:19:33 andrew Exp $ */ /* * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]> * @@ -200,9 +200,6 @@ stonith_constraints( node_t *node, action_t *stonith_op, pe_working_set_t *data_set) { - char *key = NULL; - GListPtr action_list = NULL; - CRM_CHECK(stonith_op != NULL, return FALSE); /* @@ -218,93 +215,6 @@ /* add the stonith OP as a stop pre-req and the mark the stop * as a pseudo op - since its now redundant */ - slist_iter( - rsc, resource_t, node->details->running_rsc, lpc, - - if(rsc->is_managed == FALSE) { - crm_debug_2("Skipping fencing constraints for unmanaged resource: %s", rsc->id); - continue; - } - - key = stop_key(rsc); - action_list = find_actions(rsc->actions, key, node); - crm_free(key); - - slist_iter( - action, action_t, action_list, lpc2, - if(node->details->online == FALSE || rsc->failed) { - resource_t *parent = NULL; - crm_info("Stop of failed resource %s is" - " implict after %s is fenced", - rsc->id, node->details->uname); - /* the stop would never complete and is - * now implied by the stonith operation - */ - action->pseudo = TRUE; - action->runnable = TRUE; - if(action->optional) { - /* does this case ever happen? */ - custom_action_order( - NULL, crm_strdup(CRM_OP_FENCE),stonith_op, - rsc, start_key(rsc), NULL, - pe_ordering_manditory, data_set); - } else { - custom_action_order( - NULL, crm_strdup(CRM_OP_FENCE),stonith_op, - rsc, NULL, action, - pe_ordering_manditory, data_set); - } - - /* find the top-most resource */ - parent = rsc->parent; - while(parent != NULL && parent->parent != NULL) { - parent = parent->parent; - } - - if(parent) { - crm_info("Re-creating actions for %s", - parent->id); - parent->cmds->create_actions( - parent, data_set); - } - - } else { - crm_info("Moving healthy resource %s" - " off %s before fencing", - rsc->id, node->details->uname); - - /* stop healthy resources before the - * stonith op - */ - custom_action_order( - rsc, stop_key(rsc), NULL, - NULL,crm_strdup(CRM_OP_FENCE),stonith_op, - pe_ordering_manditory, data_set); - } - ); - - key = demote_key(rsc); - action_list = find_actions(rsc->actions, key, node); - crm_free(key); - - slist_iter( - action, action_t, action_list, lpc2, - if(node->details->online == FALSE || rsc->failed) { - crm_info("Demote of failed resource %s is" - " implict after %s is fenced", - rsc->id, node->details->uname); - /* the stop would never complete and is - * now implied by the stonith operation - */ - action->pseudo = TRUE; - action->runnable = TRUE; - custom_action_order( - NULL, crm_strdup(CRM_OP_FENCE),stonith_op, - rsc, demote_key(rsc), NULL, - pe_ordering_manditory, data_set); - } - ); - ); return TRUE; } =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/native.c,v retrieving revision 1.157 retrieving revision 1.158 diff -u -3 -r1.157 -r1.158 --- native.c 12 Jul 2006 15:41:45 -0000 1.157 +++ native.c 18 Jul 2006 06:19:33 -0000 1.158 @@ -1,4 +1,4 @@ -/* $Id: native.c,v 1.157 2006/07/12 15:41:45 andrew Exp $ */ +/* $Id: native.c,v 1.158 2006/07/18 06:19:33 andrew Exp $ */ /* * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]> * @@ -1748,46 +1748,170 @@ return TRUE; } - -void -native_stonith_ordering( - resource_t *rsc, action_t *stonith_op, pe_working_set_t *data_set) +static void +native_start_constraints( + resource_t *rsc, action_t *stonith_op, gboolean is_stonith, + pe_working_set_t *data_set) { gboolean is_unprotected = FALSE; gboolean run_unprotected = TRUE; - const char *class = crm_element_value(rsc->xml, XML_AGENT_ATTR_CLASS); - if(stonith_op != NULL && safe_str_eq(class, "stonith")) { + if(is_stonith) { char *key = start_key(rsc); - crm_debug("Ordering %s before stonith op", key); + crm_debug_2("Ordering %s action before stonith events", key); custom_action_order( rsc, key, NULL, NULL, crm_strdup(CRM_OP_FENCE), stonith_op, pe_ordering_optional, data_set); - return; - } - - slist_iter(action, action_t, rsc->actions, lpc2, - if(action->needs != rsc_req_stonith) { - continue; - } - if(stonith_op != NULL) { - custom_action_order( - NULL, crm_strdup(CRM_OP_FENCE), stonith_op, - rsc, NULL, action, - pe_ordering_manditory, data_set); - - } else if(run_unprotected == FALSE) { - /* mark the start unrunnable */ - action->runnable = FALSE; - - } else { - is_unprotected = TRUE; - } - ); + } else { + slist_iter(action, action_t, rsc->actions, lpc2, + if(action->needs != rsc_req_stonith) { + crm_debug_3("%s doesnt need to wait for stonith events", action->uuid); + continue; + } + crm_debug_2("Ordering %s after stonith events", action->uuid); + if(stonith_op != NULL) { + custom_action_order( + NULL, crm_strdup(CRM_OP_FENCE), stonith_op, + rsc, NULL, action, + pe_ordering_manditory, data_set); + + } else if(run_unprotected == FALSE) { + /* mark the start unrunnable */ + action->runnable = FALSE; + + } else { + is_unprotected = TRUE; + } + ); + } + if(is_unprotected) { pe_err("SHARED RESOURCE %s IS NOT PROTECTED:" " Stonith disabled", rsc->id); } + +} + +static void +native_stop_constraints( + resource_t *rsc, action_t *stonith_op, gboolean is_stonith, + pe_working_set_t *data_set) +{ + char *key = NULL; + GListPtr action_list = NULL; + node_t *node = stonith_op->node; + + key = stop_key(rsc); + action_list = find_actions(rsc->actions, key, node); + crm_free(key); + + /* add the stonith OP as a stop pre-req and the mark the stop + * as a pseudo op - since its now redundant + */ + + slist_iter( + action, action_t, action_list, lpc2, + if(node->details->online == FALSE || rsc->failed) { + resource_t *parent = NULL; + crm_warn("Stop of failed resource %s is" + " implict after %s is fenced", + rsc->id, node->details->uname); + /* the stop would never complete and is + * now implied by the stonith operation + */ + action->pseudo = TRUE; + action->runnable = TRUE; + if(is_stonith) { + /* do nothing */ + + } else if(action->optional) { + /* does this case ever happen? */ + custom_action_order( + NULL, crm_strdup(CRM_OP_FENCE),stonith_op, + rsc, start_key(rsc), NULL, + pe_ordering_manditory, data_set); + } else { + custom_action_order( + NULL, crm_strdup(CRM_OP_FENCE),stonith_op, + rsc, NULL, action, + pe_ordering_manditory, data_set); + } + + /* find the top-most resource */ + parent = rsc->parent; + while(parent != NULL && parent->parent != NULL) { + parent = parent->parent; + } + + if(parent) { + crm_info("Re-creating actions for %s", + parent->id); + parent->cmds->create_actions(parent, data_set); + } + + } else if(is_stonith == FALSE) { + crm_info("Moving healthy resource %s" + " off %s before fencing", + rsc->id, node->details->uname); + + /* stop healthy resources before the + * stonith op + */ + custom_action_order( + rsc, stop_key(rsc), NULL, + NULL,crm_strdup(CRM_OP_FENCE),stonith_op, + pe_ordering_manditory, data_set); + } + ); + + key = demote_key(rsc); + action_list = find_actions(rsc->actions, key, node); + crm_free(key); + + slist_iter( + action, action_t, action_list, lpc2, + if(node->details->online == FALSE || rsc->failed) { + crm_info("Demote of failed resource %s is" + " implict after %s is fenced", + rsc->id, node->details->uname); + /* the stop would never complete and is + * now implied by the stonith operation + */ + action->pseudo = TRUE; + action->runnable = TRUE; + if(is_stonith == FALSE) { + custom_action_order( + NULL, crm_strdup(CRM_OP_FENCE), stonith_op, + rsc, demote_key(rsc), NULL, + pe_ordering_manditory, data_set); + } + } + ); +} + +void +native_stonith_ordering( + resource_t *rsc, action_t *stonith_op, pe_working_set_t *data_set) +{ + gboolean is_stonith = FALSE; + const char *class = crm_element_value(rsc->xml, XML_AGENT_ATTR_CLASS); + + if(rsc->is_managed == FALSE) { + crm_debug_3("Skipping fencing constraints for unmanaged resource: %s", rsc->id); + return; + } + + if(stonith_op != NULL && safe_str_eq(class, "stonith")) { + is_stonith = TRUE; + } + + /* Start constraints */ + native_start_constraints(rsc, stonith_op, is_stonith, data_set); + + /* Stop constraints */ + + native_stop_constraints(rsc, stonith_op, is_stonith, data_set); + } ------------------------------ _______________________________________________ Linux-ha-cvs mailing list Linux-ha-cvs@lists.linux-ha.org http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs End of Linux-ha-cvs Digest, Vol 32, Issue 58 ********************************************