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


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

Message: 1
Date: Sat, 27 May 2006 18:54:20 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: heartbeat by zhenh from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

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

Dir     : linux-ha/heartbeat


Modified Files:
        heartbeat.c 


Log Message:
add message handlers for setting the weight and site of node
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/heartbeat/heartbeat.c,v
retrieving revision 1.509
retrieving revision 1.510
diff -u -3 -r1.509 -r1.510
--- heartbeat.c 11 May 2006 17:45:35 -0000      1.509
+++ heartbeat.c 28 May 2006 00:54:19 -0000      1.510
@@ -1,4 +1,4 @@
-/* $Id: heartbeat.c,v 1.509 2006/05/11 17:45:35 alan Exp $ */
+/* $Id: heartbeat.c,v 1.510 2006/05/28 00:54:19 zhenh Exp $ */
 /*
  * heartbeat: Linux-HA heartbeat code
  *
@@ -2458,6 +2458,58 @@
        return;
 }
 
+static void
+HBDoMsg_T_SETWEIGHT(const char * type, struct node_info * fromnode,
+                 TIME_T msgtime, seqno_t seqno, const char * iface, struct 
ha_msg * msg)
+{
+       const char*     node;
+       int             weight;
+
+       node =  ha_msg_value(msg, F_NODE);
+       if (node == NULL){
+               cl_log(LOG_ERR, "%s: node not found in msg",                   
+                      __FUNCTION__);
+               cl_log_message(LOG_INFO, msg);
+               return ;
+       }
+       if (ha_msg_value_int(msg, F_WEIGHT, &weight) != HA_OK){                 
+               cl_log(LOG_ERR, "%s: weight not found in msg",                 
+                      __FUNCTION__);
+               cl_log_message(LOG_INFO, msg);
+               return ;
+       }
+       if (set_node_weight(node, weight) == HA_OK) {
+               G_main_set_trigger(write_hostcachefile);
+       }
+       return;
+}
+
+static void
+HBDoMsg_T_SETSITE(const char * type, struct node_info * fromnode,
+                 TIME_T msgtime, seqno_t seqno, const char * iface, struct 
ha_msg * msg)
+{
+       const char*     node;
+       const char*     site;
+
+       node =  ha_msg_value(msg, F_NODE);
+       if (node == NULL){
+               cl_log(LOG_ERR, "%s: node not found in msg",                   
+                      __FUNCTION__);
+               cl_log_message(LOG_INFO, msg);
+               return ;
+       }
+       site =  ha_msg_value(msg, F_SITE);
+       if (node == NULL){
+               cl_log(LOG_ERR, "%s: site not found in msg",                   
+                      __FUNCTION__);
+               cl_log_message(LOG_INFO, msg);
+               return ;
+       }
+       if (set_node_site(node, site) == HA_OK) {
+               G_main_set_trigger(write_hostcachefile);
+       }
+       return;
+}
 
 static int
 hb_remove_one_node(const char* node, int deletion)
@@ -4554,6 +4606,8 @@
        hb_register_msg_callback(T_QCSTATUS,    HBDoMsg_T_QCSTATUS);
        hb_register_msg_callback(T_ACKMSG,      HBDoMsg_T_ACKMSG);
        hb_register_msg_callback(T_ADDNODE,     HBDoMsg_T_ADDNODE);
+       hb_register_msg_callback(T_SETWEIGHT,   HBDoMsg_T_SETWEIGHT);
+       hb_register_msg_callback(T_SETSITE,     HBDoMsg_T_SETSITE);
        hb_register_msg_callback(T_DELNODE,     HBDoMsg_T_DELNODE);
        hb_register_msg_callback(T_REQNODES,    HBDoMsg_T_REQNODES);
        hb_register_msg_callback(T_REPNODES,    HBDoMsg_T_REPNODES);
@@ -6293,6 +6347,9 @@
 
 /*
  * $Log: heartbeat.c,v $
+ * Revision 1.510  2006/05/28 00:54:19  zhenh
+ * add message handlers for setting the weight and site of node
+ *
  * Revision 1.509  2006/05/11 17:45:35  alan
  * Modified a recent patch to a Coverity problem, to eliminate a possible 
infinite loop
  *




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

Message: 2
Date: Sat, 27 May 2006 18:56:57 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: include by zhenh from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : zhenh
Host    : 
Project : linux-ha
Module  : include

Dir     : linux-ha/include


Modified Files:
        hb_api.h hb_api_core.h 


Log Message:
add api for setting the weight and site of node
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/include/hb_api.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -3 -r1.46 -r1.47
--- hb_api.h    26 May 2006 02:55:28 -0000      1.46
+++ hb_api.h    28 May 2006 00:56:57 -0000      1.47
@@ -1,4 +1,4 @@
-/* $Id: hb_api.h,v 1.46 2006/05/26 02:55:28 zhenh Exp $ */
+/* $Id: hb_api.h,v 1.47 2006/05/28 00:56:57 zhenh Exp $ */
 /*
  * Client-side Low-level clustering API for heartbeat.
  *
@@ -157,6 +157,17 @@
  *     node_status:    Return most recent heartbeat status of the given node
  */
        const char *    (*node_status)(ll_cluster_t*, const char * nodename);
+
+/*
+ *     node_status:    Return the weight of the given node
+ */
+       int             (*node_weight)(ll_cluster_t*, const char * nodename);
+
+/*
+ *     node_status:    Return the site of the given node
+ */
+       const char *    (*node_site)(ll_cluster_t*, const char * nodename);
+
 /*
  *     node_type:      Return type of the given node
  */
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/include/hb_api_core.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- hb_api_core.h       7 Feb 2006 17:18:24 -0000       1.18
+++ hb_api_core.h       28 May 2006 00:56:57 -0000      1.19
@@ -1,4 +1,4 @@
-/* $Id: hb_api_core.h,v 1.18 2006/02/07 17:18:24 alan Exp $ */
+/* $Id: hb_api_core.h,v 1.19 2006/05/28 00:56:57 zhenh Exp $ */
 /*
  * hb_api_core_h: Internal definitions and functions for the heartbeat API
  *
@@ -113,6 +113,8 @@
 #      define  F_NODENAME      "node"
 #define        API_NODELIST_END        "nodelist-end"
 #define        API_NODESTATUS          "nodestatus"
+#define        API_NODEWEIGHT          "nodeweight"
+#define        API_NODESITE            "nodesite"
 #define        API_NODETYPE            "nodetype"
 #define        API_NUMNODES            "numnodes"
 




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

Message: 3
Date: Sat, 27 May 2006 18:56:58 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: heartbeat by zhenh from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

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

Dir     : linux-ha/heartbeat


Modified Files:
        hb_api.c 


Log Message:
add api for setting the weight and site of node
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/heartbeat/hb_api.c,v
retrieving revision 1.153
retrieving revision 1.154
diff -u -3 -r1.153 -r1.154
--- hb_api.c    10 Feb 2006 13:19:54 -0000      1.153
+++ hb_api.c    28 May 2006 00:56:57 -0000      1.154
@@ -1,4 +1,4 @@
-/* $Id: hb_api.c,v 1.153 2006/02/10 13:19:54 alan Exp $ */
+/* $Id: hb_api.c,v 1.154 2006/05/28 00:56:57 zhenh Exp $ */
 /*
  * hb_api: Server-side heartbeat API code
  *
@@ -110,6 +110,12 @@
 static int api_nodestatus (const struct ha_msg* msg, struct ha_msg* resp
 ,      client_proc_t* client, const char** failreason);
 
+static int api_nodeweight (const struct ha_msg* msg, struct ha_msg* resp
+,      client_proc_t* client, const char** failreason);
+
+static int api_nodesite (const struct ha_msg* msg, struct ha_msg* resp
+,      client_proc_t* client, const char** failreason);
+
 static int api_nodetype (const struct ha_msg* msg, struct ha_msg* resp
 ,      client_proc_t* client, const char** failreason);
 
@@ -149,6 +155,8 @@
        { API_SETSIGNAL, api_setsignal },
        { API_NODELIST, api_nodelist },
        { API_NODESTATUS, api_nodestatus },
+       { API_NODEWEIGHT, api_nodeweight },
+       { API_NODESITE, api_nodesite },
        { API_NODETYPE, api_nodetype },
        { API_IFSTATUS, api_ifstatus },
        { API_IFLIST, api_iflist },
@@ -614,6 +622,55 @@
 }
 
 /**********************************************************************
+ * API_NODEWEIGHT: Return the weight of the given node
+ *********************************************************************/
+
+static int
+api_nodeweight(const struct ha_msg* msg, struct ha_msg* resp
+,      client_proc_t* client, const char** failreason)
+{
+       const char *            cnode;
+       struct node_info *      node;
+
+       if ((cnode = ha_msg_value(msg, F_NODENAME)) == NULL
+       || (node = lookup_node(cnode)) == NULL) {
+               *failreason = "EINVAL";
+               return I_API_BADREQ;
+       }
+       
+       if (ha_msg_add_int(resp, F_WEIGHT, node->weight) != HA_OK) {
+               cl_log(LOG_ERR
+               ,       "api_nodeweight: cannot add field");
+               return I_API_IGN;
+       }
+       return I_API_RET;
+}
+
+/**********************************************************************
+ * API_NODESITE: Return the site of the given node
+ *********************************************************************/
+
+static int
+api_nodesite(const struct ha_msg* msg, struct ha_msg* resp
+,      client_proc_t* client, const char** failreason)
+{
+       const char *            cnode;
+       struct node_info *      node;
+
+       if ((cnode = ha_msg_value(msg, F_NODENAME)) == NULL
+       || (node = lookup_node(cnode)) == NULL) {
+               *failreason = "EINVAL";
+               return I_API_BADREQ;
+       }
+       if (ha_msg_add(resp, F_SITE, node->site) != HA_OK) {
+               cl_log(LOG_ERR
+               ,       "api_nodesite: cannot add field");
+               return I_API_IGN;
+       }
+       return I_API_RET;
+}
+
+/**********************************************************************
  * API_NODETYPE: Return the type of the given node
  *********************************************************************/
 




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

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

Reply via email to