public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* master - cman: Copy "service" keys down to corosync
@ 2008-09-11 15:44 Christine Caulfield
  0 siblings, 0 replies; only message in thread
From: Christine Caulfield @ 2008-09-11 15:44 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=24f9c91e737508cd3d8f7a75fae9556e456c4f58
Commit:        24f9c91e737508cd3d8f7a75fae9556e456c4f58
Parent:        e11bc56bce2c4ad35b2695ce1de51087005e0ba6
Author:        Christine Caulfield <ccaulfie@redhat.com>
AuthorDate:    Thu Sep 11 16:36:55 2008 +0100
Committer:     Christine Caulfield <ccaulfie@redhat.com>
CommitterDate: Thu Sep 11 16:36:55 2008 +0100

cman: Copy "service" keys down to corosync

Allow the user to specify multiple <service> keys
in cluster.conf, to include extra services.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
---
 cman/daemon/cman-preconfig.c    |   29 +++++++++++++++-----------
 config/daemons/ccsd/ccsd        |  Bin 0 -> 147221 bytes
 config/ldap.tar.gz              |  Bin 0 -> 581186 bytes
 config/tools/ccs_test/ccs_test  |  Bin 0 -> 11963 bytes
 config/tools/ccs_tool/ccs_test  |    1 +
 config/tools/ccs_tool/ccs_tool  |  Bin 0 -> 86855 bytes
 config/tools/ldap/confdb2ldif   |  Bin 0 -> 15714 bytes
 config/tools/man/confdb2ldif.8~ |   42 +++++++++++++++++++++++++++++++++++++++
 8 files changed, 60 insertions(+), 12 deletions(-)

diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c
index a7ddea7..5792cec 100644
--- a/cman/daemon/cman-preconfig.c
+++ b/cman/daemon/cman-preconfig.c
@@ -918,7 +918,7 @@ static int set_noccs_defaults(struct objdb_iface_ver0 *objdb)
 }
 
 /* Move an object/key tree */
-static int move_config_tree(struct objdb_iface_ver0 *objdb, unsigned int source_object, unsigned int target_parent_object)
+static int move_config_tree(struct objdb_iface_ver0 *objdb, unsigned int source_object, unsigned int target_parent_object, int always_create)
 {
 	unsigned int object_handle;
 	unsigned int new_object;
@@ -935,7 +935,7 @@ static int move_config_tree(struct objdb_iface_ver0 *objdb, unsigned int source_
 	objdb->object_name_get(source_object, object_name, &object_name_len);
 
 	objdb->object_find_create(target_parent_object, object_name, strlen(object_name), &find_handle);
-	if (objdb->object_find_next(find_handle, &object_handle))
+	if (always_create || objdb->object_find_next(find_handle, &object_handle))
 			objdb->object_create(target_parent_object, &new_object, object_name, object_name_len);
 	objdb->object_find_destroy(find_handle);
 
@@ -959,7 +959,7 @@ static int move_config_tree(struct objdb_iface_ver0 *objdb, unsigned int source_
 	while ( (res = objdb->object_find_next(find_handle, &object_handle) == 0)) {
 
 		/* Down we go ... */
-		move_config_tree(objdb, object_handle, new_object);
+		move_config_tree(objdb, object_handle, new_object, 0);
 	}
 	objdb->object_find_destroy(find_handle);
 
@@ -970,19 +970,19 @@ static int move_config_tree(struct objdb_iface_ver0 *objdb, unsigned int source_
  * Move trees from /cluster where they live in cluster.conf, into the root
  * of the config tree where corosync expects to find them.
  */
-static int move_tree_to_root(struct objdb_iface_ver0 *objdb, char *name)
+static int move_tree_to_root(struct objdb_iface_ver0 *objdb, char *name, int always_create)
 {
 	unsigned int find_handle;
 	unsigned int object_handle;
 	int res=0;
 
 	objdb->object_find_create(cluster_parent_handle, name, strlen(name), &find_handle);
-	if (objdb->object_find_next(find_handle, &object_handle) == 0) {
-		res = move_config_tree(objdb, object_handle, OBJECT_PARENT_HANDLE);
+	while (objdb->object_find_next(find_handle, &object_handle) == 0) {
+		res = move_config_tree(objdb, object_handle, OBJECT_PARENT_HANDLE, always_create);
 	}
 	objdb->object_find_destroy(find_handle);
 
-	// TODO Destroy original ??
+	// TODO Destroy original(s) ??
 	// objdb->object_destroy(object_handle);
 	return res;
 }
@@ -1025,13 +1025,18 @@ static int cmanpre_readconfig(struct objdb_iface_ver0 *objdb, char **error_strin
 	objdb->object_find_create(OBJECT_PARENT_HANDLE, "cluster", strlen("cluster"), &find_handle);
         objdb->object_find_next(find_handle, &cluster_parent_handle);
 	objdb->object_find_destroy(find_handle);
+	if (!cluster_parent_handle) {
+		sprintf (error_reason, "%s", "Cannot find /cluster/ key in configuration\n");
+		return -1;
+	}
 
 	/* Move these to a place where corosync expects to find them */
-	ret = move_tree_to_root(objdb, "totem");
-	ret = move_tree_to_root(objdb, "logging");
-	ret = move_tree_to_root(objdb, "event");
-	ret = move_tree_to_root(objdb, "amf");
-	ret = move_tree_to_root(objdb, "aisexec");
+	ret = move_tree_to_root(objdb, "totem", 0);
+	ret = move_tree_to_root(objdb, "logging", 0);
+	ret = move_tree_to_root(objdb, "event", 0);
+	ret = move_tree_to_root(objdb, "amf", 0);
+	ret = move_tree_to_root(objdb, "aisexec", 0);
+	ret = move_tree_to_root(objdb, "service", 1);
 
 	objdb->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
 	if (objdb->object_find_next(find_handle, &object_handle)) {
diff --git a/config/daemons/ccsd/ccsd b/config/daemons/ccsd/ccsd
new file mode 100755
index 0000000..92c6800
Binary files /dev/null and b/config/daemons/ccsd/ccsd differ
diff --git a/config/ldap.tar.gz b/config/ldap.tar.gz
new file mode 100644
index 0000000..1b4996c
Binary files /dev/null and b/config/ldap.tar.gz differ
diff --git a/config/tools/ccs_test/ccs_test b/config/tools/ccs_test/ccs_test
new file mode 100755
index 0000000..658b311
Binary files /dev/null and b/config/tools/ccs_test/ccs_test differ
diff --git a/config/tools/ccs_tool/ccs_test b/config/tools/ccs_tool/ccs_test
new file mode 120000
index 0000000..c22b977
--- /dev/null
+++ b/config/tools/ccs_tool/ccs_test
@@ -0,0 +1 @@
+ccs_tool
\ No newline at end of file
diff --git a/config/tools/ccs_tool/ccs_tool b/config/tools/ccs_tool/ccs_tool
new file mode 100755
index 0000000..4c80a02
Binary files /dev/null and b/config/tools/ccs_tool/ccs_tool differ
diff --git a/config/tools/ldap/confdb2ldif b/config/tools/ldap/confdb2ldif
new file mode 100755
index 0000000..95a5bbc
Binary files /dev/null and b/config/tools/ldap/confdb2ldif differ
diff --git a/config/tools/man/confdb2ldif.8~ b/config/tools/man/confdb2ldif.8~
new file mode 100644
index 0000000..a435f5c
--- /dev/null
+++ b/config/tools/man/confdb2ldif.8~
@@ -0,0 +1,42 @@
+.TH confdb2ldif 8
+
+.SH NAME
+confdb2ldif - Create a LDAP LDIF file from a cluster configuration
+
+.SH SYNOPSIS
+.B confdb2ldap <basedn> [<config object base>]
+
+.SH DESCRIPTION
+\fBconfdb2ldif\fP Reads the cluster configuration from the openais object database
+and generates and LDIF file suitable for importing into an LDAP database. The LDIF
+file is written to standard output.
+
+.SH OPTIONS
+.TP
+\fB<basedn>\fP
+This is the base DN of the LDAP server into which the configuration will be imported.
+confdb2ldif will create a "cn=cluster" object below this to contain the cluster configuration.
+.TP
+\fB[<config object base>]\fP
+Configuration object in the objdb to start from. This defaults to "cluster" and 
+there should rarely be any need to change it.
+
+.SH COMMENTS
+\fBconfdb2ldif\fP uses the openais libconfdb to read the configuration. If run against
+a running aisexec it will read the live configuration. It is possible to generate an LDIF file 
+from a non-running system by using the standalone feature of openais's libconfdb.
+.b
+eg to read the configuration from /etc/cluster/cluster.conf, use the following command:
+
+\fOPENAIS_DEFAULT_CONFIG_IFACE=xmlconfig:cmanpreconfig \fconfdb2ldif \fdc=mycompany,dc=com
+
+or to do it from CCS
+
+\fOPENAIS_DEFAULT_CONFIG_IFACE=ccsconfig:cmanpreconfig \fconfdb2ldif \fdc=mycompany,dc=com
+
+
+
+.SH BUGS
+
+.SH SEE ALSO
+libconfdb(7), openais(8), cluster.conf(5)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-09-11 15:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-11 15:44 master - cman: Copy "service" keys down to corosync Christine Caulfield

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).