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


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

Message: 1
Date: Fri,  7 Apr 2006 08:07:12 -0600 (MDT)
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:
        ctrl.c 


Log Message:
We're not using this code anywhere for the moment... maybe one day

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/crm/common/ctrl.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ctrl.c      13 Jun 2005 15:57:58 -0000      1.3
+++ ctrl.c      7 Apr 2006 14:07:12 -0000       1.4
@@ -1,4 +1,4 @@
-/* $Id: ctrl.c,v 1.3 2005/06/13 15:57:58 davidlee Exp $ */
+/* $Id: ctrl.c,v 1.4 2006/04/07 14:07:12 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -41,11 +41,10 @@
 
 #include <crm/dmalloc_wrapper.h>
 
+#if 0
 
 static int  wdt_interval_ms = 10000;
 
-
-
 void
 register_with_apphb(const char *client_name,
                    gboolean(*tickle_fn)(gpointer data))
@@ -98,3 +97,5 @@
        }
        return TRUE;
 }
+
+#endif




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

Message: 2
Date: Fri,  7 Apr 2006 08:08:08 -0600 (MDT)
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/cib


Modified Files:
        cib_attrs.c 


Log Message:
Call abort() less and fill in sensible defaults more
Always creates the non-deprecated form for options

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/crm/cib/cib_attrs.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- cib_attrs.c 5 Apr 2006 08:05:26 -0000       1.17
+++ cib_attrs.c 7 Apr 2006 14:08:07 -0000       1.18
@@ -1,4 +1,4 @@
-/* $Id: cib_attrs.c,v 1.17 2006/04/05 08:05:26 andrew Exp $ */
+/* $Id: cib_attrs.c,v 1.18 2006/04/07 14:08:07 andrew Exp $ */
 
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
@@ -39,6 +39,51 @@
 
 #include <crm/dmalloc_wrapper.h>
 
+#define attr_common_setup(section)                                     \
+       gboolean is_crm_config = FALSE;                                 \
+       gboolean is_node_transient = FALSE;                             \
+       char *local_attr_id = NULL;                                     \
+       if(attr_id == NULL && attr_name == NULL) {                      \
+               return cib_missing;                                     \
+                                                                       \
+       } else if(section == NULL) {                                    \
+               return cib_NOSECTION;                                   \
+       }                                                               \
+       if(safe_str_eq(section, XML_CIB_TAG_CRMCONFIG)) {               \
+               tag = NULL;                                             \
+               is_crm_config = TRUE;                                   \
+               if(set_name == NULL) {                                  \
+                       set_name = CIB_OPTIONS_FIRST;                   \
+               }                                                       \
+                                                                       \
+       } else if(safe_str_eq(section, XML_CIB_TAG_NODES)) {            \
+               tag = XML_CIB_TAG_NODE;                                 \
+               if(node_uuid == NULL) {                         \
+                       return cib_missing;                             \
+               }                                                       \
+               if(set_name == NULL) {                                  \
+                       set_name = node_uuid;                           \
+               }                                                       \
+                                                                       \
+       } else if(node_uuid != NULL) {                                  \
+               is_node_transient = TRUE;                               \
+               tag = XML_TAG_TRANSIENT_NODEATTRS;                      \
+               if(node_uuid == NULL) {                         \
+                       return cib_missing;                             \
+               }                                                       \
+               if(set_name == NULL) {                                  \
+                       set_name = node_uuid;                           \
+               }                                                       \
+       }                                                               \
+                                                                       \
+       if(attr_id == NULL) {                                           \
+               local_attr_id = crm_concat(set_name, attr_name, '-');   \
+               attr_id = local_attr_id;                                \
+                                                                       \
+       } else if(attr_name == NULL) {                                  \
+               attr_name = attr_id;                                    \
+       }                                                               \
+
 
 enum cib_errors 
 update_attr(cib_t *the_cib, int call_options,
@@ -46,43 +91,28 @@
            const char *attr_id, const char *attr_name, const char *attr_value)
 {
        const char *tag = NULL;
-       gboolean is_crm_config = FALSE;
        
        enum cib_errors rc = cib_ok;
        crm_data_t *xml_top = NULL;
        crm_data_t *xml_obj = NULL;
        crm_data_t *fragment = NULL;
 
-       if(attr_id == NULL) {
-               attr_id = attr_name;
-       }
-       if(attr_name == NULL) {
-               attr_name = attr_id;
+       attr_common_setup(section);     
+
+       CRM_CHECK(attr_id != NULL, return cib_missing);
+       CRM_CHECK(attr_name != NULL, return cib_missing);
+       CRM_CHECK(set_name != NULL, return cib_missing);
+
+       if(attr_value == NULL) {
+               return cib_missing_data;
        }
 
-       CRM_ASSERT(attr_id != NULL);
-       CRM_ASSERT(attr_name != NULL);
-       
-       if(safe_str_eq(section, XML_CIB_TAG_CRMCONFIG)) {
-               tag = NULL;
-               is_crm_config = TRUE;
-               
-       } else if(safe_str_eq(section, XML_CIB_TAG_NODES)) {
-               tag = XML_CIB_TAG_NODE;
-               
-       } else if(section != NULL && node_uuid != NULL) {
+       if(is_node_transient) {
                xml_obj = create_xml_node(xml_obj, XML_CIB_TAG_STATE);
                crm_xml_add(xml_obj, XML_ATTR_ID, node_uuid);
                if(xml_top == NULL) {
                        xml_top = xml_obj;
                }
-               tag = XML_TAG_TRANSIENT_NODEATTRS;
-
-       } else if(section != NULL) {
-               tag = XML_TAG_TRANSIENT_NODEATTRS;
-
-       } else {
-               return cib_NOSECTION;
        }
        
        crm_debug_2("Creating %s/%s", section, tag);
@@ -94,22 +124,20 @@
                }
        }
 
-       if(set_name != NULL) {
-               if(is_crm_config) {
-                       xml_obj = create_xml_node(xml_obj, XML_CIB_TAG_PROPSET);
-               } else {
-                       xml_obj = create_xml_node(xml_obj, XML_TAG_ATTR_SETS);
-               }
-               if(xml_top == NULL) {
-                       xml_top = xml_obj;
-               }
-               crm_xml_add(xml_obj, XML_ATTR_ID, set_name);
-               xml_obj = create_xml_node(xml_obj, XML_TAG_ATTRS);
+       if(is_crm_config) {
+               xml_obj = create_xml_node(xml_obj, XML_CIB_TAG_PROPSET);
+       } else {
+               xml_obj = create_xml_node(xml_obj, XML_TAG_ATTR_SETS);
        }
-       xml_obj = create_xml_node(xml_obj, XML_CIB_TAG_NVPAIR);
+       crm_xml_add(xml_obj, XML_ATTR_ID, set_name);
+
        if(xml_top == NULL) {
                xml_top = xml_obj;
        }
+
+       xml_obj = create_xml_node(xml_obj, XML_TAG_ATTRS);
+       xml_obj = create_xml_node(xml_obj, XML_CIB_TAG_NVPAIR);
+
        crm_xml_add(xml_obj, XML_ATTR_ID, attr_id);
        crm_xml_add(xml_obj, XML_NVPAIR_ATTR_NAME, attr_name);
        crm_xml_add(xml_obj, XML_NVPAIR_ATTR_VALUE, attr_value);
@@ -134,7 +162,9 @@
                        cib_error2string(rc));
        }
        
+       crm_free(local_attr_id);
        free_xml(fragment);
+       
        return rc;
 }
 
@@ -145,7 +175,6 @@
 {
        const char *tag = NULL;
        enum cib_errors rc = cib_ok;
-       gboolean is_crm_config = FALSE;
 
        crm_data_t *xml_obj = NULL;
        crm_data_t *xml_next = NULL;
@@ -154,6 +183,8 @@
        CRM_ASSERT(attr_value != NULL);
        *attr_value = NULL;
 
+       attr_common_setup(section);
+       
        crm_debug("Searching for attribute %s (section=%s, node=%s, set=%s)",
                  attr_name, section, crm_str(node_uuid), crm_str(set_name));
 
@@ -263,17 +294,16 @@
                crm_debug("<%s id=%s name=%s/> not found in %s",
                          XML_CIB_TAG_NVPAIR, attr_id, attr_name,
                          crm_element_name(xml_obj));
-               return cib_NOTEXISTS;
-       }
-       xml_obj = xml_next;
-       
-       if(crm_element_value(xml_obj, XML_NVPAIR_ATTR_VALUE) != NULL) {
+
+       } else if(crm_element_value(xml_next, XML_NVPAIR_ATTR_VALUE) != NULL) {
                *attr_value = crm_element_value_copy(
-                       xml_obj, XML_NVPAIR_ATTR_VALUE);
+                       xml_next, XML_NVPAIR_ATTR_VALUE);
        }
        
+       crm_free(local_attr_id);
        free_xml(fragment);
-       return cib_ok;
+
+       return xml_next == NULL?cib_NOTEXISTS:cib_ok;
 }
 
 
@@ -285,7 +315,10 @@
        char *tmp = NULL;
        enum cib_errors rc = cib_ok;
        crm_data_t *xml_obj = NULL;
-
+       const char *tag = NULL;
+       
+       attr_common_setup(section);
+       
        rc = read_attr(the_cib, section, node_uuid, set_name,
                       attr_id, attr_name, &tmp);
 
@@ -295,6 +328,7 @@
        } else if(attr_value != NULL
                  && safe_str_neq(attr_value, tmp)) {
                crm_free(tmp);
+               crm_free(local_attr_id);
                return cib_NOTEXISTS;
        }
        crm_free(tmp);
@@ -308,6 +342,7 @@
                the_cib, section, xml_obj, NULL,
                cib_sync_call|cib_quorum_override);
 
+       crm_free(local_attr_id);
        free_xml(xml_obj);
        return rc;
 }
@@ -436,8 +471,7 @@
        } else {                                                        \
                crm_malloc0(attr_id, str_length);                       \
                sprintf(attr_id, "%s-%s", attr_name, uuid);             \
-       }                                                               \
-       set_name = crm_strdup(attr_id);
+       }
 
 enum cib_errors 
 query_standby(cib_t *the_cib, const char *uuid, const char *scope,




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

Message: 3
Date: Fri,  7 Apr 2006 08:10:17 -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/test


Modified Files:
        helper.sh.in 


Log Message:
fill in an id

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/test/helper.sh.in,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -3 -r1.76 -r1.77
--- helper.sh.in        4 Apr 2006 13:06:10 -0000       1.76
+++ helper.sh.in        7 Apr 2006 14:10:16 -0000       1.77
@@ -403,7 +403,7 @@
     fi
     node_xml="$node_xml >";
     if [ ! -z "$args" -a "x$args" != "x-" ]; then
-       node_xml="$node_xml <instance_attributes> <attributes>${args} 
</attributes> </instance_attributes>"
+       node_xml="$node_xml <instance_attributes id=\\\"${id}\\\"> 
<attributes>${args} </attributes> </instance_attributes>"
     fi
     node_xml="$node_xml </primitive>";
     




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

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

Reply via email to