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

[Cluster-devel] cluster cman-kernel/src/cnxman-socket.h cman-k ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	STABLE
Changes by:	pcaulfield sourceware org	2006-12-18 11:37:54

Modified files:
	cman-kernel/src: cnxman-socket.h cnxman.c 
	cman/cman_tool : cman_tool.h join.c join_ccs.c 

Log message:
	Add cman/cluster_id field to CCS to allow users to override the
	cluster ID generated from the name.
	bz#219588.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman-kernel/src/cnxman-socket.h.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.7.2.1.6.1&r2=1.7.2.1.6.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman-kernel/src/cnxman.c.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.42.2.12.4.1.2.12&r2=1.42.2.12.4.1.2.13
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/cman_tool/cman_tool.h.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.3.2.4.6.1&r2=1.3.2.4.6.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/cman_tool/join.c.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.12.2.7.4.1.2.4&r2=1.12.2.7.4.1.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/cman_tool/join_ccs.c.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.7.2.6.6.2&r2=1.7.2.6.6.3

--- cluster/cman-kernel/src/Attic/cnxman-socket.h	2006/03/13 11:45:10	1.7.2.1.6.1
+++ cluster/cman-kernel/src/Attic/cnxman-socket.h	2006/12/18 11:37:53	1.7.2.1.6.2
@@ -57,6 +57,7 @@
 #define SIOCCLUSTER_QD_REGISTER       _IOW('x', 0x0a1, struct cl_quorumdevice_info)
 #define SIOCCLUSTER_QD_UNREGISTER     _IO('x', 0x0a2)
 #define SIOCCLUSTER_QD_POLL           _IOW('x', 0x0a3, int)
+#define SIOCCLUSTER_SET_CLUSTERID     _IOW('x', 0x0a4, uint16_t)
 
 /* These were setsockopts */
 #define SIOCCLUSTER_PASS_SOCKET       _IOW('x', 0x0b0, struct cl_passed_sock)
--- cluster/cman-kernel/src/Attic/cnxman.c	2006/05/09 09:34:26	1.42.2.12.4.1.2.12
+++ cluster/cman-kernel/src/Attic/cnxman.c	2006/12/18 11:37:53	1.42.2.12.4.1.2.13
@@ -1704,6 +1704,17 @@
 	return 0;
 }
 
+static int do_ioctl_set_clusterid(unsigned long arg)
+{
+	if (!capable(CAP_CLUSTER))
+		return -EPERM;
+	if (atomic_read(&cnxman_running))
+		return -EALREADY;
+
+	cluster_id = (uint16_t)arg;
+	return 0;
+}
+
 static int do_ioctl_join_cluster(unsigned long arg)
 {
 	struct cl_join_cluster_info join_info;
@@ -1725,7 +1736,8 @@
 		return -ENOTCONN;
 
 	set_votes(join_info.votes, join_info.expected_votes);
-	cluster_id = generate_cluster_id(join_info.cluster_name);
+	if (!cluster_id)
+		cluster_id = generate_cluster_id(join_info.cluster_name);
 	strncpy(cluster_name, join_info.cluster_name, MAX_CLUSTER_NAME_LEN);
 	two_node = join_info.two_node;
 	config_version = join_info.config_version;
@@ -1926,6 +1938,13 @@
 			err = do_ioctl_set_nodeid(arg);
 		break;
 
+	case SIOCCLUSTER_SET_CLUSTERID:
+		if (sock->sk->sk_protocol != CLPROTO_MASTER)
+			err = -EOPNOTSUPP;
+		else
+			err = do_ioctl_set_clusterid(arg);
+		break;
+
 	case SIOCCLUSTER_JOIN_CLUSTER:
 		if (sock->sk->sk_protocol != CLPROTO_MASTER)
 			err = -EOPNOTSUPP;
@@ -2986,6 +3005,7 @@
 	acks_expected = 0;
 	wanted_nodeid = 0;
 	cur_seq = 0;
+	cluster_id = 0;
 	quorum_device = NULL;
 }
 
--- cluster/cman/cman_tool/cman_tool.h	2005/11/15 15:32:29	1.3.2.4.6.1
+++ cluster/cman/cman_tool/cman_tool.h	2006/12/18 11:37:54	1.3.2.4.6.2
@@ -79,6 +79,7 @@
 	int force;
         int verbose;
         int nodeid;
+	int cluster_id;
 	int timeout;
 	unsigned int config_version;
 
--- cluster/cman/cman_tool/join.c	2006/01/26 09:57:34	1.12.2.7.4.1.2.4
+++ cluster/cman/cman_tool/join.c	2006/12/18 11:37:54	1.12.2.7.4.1.2.5
@@ -380,6 +380,13 @@
 	    die("Unable to set cluster nodeid: %s", cman_error(errno));
     }
 
+    if (comline->cluster_id) {
+	error = ioctl(cluster_sock, SIOCCLUSTER_SET_CLUSTERID,
+		      comline->cluster_id);
+	if (error)
+	    die("Unable to set cluster_id: %s", cman_error(errno));
+    }
+
     /*
      * Setup the interface/multicast
      */
--- cluster/cman/cman_tool/join_ccs.c	2005/09/22 08:20:35	1.7.2.6.6.2
+++ cluster/cman/cman_tool/join_ccs.c	2006/12/18 11:37:54	1.7.2.6.6.3
@@ -28,6 +28,7 @@
 #define CONFIG_VERSION_PATH	"/cluster/@config_version"
 #define EXP_VOTES_PATH		"/cluster/cman/@expected_votes"
 #define TWO_NODE_PATH		"/cluster/cman/@two_node"
+#define CLUSTER_ID_PATH		"/cluster/cman/@cluster_id"
 #define MCAST_ADDR_PATH		"/cluster/cman/multicast/@addr"
 #define PORT_PATH		"/cluster/cman/@port"
 #define CMAN_PREFIX		"/cluster/cman/@"
@@ -524,6 +525,13 @@
 		}
 	}
 
+	/* cluster_id override? */
+	error = ccs_get(cd, CLUSTER_ID_PATH, &str);
+	if (!error) {
+		comline->cluster_id = atoi(str);
+		free(str);
+	}
+
 	get_ccs_cman_config(cd, comline);
 
 	ccs_disconnect(cd);


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