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


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

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

linux-ha CVS committal

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

Dir     : linux-ha/lib/hbclient


Modified Files:
        client_lib.c 


Log Message:
add functions for setting the weight and site of node in hb client lib
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/hbclient/client_lib.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -3 -r1.40 -r1.41
--- client_lib.c        10 May 2006 19:14:49 -0000      1.40
+++ client_lib.c        28 May 2006 00:57:55 -0000      1.41
@@ -1,4 +1,4 @@
-/* $Id: client_lib.c,v 1.40 2006/05/10 19:14:49 lars Exp $ */
+/* $Id: client_lib.c,v 1.41 2006/05/28 00:57:55 zhenh Exp $ */
 /* 
  * client_lib: heartbeat API client side code
  *
@@ -190,6 +190,8 @@
 static const char * nextnode (ll_cluster_t* ci);
 static int init_ifwalk (ll_cluster_t* ci, const char * host);
 static const char *    get_nodestatus(ll_cluster_t*, const char *host);
+static int             get_nodeweight(ll_cluster_t*, const char *host);
+static const char *    get_nodesite(ll_cluster_t*, const char *host);
 static const char *
 get_clientstatus(ll_cluster_t*, const char *host, const char *clientid
 ,      int timeout);
@@ -824,6 +826,128 @@
 
        return ret;
 }
+
+/*
+ * Return the weight of the given node.
+ */
+
+static int
+get_nodeweight(ll_cluster_t* lcl, const char *host)
+{
+       struct ha_msg*          request;
+       struct ha_msg*          reply;
+       const char *            result;
+       const char *            weight_s;
+       int                     ret;
+       llc_private_t*          pi;
+
+       ClearLog();
+       if (!ISOURS(lcl)) {
+               ha_api_log(LOG_ERR, "get_nodeweight: bad cinfo");
+               return -1;
+       }
+       pi = (llc_private_t*)lcl->ll_cluster_private;
+
+       if (!pi->SignedOn) {
+               ha_api_log(LOG_ERR, "not signed on");
+               return -1;
+       }
+
+       if ((request = hb_api_boilerplate(API_NODEWEIGHT)) == NULL) {
+               return -1;
+       }
+       if (ha_msg_add(request, F_NODENAME, host) != HA_OK) {
+               ha_api_log(LOG_ERR, "get_nodeweight: cannot add field");
+               ZAPMSG(request);
+               return -1;
+       }
+
+       /* Send message */
+       if (msg2ipcchan(request, pi->chan) != HA_OK) {
+               ZAPMSG(request);
+               ha_api_perror("Can't send message to IPC Channel");
+               return -1;
+       }
+       ZAPMSG(request);
+
+       /* Read reply... */
+       if ((reply=read_api_msg(pi)) == NULL) {
+               return -1;
+       }
+       if ((result = ha_msg_value(reply, F_APIRESULT)) != NULL
+       &&      strcmp(result, API_OK) == 0
+       &&      (weight_s = ha_msg_value(reply, F_WEIGHT)) != NULL) {
+               ret = atoi(weight_s);
+       }else{
+               ret = -1;
+       }
+       ZAPMSG(reply);
+
+       return ret;
+}
+
+/*
+ * Return the site of the given node.
+ */
+
+static const char *
+get_nodesite(ll_cluster_t* lcl, const char *host)
+{
+       struct ha_msg*          request;
+       struct ha_msg*          reply;
+       const char *            result;
+       const char *            site;
+       static char             sitebuf[HOSTLENG];
+       const char *            ret;
+       llc_private_t*          pi;
+
+       ClearLog();
+       if (!ISOURS(lcl)) {
+               ha_api_log(LOG_ERR, "get_nodesite: bad cinfo");
+               return NULL;
+       }
+       pi = (llc_private_t*)lcl->ll_cluster_private;
+
+       if (!pi->SignedOn) {
+               ha_api_log(LOG_ERR, "not signed on");
+               return NULL;
+       }
+
+       if ((request = hb_api_boilerplate(API_NODESITE)) == NULL) {
+               return NULL;
+       }
+       if (ha_msg_add(request, F_NODENAME, host) != HA_OK) {
+               ha_api_log(LOG_ERR, "get_nodesite: cannot add field");
+               ZAPMSG(request);
+               return NULL;
+       }
+
+       /* Send message */
+       if (msg2ipcchan(request, pi->chan) != HA_OK) {
+               ZAPMSG(request);
+               ha_api_perror("Can't send message to IPC Channel");
+               return NULL;
+       }
+       ZAPMSG(request);
+
+       /* Read reply... */
+       if ((reply=read_api_msg(pi)) == NULL) {
+               return NULL;
+       }
+       if ((result = ha_msg_value(reply, F_APIRESULT)) != NULL
+       &&      strcmp(result, API_OK) == 0
+       &&      (site = ha_msg_value(reply, F_SITE)) != NULL) {
+                memset(sitebuf, 0, sizeof(sitebuf));
+               strncpy(sitebuf, site, sizeof(sitebuf) - 1);
+               ret = sitebuf;
+       }else{
+               ret = NULL;
+       }
+       ZAPMSG(reply);
+
+       return ret;
+}
+
 /*
 * Return the status of the given client.
 */
@@ -3089,6 +3213,8 @@
        nextnode:               nextnode,               
        end_nodewalk:           end_nodewalk,           
        node_status:            get_nodestatus,         
+       node_weight:            get_nodeweight,         
+       node_site:              get_nodesite,           
        node_type:              get_nodetype,   
        num_nodes:              get_num_nodes,
        init_ifwalk:            init_ifwalk,            




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

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

linux-ha CVS committal

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

Dir     : linux-ha/tools


Modified Files:
        cl_status.c 


Log Message:
let cl_status support the weight and site of node
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/tools/cl_status.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- cl_status.c 23 Sep 2005 15:53:26 -0000      1.21
+++ cl_status.c 28 May 2006 01:00:58 -0000      1.22
@@ -104,6 +104,20 @@
 
 /*
  * Return Value:
+ *     the weight of the node
+ */
+static int
+nodeweight(ll_cluster_t *hb, int argc, char ** argv, const char * optstr);
+
+/*
+ * Return Value:
+ *     the site of the node
+ */
+static int
+nodesite(ll_cluster_t *hb, int argc, char ** argv, const char * optstr);
+
+/*
+ * Return Value:
  *     0: normal
  *     1: ping
  *     3: unknown type
@@ -179,6 +193,8 @@
        { "hbstatus",      hbstatus,      "m" ,         FALSE},
        { "listnodes",     listnodes,     "mpn",        TRUE},
        { "nodestatus",    nodestatus,    "m",          TRUE},
+       { "nodeweight",    nodeweight,    "m",          TRUE},
+       { "nodesite",      nodesite,      "m",          TRUE},
        { "nodetype",      nodetype,      "m",          TRUE },
        { "listhblinks",   listhblinks,   "m",          TRUE },
        { "hblinkstatus",  hblinkstatus,  "m",          TRUE },
@@ -208,6 +224,10 @@
 "              -n      list only 'normal' type nodes\n"
 "nodestatus <node-name>\n"
 "      List the node status.\n"
+"nodeweight <node-name>\n"
+"      List the node weight.\n"
+"nodesite <node-name>\n"
+"      List the node site.\n"
 "nodetype <node-name>\n"
 "      List the nodes of a given type.\n"
 "rscstatus\n"
@@ -448,6 +468,75 @@
        
        return ret;
 }
+static int 
+nodeweight(ll_cluster_t *hb, int argc, char ** argv, const char * optstr)
+{
+       int     weight;
+       int     ret = UNKNOWN_ERROR;
+
+       if ( general_simple_opt_deal(argc, argv, optstr) < 0 ) {
+               /* There are option errors */
+               return PARAMETER_ERROR;
+       };
+
+       if (argc <= optind+1) {
+               fprintf(stderr, "Not enough parameters.\n");
+               return PARAMETER_ERROR;
+       }
+
+       cl_log(LOG_DEBUG, "optind: %d   argv[optindex+1]: %s", optind, 
+               argv[optind+1]);
+       weight = hb->llc_ops->node_weight(hb, argv[optind+1]);
+       if ( weight == -1 ) {
+               fprintf(stderr, "Error. May be due to incorrect node name\n");
+               return PARAMETER_ERROR;
+       }
+       if (FOR_HUMAN_READ == TRUE) {
+               printf("The weight of the cluster node %s is %d\n", 
argv[optind+1], weight);
+       } else {
+               printf("%d\n", weight);
+       }
+
+       if (weight != -1) {
+               ret = OK; 
+       } else {
+               ret = NORMAL_FAIL;  
+       }
+       
+       return ret;
+}
+/* Map string std_output to return value ? 
+ * Active
+ */
+static int 
+nodesite(ll_cluster_t *hb, int argc, char ** argv, const char * optstr)
+{
+       const char *    site;
+
+       if ( general_simple_opt_deal(argc, argv, optstr) < 0 ) {
+               /* There are option errors */
+               return PARAMETER_ERROR;
+       };
+
+       if (argc <= optind+1) {
+               fprintf(stderr, "Not enough parameters.\n");
+               return PARAMETER_ERROR;
+       }
+
+       cl_log(LOG_DEBUG, "optind: %d   argv[optindex+1]: %s", optind, 
+               argv[optind+1]);
+       site = hb->llc_ops->node_site(hb, argv[optind+1]);
+       if ( site == NULL ) {
+               fprintf(stderr, "Error. May be due to incorrect node name\n");
+               return PARAMETER_ERROR;
+       }
+       if (FOR_HUMAN_READ == TRUE) {
+               printf("The site of the cluster node %s is %s\n", 
argv[optind+1], site);
+       } else {
+               printf("%s\n", site);
+       }
+       return  OK;
+}
 
 /* Map string std_output to return value ? No
  * NORMAL PING UNKNOWN




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

Message: 3
Date: Sun, 28 May 2006 01:03:41 -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:
        utils.c 


Log Message:
Put the assingment back after the declaration was moved out of the loop. 

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/crm/common/utils.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -3 -r1.53 -r1.54
--- utils.c     26 May 2006 08:46:07 -0000      1.53
+++ utils.c     28 May 2006 07:03:37 -0000      1.54
@@ -1,4 +1,4 @@
-/* $Id: utils.c,v 1.53 2006/05/26 08:46:07 davidlee Exp $ */
+/* $Id: utils.c,v 1.54 2006/05/28 07:03:37 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -1145,6 +1145,7 @@
        }
        
        xml_prop_iter(param_set, prop_name, prop_value,      
+                     do_delete = FALSE;
                      if(strncasecmp(prop_name, CRM_META, meta_len) == 0) {
                              do_delete = TRUE;
                      }




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

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

Reply via email to