[Cluster-devel] cluster cman-kernel/src/cnxman-socket.h cman-k ...
pcaulfield at sourceware.org
pcaulfield at sourceware.org
Mon Dec 18 13:37:57 UTC 2006
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL4
Changes by: pcaulfield at sourceware.org 2006-12-18 13:37:55
Modified files:
cman-kernel/src: cnxman-socket.h cnxman.c
cman/cman_tool : cman_tool.h join.c join_ccs.c
Log message:
Allow cluster id to ve set in CCS.
bz#219588
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman-kernel/src/cnxman-socket.h.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.7.2.2&r2=1.7.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman-kernel/src/cnxman.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.42.2.25&r2=1.42.2.26
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/cman_tool/cman_tool.h.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.3.2.4&r2=1.3.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/cman_tool/join.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.12.2.10&r2=1.12.2.11
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/cman_tool/join_ccs.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.7.2.7&r2=1.7.2.8
--- cluster/cman-kernel/src/Attic/cnxman-socket.h 2006/03/13 11:33:30 1.7.2.2
+++ cluster/cman-kernel/src/Attic/cnxman-socket.h 2006/12/18 13:37:55 1.7.2.3
@@ -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:26:31 1.42.2.25
+++ cluster/cman-kernel/src/Attic/cnxman.c 2006/12/18 13:37:55 1.42.2.26
@@ -1703,6 +1703,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;
@@ -1724,7 +1735,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;
@@ -1925,6 +1937,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;
@@ -2985,6 +3004,7 @@
acks_expected = 0;
wanted_nodeid = 0;
cur_seq = 0;
+ cluster_id = 0;
quorum_device = NULL;
}
--- cluster/cman/cman_tool/cman_tool.h 2005/03/15 10:35:06 1.3.2.4
+++ cluster/cman/cman_tool/cman_tool.h 2006/12/18 13:37:55 1.3.2.5
@@ -78,6 +78,7 @@
int force;
int verbose;
int nodeid;
+ int cluster_id;
int timeout;
unsigned int config_version;
--- cluster/cman/cman_tool/join.c 2006/03/06 10:38:42 1.12.2.10
+++ cluster/cman/cman_tool/join.c 2006/12/18 13:37:55 1.12.2.11
@@ -377,6 +377,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/11/24 09:34:19 1.7.2.7
+++ cluster/cman/cman_tool/join_ccs.c 2006/12/18 13:37:55 1.7.2.8
@@ -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);
More information about the Cluster-devel
mailing list