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: cim by panjiam from 
      ([email protected])
   2. Linux-HA CVS: cim by panjiam from 
      ([email protected])
   3. Linux-HA CVS: heartbeat by alan from 
      ([email protected])


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

Message: 1
Date: Tue, 25 Apr 2006 12:00:15 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: cim by panjiam from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : panjiam
Host    : 
Project : linux-ha
Module  : cim

Dir     : linux-ha/cim/tests


Modified Files:
        ResourceTest.sh 


Log Message:
delete the resource if it already exists
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/tests/ResourceTest.sh,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ResourceTest.sh     25 Apr 2006 17:57:41 -0000      1.4
+++ ResourceTest.sh     25 Apr 2006 18:00:15 -0000      1.5
@@ -121,6 +121,7 @@
 RESOURCE_ID=test_primitive_resource
 ATTRIBUTE_ID=${RESOURCE_ID}_ip
 
+delete_resource HA_PrimitiveResource $RESOURCE_ID 2>/dev/null
 create_primitive_resource "IPaddr" "$RESOURCE_ID"
 create_attribute $RESOURCE_ID $ATTRIBUTE_ID "ip" "127.0.0.111"
 cib_add_resource $RESOURCE_ID
@@ -144,7 +145,7 @@
 #############################################################
 
 GROUP_ID=test_resource_group
-delete_resource HA_ResourceGroup $GROUP_ID
+delete_resource HA_ResourceGroup $GROUP_ID 2>/dev/null
 
 echo "---------------------------------------------------"
 echo "Resource Group Creation test"




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

Message: 2
Date: Tue, 25 Apr 2006 20:25:08 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: cim by panjiam from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : panjiam
Host    : 
Project : linux-ha
Module  : cim

Dir     : linux-ha/cim/tests


Modified Files:
        ResourceTest.sh 


Log Message:
create more attriubutes, and create operation
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/cim/tests/ResourceTest.sh,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- ResourceTest.sh     25 Apr 2006 18:00:15 -0000      1.5
+++ ResourceTest.sh     26 Apr 2006 02:25:07 -0000      1.6
@@ -57,6 +57,24 @@
 Value="$VALUE" > /dev/null
 }
 
+#create its operations
+function create_operation()
+{
+RSC_ID=$1
+OP_ID=$2
+NAME=$3
+INTERVAL=$4
+TIMEOUT=$5
+echo "creating opertion for resource: $RSC_ID, id: $OP_ID, 
$NAME,$INTERVAL,$TIMEOUT."
+wbemcli ci http://$USER:[EMAIL PROTECTED]/root/cimv2:HA_Operation.Id="$OP_ID",\
+ResourceId="$RSC_ID" \
+Id="$OP_ID",\
+ResourceId="$RSC_ID",\
+Name="$NAME",\
+Interval="$INTERVAL",\
+TimeOut="$TIMEOUT" > /dev/null
+}
+
 
 #add to CIB
 function cib_add_resource()
@@ -124,7 +142,10 @@
 delete_resource HA_PrimitiveResource $RESOURCE_ID 2>/dev/null
 create_primitive_resource "IPaddr" "$RESOURCE_ID"
 create_attribute $RESOURCE_ID $ATTRIBUTE_ID "ip" "127.0.0.111"
+create_attribute $RESOURCE_ID ${RESOURCE_ID}_nic "nic" "lo"
 cib_add_resource $RESOURCE_ID
+create_attribute $RESOURCE_ID ${RESOURCE_ID}_netmask "netmask" "255.255.255.0"
+create_operation $RESOURCE_ID ${RESOURCE_ID}_monitor "monitor" "10s" "20s"
 wait_cib_updated
 
 rc=0




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

Message: 3
Date: Tue, 25 Apr 2006 21:42:07 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: heartbeat by alan from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : alan
Host    : 
Project : linux-ha
Module  : heartbeat

Dir     : linux-ha/heartbeat


Modified Files:
        config.c hb_uuid.c heartbeat.c 


Log Message:
Committed a patch from gshi which should GREATLY improve the
behavior of autojoin code.
The basic idea is that anyone newly joining the cluster should listen to anyone 
already in the cluster for the cache file contents, etc.

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/heartbeat/config.c,v
retrieving revision 1.198
retrieving revision 1.199
diff -u -3 -r1.198 -r1.199
--- config.c    24 Apr 2006 04:52:24 -0000      1.198
+++ config.c    26 Apr 2006 03:42:07 -0000      1.199
@@ -1,4 +1,4 @@
-/* $Id: config.c,v 1.198 2006/04/24 04:52:24 alan Exp $ */
+/* $Id: config.c,v 1.199 2006/04/26 03:42:07 alan Exp $ */
 /*
  * Parse various heartbeat configuration files...
  *
@@ -67,6 +67,8 @@
 
 #define        DIRTYALIASKLUDGE
 
+void dellist_destroy(void);
+int dellist_add(const char* nodename);
 
 static int add_normal_node(const char *);
 static int set_hopfudge(const char *);
@@ -1141,8 +1143,58 @@
 }
 
 
+void 
+dellist_destroy(void){
+       
+       GSList* list = del_node_list;
+
+       while (list != NULL){
+               ha_free(list->data);
+               list->data=NULL;
+               list= list->next;
+       }
 
+       g_slist_free(del_node_list);
+       del_node_list = NULL;
+       return;
+}
+
+static void
+dellist_append(struct node_info* hip)
+{
+       struct node_info* dup_hip;
+       
+       dup_hip = ha_malloc(sizeof(struct node_info));
+       if (dup_hip == NULL){
+               cl_log(LOG_ERR, "%s: malloc failed",
+                      __FUNCTION__);
+               return;
+       }
 
+       memcpy(dup_hip, hip, sizeof(struct node_info));
+       
+       del_node_list = g_slist_append(del_node_list, dup_hip);
+       
+       
+}
+int 
+dellist_add(const char* nodename){
+       struct node_info node;
+       int i;
+
+       for (i=0; i < config->nodecount; i++){
+               if (strncmp(nodename, config->nodes[i].nodename,HOSTLENG) == 0){
+                       dellist_append(&config->nodes[i]);
+                       return HA_OK;
+               }
+       }
+       
+       memset(&node, 0, sizeof(struct node_info));
+       strncpy(node.nodename, nodename, HOSTLENG);
+       
+       dellist_append(&node);
+       return HA_OK;
+}
 
 static gint
 dellist_match(gconstpointer data, gconstpointer nodename)
@@ -1174,6 +1226,8 @@
        
 }
 
+
+
 /*
  * For reliability reasons, we should probably require nodename
  * to be in /etc/hosts, so we don't lose our mind if (when) DNS goes out...
@@ -1224,28 +1278,11 @@
        return(HA_OK);
 }
 
-void
-append_to_dellist(struct node_info* hip)
-{
-       struct node_info* dup_hip;
-       
-       dup_hip = ha_malloc(sizeof(struct node_info));
-       if (dup_hip == NULL){
-               cl_log(LOG_ERR, "%s: malloc failed",
-                      __FUNCTION__);
-               return;
-       }
 
-       memcpy(dup_hip, hip, sizeof(struct node_info));
-       
-       del_node_list = g_slist_append(del_node_list, dup_hip);
-       
-       
-}
 
 
 int 
-delete_node(const char* value)
+remove_node(const char* value, int deletion)
 {
        int i;
        struct node_info *      hip = NULL;
@@ -1266,20 +1303,26 @@
        
 
        if (i == config->nodecount){
-               cl_log(LOG_ERR, "%s: node %s not found",
-                      __FUNCTION__, value);
-               return HA_FAIL;
+               if (deletion){
+                       cl_log(LOG_DEBUG,"Adding node(%s) to deletion list", 
value);
+                       dellist_add(value);
+               }       
+               
+               return HA_OK;
        }
 
        
        if (STRNCMP_CONST(hip->status, DEADSTATUS) != 0
            && STRNCMP_CONST(hip->status, INITSTATUS) != 0){
-               cl_log(LOG_ERR, "%s: node %s is %s. Cannot delete alive node",
+               cl_log(LOG_ERR, "%s: node %s is %s. Cannot remove alive node",
                       __FUNCTION__, value, hip->status);
                return HA_FAIL;
        }
        
-       append_to_dellist(hip);
+       if (deletion){
+               cl_log(LOG_DEBUG,"Adding this node to deletion list");
+               dellist_append(hip);
+       }
 
        for (j = i; j < config->nodecount; j++){
                memcpy(&config->nodes[j], &config->nodes[j + 1], 
@@ -2530,6 +2573,11 @@
 
 /*
  * $Log: config.c,v $
+ * Revision 1.199  2006/04/26 03:42:07  alan
+ * Committed a patch from gshi which should GREATLY improve the
+ * behavior of autojoin code.
+ * The basic idea is that anyone newly joining the cluster should listen to 
anyone already in the cluster for the cache file contents, etc.
+ *
  * Revision 1.198  2006/04/24 04:52:24  alan
  * Disabled traditional compression because of realtime concerns.
  *
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/heartbeat/hb_uuid.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- hb_uuid.c   24 Apr 2006 00:00:05 -0000      1.23
+++ hb_uuid.c   26 Apr 2006 03:42:07 -0000      1.24
@@ -705,16 +705,15 @@
        
        if ((f=fopen(filename, "r")) == NULL) {
                cl_perror("%s: Cannot fopen %s for reading"
-               ,       __FUNCTION__, filename);
+                         ,     __FUNCTION__, filename);
                return HA_FAIL;
        }
        
        while ((rc=node_uuid_file_in(f, host, &uu)) > 0) {
                strncpy(thisnode.nodename, host, HOSTLENG);
                cl_uuid_copy(&thisnode.uuid, &uu);
-               if (lookup_node(thisnode.nodename)){
-                       delete_node(thisnode.nodename);
-                }
+
+               remove_node(thisnode.nodename, TRUE);
 
        }
        fclose(f);
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/heartbeat/heartbeat.c,v
retrieving revision 1.505
retrieving revision 1.506
diff -u -3 -r1.505 -r1.506
--- heartbeat.c 23 Apr 2006 20:02:10 -0000      1.505
+++ heartbeat.c 26 Apr 2006 03:42:07 -0000      1.506
@@ -1,4 +1,4 @@
-/* $Id: heartbeat.c,v 1.505 2006/04/23 20:02:10 alan Exp $ */
+/* $Id: heartbeat.c,v 1.506 2006/04/26 03:42:07 alan Exp $ */
 /*
  * heartbeat: Linux-HA heartbeat code
  *
@@ -340,6 +340,7 @@
 static int                     WikiOutput = FALSE;
 GTRIGSource*                   write_hostcachefile = NULL;
 GTRIGSource*                   write_delcachefile = NULL;
+extern GSList*                 del_node_list;
 
 
 #undef DO_AUDITXMITHIST
@@ -459,6 +460,10 @@
                /* The REAL biggie ;-) */
 static void    master_control_process(void);
 
+extern void    dellist_destroy(void);
+extern int     dellist_add(const char* nodename);
+
+
 #define        CHECK_HA_RESOURCES()    (DoManageResources              \
                 ?      (parse_ha_resources(RESOURCE_CFG) == HA_OK) : TRUE)
 
@@ -2455,13 +2460,13 @@
 
 
 static int
-hb_del_one_node(const char* node)
+hb_remove_one_node(const char* node, int deletion)
 {
        struct node_info* thisnode = NULL;
-       struct ha_msg* delmsg;
+       struct ha_msg* removemsg;
        
        cl_log(LOG_INFO,
-              "Deleting node [%s] from configuration.",
+              "Removing node [%s] from configuration.",
               node);
        
        thisnode = lookup_node(node);
@@ -2471,25 +2476,25 @@
                return HA_FAIL;
        }
        
-       if (delete_node(node) != HA_OK){
+       if (remove_node(node, deletion) != HA_OK){
                cl_log(LOG_ERR, "%s: Deleting node(%s) failed",
                       __FUNCTION__, node);
                return HA_FAIL;
        }
        
-       delmsg = ha_msg_new(0);
-       if (delmsg == NULL){
+       removemsg = ha_msg_new(0);
+       if (removemsg == NULL){
                cl_log(LOG_ERR, "%s: creating new message failed",__FUNCTION__);
                return HA_FAIL;
        }
        
-       if ( ha_msg_add(delmsg, F_TYPE, T_DELNODE)!= HA_OK
-            || ha_msg_add(delmsg, F_NODE, node) != HA_OK){
+       if ( ha_msg_add(removemsg, F_TYPE, T_DELNODE)!= HA_OK
+            || ha_msg_add(removemsg, F_NODE, node) != HA_OK){
                cl_log(LOG_ERR, "%s: adding fields to msg failed", 
__FUNCTION__);
                return HA_FAIL;
        }
 
-       heartbeat_monitor(delmsg, KEEPIT, NULL);
+       heartbeat_monitor(removemsg, KEEPIT, NULL);
        reset_lowest_acknode();
        return HA_OK;
        
@@ -2560,7 +2565,7 @@
                        return;
                }
 
-               if (hb_del_one_node(nodes[i])!= HA_OK){
+               if (hb_remove_one_node(nodes[i], TRUE)!= HA_OK){
                        cl_log(LOG_ERR, "Deleting node %s failed", nodes[i]);
                }
        }
@@ -2572,6 +2577,7 @@
        }
        
        write_delnode_file(config);
+       write_cache_file(config);
        G_main_set_trigger(write_delcachefile);
        
        return ;
@@ -2593,20 +2599,67 @@
                numleft -= tmplen;
                if (tmplen <= 0){
                        cl_log(LOG_ERR, "%s: not enough buffer", 
-                               __FUNCTION__);
+                              __FUNCTION__);
                        return HA_FAIL;
                }
        }
-
+       
        return HA_OK;
 
 }
 
+static int
+get_delnodelist(char* delnodelist, int len)
+{
+       char* p = delnodelist;
+       int numleft = len;
+       GSList* list = NULL;
+
+       if (del_node_list == NULL){
+               delnodelist[0]= ' ';
+               delnodelist[1]=0;
+               goto out;
+       }
+       
+       list = del_node_list;
+
+       while( list){
+               struct node_info* hip;
+               int tmplen; 
+               
+               hip = (struct node_info*)list->data;
+               if (hip == NULL){
+                       cl_log(LOG_ERR, "%s: null data in del node list",
+                              __FUNCTION__);
+                       return HA_FAIL;
+               }
+               
+               tmplen = snprintf(p, numleft,  "%s ", hip->nodename);
+               if (tmplen <= 0){
+                       cl_log(LOG_ERR, "%s: not enough buffer", 
+                              __FUNCTION__);
+                       return HA_FAIL;
+               }
+               
+               p += tmplen;
+               numleft -=tmplen;
+
+               list = list->next;
+       }
+       
+ out: 
+       cl_log(LOG_DEBUG, "%s: delnodelist=%s", __FUNCTION__,  delnodelist);
+       
+       return HA_OK;
+}
+
+
 static void
 HBDoMsg_T_REQNODES(const char * type, struct node_info * fromnode,
                   TIME_T msgtime, seqno_t seqno, const char * iface, struct 
ha_msg * msg)
 {
        char nodelist[MAXLINE];
+       char delnodelist[MAXLINE];
        struct ha_msg* repmsg;
        
        if (fromnode == curnode){
@@ -2618,19 +2671,23 @@
        if (ANYDEBUG){
                cl_log(LOG_DEBUG, "Get a reqnodes message from %s", 
fromnode->nodename);
        }
-       if (get_nodelist(nodelist, MAXLINE) != HA_OK){
-               cl_log(LOG_ERR, "%s: get node list from config failed",
+       
+       if (get_nodelist(nodelist, MAXLINE) != HA_OK
+           || get_delnodelist(delnodelist, MAXLINE) != HA_OK){
+               cl_log(LOG_ERR, "%s: get node list or del node list from config 
failed",
                       __FUNCTION__);
                return;
        }
 
+       
        repmsg = ha_msg_new(0);
        if ( repmsg == NULL
        || ha_msg_add(repmsg, F_TO, fromnode->nodename) != HA_OK
        || ha_msg_add(repmsg, F_TYPE, T_REPNODES) != HA_OK
-       || ha_msg_add(repmsg, F_NODELIST, nodelist) != HA_OK){
+       || ha_msg_add(repmsg, F_NODELIST, nodelist) != HA_OK
+       || ha_msg_add(repmsg, F_DELNODELIST, delnodelist) != HA_OK){
                cl_log(LOG_ERR, "%s: constructing REPNODES msg failed",
-                       __FUNCTION__);
+                      __FUNCTION__);
                ha_msg_del(repmsg);
                return; 
        } 
@@ -2644,8 +2701,11 @@
                   TIME_T msgtime, seqno_t seqno, const char * iface, struct 
ha_msg * msg)
 {
        const char* nodelist = ha_msg_value(msg, F_NODELIST);
+       const char* delnodelist = ha_msg_value(msg, F_DELNODELIST);
        char*   nodes[MAXNODE];
+       char*   delnodes[MAXNODE];
        int     num =  MAXNODE;
+       int     delnum = MAXNODE;
        int     i;
        int     j;
 
@@ -2670,52 +2730,80 @@
                        __FUNCTION__);
                return;
        }
+       
+       if (getnodes(delnodelist, delnodes, &delnum) != HA_OK){        
+               cl_log(LOG_ERR, "%s: get del nodes from nodelist failed",
+                       __FUNCTION__);
+               return;
+       }
 
-#if 0
-       /* This truly is broken... -- gshi and alanr agree */
-       /* FIXME FIXME FIXME */
+       /* term definition*/
+       /* added: a node in config->nodes[] 
+          deleted: a node in del_node_list
+          removed: remove a node either from config->nodes[] or del_node_list
+       */
 
+
+
+       /* process delnodelist*/
+       /* update our del node list to be the exact same list as the received 
one
+        */
+       
+       dellist_destroy();
+       for (i = 0; i < delnum; i++){
+               dellist_add(delnodes[i]);
+       }       
+       
+
+
+       /* process nodelist*/
+       /* our local node list is outdated
+        * any node that is in nodelist but not in local node list should be 
added
+        * any node that is in local node list but not in nodelist should be 
removed
+        * (but not deleted)
+        */
+       if (ANYDEBUG){
+               cl_log(LOG_DEBUG, "nodelist received:%s", nodelist);
+               cl_log(LOG_DEBUG, "delnodelist received:%s", delnodelist);
+       }
+       for (i =0; i < num; i++){
+               for (j = 0; j < config->nodecount; j++){
+                       if (strncmp(nodes[i], config->nodes[j].nodename,
+                                   HOSTLENG) == 0){
+                               break;
+                       }
+               }
+               if ( j == config->nodecount){
+                       /*this node is not found in config
+                        * we need to add it 
+                        */
+                       hb_add_one_node(nodes[i]);              
+               }
+       }
+       
        for (i =0; i < config->nodecount; i++){
                for (j=0;j < num; j++){
                        if ( strncmp(config->nodes[i].nodename,
-                               nodes[j], HOSTLENG) == 0){
+                                    nodes[j], HOSTLENG) == 0){
                                break;
                        }       
                }
                if (j == num){
                        /* This node is not found in incoming nodelist,
-                        * therefore, we need to delete it.
+                        * therefore, we need to remove it from config->nodes[]
                         *
                         * Of course, this assumes everyone has correct node
                         * lists - which may not be the case :-(  FIXME???
                         * And it assumes autojoin is on - which it may
                         * not be...
                         */
-                       cl_log(LOG_ERR, "%s: Node %s is deleted"
-                       " (according to %s) and we don't know it!"
-                       ,       __FUNCTION__, config->nodes[i].nodename
-                       ,       fromnode->nodename);
-                       hb_del_one_node(config->nodes[i].nodename);
+                       hb_remove_one_node(config->nodes[i].nodename, FALSE);
                        
                }
        }
-#endif
 
-       for (i =0; i < num; i++){
-               for (j = 0; j < config->nodecount; j++){
-                       if (strncmp(nodes[i], config->nodes[j].nodename,
-                               HOSTLENG) == 0){
-                               break;
-                       }
-               }
-               if ( j == config->nodecount){
-                       /*this node is not found in config
-                       * we need to add it 
-                       */
-                       hb_add_one_node(nodes[i]);              
-               }
-       }       
 
+       
        for (i = 0; i< num; i++){
                if (nodes[i]){
                        ha_free(nodes[i]);
@@ -2723,7 +2811,16 @@
                }
        }
 
+       for (i = 0; i < delnum; i++){
+               if (delnodes[i]){
+                       ha_free(delnodes[i]);
+                       delnodes[i] = NULL;
+               }
+       }
+
        get_reqnodes_reply = TRUE;
+       write_cache_file(config);
+       write_delnode_file(config);
        comm_now_up();
         return;
 }
@@ -6185,6 +6282,11 @@
 
 /*
  * $Log: heartbeat.c,v $
+ * Revision 1.506  2006/04/26 03:42:07  alan
+ * Committed a patch from gshi which should GREATLY improve the
+ * behavior of autojoin code.
+ * The basic idea is that anyone newly joining the cluster should listen to 
anyone already in the cluster for the cache file contents, etc.
+ *
  * Revision 1.505  2006/04/23 20:02:10  alan
  * Disabled a message put in to give me confidence a recent change.
  *




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

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

Reply via email to