[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/cman lib/libcman.h daemon/cnxman-socke ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	pcaulfield sourceware org	2007-11-05 15:15:53

Modified files:
	cman/lib       : libcman.h 
	cman/daemon    : cnxman-socket.h commands.c 

Log message:
	Enhance API to retrive just the quorum device information using cman_get_node()

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/libcman.h.diff?cvsroot=cluster&r1=1.34&r2=1.35
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/cnxman-socket.h.diff?cvsroot=cluster&r1=1.19&r2=1.20
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/commands.c.diff?cvsroot=cluster&r1=1.73&r2=1.74

--- cluster/cman/lib/libcman.h	2007/08/28 13:30:23	1.34
+++ cluster/cman/lib/libcman.h	2007/11/05 15:15:53	1.35
@@ -38,7 +38,13 @@
 /*
  * Pass this into cman_get_node() as the nodeid to get local node information
  */
-#define CMAN_NODEID_US 0
+#define CMAN_NODEID_US     0
+
+/*
+ * Pass this into cman_get_node() as the nodeid to get quorum device information
+ */
+#define CMAN_NODEID_QDISK -1
+
 
 /* Pass this into cman_send_data to send a message to all nodes */
 #define CMAN_NODEID_ALL 0
--- cluster/cman/daemon/cnxman-socket.h	2007/08/28 13:14:10	1.19
+++ cluster/cman/daemon/cnxman-socket.h	2007/11/05 15:15:53	1.20
@@ -2,7 +2,7 @@
 *******************************************************************************
 **
 **  Copyright (C) Sistina Software, Inc.  1997-2003  All rights reserved.
-**  Copyright (C) 2004-2006 Red Hat, Inc.  All rights reserved.
+**  Copyright (C) 2004-2007 Red Hat, Inc.  All rights reserved.
 **
 **  This copyrighted material is made available to anyone wishing to use,
 **  modify, copy, or redistribute it subject to the terms and conditions
@@ -83,6 +83,9 @@
  * transition */
 #define HIGH_PROTECTED_PORT      9
 
+/* Nodeid passed to CMD_GETNODE to return the quorum device info */
+#define CLUSTER_GETNODE_QUORUMDEV -1
+
 /* Reasons for leaving the cluster */
 #define CLUSTER_LEAVEFLAG_DOWN     0	/* Normal shutdown */
 #define CLUSTER_LEAVEFLAG_KILLED   1
--- cluster/cman/daemon/commands.c	2007/10/03 10:06:21	1.73
+++ cluster/cman/daemon/commands.c	2007/11/05 15:15:53	1.74
@@ -599,17 +599,25 @@
 	if (!we_are_a_cluster_member)
 		return -ENOENT;
 
-	if (!u_node->name[0]) {
-		if (u_node->node_id == 0)
-			u_node->node_id = us->node_id;
-		node = find_node_by_nodeid(u_node->node_id);
+	if (u_node->node_id == CLUSTER_GETNODE_QUORUMDEV) {
+		if (quorum_device)
+			node = quorum_device;
+		else
+			return -ENOENT;
 	}
-	else
-		node = find_node_by_name(u_node->name);
+	else {
+		if (!u_node->name[0]) {
+			if (u_node->node_id == 0)
+				u_node->node_id = us->node_id;
+			node = find_node_by_nodeid(u_node->node_id);
+		}
+		else
+			node = find_node_by_name(u_node->name);
 
-	if (!node) {
-		P_MEMB("cmd_get_node failed: id=%d, name='%s'\n", u_node->node_id, u_node->name);
-		return -ENOENT;
+		if (!node) {
+			P_MEMB("cmd_get_node failed: id=%d, name='%s'\n", u_node->node_id, u_node->name);
+			return -ENOENT;
+		}
 	}
 
 	copy_to_usernode(node, r_node);
@@ -1046,6 +1054,7 @@
 	if (!quorum_device || quorum_device->state == NODESTATE_DEAD)
 		return;
 
+	P_MEMB("quorum_device_timer_fn\n");
 	gettimeofday(&now, NULL);
 	if (quorum_device->last_hello.tv_sec + quorumdev_poll/1000 < now.tv_sec) {
 		quorum_device->state = NODESTATE_DEAD;
@@ -2024,9 +2033,9 @@
 		node->state = NODESTATE_DEAD;
 		cluster_members--;
 
-		if ((node->leave_reason & 0xF) & CLUSTER_LEAVEFLAG_REMOVED) 
+		if ((node->leave_reason & 0xF) & CLUSTER_LEAVEFLAG_REMOVED)
 			recalculate_quorum(1, 1);
-		else 
+		else
 			recalculate_quorum(0, 0);
 		break;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]