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: Tue, 18 Apr 2006 05:15:37 -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:
        graph.c native.c unpack.c utils.c 


Log Message:
Fix detection and handling of resource definition changes and orphan 
  actions.
Added "disabled" to an operation which makes it behave as if it was an orphan
Update the DTD
Some new #define's

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/graph.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -3 -r1.83 -r1.84
--- graph.c     12 Apr 2006 09:06:00 -0000      1.83
+++ graph.c     18 Apr 2006 11:15:37 -0000      1.84
@@ -1,4 +1,4 @@
-/* $Id: graph.c,v 1.83 2006/04/12 09:06:00 andrew Exp $ */
+/* $Id: graph.c,v 1.84 2006/04/18 11:15:37 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -83,7 +83,7 @@
                        
                } else if(safe_str_eq(other->action->task, CRMD_ACTION_START)) {
                        const char *interval = g_hash_table_lookup(
-                               action->extra, "interval");
+                               action->extra, XML_LRM_ATTR_INTERVAL);
                        int interval_i = 0;
                        if(interval != NULL) {
                                interval_i = crm_parse_int(interval, NULL);
@@ -425,7 +425,7 @@
 
        CRM_CHECK(action != NULL, return FALSE);
 
-       interval = g_hash_table_lookup(action->extra, "interval");
+       interval = g_hash_table_lookup(action->extra, XML_LRM_ATTR_INTERVAL);
        if(action->optional) {
                crm_debug_5("action %d was optional", action->id);
                return FALSE;
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/native.c,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -3 -r1.127 -r1.128
--- native.c    12 Apr 2006 08:23:41 -0000      1.127
+++ native.c    18 Apr 2006 11:15:37 -0000      1.128
@@ -1,4 +1,4 @@
-/* $Id: native.c,v 1.127 2006/04/12 08:23:41 andrew Exp $ */
+/* $Id: native.c,v 1.128 2006/04/18 11:15:37 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -406,13 +406,18 @@
                
                is_optional = TRUE;
                name = crm_element_value(operation, "name");
-               interval = crm_element_value(operation, "interval");
+               interval = crm_element_value(operation, XML_LRM_ATTR_INTERVAL);
                interval_ms = crm_get_msec(interval);
 
                if(interval_ms <= 0) {
                        continue;
                }
 
+               value = crm_element_value(operation, "disabled");
+               if(crm_is_true(value)) {
+                       continue;
+               }
+               
                key = generate_op_key(rsc->graph_name, name, interval_ms);
                if(start != NULL) {
                        crm_debug_3("Marking %s %s due to %s",
@@ -446,7 +451,7 @@
                                        FALSE, TRUE, data_set);
 
                                mon->task = CRMD_ACTION_CANCEL;
-                               add_hash_param(mon->extra, "interval", 
interval);
+                               add_hash_param(mon->extra, 
XML_LRM_ATTR_INTERVAL, interval);
                                add_hash_param(mon->extra, "task", name);
                                
                                custom_action_order(
@@ -1630,7 +1635,7 @@
        entry->rsc = rsc;
        entry->node = on_node;
 
-       crm_err("%s state: %s", rsc->id, role2text(rsc->next_role));
+       crm_debug_2("%s state: %s", rsc->id, role2text(rsc->next_role));
 
        switch(rsc->next_role) {
                case RSC_ROLE_STOPPED:
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/unpack.c,v
retrieving revision 1.183
retrieving revision 1.184
diff -u -3 -r1.183 -r1.184
--- unpack.c    11 Apr 2006 08:51:49 -0000      1.183
+++ unpack.c    18 Apr 2006 11:15:37 -0000      1.184
@@ -1,4 +1,4 @@
-/* $Id: unpack.c,v 1.183 2006/04/11 08:51:49 andrew Exp $ */
+/* $Id: unpack.c,v 1.184 2006/04/18 11:15:37 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -1123,11 +1123,15 @@
        const char *param_digest = NULL;
        char *local_param_digest = NULL;
 
+       crm_data_t *params = 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, active_node,
                                         TRUE, FALSE, data_set);
 
+       CRM_CHECK(active_node != NULL, return FALSE);
+       
        local_rsc_params = g_hash_table_new_full(
                g_str_hash, g_str_equal,
                g_hash_destroy_str, g_hash_destroy_str);
@@ -1145,8 +1149,11 @@
        pnow_digest = calculate_xml_digest(pnow, TRUE);
        param_digest = crm_element_value(xml_op, XML_LRM_ATTR_OP_DIGEST);
 
+#if CRM_DEPRECATED_SINCE_2_0_4
        if(param_digest == NULL) {
-               crm_data_t *params = find_xml_node(xml_op, XML_TAG_PARAMS, 
TRUE);
+               params = find_xml_node(xml_op, XML_TAG_PARAMS, TRUE);
+       }
+       if(params != NULL) {
                crm_data_t *local_params = copy_xml(params);
 
                crm_info("Faking parameter digest creation for %s", ID(xml_op));
@@ -1157,6 +1164,7 @@
                
                free_xml(local_params);
        }
+#endif
 
        if(safe_str_neq(pnow_digest, param_digest)) {
                crm_data_t *params = find_xml_node(xml_op,XML_TAG_PARAMS,FALSE);
@@ -1170,8 +1178,9 @@
                }
 
                did_change = TRUE;
-               crm_info("Parameters to %s action changed: %s vs. %s",
-                        id, pnow_digest, param_digest);
+               crm_info("Parameters to %s on %s changed: %s vs. %s",
+                        ID(xml_op), active_node->details->uname,
+                        pnow_digest, crm_str(param_digest));
                
                
                custom_action(rsc, crm_strdup(id), task, NULL,
@@ -1213,7 +1222,10 @@
        gboolean is_probe = FALSE;
        gboolean is_stop_action = FALSE;
 
-       crm_data_t *params = find_xml_node(xml_op, XML_TAG_PARAMS, FALSE);
+       crm_data_t *params = NULL;
+#if CRM_DEPRECATED_SINCE_2_0_4
+       params = find_xml_node(xml_op, XML_TAG_PARAMS, FALSE);
+#endif
        
        CRM_CHECK(rsc    != NULL, return FALSE);
        CRM_CHECK(node   != NULL, return FALSE);
@@ -1222,6 +1234,7 @@
        id = ID(xml_op);
        task        = crm_element_value(xml_op, XML_LRM_ATTR_TASK);
        task_id     = crm_element_value(xml_op, XML_LRM_ATTR_CALLID);
+        interval_s  = crm_element_value(xml_op, XML_LRM_ATTR_INTERVAL);
        task_status = crm_element_value(xml_op, XML_LRM_ATTR_OPSTATUS);
        op_digest   = crm_element_value(xml_op, XML_LRM_ATTR_OP_DIGEST);
 
@@ -1243,13 +1256,16 @@
                    id, task, task_id, task_status, node->details->uname,
                    role2text(rsc->role));
 
-       if(params != NULL) {
-               interval_s = crm_element_value(params, "interval");
-               if(interval_s != NULL) {
-                       interval = crm_parse_int(interval_s, NULL);
-               }
+#if CRM_DEPRECATED_SINCE_2_0_4
+       if(interval_s == NULL && params != NULL) {
+               interval_s = crm_element_value(params, XML_LRM_ATTR_INTERVAL);
        }
-
+#endif
+       
+       CRM_CHECK(interval_s != NULL,
+                 crm_err("Invalid rsc op: %s", id); return FALSE);
+       interval = crm_parse_int(interval_s, NULL);
+       
        if(interval == 0 && safe_str_eq(task, CRMD_ACTION_STATUS)) {
                is_probe = TRUE;
 
@@ -1265,44 +1281,17 @@
        } else if(safe_str_eq(task, CRMD_ACTION_STOP)) {
                crm_debug_2("Ignoring stop params: %s", id);
 
-       } else if(op_digest == NULL && params == NULL) {
-               /* for older test cases */
-               crm_err("Skipping param check: %s %s", id, task);
-
        } 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);
                
-       } else if(interval > 0 && data_set->stop_action_orphans) {
+       } else if(interval > 0) {
                crm_data_t *op_match = NULL;
                
                crm_debug_2("Checking parameters for %s %s", id, task);
-               
-               xml_child_iter_filter(
-                       rsc->ops_xml, operation, "op",
-                       
-                       int value = 0;
-                       const char *name = NULL;
-
-                       value = crm_get_msec(
-                               crm_element_value(operation, "interval"));
-                       
-                       if(interval <= 0) {
-                               break;
-                               
-                       } else if(value != interval) {
-                               continue;
-                       }
-
-                       name = crm_element_value(operation, "name");
-                       if(safe_str_neq(name, task)) {
-                               continue;
-                       }
+               op_match = find_rsc_op_entry(rsc, id);
 
-                       op_match = operation;
-                       );
-               
-               if(op_match == NULL && interval > 0 && 
data_set->stop_action_orphans) {
+               if(op_match == NULL && data_set->stop_action_orphans) {
                        /* create a cancel action */
                        pe_config_warn("Orphan action will be stopped: %s", id);
 
@@ -1310,15 +1299,16 @@
                                rsc, crm_strdup(id), CRMD_ACTION_CANCEL, node,
                                FALSE, TRUE, data_set);
 
-                       add_hash_param(action->extra, "interval", interval_s);
-                       add_hash_param(action->extra, "task", task);
+                       add_hash_param(action->extra, XML_LRM_ATTR_TASK, task);
+                       add_hash_param(action->extra,
+                                      XML_LRM_ATTR_INTERVAL, interval_s);
                        
                        custom_action_order(
                                rsc, NULL, action,
                                rsc, stop_key(rsc), NULL,
                                pe_ordering_optional, data_set);
 
-               } else if(op_match == NULL && interval > 0) {
+               } else if(op_match == NULL) {
                        pe_config_warn("Ignoring orphan action: %s", id);
 
                } else {
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/pengine/utils.c,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -3 -r1.129 -r1.130
--- utils.c     3 Apr 2006 10:40:39 -0000       1.129
+++ utils.c     18 Apr 2006 11:15:37 -0000      1.130
@@ -1,4 +1,4 @@
-/* $Id: utils.c,v 1.129 2006/04/03 10:40:39 andrew Exp $ */
+/* $Id: utils.c,v 1.130 2006/04/18 11:15:37 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -418,6 +418,7 @@
                }
        }
        /* error */
+       crm_debug("No match for %s", id);
        return NULL;
 }
 
@@ -850,7 +851,7 @@
        int lpc = 0;
        const char *value = NULL;
        const char *fields[] = {
-               "interval",
+               XML_LRM_ATTR_INTERVAL,
                "timeout",
                "start_delay",
        };
@@ -1017,6 +1018,7 @@
 find_rsc_op_entry(resource_t *rsc, const char *key) 
 {
        const char *name = NULL;
+       const char *value = NULL;
        const char *interval = NULL;
        char *match_key = NULL;
        crm_data_t *op = NULL;
@@ -1025,19 +1027,27 @@
                rsc->ops_xml, operation, "op",
 
                name = crm_element_value(operation, "name");
-               interval = crm_element_value(operation, "interval");
+               interval = crm_element_value(operation, XML_LRM_ATTR_INTERVAL);
+               value = crm_element_value(operation, "disabled");
+               if(crm_is_true(value)) {
+                       crm_debug_2("%s disabled", ID(operation));
+                       continue;
+               }
+               
+               match_key = generate_op_key(
+                       rsc->graph_name, name, crm_get_msec(interval));
 
-               match_key = 
generate_op_key(rsc->graph_name,name,crm_get_msec(interval));
                crm_debug_2("Matching %s with %s", key, match_key);
                if(safe_str_eq(key, match_key)) {
                        op = operation;
                }
                crm_free(match_key);
+
                if(op != NULL) {
-                       break;
+                       return op;
                }
                );
-       crm_debug_2("No matching for %s", key);
+       crm_debug_2("No match for %s", key);
        return op;
 }
 
@@ -1651,7 +1661,7 @@
        
        slist_iter(
                action, action_t, input, lpc,
-               value = g_hash_table_lookup(action->extra, "interval");
+               value = g_hash_table_lookup(action->extra, 
XML_LRM_ATTR_INTERVAL);
                if(value == NULL) {
                        /* skip */
                } else if(safe_str_eq(CRMD_ACTION_CANCEL, action->task)) {




------------------------------

_______________________________________________
Linux-ha-cvs mailing list
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs


End of Linux-ha-cvs Digest, Vol 29, Issue 91
********************************************

Reply via email to