From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1825 invoked by alias); 9 Jul 2008 14:20:00 -0000 Received: (qmail 1781 invoked by uid 9452); 9 Jul 2008 14:19:57 -0000 Date: Wed, 09 Jul 2008 14:20:00 -0000 Message-ID: <20080709141956.1762.qmail@sourceware.org> From: ccaulfield@sourceware.org To: cluster-cvs@sources.redhat.com, cluster-devel@redhat.com Subject: Cluster Project branch, master, updated. cluster-2.99.05-56-ge88a7d8 X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 6fb8dc9d73db3a5e48589ee274f1c34ee4bc76c5 X-Git-Newrev: e88a7d8044de44be39369f99d65bdb818e478c97 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2008-q3/txt/msg00030.txt.bz2 This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=e88a7d8044de44be39369f99d65bdb818e478c97 The branch, master has been updated via e88a7d8044de44be39369f99d65bdb818e478c97 (commit) from 6fb8dc9d73db3a5e48589ee274f1c34ee4bc76c5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e88a7d8044de44be39369f99d65bdb818e478c97 Author: Christine Caulfield Date: Wed Jul 9 15:18:09 2008 +0100 [CONFIG] Add ldap loader Add a new tool to load an existing cluster config into LDAP. This is as incomplete as the schema at the moment, but it will allow you to add nodes and some very basic fencing devices. It uses libconfdb so it can migrate either a running system or a cluster.conf file. Signed-off-by: Christine Caulfield ----------------------------------------------------------------------- Summary of changes: config/plugins/ldap/99cluster.ldif | 2 +- config/tools/{ccs_test => ldap}/Makefile | 8 +- config/tools/ldap/loadldap.c | 206 ++++++++++++++++++++++++++++++ 3 files changed, 211 insertions(+), 5 deletions(-) copy config/tools/{ccs_test => ldap}/Makefile (81%) create mode 100644 config/tools/ldap/loadldap.c diff --git a/config/plugins/ldap/99cluster.ldif b/config/plugins/ldap/99cluster.ldif index bd2d843..7b53a12 100644 --- a/config/plugins/ldap/99cluster.ldif +++ b/config/plugins/ldap/99cluster.ldif @@ -129,7 +129,7 @@ objectClasses: ( 1.3.6.1.4.1.2312.8.1.2.6 NAME 'rhcsFenceagent' SUP top STRUCTURAL DESC 'A Fence device' MUST ( name ) - MAY ( rhcsPort ) + MAY ( rhcsPort $ rhcsIpaddr ) ) objectClasses: ( 1.3.6.1.4.1.2312.8.1.2.7 NAME 'rhcsFencemethod' SUP top STRUCTURAL diff --git a/config/tools/ccs_test/Makefile b/config/tools/ldap/Makefile similarity index 81% copy from config/tools/ccs_test/Makefile copy to config/tools/ldap/Makefile index f0ebddc..dae9849 100644 --- a/config/tools/ccs_test/Makefile +++ b/config/tools/ldap/Makefile @@ -1,4 +1,4 @@ -TARGET= ccs_test +TARGET= loadldap SBINDIRT=$(TARGET) @@ -10,13 +10,13 @@ include $(OBJDIR)/make/clean.mk include $(OBJDIR)/make/install.mk include $(OBJDIR)/make/uninstall.mk -OBJS= ccs_test.o +OBJS= loadldap.o CFLAGS += -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -CFLAGS += -I${ccsincdir} +CFLAGS += -I${openaisincdir} CFLAGS += -I${incdir} -LDFLAGS += -L${ccslibdir} -lccs +LDFLAGS += -L${openaislibdir} -lconfdb ${TARGET}: ${OBJS} diff --git a/config/tools/ldap/loadldap.c b/config/tools/ldap/loadldap.c new file mode 100644 index 0000000..b25a3d6 --- /dev/null +++ b/config/tools/ldap/loadldap.c @@ -0,0 +1,206 @@ +/* + * Copyright (c) 2008 Red Hat Inc + * + * All rights reserved. + * + * Author: Christine Caulfield + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +confdb_callbacks_t callbacks = { + .confdb_change_notify_fn = NULL, +}; + +/* This structure maps object parent names to object classes */ +struct objectclasses +{ + char *name; + char *class; +} objectclasses[] = +{ + { "cluster", "rhcsCluster" }, + { "cman", "rhcsCman" }, + { "totem", "rhcsTotem" }, + { "clusternode", "rhcsNode" }, + { "device", "rhcsFenceagent" }, + { "fencedevice", "rhcsFencedevice" }, + { "method", "rhcsFencemethod" }, +}; +/* TODO: Add more here as the schema gets filled in */ + + +static char *ldap_attr_name(char *attrname) +{ + static char newname[1024]; + int i; + + if (strcmp(attrname, "name") == 0) + return attrname; + + sprintf(newname, "rhcs"); + for (i=0; i []\n", argv[0]); + fprintf(stderr, "\n"); + fprintf(stderr, " eg: \n"); + fprintf(stderr, " %s dc=mycompany,dc=com\n", argv[0]); + fprintf(stderr, " %s dc=mycompany,dc=com rhcluster\n", argv[0]); + fprintf(stderr, "\n"); + fprintf(stderr, "objdb root defaults to 'cn=cluster'\n"); + fprintf(stderr, "\n"); + return 0; + } + + if (argc > 2) { + clusterroot = argv[2]; + } + + result = confdb_initialize (&handle, &callbacks); + if (result != SA_AIS_OK) { + printf ("Could not initialize Cluster Configuration Database API instance error %d\n", result); + exit (1); + } + + /* Find the starting object ... this should be a param */ + + result = confdb_object_find_start(handle, OBJECT_PARENT_HANDLE); + if (result != SA_AIS_OK) { + printf ("Could not start object_find %d\n", result); + exit (1); + } + + result = confdb_object_find(handle, OBJECT_PARENT_HANDLE, "cluster", strlen("cluster"), &cluster_handle); + if (result != SA_AIS_OK) { + printf ("Could not object_find \"cluster\": %d\n", result); + exit (1); + } + + sprintf(basedn, "cn=%s,%s", clusterroot, argv[1]); + + /* Print the configuration */ + print_config_tree(handle, cluster_handle, clusterroot, basedn); + + + result = confdb_finalize (handle); + return (0); +} hooks/post-receive -- Cluster Project