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) 2. Linux-HA CVS: lib by andrew from (linux-ha-cvs@lists.linux-ha.org) 3. Linux-HA CVS: crm by andrew from (linux-ha-cvs@lists.linux-ha.org) ---------------------------------------------------------------------- Message: 1 Date: Wed, 21 Jun 2006 03:50:05 -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: allocate.c Log Message: Remove dead code Fix a potential memory leak when using "key" =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/allocate.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- allocate.c 19 Jun 2006 10:47:31 -0000 1.7 +++ allocate.c 21 Jun 2006 09:50:04 -0000 1.8 @@ -1,4 +1,4 @@ -/* $Id: allocate.c,v 1.7 2006/06/19 10:47:31 andrew Exp $ */ +/* $Id: allocate.c,v 1.8 2006/06/21 09:50:04 andrew Exp $ */ /* * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]> * @@ -433,15 +433,16 @@ if(op_match == NULL && data_set->stop_action_orphans) { /* create a cancel action */ action_t *cancel = NULL; + char *cancel_key = NULL; + crm_info("Orphan action will be stopped: %s on %s", key, active_node->details->uname); - crm_free(key); - key = generate_op_key(rsc->id, CRMD_ACTION_CANCEL, interval); + cancel_key = generate_op_key(rsc->id, CRMD_ACTION_CANCEL, interval); cancel = custom_action( - rsc, key, CRMD_ACTION_CANCEL, active_node, - FALSE, TRUE, data_set); + rsc, cancel_key, CRMD_ACTION_CANCEL, + active_node, FALSE, TRUE, data_set); add_hash_param(cancel->meta, XML_LRM_ATTR_TASK, task); add_hash_param(cancel->meta, @@ -455,6 +456,7 @@ if(op_match == NULL) { crm_debug("Orphan action detected: %s on %s", key, active_node->details->uname); + crm_free(key); key = NULL; return TRUE; } } @@ -499,16 +501,6 @@ #endif if(safe_str_neq(pnow_digest, param_digest)) { -#if CRM_DEPRECATED_SINCE_2_0_4 - if(params) { - crm_data_t *local_params = copy_xml(params); - filter_action_parameters(local_params, op_version); - xml_remove_prop(local_params, "interval"); - xml_remove_prop(local_params, "timeout"); - - free_xml(local_params); - } -#endif did_change = TRUE; crm_log_xml_info(pnow, "params:calc"); crm_warn("Parameters to %s on %s changed: recorded %s vs. calculated %s", @@ -558,7 +550,7 @@ if(check_rsc_parameters(rsc, node, rsc_entry, data_set)) { DeleteRsc(rsc, node, data_set); } - + xml_child_iter_filter( rsc_entry, rsc_op, XML_LRM_TAG_RSC_OP, op_list = g_list_append(op_list, rsc_op); ------------------------------ Message: 2 Date: Wed, 21 Jun 2006 05:06:14 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org Subject: [Linux-ha-cvs] Linux-HA CVS: lib by andrew from To: [EMAIL PROTECTED] Message-ID: <[EMAIL PROTECTED]> linux-ha CVS committal Author : andrew Host : Project : linux-ha Module : lib Dir : linux-ha/lib/crm/pengine Modified Files: utils.c utils.h Log Message: Remove dead code Move other code to where its used (ie. out of the general PE library) =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/lib/crm/pengine/utils.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- utils.c 13 Jun 2006 10:30:50 -0000 1.5 +++ utils.c 21 Jun 2006 11:06:13 -0000 1.6 @@ -1,4 +1,4 @@ -/* $Id: utils.c,v 1.5 2006/06/13 10:30:50 andrew Exp $ */ +/* $Id: utils.c,v 1.6 2006/06/21 11:06:13 andrew Exp $ */ /* * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]> * @@ -342,72 +342,6 @@ return 0; } -/* return -1 if 'a' is more preferred - * return 1 if 'b' is more preferred - */ -gint sort_node_weight(gconstpointer a, gconstpointer b) -{ - const node_t *node1 = (const node_t*)a; - const node_t *node2 = (const node_t*)b; - - int node1_weight = 0; - int node2_weight = 0; - - if(a == NULL) { return 1; } - if(b == NULL) { return -1; } - - node1_weight = node1->weight; - node2_weight = node2->weight; - - if(node1->details->unclean - || node1->details->standby - || node1->details->shutdown) { - node1_weight = -INFINITY; - } - if(node2->details->unclean - || node2->details->standby - || node2->details->shutdown) { - node2_weight = -INFINITY; - } - - if(node1_weight > node2_weight) { - crm_debug_3("%s (%d) > %s (%d) : weight", - node1->details->uname, node1_weight, - node2->details->uname, node2_weight); - return -1; - } - - if(node1_weight < node2_weight) { - crm_debug_3("%s (%d) < %s (%d) : weight", - node1->details->uname, node1_weight, - node2->details->uname, node2_weight); - return 1; - } - - crm_debug_3("%s (%d) == %s (%d) : weight", - node1->details->uname, node1_weight, - node2->details->uname, node2_weight); - - /* now try to balance resources across the cluster */ - if(node1->details->num_resources - < node2->details->num_resources) { - crm_debug_3("%s (%d) < %s (%d) : resources", - node1->details->uname, node1->details->num_resources, - node2->details->uname, node2->details->num_resources); - return -1; - - } else if(node1->details->num_resources - > node2->details->num_resources) { - crm_debug_3("%s (%d) > %s (%d) : resources", - node1->details->uname, node1->details->num_resources, - node2->details->uname, node2->details->num_resources); - return 1; - } - - crm_debug_4("%s = %s", node1->details->uname, node2->details->uname); - return 0; -} - action_t * custom_action(resource_t *rsc, char *key, const char *task, node_t *on_node, gboolean optional, gboolean save_action, =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/lib/crm/pengine/utils.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- utils.h 8 Jun 2006 13:39:10 -0000 1.3 +++ utils.h 21 Jun 2006 11:06:13 -0000 1.4 @@ -1,4 +1,4 @@ -/* $Id: utils.h,v 1.3 2006/06/08 13:39:10 andrew Exp $ */ +/* $Id: utils.h,v 1.4 2006/06/21 11:06:13 andrew Exp $ */ /* * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]> * @@ -58,10 +58,6 @@ /* Sorting functions */ extern gint sort_rsc_priority(gconstpointer a, gconstpointer b); -extern gint sort_rsc_node_weight(gconstpointer a, gconstpointer b); -extern gint sort_cons_strength(gconstpointer a, gconstpointer b); -extern gint sort_color_weight(gconstpointer a, gconstpointer b); -extern gint sort_node_weight(gconstpointer a, gconstpointer b); extern crm_data_t *find_rsc_op_entry(resource_t *rsc, const char *key); ------------------------------ Message: 3 Date: Wed, 21 Jun 2006 05:06:13 -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: native.c utils.c utils.h Log Message: Remove dead code Move other code to where its used (ie. out of the general PE library) =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/native.c,v retrieving revision 1.152 retrieving revision 1.153 diff -u -3 -r1.152 -r1.153 --- native.c 16 Jun 2006 07:28:34 -0000 1.152 +++ native.c 21 Jun 2006 11:06:13 -0000 1.153 @@ -1,4 +1,4 @@ -/* $Id: native.c,v 1.152 2006/06/16 07:28:34 andrew Exp $ */ +/* $Id: native.c,v 1.153 2006/06/21 11:06:13 andrew Exp $ */ /* * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]> * @@ -979,6 +979,25 @@ { } +static gint sort_color_weight(gconstpointer a, gconstpointer b) +{ + const color_t *color1 = (const color_t*)a; + const color_t *color2 = (const color_t*)b; + + if(a == NULL) { return 1; } + if(b == NULL) { return -1; } + + if(color1->local_weight > color2->local_weight) { + return -1; + } + + if(color1->local_weight < color2->local_weight) { + return 1; + } + + return 0; +} + gboolean native_choose_color(resource_t *rsc, color_t *no_color) { =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/utils.c,v retrieving revision 1.145 retrieving revision 1.146 diff -u -3 -r1.145 -r1.146 --- utils.c 8 Jun 2006 13:39:10 -0000 1.145 +++ utils.c 21 Jun 2006 11:06:13 -0000 1.146 @@ -1,4 +1,4 @@ -/* $Id: utils.c,v 1.145 2006/06/08 13:39:10 andrew Exp $ */ +/* $Id: utils.c,v 1.146 2006/06/21 11:06:13 andrew Exp $ */ /* * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]> * @@ -176,26 +176,6 @@ return 0; } -gint sort_color_weight(gconstpointer a, gconstpointer b) -{ - const color_t *color1 = (const color_t*)a; - const color_t *color2 = (const color_t*)b; - - if(a == NULL) { return 1; } - if(b == NULL) { return -1; } - - if(color1->local_weight > color2->local_weight) { - return -1; - } - - if(color1->local_weight < color2->local_weight) { - return 1; - } - - return 0; -} - - void print_color_details(const char *pre_text, struct color_shared_s *color, @@ -431,3 +411,70 @@ } return result; } + + +/* return -1 if 'a' is more preferred + * return 1 if 'b' is more preferred + */ +gint sort_node_weight(gconstpointer a, gconstpointer b) +{ + const node_t *node1 = (const node_t*)a; + const node_t *node2 = (const node_t*)b; + + int node1_weight = 0; + int node2_weight = 0; + + if(a == NULL) { return 1; } + if(b == NULL) { return -1; } + + node1_weight = node1->weight; + node2_weight = node2->weight; + + if(node1->details->unclean + || node1->details->standby + || node1->details->shutdown) { + node1_weight = -INFINITY; + } + if(node2->details->unclean + || node2->details->standby + || node2->details->shutdown) { + node2_weight = -INFINITY; + } + + if(node1_weight > node2_weight) { + crm_debug_3("%s (%d) > %s (%d) : weight", + node1->details->uname, node1_weight, + node2->details->uname, node2_weight); + return -1; + } + + if(node1_weight < node2_weight) { + crm_debug_3("%s (%d) < %s (%d) : weight", + node1->details->uname, node1_weight, + node2->details->uname, node2_weight); + return 1; + } + + crm_debug_3("%s (%d) == %s (%d) : weight", + node1->details->uname, node1_weight, + node2->details->uname, node2_weight); + + /* now try to balance resources across the cluster */ + if(node1->details->num_resources + < node2->details->num_resources) { + crm_debug_3("%s (%d) < %s (%d) : resources", + node1->details->uname, node1->details->num_resources, + node2->details->uname, node2->details->num_resources); + return -1; + + } else if(node1->details->num_resources + > node2->details->num_resources) { + crm_debug_3("%s (%d) > %s (%d) : resources", + node1->details->uname, node1->details->num_resources, + node2->details->uname, node2->details->num_resources); + return 1; + } + + crm_debug_4("%s = %s", node1->details->uname, node2->details->uname); + return 0; +} =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/utils.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- utils.h 8 Jun 2006 13:39:10 -0000 1.1 +++ utils.h 21 Jun 2006 11:06:13 -0000 1.2 @@ -1,4 +1,4 @@ -/* $Id: utils.h,v 1.1 2006/06/08 13:39:10 andrew Exp $ */ +/* $Id: utils.h,v 1.2 2006/06/21 11:06:13 andrew Exp $ */ /* * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]> * @@ -70,4 +70,7 @@ extern rsc_to_node_t *generate_location_rule( resource_t *rsc, crm_data_t *location_rule, pe_working_set_t *data_set); +extern gint sort_cons_strength(gconstpointer a, gconstpointer b); +extern gint sort_node_weight(gconstpointer a, gconstpointer b); + #endif ------------------------------ _______________________________________________ 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 31, Issue 72 ********************************************