All of lore.kernel.org
 help / color / mirror / Atom feed
From: pcaulfield@sourceware.org <pcaulfield@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster cman-kernel/src/cnxman-socket.h cman-k ...
Date: 18 Dec 2006 11:37:56 -0000	[thread overview]
Message-ID: <20061218113756.14858.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	STABLE
Changes by:	pcaulfield at 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);



             reply	other threads:[~2006-12-18 11:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-18 11:37 pcaulfield [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-12-18 13:37 [Cluster-devel] cluster cman-kernel/src/cnxman-socket.h cman-k pcaulfield

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061218113756.14858.qmail@sourceware.org \
    --to=pcaulfield@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.