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


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

Message: 1
Date: Mon, 15 May 2006 02:47:28 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: lib by sunjd from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

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

Dir     : linux-ha/lib/plugins/lrm


Modified Files:
        raexecstonith.c 


Log Message:
Add more information to the metadata of a STONITH RA

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/plugins/lrm/raexecstonith.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- raexecstonith.c     11 May 2006 10:48:52 -0000      1.16
+++ raexecstonith.c     15 May 2006 08:47:27 -0000      1.17
@@ -87,30 +87,37 @@
        get_resource_meta
 };
 
-static const char * meta_data1 =
+static const char * const meta_template = 
 "<?xml version=\"1.0\"?>\n"
 "<!DOCTYPE resource-agent SYSTEM \"ra-api-1.dtd\">\n"
-"<resource-agent name=\"";
-
-static const char * meta_data2 = 
-"\" version=\"0.1\">\n"
-"  <version>1.0</version>\n";
-
-static const char * meta_data3 = 
-"  <actions>\n"
-"    <action name=\"start\"   timeout=\"15\" />\n"
-"    <action name=\"stop\"    timeout=\"15\" />\n"
-"    <action name=\"status\"  timeout=\"15\" />\n"
-"    <action name=\"monitor\" timeout=\"15\" interval=\"15\" 
start-delay=\"15\" />\n"
-"    <action name=\"meta-data\"  timeout=\"15\" />\n"
-"  </actions>\n"
-"  <special tag=\"heartbeat\">\n"
-"    <version>2.0</version>\n"
-"  </special>\n"
+"<resource-agent name=\"%s\"\n"
+"<version>1.0</version>\n"
+"<longdesc lang=\"en\">\n"
+"%s\n"
+"</longdesc>\n"
+"<shortdesc lang=\"en\">%s</shortdesc>\n"
+"%s\n"
+"<actions>\n"
+"<action name=\"start\"   timeout=\"15\" />\n"
+"<action name=\"stop\"    timeout=\"15\" />\n"
+"<action name=\"status\"  timeout=\"15\" />\n"
+"<action name=\"monitor\" timeout=\"15\" interval=\"15\" start-delay=\"15\" 
/>\n"
+"<action name=\"meta-data\"  timeout=\"15\" />\n"
+"</actions>\n"
+"<special tag=\"heartbeat\">\n"
+"<version>2.0</version>\n"
+"</special>\n"
 "</resource-agent>\n";
 
 static const char * no_parameter_info = "<!-- No parameter segment --->";
 
+#define CHECKMETANULL(ret, which) \
+       if (ret == NULL) { \
+               cl_log(LOG_WARNING, "stonithRA plugin: cannot get %s" \
+                       "segment of %s's metadata.", which, rsc_type); \
+               ret = no_parameter_info; \
+       }
+
 PIL_PLUGIN_BOILERPLATE2("1.0", Debug);
 
 static const PILPluginImports*  PluginImports;
@@ -296,7 +303,10 @@
 get_resource_meta(const char* rsc_type, const char* provider)
 {
        char * buffer;
-       const char * tmp = NULL;
+       int bufferlen = 0;
+       const char * meta_param = NULL;
+       const char * meta_longdesc = NULL;
+       const char * meta_shortdesc = NULL;
        Stonith * stonith_obj = NULL;   
 
        if ( provider != NULL ) {
@@ -305,17 +315,21 @@
        }
 
        stonith_obj = stonith_new(rsc_type);
-       tmp = stonith_get_info(stonith_obj, ST_CONF_XML);
-       if (tmp == NULL) {
-               cl_log(LOG_WARNING, "stonithRA plugin: cannot get the parameter"
-                       " segment of %s's metadata.", rsc_type);
-               tmp = no_parameter_info;
-       }
-
-       buffer = g_new(char, strlen(meta_data1) + strlen(meta_data2)
-                               + strlen(tmp) + strlen(meta_data3) + 1);
-
-       sprintf(buffer, "%s%s%s%s", meta_data1, meta_data2, tmp, meta_data3);
+       meta_longdesc = stonith_get_info(stonith_obj, ST_DEVICEDESCR);
+       CHECKMETANULL(meta_longdesc, "longdesc")
+       meta_shortdesc = stonith_get_info(stonith_obj, ST_DEVICENAME);
+       CHECKMETANULL(meta_shortdesc, "shortdesc") 
+       meta_param = stonith_get_info(stonith_obj, ST_CONF_XML);
+       CHECKMETANULL(meta_param, "parameters") 
+
+       
+       bufferlen = strlen(meta_template) + strlen(rsc_type)
+                       + strlen(meta_longdesc) + strlen(meta_shortdesc)
+                       + strlen(meta_param) + 1;
+       buffer = g_new(char, bufferlen);
+       buffer[bufferlen-1] = '\0';
+       snprintf(buffer, bufferlen-1, meta_template, rsc_type
+               , meta_longdesc, meta_shortdesc, meta_param);
        stonith_delete(stonith_obj);
 
        return buffer;




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

Message: 2
Date: Mon, 15 May 2006 02:51:20 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: lib by sunjd from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

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

Dir     : linux-ha/lib/plugins/lrm


Modified Files:
        raexechb.c 


Log Message:
format tweak
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/plugins/lrm/raexechb.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -3 -r1.48 -r1.49
--- raexechb.c  15 May 2006 03:40:57 -0000      1.48
+++ raexechb.c  15 May 2006 08:51:19 -0000      1.49
@@ -50,39 +50,38 @@
 "<?xml version=\"1.0\"?>\n"\
 "<!DOCTYPE resource-agent SYSTEM \"ra-api-1.dtd\">\n"\
 "<resource-agent name=%s"\
-"\" version=\"0.1\">\n"\
-"  <version>1.0</version>\n"\
-"  <longdesc lang=\"en\">\n"\
-"    %s"\
-"  </longdesc>\n"\
-"  <shortdesc lang=\"en\">%s</shortdesc>\n"\
-"  <parameters>\n"\
-"     <parameter name=\"1\" unique=\"1\" required=\"0\">\n"\
-"        <longdesc lang=\"en\">\n"\
-"           This argument will be passed as the first argument to the"\
-"           heartbeat resource agent (assuming it supports one)\n"\
-"        </longdesc>\n"\
-"        <shortdesc lang=\"en\">argv[1]</shortdesc>\n"\
-"        <content type=\"string\" default=" " />\n"\
-"     </parameter>\n"\
-"     <parameter name=\"2\" unique=\"1\" required=\"0\">\n"\
-"        <longdesc lang=\"en\">\n"\
-"           This argument will be passed as the first argument to the"\
-"           heartbeat resource agent (assuming it supports one)\n"\
-"        </longdesc>\n"\
-"        <shortdesc lang=\"en\">argv[2]</shortdesc>\n"\
-"        <content type=\"string\" default=" " />\n"\
-"     </parameter>\n"\
-"  </parameters>\n"\
-"  <actions>\n"\
-"    <action name=\"start\"   timeout=\"15\" />\n"\
-"    <action name=\"stop\"    timeout=\"15\" />\n"\
-"    <action name=\"status\"  timeout=\"15\" />\n"\
-"    <action name=\"monitor\" timeout=\"15\" interval=\"15\" 
start-delay=\"15\" />\n"\
-"    <action name=\"meta-data\"  timeout=\"5\" />\n"\
-"  </actions>\n"\
-"  <special tag=\"heartbeart\">\n"\
-"  </special>\n"\
+"<version>1.0</version>\n"\
+"<longdesc lang=\"en\">\n"\
+"%s"\
+"</longdesc>\n"\
+"<shortdesc lang=\"en\">%s</shortdesc>\n"\
+"<parameters>\n"\
+"<parameter name=\"1\" unique=\"1\" required=\"0\">\n"\
+"<longdesc lang=\"en\">\n"\
+"This argument will be passed as the first argument to the"\
+"heartbeat resource agent (assuming it supports one)\n"\
+"</longdesc>\n"\
+"<shortdesc lang=\"en\">argv[1]</shortdesc>\n"\
+"<content type=\"string\" default=" " />\n"\
+"</parameter>\n"\
+"<parameter name=\"2\" unique=\"1\" required=\"0\">\n"\
+"<longdesc lang=\"en\">\n"\
+"This argument will be passed as the first argument to the"\
+"heartbeat resource agent (assuming it supports one)\n"\
+"</longdesc>\n"\
+"<shortdesc lang=\"en\">argv[2]</shortdesc>\n"\
+"<content type=\"string\" default=" " />\n"\
+"</parameter>\n"\
+"</parameters>\n"\
+"<actions>\n"\
+"<action name=\"start\"   timeout=\"15\" />\n"\
+"<action name=\"stop\"    timeout=\"15\" />\n"\
+"<action name=\"status\"  timeout=\"15\" />\n"\
+"<action name=\"monitor\" timeout=\"15\" interval=\"15\" start-delay=\"15\" 
/>\n"\
+"<action name=\"meta-data\"  timeout=\"5\" />\n"\
+"</actions>\n"\
+"<special tag=\"heartbeart\">\n"\
+"</special>\n"\
 "</resource-agent>\n"
 
 /* The begin of exported function list */




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

Message: 3
Date: Mon, 15 May 2006 02:58:37 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: lib by sunjd from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

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

Dir     : linux-ha/lib/plugins/lrm


Modified Files:
        raexechb.c 


Log Message:
make heartbeat RAs' provider be 'heartbeat'
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/plugins/lrm/raexechb.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -3 -r1.49 -r1.50
--- raexechb.c  15 May 2006 08:51:19 -0000      1.49
+++ raexechb.c  15 May 2006 08:58:36 -0000      1.50
@@ -366,6 +366,20 @@
 static int
 get_provider_list(const char* ra_type, GList ** providers)
 {
-       *providers = NULL;
-       return 0;
+        if ( providers == NULL ) {
+                cl_log(LOG_ERR, "%s:%d: Parameter error: providers==NULL"
+                        , __FUNCTION__, __LINE__);
+                return -2;
+        }
+
+        if ( *providers != NULL ) {
+                cl_log(LOG_ERR, "%s:%d: Parameter error: *providers==NULL."
+                        "This will cause memory leak."
+                        , __FUNCTION__, __LINE__);
+        }
+
+        /* Now temporarily make it fixed */
+        *providers = g_list_append(*providers, g_strdup("heartbeat"));
+
+        return g_list_length(*providers);
 }




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

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

Reply via email to