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: resources by xunsun from 
      ([email protected])
   2. Linux-HA CVS: lib by andrew from 
      ([email protected])


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

Message: 1
Date: Fri, 10 Mar 2006 21:02:58 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: resources by xunsun from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : xunsun
Host    : 
Project : linux-ha
Module  : resources

Dir     : linux-ha/resources/OCF


Modified Files:
        ocf-shellfuncs.in 


Log Message:
removed the useless function
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/resources/OCF/ocf-shellfuncs.in,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- ocf-shellfuncs.in   10 Mar 2006 04:14:20 -0000      1.26
+++ ocf-shellfuncs.in   11 Mar 2006 04:02:58 -0000      1.27
@@ -1,5 +1,5 @@
 #
-#      $Id: ocf-shellfuncs.in,v 1.26 2006/03/10 04:14:20 xunsun Exp $
+#      $Id: ocf-shellfuncs.in,v 1.27 2006/03/11 04:02:58 xunsun Exp $
 #
 #      Common helper functions for the OCF Resource Agents supplied by
 #      heartbeat.
@@ -208,28 +208,9 @@
        ha_log "${__OCF_PRIO}: $__OCF_MSG"
 }
 
-return_master() {
-       if [ $# -ne 1 ]; then
-           return $OCF_ERR_GENERIC
-       fi
-       
-       rc=$1
-       if [ "${__OCF_ACTION}" = "monitor" -a "${OCF_RESKEY_interval}" = "0" ]; 
then
-           if [ "$rc" = "$OCF_SUCCESS" ]; then
-               return $OCF_RUNNING_MASTER
-           fi
-
-           if [ "$rc" = "$OCF_ERR_GENERIC" ]; then
-               return $OCF_FAILED_MASTER
-           fi
-       fi
-
-       return $rc
-}
-
 #
-# Run:  Run a script, and log its output.
-# Usage: ocf_run <command>
+# Ocf_run: Run a script, and log its output.
+# Usage:   ocf_run <command>
 #
 ocf_run() {
        output=`"$@" 2>&1`




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

Message: 2
Date: Sat, 11 Mar 2006 11:59:48 -0700 (MST)
From: [email protected]
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/common


Modified Files:
        xml.c 


Log Message:
Support atomic incrimenting in the CIB.
if the following object exists in the CIB:
  <nvpair id="foo" name="bar" value="3"/>
the following command:
  cibadmin -M -X '<nvpair id="bar" some_attr="some_attr++" value="value++"/>'
will produce:
  <nvpair id="foo" name="bar" value="4" some_attr="1"/>
Simple really :-)

This will initially be used by the failure stickiness code. 

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/crm/common/xml.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -3 -r1.58 -r1.59
--- xml.c       8 Mar 2006 22:30:00 -0000       1.58
+++ xml.c       11 Mar 2006 18:59:47 -0000      1.59
@@ -1,4 +1,4 @@
-/* $Id: xml.c,v 1.58 2006/03/08 22:30:00 andrew Exp $ */
+/* $Id: xml.c,v 1.59 2006/03/11 18:59:47 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -217,16 +217,53 @@
 void
 copy_in_properties(crm_data_t* target, const crm_data_t *src)
 {
+       int value_len = 0;
+       char *incr_value = NULL;
+       char *new_value = NULL;
+       
        crm_validate_data(src);
        crm_validate_data(target);
+
        if(src == NULL) {
                crm_warn("No node to copy properties from");
+
        } else if (target == NULL) {
                crm_err("No node to copy properties into");
+
        } else {
                xml_prop_iter(
                        src, local_prop_name, local_prop_value,
+
+                       /* if the value is name followed by "++" we need
+                        *   to increment the existing value
+                        */
+                       new_value = NULL;
+                       incr_value = NULL;
+                       /* do a quick check to decide if its worth
+                        *   constructing the various strings and
+                        *   performing string comparisions
+                        */
+                       value_len = strlen(local_prop_value);
+                       if(value_len > 2
+                          && local_prop_value[0] == local_prop_value[0]
+                          && local_prop_value[value_len-1] == '+'
+                          && local_prop_value[value_len-2] == '+') {
+                               int old_int = 0;
+                               const char *old_value = NULL;
+                               incr_value=crm_concat(local_prop_name,"+",'+');
+
+                               if(safe_str_eq(local_prop_value, incr_value)) {
+                                       old_value = crm_element_value(
+                                               target, local_prop_name);
+                                       old_int = crm_parse_int(old_value, "0");
+                                       new_value = crm_itoa(old_int + 1);
+                                       local_prop_value = new_value;
+                               }
+                       }
+                               
                        crm_xml_add(target, local_prop_name, local_prop_value);
+                       crm_free(incr_value);
+                       crm_free(new_value);
                        );
                crm_validate_data(target);
        }




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

_______________________________________________
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 20
********************************************

Reply via email to