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])
----------------------------------------------------------------------
Message: 1
Date: Fri, 5 May 2006 07:08:50 -0600 (MDT)
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:
complex.c complex.h graph.c group.c incarnation.c master.c
native.c pe_utils.h pengine.c pengine.h unpack.c utils.c
Log Message:
* Default to short resource names
- calculate both and supply both the TE/CRMd
- the CRMd will look for either form in the LRM and if neither are found
will use the short version
* Fix cloned groups
- call the internal_constraints() for each child resource
- make sure the long resource name is calculated before the child has
finished begin created
* Dont create recurring actions for nodes that are offline
- less clutter in the PE output
* Create cancel operations with a key that includes "cancel" and the
recurring interval (rather than re-use the key from the operation being
cancelled). We can do this because the CRMd now calculates the key based
on the form of the resource id it found.
* Update test cases
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/complex.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -3 -r1.83 -r1.84
--- complex.c 1 May 2006 08:42:51 -0000 1.83
+++ complex.c 5 May 2006 13:08:49 -0000 1.84
@@ -1,4 +1,4 @@
-/* $Id: complex.c,v 1.83 2006/05/01 08:42:51 andrew Exp $ */
+/* $Id: complex.c,v 1.84 2006/05/05 13:08:49 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -171,12 +171,13 @@
gboolean
common_unpack(crm_data_t * xml_obj, resource_t **rsc,
- GHashTable *defaults, pe_working_set_t *data_set)
+ resource_t *parent, pe_working_set_t *data_set)
{
int lpc = 0;
const char *id = crm_element_value(xml_obj, XML_ATTR_ID);
const char *value = NULL;
-
+ GHashTable *defaults = parent?parent->parameters:NULL;
+
const char *allowed_attrs[] = {
XML_CIB_ATTR_PRIORITY,
XML_RSC_ATTR_INCARNATION_MAX,
@@ -218,24 +219,37 @@
return FALSE;
}
- (*rsc)->id = id;
- (*rsc)->graph_name = crm_strdup(id);
(*rsc)->xml = xml_obj;
+ (*rsc)->parent = NULL;
(*rsc)->ops_xml = find_xml_node(xml_obj, "operations", FALSE);
(*rsc)->variant = get_resource_type(crm_element_name(xml_obj));
-
if((*rsc)->variant == pe_unknown) {
pe_err("Unknown resource type: %s", crm_element_name(xml_obj));
crm_free(*rsc);
return FALSE;
}
- (*rsc)->fns = &resource_class_functions[(*rsc)->variant];
- crm_debug_3("Unpacking resource...");
-
(*rsc)->parameters = g_hash_table_new_full(
g_str_hash,g_str_equal, g_hash_destroy_str,g_hash_destroy_str);
+
+ value = crm_element_value(xml_obj, XML_RSC_ATTR_INCARNATION);
+ if(value) {
+ (*rsc)->id = crm_concat(id, value, ':');
+ add_hash_param((*rsc)->parameters, XML_RSC_ATTR_INCARNATION,
value);
+
+ } else {
+ (*rsc)->id = crm_strdup(id);
+ }
+ if(parent) {
+ (*rsc)->long_name = crm_concat(parent->long_name, (*rsc)->id,
':');
+ } else {
+ (*rsc)->long_name = crm_strdup((*rsc)->id);
+ }
+
+ (*rsc)->fns = &resource_class_functions[(*rsc)->variant];
+ crm_debug_3("Unpacking resource...");
+
for(lpc = 0; lpc < DIMOF(rsc_attrs); lpc++) {
value = crm_element_value(xml_obj, rsc_attrs[lpc]);
if(value != NULL) {
@@ -257,7 +271,6 @@
(*rsc)->starting = FALSE;
(*rsc)->stopping = FALSE;
- (*rsc)->parent = NULL;
(*rsc)->candidate_colors = NULL;
(*rsc)->rsc_cons = NULL;
(*rsc)->actions = NULL;
@@ -292,7 +305,7 @@
new_con->node_list_rh = node_list_dup(data_set->nodes, FALSE);
}
- crm_debug_2("Options for %s", id);
+ crm_debug_2("Options for %s", (*rsc)->id);
value = g_hash_table_lookup((*rsc)->parameters, "globally_unique");
if(value != NULL) {
cl_str_to_boolean(value, &((*rsc)->globally_unique));
@@ -435,7 +448,8 @@
pe_free_shallow_adv(rsc->candidate_colors, TRUE);
pe_free_shallow_adv(rsc->rsc_location, FALSE);
pe_free_shallow_adv(rsc->allowed_nodes, TRUE);
- crm_free(rsc->graph_name);
+ crm_free(rsc->id);
+ crm_free(rsc->long_name);
crm_free(rsc->variant_opaque);
crm_free(rsc);
crm_debug_5("Resource freed");
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/complex.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -3 -r1.32 -r1.33
--- complex.h 10 Apr 2006 07:23:27 -0000 1.32
+++ complex.h 5 May 2006 13:08:49 -0000 1.33
@@ -1,4 +1,4 @@
-/* $Id: complex.h,v 1.32 2006/04/10 07:23:27 andrew Exp $ */
+/* $Id: complex.h,v 1.33 2006/05/05 13:08:49 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -214,8 +214,9 @@
/* extern resource_object_functions_t resource_variants[]; */
extern resource_object_functions_t resource_class_functions[];
-extern gboolean common_unpack(crm_data_t *xml_obj, resource_t **rsc,
- GHashTable *defaults, pe_working_set_t *data_set);
+extern gboolean common_unpack(crm_data_t * xml_obj, resource_t **rsc,
+ resource_t *parent, pe_working_set_t *data_set);
+
extern void common_print(resource_t *rsc, const char *pre_text, long options,
void *print_data);
extern void common_free(resource_t *rsc);
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/graph.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -3 -r1.86 -r1.87
--- graph.c 27 Apr 2006 13:16:02 -0000 1.86
+++ graph.c 5 May 2006 13:08:49 -0000 1.87
@@ -1,4 +1,4 @@
-/* $Id: graph.c,v 1.86 2006/04/27 13:16:02 lars Exp $ */
+/* $Id: graph.c,v 1.87 2006/05/05 13:08:49 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -367,10 +367,6 @@
crm_xml_add(action_xml, XML_ATTR_ID, action_id_s);
crm_free(action_id_s);
- if(action->rsc != NULL) {
- crm_xml_add(action_xml, XML_LRM_ATTR_RSCID,
- action->rsc->graph_name);
- }
crm_xml_add(action_xml, XML_LRM_ATTR_TASK, action->task);
crm_xml_add(action_xml, XML_LRM_ATTR_TASK_KEY, action->uuid);
@@ -401,7 +397,8 @@
action_xml, crm_element_name(action->rsc->xml));
copy_in_properties(rsc_xml, action->rsc->xml);
- crm_xml_add(rsc_xml, XML_ATTR_ID, action->rsc->graph_name);
+ crm_xml_add(rsc_xml, XML_ATTR_ID, action->rsc->id);
+ crm_xml_add(rsc_xml, XML_ATTR_ID_LONG, action->rsc->long_name);
args_xml = create_xml_node(action_xml, XML_TAG_ATTRS);
g_hash_table_foreach(action->extra, hash2field, args_xml);
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/group.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -3 -r1.60 -r1.61
--- group.c 10 Apr 2006 07:23:27 -0000 1.60
+++ group.c 5 May 2006 13:08:49 -0000 1.61
@@ -1,4 +1,4 @@
-/* $Id: group.c,v 1.60 2006/04/10 07:23:27 andrew Exp $ */
+/* $Id: group.c,v 1.61 2006/05/05 13:08:49 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -53,6 +53,8 @@
CRM_ASSERT(rsc->variant_opaque != NULL); \
data = (group_variant_data_t *)rsc->variant_opaque; \
+void group_assign_color(resource_t *rsc, color_t *group_color);
+
void group_unpack(resource_t *rsc, pe_working_set_t *data_set)
{
resource_t *self = NULL;
@@ -63,8 +65,8 @@
rsc->parameters, XML_RSC_ATTR_ORDERED);
const char *group_colocated = g_hash_table_lookup(
rsc->parameters, "collocated");
+ const char *clone_id = NULL;
-
crm_debug_3("Processing resource %s...", rsc->id);
/* rsc->id = "dummy_group_rsc_id"; */
@@ -99,26 +101,20 @@
return;
}
+ clone_id = crm_element_value(rsc->xml, XML_RSC_ATTR_INCARNATION);
+
xml_child_iter_filter(
xml_obj, xml_native_rsc, XML_CIB_TAG_RESOURCE,
resource_t *new_rsc = NULL;
+ crm_xml_add(xml_native_rsc, XML_RSC_ATTR_INCARNATION, clone_id);
if(common_unpack(xml_native_rsc, &new_rsc,
- group_data->self->parameters, data_set) ==
FALSE) {
+ rsc, data_set) == FALSE) {
pe_err("Failed unpacking resource %s",
crm_element_value(xml_obj, XML_ATTR_ID));
continue;
}
-
- crm_free(new_rsc->graph_name);
- if(data_set->short_rsc_names) {
- new_rsc->graph_name = crm_strdup(new_rsc->id);
- } else {
- new_rsc->graph_name = crm_concat(
- group_data->self->id, new_rsc->id, ':');
- }
- new_rsc->parent = rsc;
group_data->num_children++;
group_data->child_list = g_list_append(
group_data->child_list, new_rsc);
@@ -174,6 +170,8 @@
group_variant_data_t *group_data = NULL;
get_group_variant_data(group_data, rsc);
+ crm_debug_3("Coloring children of: %s", rsc->id);
+
slist_iter(
child_rsc, resource_t, group_data->child_list, lpc,
group_color = child_rsc->fns->color(child_rsc, data_set);
@@ -184,6 +182,22 @@
return group_color;
}
+void
+group_assign_color(resource_t *rsc, color_t *group_color)
+{
+ group_variant_data_t *group_data = NULL;
+ get_group_variant_data(group_data, rsc);
+
+ crm_debug_3("Coloring children of: %s", rsc->id);
+ CRM_CHECK(group_color != NULL, return);
+
+ native_assign_color(rsc, group_color);
+ slist_iter(
+ child_rsc, resource_t, group_data->child_list, lpc,
+ native_assign_color(child_rsc, group_color);
+ );
+}
+
void group_update_pseudo_status(resource_t *parent, resource_t *child);
void group_create_actions(resource_t *rsc, pe_working_set_t *data_set)
@@ -247,6 +261,8 @@
group_variant_data_t *group_data = NULL;
get_group_variant_data(group_data, rsc);
+ group_data->self->fns->internal_constraints(group_data->self, data_set);
+
custom_action_order(
group_data->self, stopped_key(group_data->self), NULL,
group_data->self, start_key(group_data->self), NULL,
@@ -265,7 +281,7 @@
slist_iter(
child_rsc, resource_t, group_data->child_list, lpc,
- order_restart(child_rsc);
+ child_rsc->fns->internal_constraints(child_rsc, data_set);
if(group_data->ordered == FALSE) {
order_start_start(
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/incarnation.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -3 -r1.80 -r1.81
--- incarnation.c 27 Apr 2006 11:27:48 -0000 1.80
+++ incarnation.c 5 May 2006 13:08:49 -0000 1.81
@@ -1,4 +1,4 @@
-/* $Id: incarnation.c,v 1.80 2006/04/27 11:27:48 andrew Exp $ */
+/* $Id: incarnation.c,v 1.81 2006/05/05 13:08:49 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -78,33 +78,26 @@
get_clone_variant_data(clone_data, rsc);
CRM_CHECK(clone_data->xml_obj_child != NULL, return FALSE);
+
+ inc_num = crm_itoa(sub_id);
+ inc_max = crm_itoa(clone_data->clone_max);
+
child_copy = copy_xml(clone_data->xml_obj_child);
- set_id(child_copy, NULL, sub_id);
-
+
+ crm_xml_add(child_copy, XML_RSC_ATTR_INCARNATION, inc_num);
+
if(common_unpack(child_copy, &child_rsc,
- clone_data->self->parameters, data_set) == FALSE) {
+ rsc, data_set) == FALSE) {
pe_err("Failed unpacking resource %s",
crm_element_value(child_copy, XML_ATTR_ID));
return FALSE;
}
-
- crm_free(child_rsc->graph_name);
- if(data_set->short_rsc_names == FALSE) {
- child_rsc->graph_name = crm_concat(
- clone_data->self->id, child_rsc->id, ':');
- } else {
- child_rsc->graph_name = crm_strdup(child_rsc->id);
- }
-
- inc_num = crm_itoa(sub_id);
- inc_max = crm_itoa(clone_data->clone_max);
+/* child_rsc->parent = clone_data->self; */
crm_debug_3("Setting clone attributes for: %s", child_rsc->id);
clone_data->child_list = g_list_append(
clone_data->child_list, child_rsc);
- child_rsc->parent = rsc;
-
add_rsc_param(child_rsc, XML_RSC_ATTR_INCARNATION, inc_num);
add_rsc_param(child_rsc, XML_RSC_ATTR_INCARNATION_MAX, inc_max);
@@ -291,6 +284,7 @@
return NULL;
}
+extern void group_assign_color(resource_t *rsc, color_t *group_color);
color_t *
clone_color(resource_t *rsc, pe_working_set_t *data_set)
@@ -406,10 +400,12 @@
crm_debug_2("Processing unalloc'd resource: %s", child->id);
color_ptr = next_color(
child_colors, color_ptr, local_node_max);
- if(color_ptr == NULL) {
- native_assign_color(child, data_set->no_color);
+ if(child->variant == pe_native) {
+ native_assign_color(child,
color_ptr?color_ptr->data:data_set->no_color);
+ } else if(child->variant == pe_group) {
+ group_assign_color(child,
color_ptr?color_ptr->data:data_set->no_color);
} else {
- native_assign_color(child, color_ptr->data);
+ crm_err("Bad variant: %d", child->variant);
}
);
@@ -546,7 +542,7 @@
/* create pre_notify */
notify_key = generate_notify_key(
- clone_data->self->graph_name, "pre", action->task);
+ clone_data->self->id, "pre", action->task);
notify = custom_action(clone_data->self, notify_key,
CRMD_ACTION_NOTIFY, NULL,
action->optional, TRUE, data_set);
@@ -562,7 +558,7 @@
/* create pre_notify_complete */
notify_key = generate_notify_key(
- clone_data->self->graph_name, "confirmed-pre", action->task);
+ clone_data->self->id, "confirmed-pre", action->task);
notify_complete = custom_action(clone_data->self, notify_key,
CRMD_ACTION_NOTIFIED, NULL,
action->optional, TRUE, data_set);
@@ -593,7 +589,7 @@
/* create post_notify */
notify_key = generate_notify_key
- (clone_data->self->graph_name, "post", action->task);
+ (clone_data->self->id, "post", action->task);
notify = custom_action(clone_data->self, notify_key,
CRMD_ACTION_NOTIFY, NULL,
action_complete->optional, TRUE, data_set);
@@ -614,7 +610,7 @@
/* create post_notify_complete */
notify_key = generate_notify_key(
- clone_data->self->graph_name, "confirmed-post", action->task);
+ clone_data->self->id, "confirmed-post", action->task);
notify_complete = custom_action(clone_data->self, notify_key,
CRMD_ACTION_NOTIFIED, NULL,
action->optional, TRUE, data_set);
@@ -759,6 +755,8 @@
clone_variant_data_t *clone_data = NULL;
get_clone_variant_data(clone_data, rsc);
+ clone_data->self->fns->internal_constraints(clone_data->self, data_set);
+
/* global stop before stopped */
custom_action_order(
clone_data->self, stop_key(clone_data->self), NULL,
@@ -780,8 +778,7 @@
slist_iter(
child_rsc, resource_t, clone_data->child_list, lpc,
- /* child stop before start */
- order_restart(child_rsc);
+ child_rsc->fns->internal_constraints(child_rsc, data_set);
child_starting_constraints(
clone_data, pe_ordering_optional,
@@ -794,7 +791,14 @@
last_rsc = child_rsc;
);
-
+
+ child_starting_constraints(
+ clone_data, pe_ordering_optional,
+ NULL, last_rsc, data_set);
+
+ child_stopping_constraints(
+ clone_data, pe_ordering_optional,
+ NULL, last_rsc, data_set);
}
void clone_rsc_colocation_lh(
@@ -824,7 +828,8 @@
clone_data_rh, constraint->rsc_rh);
if(clone_data->clone_node_max
!= clone_data_rh->clone_node_max) {
- pe_err("Cannot interleave "XML_CIB_TAG_INCARNATION" %s
and %s because"
+ pe_err("Cannot interleave "XML_CIB_TAG_INCARNATION
+ " %s and %s because"
" they do not support the same number of"
" resources per node",
constraint->rsc_lh->id, constraint->rsc_rh->id);
@@ -846,7 +851,6 @@
return;
}
-
if(do_interleave) {
resource_t *child_lh = NULL;
resource_t *child_rh = NULL;
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/master.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- master.c 2 May 2006 10:03:40 -0000 1.15
+++ master.c 5 May 2006 13:08:49 -0000 1.16
@@ -1,4 +1,4 @@
-/* $Id: master.c,v 1.15 2006/05/02 10:03:40 andrew Exp $ */
+/* $Id: master.c,v 1.16 2006/05/05 13:08:49 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -56,7 +56,7 @@
void master_unpack(resource_t *rsc, pe_working_set_t *data_set)
{
- add_hash_param(rsc->parameters, "stateful", XML_BOOLEAN_TRUE);
+ add_hash_param(rsc->parameters, "stateful", XML_BOOLEAN_TRUE);
clone_unpack(rsc, data_set);
}
@@ -285,7 +285,7 @@
CRM_CHECK(chosen != NULL, break);
- len = 8 + strlen(child_rsc->graph_name);
+ len = 8 + strlen(child_rsc->id);
crm_malloc0(attr_name, len);
sprintf(attr_name, "master-%s", child_rsc->id);
@@ -295,7 +295,7 @@
chosen->details->attrs, attr_name);
if(attr_value == NULL) {
- sprintf(attr_name, "master-%s",
child_rsc->graph_name);
+ sprintf(attr_name, "master-%s",
child_rsc->long_name);
crm_debug_2("looking for %s on %s",
attr_name,
chosen->details->uname);
attr_value = g_hash_table_lookup(
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/native.c,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -3 -r1.131 -r1.132
--- native.c 3 May 2006 09:02:24 -0000 1.131
+++ native.c 5 May 2006 13:08:49 -0000 1.132
@@ -1,4 +1,4 @@
-/* $Id: native.c,v 1.131 2006/05/03 09:02:24 andrew Exp $ */
+/* $Id: native.c,v 1.132 2006/05/05 13:08:49 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -418,7 +418,7 @@
continue;
}
- key = generate_op_key(rsc->graph_name, name, interval_ms);
+ key = generate_op_key(rsc->id, name, interval_ms);
if(start != NULL) {
crm_debug_3("Marking %s %s due to %s",
key, start->optional?"optional":"manditory",
@@ -517,8 +517,11 @@
enum rsc_role_e role = RSC_ROLE_UNKNOWN;
enum rsc_role_e next_role = RSC_ROLE_UNKNOWN;
- if(rsc->color != NULL) {
- chosen = rsc->color->details->chosen_node;
+ CRM_CHECK(rsc->color != NULL, return);
+
+ chosen = rsc->color->details->chosen_node;
+ if(chosen != NULL) {
+ CRM_CHECK(rsc->next_role != RSC_ROLE_UNKNOWN, rsc->next_role =
RSC_ROLE_STARTED);
}
unpack_instance_attributes(
@@ -1680,7 +1683,7 @@
}
next_node = rsc->color->details->chosen_node;
- op_key = generate_op_key(rsc->graph_name, op->task, 0);
+ op_key = generate_op_key(rsc->id, op->task, 0);
possible_matches = find_actions(rsc->actions, op_key, NULL);
crm_debug_2("Creating notificaitons for: %s (%s->%s)",
@@ -1758,7 +1761,7 @@
crm_debug_2("Creating actions for %s: %s (%s-%s)",
op->uuid, rsc->id, value, task);
- key = generate_notify_key(rsc->graph_name, value, task);
+ key = generate_notify_key(rsc->id, value, task);
trigger = custom_action(rsc, key, op->task, node,
op->optional, TRUE, data_set);
g_hash_table_foreach(op->extra, dup_attr, trigger->extra);
@@ -2086,7 +2089,7 @@
}
target_rc = crm_itoa(EXECRA_NOT_RUNNING);
- key = generate_op_key(rsc->graph_name, CRMD_ACTION_STATUS, 0);
+ key = generate_op_key(rsc->id, CRMD_ACTION_STATUS, 0);
probe = custom_action(rsc, key, CRMD_ACTION_STATUS, node,
FALSE, TRUE, data_set);
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/pe_utils.h,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -3 -r1.44 -r1.45
--- pe_utils.h 23 Apr 2006 19:49:05 -0000 1.44
+++ pe_utils.h 5 May 2006 13:08:49 -0000 1.45
@@ -1,4 +1,4 @@
-/* $Id: pe_utils.h,v 1.44 2006/04/23 19:49:05 andrew Exp $ */
+/* $Id: pe_utils.h,v 1.45 2006/05/05 13:08:49 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -114,47 +114,47 @@
const char *id, resource_t *rsc, int weight, node_t *node,
pe_working_set_t *data_set);
-#define delete_key(rsc) generate_op_key(rsc->graph_name, CRMD_ACTION_DELETE, 0)
+#define delete_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_DELETE, 0)
#define delete_action(rsc, node) custom_action(
\
rsc, delete_key(rsc), CRMD_ACTION_DELETE, node, \
FALSE, TRUE, data_set);
-#define stopped_key(rsc) generate_op_key(rsc->graph_name, CRMD_ACTION_STOPPED,
0)
+#define stopped_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_STOPPED, 0)
#define stopped_action(rsc, node, optional) custom_action( \
rsc, stopped_key(rsc), CRMD_ACTION_STOPPED, node, \
optional, TRUE, data_set);
-#define stop_key(rsc) generate_op_key(rsc->graph_name, CRMD_ACTION_STOP, 0)
+#define stop_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_STOP, 0)
#define stop_action(rsc, node, optional) custom_action(
\
rsc, stop_key(rsc), CRMD_ACTION_STOP, node, \
optional, TRUE, data_set);
-#define start_key(rsc) generate_op_key(rsc->graph_name, CRMD_ACTION_START, 0)
+#define start_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_START, 0)
#define start_action(rsc, node, optional) custom_action( \
rsc, start_key(rsc), CRMD_ACTION_START, node, \
optional, TRUE, data_set)
-#define started_key(rsc) generate_op_key(rsc->graph_name, CRMD_ACTION_STARTED,
0)
+#define started_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_STARTED, 0)
#define started_action(rsc, node, optional) custom_action( \
rsc, started_key(rsc), CRMD_ACTION_STARTED, node, \
optional, TRUE, data_set)
-#define promote_key(rsc) generate_op_key(rsc->graph_name, CRMD_ACTION_PROMOTE,
0)
+#define promote_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_PROMOTE, 0)
#define promote_action(rsc, node, optional) custom_action( \
rsc, promote_key(rsc), CRMD_ACTION_PROMOTE, node, \
optional, TRUE, data_set)
-#define promoted_key(rsc) generate_op_key(rsc->graph_name,
CRMD_ACTION_PROMOTED, 0)
+#define promoted_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_PROMOTED, 0)
#define promoted_action(rsc, node, optional) custom_action( \
rsc, promoted_key(rsc), CRMD_ACTION_PROMOTED, node, \
optional, TRUE, data_set)
-#define demote_key(rsc) generate_op_key(rsc->graph_name, CRMD_ACTION_DEMOTE, 0)
+#define demote_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_DEMOTE, 0)
#define demote_action(rsc, node, optional) custom_action( \
rsc, demote_key(rsc), CRMD_ACTION_DEMOTE, node, \
optional, TRUE, data_set)
-#define demoted_key(rsc) generate_op_key(rsc->graph_name, CRMD_ACTION_DEMOTED,
0)
+#define demoted_key(rsc) generate_op_key(rsc->id, CRMD_ACTION_DEMOTED, 0)
#define demoted_action(rsc, node, optional) custom_action( \
rsc, demoted_key(rsc), CRMD_ACTION_DEMOTED, node, \
optional, TRUE, data_set)
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/pengine.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -3 -r1.109 -r1.110
--- pengine.c 21 Apr 2006 07:08:04 -0000 1.109
+++ pengine.c 5 May 2006 13:08:49 -0000 1.110
@@ -1,4 +1,4 @@
-/* $Id: pengine.c,v 1.109 2006/04/21 07:08:04 andrew Exp $ */
+/* $Id: pengine.c,v 1.110 2006/05/05 13:08:49 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -366,7 +366,6 @@
data_set->remove_after_stop = FALSE;
data_set->stop_action_orphans = TRUE;
data_set->stop_rsc_orphans = FALSE;
- data_set->short_rsc_names = FALSE;
data_set->config_hash = NULL;
data_set->nodes = NULL;
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/pengine.h,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -3 -r1.109 -r1.110
--- pengine.h 26 Apr 2006 15:57:04 -0000 1.109
+++ pengine.h 5 May 2006 13:08:49 -0000 1.110
@@ -1,4 +1,4 @@
-/* $Id: pengine.h,v 1.109 2006/04/26 15:57:04 andrew Exp $ */
+/* $Id: pengine.h,v 1.110 2006/05/05 13:08:49 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -99,7 +99,6 @@
gboolean remove_after_stop;
gboolean stop_rsc_orphans;
gboolean stop_action_orphans;
- gboolean short_rsc_names;
int default_resource_stickiness;
int default_resource_fail_stickiness;
@@ -273,8 +272,8 @@
};
struct resource_s {
- const char *id;
- char *graph_name;
+ char *id;
+ char *long_name;
crm_data_t *xml;
crm_data_t *ops_xml;
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/unpack.c,v
retrieving revision 1.191
retrieving revision 1.192
diff -u -3 -r1.191 -r1.192
--- unpack.c 26 Apr 2006 15:59:04 -0000 1.191
+++ unpack.c 5 May 2006 13:08:49 -0000 1.192
@@ -1,4 +1,4 @@
-/* $Id: unpack.c,v 1.191 2006/04/26 15:59:04 andrew Exp $ */
+/* $Id: unpack.c,v 1.192 2006/05/05 13:08:49 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -167,13 +167,6 @@
" - resources can run anywhere by default");
}
- get_cluster_pref("short_resource_names");
- if(value != NULL) {
- cl_str_to_boolean(value, &data_set->short_rsc_names);
- }
- crm_info("Using short resource names: %s",
- data_set->short_rsc_names?"true":"false");
-
get_cluster_pref("no_quorum_policy");
if(safe_str_eq(value, "ignore")) {
data_set->no_quorum_policy = no_quorum_ignore;
@@ -555,7 +548,7 @@
/* mark it unclean */
this_node->details->unclean = TRUE;
- crm_warn("Node %s (%s)is un-expectedly down",
+ crm_warn("Node %s (%s) is un-expectedly down",
this_node->details->uname, this_node->details->id);
crm_info("\tha_state=%s, ccm_state=%s,"
" crm_state=%s, join_state=%s, expected=%s",
@@ -997,22 +990,30 @@
crm_debug_2("%s: Start index %d, stop index = %d",
rsc->id, start_index, stop_index);
slist_iter(rsc_op, crm_data_t, sorted_op_list, lpc,
+ int interval = 0;
+ char *key = NULL;
const char *id = ID(rsc_op);
- const char *interval = NULL;
- if(start_index < stop_index) {
- crm_debug_2("Skipping %s/%s: not active",
+ const char *interval_s = NULL;
+ if(node->details->online == FALSE) {
+ crm_debug_4("Skipping %s/%s: node is
offline",
+ rsc->id, node->details->uname);
+ break;
+
+ } else if(start_index < stop_index) {
+ crm_debug_4("Skipping %s/%s: not active",
rsc->id, node->details->uname);
break;
} else if(lpc <= start_index) {
- crm_debug_3("Skipping %s/%s: old",
+ crm_debug_4("Skipping %s/%s: old",
id, node->details->uname);
continue;
}
- interval = get_interval(rsc_op);
- if(safe_str_eq(interval, "0")) {
- crm_debug_4("Skipping %s/%s: non-recurring",
+ interval_s = get_interval(rsc_op);
+ interval = crm_parse_int(interval_s, "0");
+ if(interval == 0) {
+ crm_debug_3("Skipping %s/%s: non-recurring",
id, node->details->uname);
continue;
}
@@ -1025,8 +1026,9 @@
}
task = crm_element_value(rsc_op, XML_LRM_ATTR_TASK);
/* create the action */
- crm_debug_2("Creating %s/%s", id,
node->details->uname);
- custom_action(rsc, crm_strdup(id), task, node,
+ key = generate_op_key(rsc->id, task, interval);
+ crm_debug_2("Creating %s/%s", key,
node->details->uname);
+ custom_action(rsc, key, task, node,
TRUE, TRUE, data_set);
);
@@ -1193,6 +1195,10 @@
check_action_definition(resource_t *rsc, node_t *active_node, crm_data_t
*xml_op,
pe_working_set_t *data_set)
{
+ int interval = 0;
+ char *key = NULL;
+ const char *interval_s = NULL;
+
gboolean did_change = FALSE;
crm_data_t *pnow = NULL;
@@ -1206,12 +1212,47 @@
crm_data_t *params = NULL;
#endif
- const char *id = ID(xml_op);
+ action_t *action = NULL;
const char *task = crm_element_value(xml_op, XML_LRM_ATTR_TASK);
- action_t *action = custom_action(rsc, crm_strdup(id), task, active_node,
- TRUE, FALSE, data_set);
CRM_CHECK(active_node != NULL, return FALSE);
+
+ interval_s = get_interval(xml_op);
+ interval = crm_parse_int(interval_s, "0");
+ key = generate_op_key(rsc->id, task, interval);
+
+ if(interval > 0) {
+ crm_data_t *op_match = NULL;
+
+ crm_debug_2("Checking parameters for %s %s", key, task);
+ op_match = find_rsc_op_entry(rsc, key);
+
+ if(op_match == NULL && data_set->stop_action_orphans) {
+ /* create a cancel action */
+ action_t *cancel = NULL;
+ pe_config_warn("Orphan action will be stopped: %s",
key);
+
+ crm_free(key);
+ key = generate_op_key(rsc->id, CRMD_ACTION_CANCEL,
interval);
+
+ cancel = custom_action(
+ rsc, key, CRMD_ACTION_CANCEL, active_node,
+ FALSE, TRUE, data_set);
+
+ add_hash_param(cancel->extra, XML_LRM_ATTR_TASK, task);
+ add_hash_param(cancel->extra,
+ XML_LRM_ATTR_INTERVAL, interval_s);
+
+ custom_action_order(
+ rsc, NULL, cancel,
+ rsc, stop_key(rsc), NULL,
+ pe_ordering_optional, data_set);
+
+ return TRUE;
+ }
+ }
+
+ action = custom_action(rsc, key, task, active_node, TRUE, FALSE,
data_set);
local_rsc_params = g_hash_table_new_full(
g_str_hash, g_str_equal,
@@ -1226,7 +1267,7 @@
g_hash_table_foreach(rsc->parameters, hash2field, pnow);
g_hash_table_foreach(local_rsc_params, hash2field, pnow);
- filter_action_parameters(pnow);
+ filter_action_parameters(pnow, NULL);
pnow_digest = calculate_xml_digest(pnow, TRUE);
param_digest = crm_element_value(xml_op, XML_LRM_ATTR_OP_DIGEST);
@@ -1239,19 +1280,33 @@
crm_info("Faking parameter digest creation for %s", ID(xml_op));
- filter_action_parameters(local_params);
+ filter_action_parameters(local_params, NULL);
local_param_digest = calculate_xml_digest(local_params, TRUE);
param_digest = local_param_digest;
free_xml(local_params);
}
#endif
-
+/*
+#if CRM_DEPRECATED_SINCE_2_0_5
+ if(safe_str_neq(pnow_digest, param_digest)) {
+ char *fallback_digest = NULL;
+ filter_action_parameters(pnow, "1.0.5");
+ fallback_digest = calculate_xml_digest(pnow, TRUE);
+ if(safe_str_eq(fallback_digest, param_digest)) {
+ crm_free(pnow_digest);
+ pnow_digest = fallback_digest;
+ fallback_digest = NULL;
+ }
+ crm_free(fallback_digest);
+ }
+#endif
+*/
if(safe_str_neq(pnow_digest, param_digest)) {
crm_data_t *params = find_xml_node(xml_op,XML_TAG_PARAMS,FALSE);
if(params) {
crm_data_t *local_params = copy_xml(params);
- filter_action_parameters(local_params);
+ filter_action_parameters(local_params, "1.0.5");
crm_log_xml_err(pnow, "params:calc");
crm_log_xml_err(local_params, "params:used");
@@ -1259,13 +1314,13 @@
}
did_change = TRUE;
- crm_info("Parameters to %s on %s changed: %s vs. %s",
+ crm_info("Parameters to %s on %s changed: calculated %s vs.
actual %s",
ID(xml_op), active_node->details->uname,
pnow_digest, crm_str(param_digest));
- custom_action(rsc, crm_strdup(id), task, NULL,
- FALSE, TRUE, data_set);
+ key = generate_op_key(rsc->id, task, interval);
+ custom_action(rsc, key, task, NULL, FALSE, TRUE, data_set);
}
g_hash_table_destroy(action->extra);
@@ -1354,35 +1409,7 @@
check_action_definition(rsc, node, xml_op, data_set);
} else if(interval > 0) {
- crm_data_t *op_match = NULL;
-
- crm_debug_2("Checking parameters for %s %s", id, task);
- op_match = find_rsc_op_entry(rsc, id);
-
- if(op_match == NULL && data_set->stop_action_orphans) {
- /* create a cancel action */
- action_t *cancel = NULL;
- pe_config_warn("Orphan action will be stopped: %s", id);
-
- cancel = custom_action(
- rsc, crm_strdup(id), CRMD_ACTION_CANCEL, node,
- FALSE, TRUE, data_set);
-
- add_hash_param(cancel->extra, XML_LRM_ATTR_TASK, task);
- add_hash_param(cancel->extra,
- XML_LRM_ATTR_INTERVAL, interval_s);
-
- custom_action_order(
- rsc, NULL, cancel,
- rsc, stop_key(rsc), NULL,
- pe_ordering_optional, data_set);
-
- } else if(op_match == NULL) {
- pe_config_warn("Ignoring orphan action: %s", id);
-
- } else {
- check_action_definition(rsc, node, xml_op, data_set);
- }
+ check_action_definition(rsc, node, xml_op, data_set);
}
if(safe_str_eq(task, CRMD_ACTION_STOP)) {
@@ -1431,7 +1458,7 @@
} else {
if(rsc->role != RSC_ROLE_MASTER) {
crm_err("%s reported %s in master mode on %s",
- id, rsc->graph_name,
+ id, rsc->id,
node->details->uname);
}
@@ -1813,8 +1840,8 @@
}
custom_action_order(
- rsc_lh, generate_op_key(rsc_lh->graph_name, action, 0), NULL,
- rsc_rh, generate_op_key(rsc_rh->graph_name, action_rh, 0), NULL,
+ rsc_lh, generate_op_key(rsc_lh->id, action, 0), NULL,
+ rsc_rh, generate_op_key(rsc_rh->id, action_rh, 0), NULL,
pe_ordering_optional, data_set);
if(rsc_rh->restart_type == pe_restart_restart
@@ -1839,8 +1866,8 @@
action_rh = invert_action(action_rh);
custom_action_order(
- rsc_rh, generate_op_key(rsc_rh->graph_name, action_rh, 0), NULL,
- rsc_lh, generate_op_key(rsc_lh->graph_name, action, 0), NULL,
+ rsc_rh, generate_op_key(rsc_rh->id, action_rh, 0), NULL,
+ rsc_lh, generate_op_key(rsc_lh->id, action, 0), NULL,
pe_ordering_optional, data_set);
if(rsc_lh->restart_type == pe_restart_restart
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/utils.c,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -3 -r1.134 -r1.135
--- utils.c 3 May 2006 09:02:45 -0000 1.134
+++ utils.c 5 May 2006 13:08:49 -0000 1.135
@@ -1,4 +1,4 @@
-/* $Id: utils.c,v 1.134 2006/05/03 09:02:45 andrew Exp $ */
+/* $Id: utils.c,v 1.135 2006/05/05 13:08:49 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -400,13 +400,9 @@
} else if(safe_str_eq(rsc->id, id)){
crm_debug_4("Found a match for %s", id);
return rsc;
-#if 0
- } else if(data_set->short_rsc_names == FALSE
- && safe_str_eq(rsc->graph_name, id)) {
-#else
- } else if(safe_str_eq(rsc->graph_name, id)) {
-#endif
- crm_debug_3("Found a match for %s", id);
+
+ } else if(safe_str_eq(rsc->long_name, id)) {
+ crm_debug_4("Found a match for %s", id);
return rsc;
}
}
@@ -758,7 +754,10 @@
if(rsc != NULL) {
enum action_tasks a_task = text2task(action->task);
-
+ int warn_level = LOG_DEBUG_3;
+ if(save_action) {
+ warn_level = LOG_WARNING;
+ }
if(action->node != NULL) {
unpack_instance_attributes(
action->op_entry, XML_TAG_ATTR_SETS,
@@ -769,26 +768,26 @@
action->runnable = FALSE;
} else if(rsc->is_managed == FALSE) {
- crm_warn("Action %s %s is for %s (unmanaged)",
+ crm_log_maybe(warn_level, "Action %s %s is for %s
(unmanaged)",
action->uuid, task, rsc->id);
action->optional = TRUE;
/* action->runnable = FALSE; */
#if 0
} else if(action->node->details->unclean) {
- crm_warn("Action %s on %s is unrunnable (unclean)",
+ crm_log_maybe(warn_level, "Action %s on %s is
unrunnable (unclean)",
action->uuid,
action->node?action->node->details->uname:"<none>");
action->runnable = FALSE;
#endif
} else if(action->node->details->online == FALSE) {
action->runnable = FALSE;
- crm_warn("Action %s on %s is unrunnable (offline)",
+ crm_log_maybe(warn_level, "Action %s on %s is
unrunnable (offline)",
action->uuid, action->node->details->uname);
if(action->rsc->is_managed
&& save_action
&& a_task == stop_rsc) {
- crm_warn("Marking node %s unclean",
+ crm_log_maybe(warn_level, "Marking node %s
unclean",
action->node->details->uname);
action->node->details->unclean = TRUE;
}
@@ -1038,9 +1037,8 @@
}
match_key = generate_op_key(
- rsc->graph_name, name, crm_get_msec(interval));
+ rsc->id, name, crm_get_msec(interval));
- crm_debug_2("Matching %s with %s", key, match_key);
if(safe_str_eq(key, match_key)) {
op = operation;
}
------------------------------
_______________________________________________
Linux-ha-cvs mailing list
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
End of Linux-ha-cvs Digest, Vol 30, Issue 11
********************************************