Browse Source

corosync-notifyd: make SNMP work again

rrp_faulty_fn in notify_callbacks no longer exists, and now become
link_faulty_fn, and also link_faulty_fn needs 5 arguments while
rrp_faulty_fn needs 4.

Signed-off-by: Bin Liu <bliu@suse.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
Bin Liu 8 years ago
parent
commit
edca042229
2 changed files with 34 additions and 22 deletions
  1. 18 9
      conf/COROSYNC-MIB.txt
  2. 16 13
      tools/corosync-notifyd.c

+ 18 - 9
conf/COROSYNC-MIB.txt

@@ -13,10 +13,12 @@ IMPORTS
 ;
 ;
 
 
 corosync MODULE-IDENTITY
 corosync MODULE-IDENTITY
-    LAST-UPDATED    "201101211300Z"
+    LAST-UPDATED    "201801121241Z"
     ORGANIZATION    "www.corosync.org"
     ORGANIZATION    "www.corosync.org"
     CONTACT-INFO    "name:  Yuki Sato
     CONTACT-INFO    "name:  Yuki Sato
                      email: users@clusterlabs.org"
                      email: users@clusterlabs.org"
+    DESCRIPTION     "*RRP* related staff has changed to *Link* staff"
+    REVISION        "201801121241Z"
     DESCRIPTION     "Add cluster quorum traps, fix smilint errors, and fix notification block ID"
     DESCRIPTION     "Add cluster quorum traps, fix smilint errors, and fix notification block ID"
     REVISION        "201101211300Z"
     REVISION        "201101211300Z"
     DESCRIPTION     "MIB objects for Corosync"
     DESCRIPTION     "MIB objects for Corosync"
@@ -70,6 +72,12 @@ corosyncObjectsNodeAddress OBJECT-TYPE
     DESCRIPTION "The address of the node."
     DESCRIPTION "The address of the node."
 ::= { corosyncObjects 4 }
 ::= { corosyncObjects 4 }
 
 
+corosyncObjectsLocalNodeID OBJECT-TYPE
+    SYNTAX      Unsigned32
+    MAX-ACCESS  accessible-for-notify
+    STATUS      current
+    DESCRIPTION "The unique integer of local node."
+::= { corosyncObjects 5 }
 
 
 --
 --
 -- Quorum Information
 -- Quorum Information
@@ -94,7 +102,7 @@ corosyncObjectsQuorumStatus OBJECT-TYPE
 ::= { corosyncObjects 21 }
 ::= { corosyncObjects 21 }
 
 
 --
 --
--- RRP Information
+-- Link Information
 ---
 ---
 
 
 corosyncObjectsIfaceNo OBJECT-TYPE
 corosyncObjectsIfaceNo OBJECT-TYPE
@@ -104,12 +112,12 @@ corosyncObjectsIfaceNo OBJECT-TYPE
     DESCRIPTION "The integer of interface."
     DESCRIPTION "The integer of interface."
 ::= { corosyncObjects 60 }
 ::= { corosyncObjects 60 }
 
 
-corosyncObjectsRRPStatus OBJECT-TYPE
+corosyncObjectsLinkStatus OBJECT-TYPE
     SYNTAX	OCTET STRING
     SYNTAX	OCTET STRING
     MAX-ACCESS  accessible-for-notify
     MAX-ACCESS  accessible-for-notify
     STATUS      current
     STATUS      current
     DESCRIPTION
     DESCRIPTION
-	"RRP Status"
+	"Link Status"
 ::= { corosyncObjects 61 }
 ::= { corosyncObjects 61 }
 
 
 --
 --
@@ -174,14 +182,15 @@ corosyncNoticesAppStatus NOTIFICATION-TYPE
        name and the new state (either 'connected' or 'disconnected')."
        name and the new state (either 'connected' or 'disconnected')."
 ::= { corosyncNotices 3 }
 ::= { corosyncNotices 3 }
 
 
-corosyncNoticesRRPStatus NOTIFICATION-TYPE
+corosyncNoticesLinkStatus NOTIFICATION-TYPE
     OBJECTS	{ corosyncObjectsNodeName,
     OBJECTS	{ corosyncObjectsNodeName,
+		  corosyncObjectsLocalNodeID,
 		  corosyncObjectsNodeID,
 		  corosyncObjectsNodeID,
 		  corosyncObjectsIfaceNo,
 		  corosyncObjectsIfaceNo,
-		  corosyncObjectsRRPStatus }
+		  corosyncObjectsLinkStatus }
     STATUS  current
     STATUS  current
     DESCRIPTION
     DESCRIPTION
-      "Produced when the interface of RRP is marked failed or operational.
+      "Produced when the interface of Link is marked failed or operational.
 
 
        The notification also includes the node name, nodeid, iface number
        The notification also includes the node name, nodeid, iface number
        and the new state (either 'failed' or 'operational')."
        and the new state (either 'failed' or 'operational')."
@@ -211,7 +220,7 @@ corosyncObjectGroup OBJECT-GROUP
 	      corosyncObjectsAppName,
 	      corosyncObjectsAppName,
 	      corosyncObjectsAppStatus,
 	      corosyncObjectsAppStatus,
 	      corosyncObjectsIfaceNo,
 	      corosyncObjectsIfaceNo,
-	      corosyncObjectsRRPStatus
+	      corosyncObjectsLinkStatus
             }
             }
     STATUS      current
     STATUS      current
     DESCRIPTION "Corosync Object Conformance Group"
     DESCRIPTION "Corosync Object Conformance Group"
@@ -221,7 +230,7 @@ corosyncNotificationGroup NOTIFICATION-GROUP
     NOTIFICATIONS { corosyncNoticesNodeStatus,
     NOTIFICATIONS { corosyncNoticesNodeStatus,
                     corosyncNoticesQuorumStatus,
                     corosyncNoticesQuorumStatus,
 		    corosyncNoticesAppStatus,
 		    corosyncNoticesAppStatus,
-		    corosyncNoticesRRPStatus
+		    corosyncNoticesLinkStatus
                   }
                   }
     STATUS      current
     STATUS      current
     DESCRIPTION "Corosync Notification Conformance Group"
     DESCRIPTION "Corosync Notification Conformance Group"

+ 16 - 13
tools/corosync-notifyd.c

@@ -146,6 +146,7 @@ enum snmp_node_status {
 #define SNMP_OID_OBJECT_NODE_ID		SNMP_OID_OBJECT_ROOT ".2"
 #define SNMP_OID_OBJECT_NODE_ID		SNMP_OID_OBJECT_ROOT ".2"
 #define SNMP_OID_OBJECT_NODE_STATUS	SNMP_OID_OBJECT_ROOT ".3"
 #define SNMP_OID_OBJECT_NODE_STATUS	SNMP_OID_OBJECT_ROOT ".3"
 #define SNMP_OID_OBJECT_NODE_ADDR	SNMP_OID_OBJECT_ROOT ".4"
 #define SNMP_OID_OBJECT_NODE_ADDR	SNMP_OID_OBJECT_ROOT ".4"
+#define SNMP_OID_OBJECT_LOCAL_NODE_ID		SNMP_OID_OBJECT_ROOT ".5"
 
 
 #define SNMP_OID_OBJECT_RINGSEQ		SNMP_OID_OBJECT_ROOT ".20"
 #define SNMP_OID_OBJECT_RINGSEQ		SNMP_OID_OBJECT_ROOT ".20"
 #define SNMP_OID_OBJECT_QUORUM		SNMP_OID_OBJECT_ROOT ".21"
 #define SNMP_OID_OBJECT_QUORUM		SNMP_OID_OBJECT_ROOT ".21"
@@ -153,14 +154,14 @@ enum snmp_node_status {
 #define SNMP_OID_OBJECT_APP_NAME	SNMP_OID_OBJECT_ROOT ".40"
 #define SNMP_OID_OBJECT_APP_NAME	SNMP_OID_OBJECT_ROOT ".40"
 #define SNMP_OID_OBJECT_APP_STATUS	SNMP_OID_OBJECT_ROOT ".41"
 #define SNMP_OID_OBJECT_APP_STATUS	SNMP_OID_OBJECT_ROOT ".41"
 
 
-#define SNMP_OID_OBJECT_RRP_IFACE_NO	SNMP_OID_OBJECT_ROOT ".60"
-#define SNMP_OID_OBJECT_RRP_STATUS	SNMP_OID_OBJECT_ROOT ".61"
+#define SNMP_OID_OBJECT_LINK_IFACE_NO	SNMP_OID_OBJECT_ROOT ".60"
+#define SNMP_OID_OBJECT_LINK_STATUS	SNMP_OID_OBJECT_ROOT ".61"
 
 
 #define SNMP_OID_TRAPS_ROOT		SNMP_OID_COROSYNC ".0"
 #define SNMP_OID_TRAPS_ROOT		SNMP_OID_COROSYNC ".0"
 #define SNMP_OID_TRAPS_NODE		SNMP_OID_TRAPS_ROOT ".1"
 #define SNMP_OID_TRAPS_NODE		SNMP_OID_TRAPS_ROOT ".1"
 #define SNMP_OID_TRAPS_QUORUM		SNMP_OID_TRAPS_ROOT ".2"
 #define SNMP_OID_TRAPS_QUORUM		SNMP_OID_TRAPS_ROOT ".2"
 #define SNMP_OID_TRAPS_APP		SNMP_OID_TRAPS_ROOT ".3"
 #define SNMP_OID_TRAPS_APP		SNMP_OID_TRAPS_ROOT ".3"
-#define SNMP_OID_TRAPS_RRP		SNMP_OID_TRAPS_ROOT ".4"
+#define SNMP_OID_TRAPS_LINK		SNMP_OID_TRAPS_ROOT ".4"
 
 
 #define CS_TIMESTAMP_STR_LEN 20
 #define CS_TIMESTAMP_STR_LEN 20
 static const char *local_host = "localhost";
 static const char *local_host = "localhost";
@@ -634,7 +635,7 @@ out_free:
 }
 }
 
 
 static void
 static void
-_cs_dbus_link_faulty_event(char *nodename, uint32_t nodeid, uint32_t iface_no, const char *state)
+_cs_dbus_link_faulty_event(char *nodename, uint32_t local_nodeid, uint32_t nodeid, uint32_t iface_no, const char *state)
 {
 {
 	DBusMessage *msg = NULL;
 	DBusMessage *msg = NULL;
 
 
@@ -665,11 +666,12 @@ _cs_dbus_link_faulty_event(char *nodename, uint32_t nodeid, uint32_t iface_no, c
 
 
 	if (!dbus_message_append_args(msg,
 	if (!dbus_message_append_args(msg,
 			DBUS_TYPE_STRING, &nodename,
 			DBUS_TYPE_STRING, &nodename,
+			DBUS_TYPE_UINT32, &local_nodeid,
 			DBUS_TYPE_UINT32, &nodeid,
 			DBUS_TYPE_UINT32, &nodeid,
 			DBUS_TYPE_UINT32, &iface_no,
 			DBUS_TYPE_UINT32, &iface_no,
 			DBUS_TYPE_STRING, &state,
 			DBUS_TYPE_STRING, &state,
 			DBUS_TYPE_INVALID)) {
 			DBUS_TYPE_INVALID)) {
-		qb_log(LOG_ERR, "error adding args to rrp signal");
+		qb_log(LOG_ERR, "error adding args to link signal");
 		goto out_unlock;
 		goto out_unlock;
 	}
 	}
 
 
@@ -710,8 +712,8 @@ _cs_dbus_init(void)
 		_cs_dbus_node_quorum_event;
 		_cs_dbus_node_quorum_event;
 	notifiers[num_notifiers].application_connection_fn =
 	notifiers[num_notifiers].application_connection_fn =
 		_cs_dbus_application_connection_event;
 		_cs_dbus_application_connection_event;
-	notifiers[num_notifiers].rrp_faulty_fn =
-		_cs_dbus_rrp_faulty_event;
+	notifiers[num_notifiers].link_faulty_fn =
+		_cs_dbus_link_faulty_event;
 
 
 	num_notifiers++;
 	num_notifiers++;
 }
 }
@@ -858,7 +860,7 @@ _cs_snmp_node_quorum_event(char *nodename, uint32_t nodeid,
 }
 }
 
 
 static void
 static void
-_cs_snmp_rrp_faulty_event(char *nodename, uint32_t nodeid,
+_cs_snmp_link_faulty_event(char *nodename, uint32_t local_nodeid, uint32_t nodeid,
 		uint32_t iface_no, const char *state)
 		uint32_t iface_no, const char *state)
 {
 {
 	int ret;
 	int ret;
@@ -883,13 +885,14 @@ _cs_snmp_rrp_faulty_event(char *nodename, uint32_t nodeid,
 	/* send uptime */
 	/* send uptime */
 	sprintf (csysuptime, "%ld", now);
 	sprintf (csysuptime, "%ld", now);
 	snmp_add_var (trap_pdu, sysuptime_oid, sizeof (sysuptime_oid) / sizeof (oid), 't', csysuptime);
 	snmp_add_var (trap_pdu, sysuptime_oid, sizeof (sysuptime_oid) / sizeof (oid), 't', csysuptime);
-	snmp_add_var (trap_pdu, snmptrap_oid, sizeof (snmptrap_oid) / sizeof (oid), 'o', SNMP_OID_TRAPS_RRP);
+	snmp_add_var (trap_pdu, snmptrap_oid, sizeof (snmptrap_oid) / sizeof (oid), 'o', SNMP_OID_TRAPS_LINK);
 
 
 	/* Add extries to the trap */
 	/* Add extries to the trap */
 	add_field (trap_pdu, ASN_OCTET_STR, SNMP_OID_OBJECT_NODE_NAME, (void*)nodename, strlen (nodename));
 	add_field (trap_pdu, ASN_OCTET_STR, SNMP_OID_OBJECT_NODE_NAME, (void*)nodename, strlen (nodename));
+	add_field (trap_pdu, ASN_UNSIGNED, SNMP_OID_OBJECT_LOCAL_NODE_ID, (void*)&local_nodeid, sizeof (local_nodeid));
 	add_field (trap_pdu, ASN_UNSIGNED, SNMP_OID_OBJECT_NODE_ID, (void*)&nodeid, sizeof (nodeid));
 	add_field (trap_pdu, ASN_UNSIGNED, SNMP_OID_OBJECT_NODE_ID, (void*)&nodeid, sizeof (nodeid));
-	add_field (trap_pdu, ASN_INTEGER, SNMP_OID_OBJECT_RRP_IFACE_NO, (void*)&iface_no, sizeof (iface_no));
-	add_field (trap_pdu, ASN_OCTET_STR, SNMP_OID_OBJECT_RRP_STATUS, (void*)state, strlen (state));
+	add_field (trap_pdu, ASN_INTEGER, SNMP_OID_OBJECT_LINK_IFACE_NO, (void*)&iface_no, sizeof (iface_no));
+	add_field (trap_pdu, ASN_OCTET_STR, SNMP_OID_OBJECT_LINK_STATUS, (void*)state, strlen (state));
 
 
 	/* Send and cleanup */
 	/* Send and cleanup */
 	ret = snmp_send (session, trap_pdu);
 	ret = snmp_send (session, trap_pdu);
@@ -912,8 +915,8 @@ _cs_snmp_init(void)
 	notifiers[num_notifiers].node_quorum_fn =
 	notifiers[num_notifiers].node_quorum_fn =
 		_cs_snmp_node_quorum_event;
 		_cs_snmp_node_quorum_event;
 	notifiers[num_notifiers].application_connection_fn = NULL;
 	notifiers[num_notifiers].application_connection_fn = NULL;
-	notifiers[num_notifiers].rrp_faulty_fn =
-		_cs_snmp_rrp_faulty_event;
+	notifiers[num_notifiers].link_faulty_fn =
+		_cs_snmp_link_faulty_event;
 	num_notifiers++;
 	num_notifiers++;
 }
 }