On Thu, 2009-07-16 at 16:20 +0900, Junko IKEDA wrote:
> Hi,
> 
> Does openais need not "myuuid" but "myid"?
Usually, a node's uuid is same as its uname for openais. Please try the
new attached patch, it should work in most cases. As you know, System
uname could be changed later, So we'll seek a better way.

> I still get the following error.
> 
> Could not map uname=dom3 to a UUID: The object/attribute does not exist
> 
Hmm, hbagent was started so early that the node hadn't been added into
cib by that time.  Try the new patch then.


> 
> 
> On Thu, 16 Jul 2009 11:21:59 +0900, Junko IKEDA <ike...@intellilink.co.jp> 
> wrote:
> 
> > Hi,
> >
> > I tried your patch,
> > and there was no problem with compiling,
> > but it complained during a start...
> >
> > # service openais start; export HA_cluster_type="openais"; 
> > /usr/lib64/heartbeat/hbagent -r 5 &
> > Starting OpenAIS daemon (aisexec): starting... rc=0: OK
> > [1] 2569
> > # Could not map uname=dom3 to a UUID: The object/attribute does not exist
> >
> > I tried to add some resources using cibadmin command after this,
> > but hbagent went to the segmentation fault.
> > I took its gdb and attached it.
> > It seems that myuuid for openAIS is still something wrong.
> >
> > By the way, hbagent(+ openAIS) became to be able to get LHAHBAgentOnline 
> > information with your patch.
> > Great!
> >
> > Thanks,
> > Junko
> >
> >
> > On Wed, 15 Jul 2009 21:49:05 +0900, Yan Gao <y...@novell.com> wrote:
> >
> >> Please try the attached patch.
> >>
> >> On Wed, 2009-07-15 at 02:56 -0600, Yan Gao wrote:
> >>> Hi,
> >>>
> >>>  >>>On 7/15/2009 at  3:18 PM, "Junko IKEDA" <ike...@intellilink.co.jp>
> >>> wrote:
> >>> > Hi,
> >>> >
> >>> > hbagent detects whether or not the event occurred on that node if it
> >>> works
> >>> > with Heartbeat.
> >>> Indeed
> >>> > Can I get the "myuuid" of openais?
> >>> Theoretically, we could get openais nodeid. I'll revise hbagent later.
> >>>
> >>> >
> >>> >
> >>> > snmp_subagent/hbagentv2.c
> >>> >
> >>> >  280 static void
> >>> >  281 hbagentv2_update_diff(const char *event, crm_data_t *msg)
> >>> >  282 {
> >>> >
> >>> >  357 #if SUPPORT_HEARTBEAT
> >>> >  358         if (is_heartbeat_cluster()) {
> >>> >  359             if (STRNCMP_CONST(node_id, myuuid) != 0) {
> >>> >  360                 /* This change is not at my node */
> >>> >  361                 free_xml(diff);
> >>> >  362                 return;
> >>> >  363             }
> >>> >  364         }
> >>> >  365 #endif
> >>> >
> >>> > Thanks,
> >>> > Junko
> >>> >
> >>> > On Tue, 14 Jul 2009 16:18:03 +0900, Junko IKEDA
> >>> <ike...@intellilink.co.jp>
> >>> > wrote:
> >>> >
> >>> > > Sorry for missing attatchments.
> >>> > >
> >>> > > Thanks,
> >>> > > Junko
> >>> > >
> >>> > > On Tue, 14 Jul 2009 16:11:20 +0900, Junko IKEDA
> >>> <ike...@intellilink.co.jp>
> >>> > wrote:
> >>> > >
> >>> > >> Hi,
> >>> > >>
> >>> > >> I am trying to run hbagent with openais in the following way,
> >>> > >>
> >>> > >> # export HA_cluster_type="openais"
> >>> > >> # service openais start
> >>> > >> # /usr/lib64/heartbeat/hbagent -d
> >>> > >>
> >>> > >> hbagent could start successfully,
> >>> > >> but there is something wrong with it.
> >>> > >>
> >>> > >> When I run hbagent included in Heartbeat 2.1.4,
> >>> > >> trap events came from the node which the event occurred on.
> >>> > >> But with openais, all node throw the trap even if that event
> >>> didn't occur
> >>> > on it.
> >>> > >>
> >>> > >> For example,
> >>> > >> primitive resource "dummy1" and "dummy2" started on "dom1".
> >>> > >> In this case, only "dom1" was supposed to trap that these two
> >>> resources
> >>> > started on it,
> >>> > >> but "dom2" (stand-by node) also notice it.
> >>> > >> It looks like a duplicate.
> >>> > >> Please see the attached logs.
> >>> > >>
> >>> > >> Should I need any additional setups?
> >>> > >>
> >>> > >> * version
> >>> > >> openais-0.80
> >>> > >> pacemaker-1.0.4
> >>> > >> pacemaker-mgmt-1.99
> >>> > >>
> >>> > >> Thanks,
> >>> > >> Junko
> >>> > >
> >>>
> >>>
> >>
> >
> >
> > 
> 
> 
> _______________________________________________
> Pacemaker mailing list
> Pacemaker@oss.clusterlabs.org
> http://oss.clusterlabs.org/mailman/listinfo/pacemaker
-- 
Regards,
Yan Gao
China R&D Software Engineer
y...@novell.com

Novell, Inc.
Making IT Work As One?6?4
diff -r 56e1e8787452 snmp_subagent/hbagent.c
--- a/snmp_subagent/hbagent.c	Tue Jul 07 14:30:31 2009 +0800
+++ b/snmp_subagent/hbagent.c	Thu Jul 16 16:14:03 2009 +0800
@@ -77,6 +77,7 @@
 #include <sys/types.h> /* getpid() */
 #include <sys/stat.h> /* fstat() */
 #include <unistd.h>
+#include <sys/utsname.h>
 
 #include <errno.h>
 
@@ -85,11 +86,12 @@
 #endif
 #include "clplumbing/cl_uuid.h" /* UU_UNPARSE_SIZEOF */
 
+char * myid = NULL; /* my node id */
+char * myuuid = NULL; /* my node uuid */
+
 #if SUPPORT_HEARTBEAT
 static unsigned long hbInitialized = 0;
 static ll_cluster_t * hb = NULL; /* heartbeat handle */
-char * myid = NULL; /* my node id */
-char * myuuid = NULL; /* my node uuid */
 static SaClmHandleT clm = 0;
 static unsigned long clmInitialized = 0;
 
@@ -123,10 +125,11 @@
 int nodestatus_trap(const char * node, const char * status);
 int ifstatus_trap(const char * node, const char * lnk, const char * status);
 int membership_trap(const char * node, SaClmClusterChangesT status);
-int hbagent_trap(int online, const char * node);
 
 int ping_membership(int * mem_fd);
 #endif
+
+int hbagent_trap(int online, const char * node);
 
 /* LHAHeartbeatConfigInfo partial-mode */
 #define DEFAULT_REFRESH_TIMING  (0)
@@ -1214,60 +1217,6 @@
 }
 
 int 
-hbagent_trap(int online, const char * node)
-{
-    netsnmp_variable_list *notification_vars = NULL;
-
-    oid objid_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };
-    size_t objid_snmptrap_len = OID_LENGTH(objid_snmptrap);
-
-    oid  nodename_oid[] = { 1, 3, 6, 1, 4, 1, 4682, 2, 1, 2 };
-    size_t nodename_oid_len = OID_LENGTH(nodename_oid);
-
-  /* this is the oid for the hbagent online trap */
-    oid  trap_oid[] = { 1, 3, 6, 1, 4, 1, 4682, 900, 7 };
-    size_t trap_oid_len = OID_LENGTH(trap_oid);
-
-    /* this is the oid for the offline trap */
-    if (!online) {
-	    trap_oid[trap_oid_len - 1] = 9;
-    }
-
-
-    snmp_varlist_add_variable(&notification_vars,
-                              /*
-                               * the snmpTrapOID.0 variable
-                               */
-                              objid_snmptrap, objid_snmptrap_len,
-                              /*
-                               * value type is an OID
-                               */
-                              ASN_OBJECT_ID,
-                              /*
-                               * value contents is our notification OID
-                               */
-                              (u_char *) trap_oid,
-                              /*
-                               * size in bytes = oid length * sizeof(oid)
-                               */
-                              trap_oid_len * sizeof(oid));
-
-    snmp_varlist_add_variable(&notification_vars,
-                              nodename_oid, 
-			      nodename_oid_len,
-                              ASN_OCTET_STR,
-                              (const u_char *) node,
-                              strlen(node)); /* do NOT use strlen() +1 */
-
-    cl_log(LOG_INFO, "sending hbagent trap. status:%d", online);
-    send_v2trap(notification_vars);
-    snmp_free_varbind(notification_vars);
-
-    return HA_OK;
-}
-
-
-int 
 membership_trap(const char * node, SaClmClusterChangesT status)
 {
     oid objid_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };
@@ -1346,6 +1295,60 @@
   return 0;
 }
 #endif
+
+int 
+hbagent_trap(int online, const char * node)
+{
+    netsnmp_variable_list *notification_vars = NULL;
+
+    oid objid_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };
+    size_t objid_snmptrap_len = OID_LENGTH(objid_snmptrap);
+
+    oid  nodename_oid[] = { 1, 3, 6, 1, 4, 1, 4682, 2, 1, 2 };
+    size_t nodename_oid_len = OID_LENGTH(nodename_oid);
+
+  /* this is the oid for the hbagent online trap */
+    oid  trap_oid[] = { 1, 3, 6, 1, 4, 1, 4682, 900, 7 };
+    size_t trap_oid_len = OID_LENGTH(trap_oid);
+
+    /* this is the oid for the offline trap */
+    if (!online) {
+	    trap_oid[trap_oid_len - 1] = 9;
+    }
+
+
+    snmp_varlist_add_variable(&notification_vars,
+                              /*
+                               * the snmpTrapOID.0 variable
+                               */
+                              objid_snmptrap, objid_snmptrap_len,
+                              /*
+                               * value type is an OID
+                               */
+                              ASN_OBJECT_ID,
+                              /*
+                               * value contents is our notification OID
+                               */
+                              (u_char *) trap_oid,
+                              /*
+                               * size in bytes = oid length * sizeof(oid)
+                               */
+                              trap_oid_len * sizeof(oid));
+
+    snmp_varlist_add_variable(&notification_vars,
+                              nodename_oid, 
+			      nodename_oid_len,
+                              ASN_OCTET_STR,
+                              (const u_char *) node,
+                              strlen(node)); /* do NOT use strlen() +1 */
+
+    cl_log(LOG_INFO, "sending hbagent trap. status:%d", online);
+    send_v2trap(notification_vars);
+    snmp_free_varbind(notification_vars);
+
+    return HA_OK;
+}
+
 
 static void
 usage(void)
@@ -1467,6 +1470,21 @@
 	}
 #endif
 
+#if SUPPORT_AIS
+	if (is_openais_cluster()) {
+		struct utsname name;
+		if(uname(&name) < 0) {
+			cl_log(LOG_ERR, "uname(2) call failed: %s", strerror(errno));
+		} else {
+			myid = strdup(name.nodename);
+		}
+
+		if (myid != NULL) {
+			myuuid = strdup(myid);
+		}
+	}
+#endif
+
 	/*
 	if ((ret = init_membership() != HA_OK) ||
 		(mem_fd = get_membership_fd()) <= 0) {
@@ -1510,11 +1528,7 @@
 
 	snmp_log(LOG_INFO,"LHA-agent is up and running.\n");
 
-#if SUPPORT_HEARTBEAT
-	if (is_heartbeat_cluster()) {
-		hbagent_trap(1, myid);
-	}
-#endif
+	hbagent_trap(1, myid);
 
 	hbconfig_refresh_cnt = 0;
 
@@ -1655,25 +1669,22 @@
 
 	/* at shutdown time */
 	
-#if SUPPORT_HEARTBEAT
-	if (is_heartbeat_cluster()) {
-		hbagent_trap(0, myid);
-	}
-#endif
+	hbagent_trap(0, myid);
 	snmp_shutdown("LHA-agent");
 
 	free_hbagentv2();
+	if (myid != NULL) {
+		free(myid);
+	}
+	if (myuuid != NULL) {
+		free(myuuid);
+	}
+
 #if SUPPORT_HEARTBEAT
         if (is_heartbeat_cluster()) {
  		free_hbconfig();
-		free(myid);
-		free(myuuid);
 		free_storage();
-	}
-#endif
 
-#if SUPPORT_HEARTBEAT
-        if (is_heartbeat_cluster()) {
 		if (!hb_already_dead && hb->llc_ops->signoff(hb, TRUE) != HA_OK) {
 			cl_log(LOG_ERR, "Cannot sign off from heartbeat.");
 			cl_log(LOG_ERR, "REASON: %s", hb->llc_ops->errmsg(hb));
diff -r 56e1e8787452 snmp_subagent/hbagentv2.c
--- a/snmp_subagent/hbagentv2.c	Tue Jul 07 14:30:31 2009 +0800
+++ b/snmp_subagent/hbagentv2.c	Thu Jul 16 16:14:03 2009 +0800
@@ -353,16 +353,11 @@
             free_xml(diff);
             return;
         }
-
-#if SUPPORT_HEARTBEAT
-        if (is_heartbeat_cluster()) {
-            if (STRNCMP_CONST(node_id, myuuid) != 0) {
-                /* This change is not at my node */
-                free_xml(diff);
-                return;
-            }
+        if (myuuid != NULL && STRNCMP_CONST(node_id, myuuid) != 0) {
+            /* This change is not at my node */
+            free_xml(diff);
+            return;
         }
-#endif
 
         /* get the head pointer of <lrm_resource>  */
         lrm_rsc = find_xml_node(node_state, XML_CIB_TAG_LRM, FALSE);
_______________________________________________
Pacemaker mailing list
Pacemaker@oss.clusterlabs.org
http://oss.clusterlabs.org/mailman/listinfo/pacemaker

Reply via email to