Send Linux-ha-cvs mailing list submissions to
[email protected]
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
([email protected])
2. Linux-HA CVS: crm by andrew from
([email protected])
----------------------------------------------------------------------
Message: 1
Date: Fri, 31 Mar 2006 04:58:18 -0700 (MST)
From: [email protected]
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/tengine
Modified Files:
events.c
Log Message:
Move the failcount updating code to the TE which already has to figure out
parse the event and check the desired rc-code.
Have the CRMd send back a digest of the parameters used for an operation
- this makes the status section smaller and verifyable with a DTD
Put the code for filtering out operation parameters into a common library
where the CRMd can call it *before* creating the op_digest
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/tengine/events.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- events.c 29 Mar 2006 06:12:28 -0000 1.8
+++ events.c 31 Mar 2006 11:58:17 -0000 1.9
@@ -1,4 +1,4 @@
-/* $Id: events.c,v 1.8 2006/03/29 06:12:28 andrew Exp $ */
+/* $Id: events.c,v 1.9 2006/03/31 11:58:17 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -161,6 +161,55 @@
return TRUE;
}
+static void
+update_failcount(crm_action_t *action, int rc)
+{
+ char *attr_set = NULL;
+ char *attr_name = NULL;
+ char *attr_id = NULL;
+
+ const char *task = NULL;
+ const char *rsc_id = NULL;
+ const char *on_node = NULL;
+ const char *on_uuid = NULL;
+ const char *interval = NULL;
+
+ if(rc == 99) {
+ /* this is an internal code for "we're busy, try again" */
+ return;
+ }
+
+ interval = g_hash_table_lookup(action->params, "interval");
+ if(interval == NULL) {
+ return;
+ }
+
+ CRM_CHECK(action->xml != NULL, return);
+
+ task = crm_element_value(action->xml, XML_LRM_ATTR_TASK);
+ rsc_id = crm_element_value(action->xml, XML_LRM_ATTR_RSCID);
+ on_node = crm_element_value(action->xml, XML_LRM_ATTR_TARGET);
+ on_uuid = crm_element_value(action->xml, XML_LRM_ATTR_TARGET_UUID);
+
+ CRM_CHECK(task != NULL, return);
+ CRM_CHECK(rsc_id != NULL, return);
+ CRM_CHECK(on_uuid != NULL, return);
+ CRM_CHECK(on_node != NULL, return);
+
+ attr_set = crm_concat("crmd-transient", on_uuid, '-');
+ attr_name = crm_concat("fail-count", rsc_id, '-');
+ attr_id = crm_concat(attr_name, on_uuid, '-');
+ crm_warn("Updating failcount for %s on %s after failed %s: rc=%d",
+ rsc_id, on_node, task, rc);
+
+ update_attr(te_cib_conn, cib_none, XML_CIB_TAG_STATUS,
+ on_uuid, attr_set, attr_id, attr_name,
+ XML_NVPAIR_ATTR_VALUE"++");
+
+ crm_free(attr_id);
+ crm_free(attr_set);
+ crm_free(attr_name);
+}
/*
* returns the ID of the action if a match is found
@@ -247,6 +296,7 @@
target_rc_s = g_hash_table_lookup(action->params,XML_ATTR_TE_TARGET_RC);
if(target_rc_s != NULL) {
+ crm_debug("Target rc: %s vs. %d", target_rc_s, op_rc_i);
target_rc = crm_parse_int(target_rc_s, NULL);
if(target_rc == op_rc_i) {
crm_debug_2("Target rc: == %d", op_rc_i);
@@ -313,6 +363,7 @@
}
if(action->failed) {
+ update_failcount(action, op_rc_i);
abort_transition(action->synapse->priority,
tg_restart, "Event failed", event);
------------------------------
Message: 2
Date: Fri, 31 Mar 2006 04:58:18 -0700 (MST)
From: [email protected]
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:
unpack.c
Log Message:
Move the failcount updating code to the TE which already has to figure out
parse the event and check the desired rc-code.
Have the CRMd send back a digest of the parameters used for an operation
- this makes the status section smaller and verifyable with a DTD
Put the code for filtering out operation parameters into a common library
where the CRMd can call it *before* creating the op_digest
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/unpack.c,v
retrieving revision 1.171
retrieving revision 1.172
diff -u -3 -r1.171 -r1.172
--- unpack.c 28 Mar 2006 13:05:23 -0000 1.171
+++ unpack.c 31 Mar 2006 11:58:17 -0000 1.172
@@ -1,4 +1,4 @@
-/* $Id: unpack.c,v 1.171 2006/03/28 13:05:23 andrew Exp $ */
+/* $Id: unpack.c,v 1.172 2006/03/31 11:58:17 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -1127,89 +1127,67 @@
}
static gboolean
-check_action_definition(resource_t *rsc, node_t *node, crm_data_t *xml_op,
+check_action_definition(resource_t *rsc, node_t *active_node, crm_data_t
*xml_op,
pe_working_set_t *data_set)
{
- int lpc = 0;
gboolean did_change = FALSE;
crm_data_t *pnow = NULL;
- crm_data_t *pdiff = NULL;
GHashTable *local_rsc_params = NULL;
+ char *pnow_digest = NULL;
+ const char *param_digest = NULL;
+ char *local_param_digest = NULL;
+
const char *id = ID(xml_op);
const char *task = crm_element_value(xml_op, XML_LRM_ATTR_TASK);
- action_t *action = custom_action(rsc, crm_strdup(id), task, node,
+ action_t *action = custom_action(rsc, crm_strdup(id), task, active_node,
TRUE, FALSE, data_set);
- crm_data_t *params = find_xml_node(xml_op, XML_TAG_PARAMS, TRUE);
- crm_data_t *local_params = copy_xml(params);
-
- const char *attr_filter[] = {
- XML_ATTR_TE_TARGET_RC,
- XML_ATTR_LRM_PROBE,
- XML_RSC_ATTR_START,
- XML_RSC_ATTR_NOTIFY,
- XML_RSC_ATTR_UNIQUE,
- XML_RSC_ATTR_MANAGED,
- XML_ATTR_CRM_VERSION,
- XML_RSC_ATTR_PRIORITY,
- XML_RSC_ATTR_MULTIPLE,
- XML_RSC_ATTR_STICKINESS,
- XML_RSC_ATTR_FAIL_STICKINESS,
-
-/* ignore clone fields */
- XML_RSC_ATTR_INCARNATION,
- XML_RSC_ATTR_INCARNATION_MAX,
- XML_RSC_ATTR_INCARNATION_NODEMAX,
- XML_RSC_ATTR_MASTER_MAX,
- XML_RSC_ATTR_MASTER_NODEMAX,
-
-/* ignore master fields */
- "crm_role",
-
-/* ignore notify fields */
- "notify_stop_resource",
- "notify_stop_uname",
- "notify_start_resource",
- "notify_start_uname",
- "notify_active_resource",
- "notify_active_uname",
- "notify_inactive_resource",
- "notify_inactive_uname",
- "notify_promote_resource",
- "notify_promote_uname",
- "notify_demote_resource",
- "notify_demote_uname",
- "notify_master_resource",
- "notify_master_uname",
- "notify_slave_resource",
- "notify_slave_uname",
- };
-
local_rsc_params = g_hash_table_new_full(
g_str_hash, g_str_equal,
g_hash_destroy_str, g_hash_destroy_str);
unpack_instance_attributes(
- rsc->xml, XML_TAG_ATTR_SETS, node, local_rsc_params,
+ rsc->xml, XML_TAG_ATTR_SETS, active_node, local_rsc_params,
NULL, 0, data_set);
pnow = create_xml_node(NULL, XML_TAG_PARAMS);
g_hash_table_foreach(action->extra, hash2field, pnow);
g_hash_table_foreach(rsc->parameters, hash2field, pnow);
g_hash_table_foreach(local_rsc_params, hash2field, pnow);
-
- for(lpc = 0; lpc < DIMOF(attr_filter); lpc++) {
- xml_remove_prop(pnow, attr_filter[lpc]);
- xml_remove_prop(local_params, attr_filter[lpc]);
+
+ filter_action_parameters(pnow);
+ pnow_digest = calculate_xml_digest(pnow);
+ param_digest = crm_element_value(xml_op, XML_LRM_ATTR_OP_DIGEST);
+
+ if(param_digest == NULL) {
+ crm_data_t *params = find_xml_node(xml_op, XML_TAG_PARAMS,
TRUE);
+ crm_data_t *local_params = copy_xml(params);
+
+ crm_info("Faking parameter digest creation for %s", ID(xml_op));
+
+ filter_action_parameters(local_params);
+ local_param_digest = calculate_xml_digest(local_params);
+ param_digest = local_param_digest;
+
+ free_xml(local_params);
}
-
- pdiff = diff_xml_object(local_params, pnow, TRUE);
- if(pdiff != NULL) {
+
+ if(safe_str_neq(pnow_digest, param_digest)) {
+ crm_data_t *params = find_xml_node(xml_op,XML_TAG_PARAMS,FALSE);
+ crm_data_t *local_params = copy_xml(params);
+ filter_action_parameters(local_params);
+
+ crm_log_xml_err(pnow, "params:calc");
+ crm_log_xml_err(local_params, "params:used");
+ free_xml(local_params);
+
did_change = TRUE;
- crm_info("Parameters to %s action changed", id);
- log_xml_diff(LOG_INFO, pdiff, __FUNCTION__);
+ crm_info("Parameters to %s action changed: %s vs. %s",
+ id, pnow_digest, param_digest);
+
+
custom_action(rsc, crm_strdup(id), task, NULL,
FALSE, TRUE, data_set);
}
@@ -1218,8 +1196,8 @@
crm_free(action->uuid);
crm_free(action);
free_xml(pnow);
- free_xml(pdiff);
- free_xml(local_params);
+ crm_free(pnow_digest);
+ crm_free(local_param_digest);
g_hash_table_destroy(local_rsc_params);
@@ -1234,8 +1212,8 @@
const char *id = NULL;
const char *task = NULL;
const char *task_id = NULL;
- const char *actual_rc = NULL;
- const char *target_rc = NULL;
+ const char *actual_rc = NULL;
+/* const char *target_rc = NULL; */
const char *task_status = NULL;
const char *interval_s = NULL;
@@ -1245,6 +1223,7 @@
int actual_rc_i = 0;
action_t *action = NULL;
+ gboolean is_probe = FALSE;
gboolean is_stop_action = FALSE;
crm_data_t *params = find_xml_node(xml_op, XML_TAG_PARAMS, FALSE);
@@ -1282,6 +1261,10 @@
interval = crm_parse_int(interval_s, NULL);
}
}
+
+ if(interval == 0 && safe_str_eq(task, CRMD_ACTION_STATUS)) {
+ is_probe = TRUE;
+ }
if(rsc->orphan) {
crm_debug_2("Skipping param check for orphan: %s %s", rsc->id,
task);
@@ -1293,8 +1276,7 @@
/* for older test cases */
crm_err("Skipping param check: %s %s", id, task);
- } else if((interval == 0 && safe_str_eq(task, CRMD_ACTION_STATUS))
- || safe_str_eq(task, CRMD_ACTION_START)) {
+ } else if(is_probe || safe_str_eq(task, CRMD_ACTION_START)) {
crm_debug_2("Checking resource definition: %s", rsc->id);
check_action_definition(rsc, node, xml_op, data_set);
@@ -1380,14 +1362,18 @@
node->details->uname, rsc->id, XML_RSC_ATTR_STOPFAIL);
}
+ actual_rc = crm_element_value(xml_op, XML_LRM_ATTR_RC);
+ CRM_CHECK(actual_rc != NULL, return FALSE);
+ actual_rc_i = crm_parse_int(actual_rc, NULL);
+
+#if 0
+ /* this wont work anymore now that we dont get the set of params,
+ * we only get the hash of them
+ */
if(params != NULL) {
target_rc = crm_element_value(params, XML_ATTR_TE_TARGET_RC);
}
- actual_rc = crm_element_value(xml_op, XML_LRM_ATTR_RC);
- CRM_CHECK(actual_rc != NULL, return FALSE);
-
- actual_rc_i = crm_parse_int(actual_rc, NULL);
if(target_rc != NULL && task_status_i != LRM_OP_PENDING) {
crm_debug_2("Exit code from %s: %s vs. %s",
task, target_rc, actual_rc);
@@ -1397,33 +1383,49 @@
task_status_i = LRM_OP_ERROR;
}
}
+#endif
if(EXECRA_NOT_RUNNING == actual_rc_i) {
- rsc->role = RSC_ROLE_STOPPED;
- if(safe_str_eq(task, CRMD_ACTION_STATUS)) {
- /* probe or stop action*/
- crm_debug_2("%s: resource %s is stopped", id, rsc->id);
- return TRUE;
+ if(is_probe) {
+ /* treat these like stops */
+ is_stop_action = TRUE;
}
-
+ if(is_stop_action) {
+ task_status_i = LRM_OP_DONE;
+ } else {
+ CRM_CHECK(task_status_i == LRM_OP_ERROR,
+ task_status_i = LRM_OP_ERROR);
+ }
+
} else if(EXECRA_RUNNING_MASTER == actual_rc_i) {
- rsc->role = RSC_ROLE_MASTER;
- if(safe_str_eq(task, CRMD_ACTION_STATUS)) {
- crm_info("%s: resource %s is a master", id, rsc->id);
+ if(is_probe
+ || (rsc->role == RSC_ROLE_MASTER
+ && safe_str_eq(task, CRMD_ACTION_STATUS))) {
+ task_status_i = LRM_OP_DONE;
+ } else {
+ if(rsc->role != RSC_ROLE_MASTER) {
+ crm_err("%s reported %s in master mode on %s",
+ task, rsc->graph_name,
+ node->details->uname);
+ }
+
+ CRM_CHECK(task_status_i == LRM_OP_ERROR,
+ task_status_i = LRM_OP_ERROR);
}
+ rsc->role = RSC_ROLE_MASTER;
} else if(EXECRA_FAILED_MASTER == actual_rc_i) {
rsc->role = RSC_ROLE_MASTER;
task_status_i = LRM_OP_ERROR;
} else if(EXECRA_OK == actual_rc_i
- && interval == 0
- && safe_str_eq(task, CRMD_ACTION_STATUS)) {
- rsc->role = RSC_ROLE_STARTED;
- crm_info("%s: resource %s is active on %s",
- id, rsc->id, node->details->uname);
- crm_log_xml_debug_2(xml_op, "op");
- return TRUE;
+ && is_probe == FALSE
+ && is_stop_action == FALSE
+ && rsc->role == RSC_ROLE_MASTER) {
+ /* catch status ops that return 0 instead of 8 while they
+ * are supposed to be in master mode
+ */
+ task_status_i = LRM_OP_ERROR;
}
if(task_status_i == LRM_OP_ERROR
@@ -1489,6 +1491,7 @@
if(is_stop_action) {
rsc->role = RSC_ROLE_STOPPED;
+ /* clear any previous failure actions */
*on_fail = action_fail_ignore;
rsc->next_role = RSC_ROLE_UNKNOWN;
@@ -1518,6 +1521,9 @@
|| safe_str_neq(task, CRMD_ACTION_START)) {
crm_debug_2("%s: %s active on %s",
rsc->id, id,
node->details->uname);
+ /* we have to specify the node so that
we know the
+ * monitor is active later on
+ */
custom_action(rsc, crm_strdup(id), task,
node, TRUE, TRUE,
data_set);
}
------------------------------
_______________________________________________
Linux-ha-cvs mailing list
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
End of Linux-ha-cvs Digest, Vol 28, Issue 88
********************************************