Compare commits

...
Sign in to create a new pull request.

10 commits

Author SHA1 Message Date
Fedora Release Engineering
d8301a66ec dist-git conversion 2010-07-28 12:12:32 +00:00
Fabio M. Di Nitto
aac7b82a90 New upstream release 2010-05-25 08:00:10 +00:00
Fabio M. Di Nitto
9ae9001a73 New upstream release 2010-04-12 03:36:11 +00:00
Fabio M. Di Nitto
bb79552cee New upstream release 2009-12-09 13:36:28 +00:00
Bill Nottingham
b409d5a69f Fix typo that causes a failure to update the common directory. (releng
#2781)
2009-11-26 01:33:14 +00:00
Fabio M. Di Nitto
f41fc03d86 New upstream release fixes major regression on specific loads 2009-10-23 07:29:39 +00:00
Fabio M. Di Nitto
5b837706ab New upstream release fixes few severe bugs 2009-10-21 05:03:34 +00:00
Fabio M. Di Nitto
16e1ca7db2 New upstream release fixes a few severe bugs 2009-10-09 05:11:17 +00:00
Fabio M. Di Nitto
6e535b2c6e New upstream release to fix several major bugs 2009-07-28 12:30:54 +00:00
Jesse Keating
ace4e4a027 Initialize branch F-11 for corosync 2009-04-15 06:31:17 +00:00
8 changed files with 932 additions and 83 deletions

View file

@ -1 +0,0 @@
corosync-0.95.tar.gz

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
corosync-1.2.3.tar.gz

View file

@ -1,21 +0,0 @@
# Makefile for source rpm: corosync
# $Id$
NAME := corosync
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attept a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)

View file

@ -1,14 +1,14 @@
## define alphatag svn1797
# global alphatag svn1211
Name: corosync
Summary: The Corosync Cluster Engine and Application Programming Interfaces
Version: 0.95
Release: 2%{?alphatag:.%{alphatag}}%{?dist}
Version: 1.2.3
Release: 1%{?alphatag:.%{alphatag}}%{?dist}
License: BSD
Group: System Environment/Base
URL: http://www.openais.org
Source0: http://developer.osdl.org/dev/openais/downloads/corosync-%{version}/corosync-%{version}.tar.gz
Patch0: fix-pkgconfig.diff
URL: http://ftp.corosync.org
Source0: ftp://ftp:user@ftp.corosync.org/downloads/%{name}-%{version}/%{name}-%{version}.tar.gz
Patch0: revision-2770.patch
# Runtime bits
Requires: corosynclib = %{version}-%{release}
@ -17,8 +17,7 @@ Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Conflicts: openais <= 0.89, openais-devel <= 0.89
# Setup/build bits
%define ais_user_uid 39
# Build bits
%define buildtrunk 0
%{?_with_buildtrunk: %define buildtrunk 1}
@ -27,23 +26,27 @@ Conflicts: openais <= 0.89, openais-devel <= 0.89
BuildRequires: autoconf automake
%endif
BuildRequires: nss-devel
BuildRequires: libibverbs-devel librdmacm-devel
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
%prep
%setup -q -n corosync-%{version}
%patch0 -p1
%setup -q -n %{name}-%{version}
%patch0
%if %{buildtrunk}
if [ ! -f configure ]; then
./autogen.sh
fi
./autogen.sh
%endif
%{_configure} CFLAGS="$(echo '%{optflags}')" \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--libdir=%{_libdir}
export ibverbs_CFLAGS=-I/usr/include/infiniband \
export ibverbs_LIBS=-libverbs \
export rdmacm_CFLAGS=-I/usr/include/rdma \
export rdmacm_LIBS=-lrdmacm \
%{configure} \
--enable-nss \
--enable-rdma \
--with-initddir=%{_initddir}
%build
make %{_smp_mflags}
@ -52,8 +55,6 @@ make %{_smp_mflags}
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
install -d %{buildroot}%{_initddir}
install -m 755 init/redhat %{buildroot}%{_initddir}/corosync
## tree fixup
# drop static libs
@ -64,15 +65,10 @@ rm -rf %{buildroot}%{_docdir}/*
%clean
rm -rf %{buildroot}
%description
%description
This package contains the Corosync Cluster Engine Executive, several default
APIs and libraries, default configuration files, and an init script.
%pre
# Add the "ais" user
/usr/sbin/useradd -c 'The Corosync Cluster Engine' \
-u %{ais_user_uid} -s /sbin/nologin -r -d '/' ais 2> /dev/null || :
%post
/sbin/chkconfig --add corosync || :
@ -82,10 +78,7 @@ if [ $1 -eq 0 ]; then
/sbin/chkconfig --del corosync || :
fi
%postun
[ "$1" -ge "1" ] && /sbin/service corosync condrestart &>/dev/null || :
%files
%files
%defattr(-,root,root,-)
%doc LICENSE SECURITY
%{_sbindir}/corosync
@ -94,7 +87,12 @@ fi
%{_sbindir}/corosync-cfgtool
%{_sbindir}/corosync-fplay
%{_sbindir}/corosync-pload
%config(noreplace) /etc/corosync.conf
%{_sbindir}/corosync-cpgtool
%{_sbindir}/corosync-quorumtool
%dir %{_sysconfdir}/corosync
%dir %{_sysconfdir}/corosync/service.d
%dir %{_sysconfdir}/corosync/uidgid.d
%config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example
%{_initddir}/corosync
%dir %{_libexecdir}/lcrso
%{_libexecdir}/lcrso/coroparse.lcrso
@ -108,7 +106,7 @@ fi
%{_libexecdir}/lcrso/quorum_testquorum.lcrso
%{_libexecdir}/lcrso/vsf_quorum.lcrso
%{_libexecdir}/lcrso/vsf_ykd.lcrso
%{_libexecdir}/lcrso/quorum.lcrso
%dir %{_localstatedir}/lib/corosync
%{_mandir}/man8/corosync_overview.8*
%{_mandir}/man8/corosync-objctl.8*
%{_mandir}/man5/corosync.conf.5*
@ -116,7 +114,7 @@ fi
%package -n corosynclib
Summary: The Corosync Cluster Engine Libraries
Group: System Environment/Libraries
Conflicts: corosync < 0.92-7
Requires: %{name} = %{version}-%{release}
%description -n corosynclib
This package contains corosync libraries.
@ -135,6 +133,7 @@ This package contains corosync libraries.
%{_libdir}/libquorum.so.*
%{_libdir}/libvotequorum.so.*
%{_libdir}/libpload.so.*
%{_libdir}/libsam.so.*
%post -n corosynclib -p /sbin/ldconfig
@ -157,6 +156,9 @@ The Corosync Cluster Engine APIs.
%doc LICENSE README.devmap
%dir %{_includedir}/corosync/
%{_includedir}/corosync/cs_config.h
%{_includedir}/corosync/corodefs.h
%{_includedir}/corosync/coroipc_types.h
%{_includedir}/corosync/coroipcs.h
%{_includedir}/corosync/coroipcc.h
%{_includedir}/corosync/cfg.h
%{_includedir}/corosync/confdb.h
@ -164,9 +166,9 @@ The Corosync Cluster Engine APIs.
%{_includedir}/corosync/cpg.h
%{_includedir}/corosync/evs.h
%{_includedir}/corosync/hdb.h
%{_includedir}/corosync/ipc_gen.h
%{_includedir}/corosync/list.h
%{_includedir}/corosync/mar_gen.h
%{_includedir}/corosync/sam.h
%{_includedir}/corosync/swab.h
%{_includedir}/corosync/quorum.h
%{_includedir}/corosync/votequorum.h
@ -196,19 +198,102 @@ The Corosync Cluster Engine APIs.
%{_libdir}/libquorum.so
%{_libdir}/libvotequorum.so
%{_libdir}/libpload.so
%{_libdir}/libsam.so
%{_libdir}/pkgconfig/*.pc
%{_mandir}/man3/cpg_*3*
%{_mandir}/man3/evs_*3*
%{_mandir}/man3/confdb_*3*
%{_mandir}/man3/votequorum_*3*
%{_mandir}/man3/sam_*3*
%{_mandir}/man8/cpg_overview.8*
%{_mandir}/man8/evs_overview.8*
%{_mandir}/man8/confdb_overview.8*
%{_mandir}/man8/logsys_overview.8*
%{_mandir}/man8/votequorum_overview.8*
%{_mandir}/man8/coroipc_overview.8*
%{_mandir}/man8/sam_overview.8*
%changelog
* Tue May 25 2010 Fabio M. Di Nitto <fdinitto@redhat.com> - 1.2.3-1
- New upstream release
- Rediff revision 2770 patch
* Mon May 17 2010 Fabio M. Di Nitto <fdinitto@redhat.com> - 1.2.2-1
- New upstream release
- Add upstream trunk revision 2770 to add cpg_model_initialize api.
- Fix URL and Source0 entries.
- Add workaround to broken 1.2.2 Makefile with make -j.
* Wed Mar 24 2010 Fabio M. Di Nitto <fdinitto@redhat.com> - 1.2.1-1
- New upstream release
* Tue Dec 8 2009 Fabio M. Di Nitto <fdinitto@redhat.com> - 1.2.0-1
- New upstream release
- Use global instead of define
- Update Source0 url
- Use more %name macro around
- Cleanup install section. Init script is now installed by upstream
- Cleanup whitespace
- Don't deadlock between package upgrade and corosync condrestart
- Ship service.d config directory
- Fix Conflicts vs Requires
- Ship new sam library and man pages
* Fri Oct 23 2009 Fabio M. Di Nitto <fdinitto@redhat.com> - 1.1.2-1
- New upstream release fixes major regression on specific loads
* Wed Oct 21 2009 Fabio M. Di Nitto <fdinitto@redhat.com> - 1.1.1-1
- New upstream release
* Fri Sep 25 2009 Fabio M. Di Nitto <fdinitto@redhat.com> - 1.1.0-1
- New upstream release
- spec file updates:
* enable IB support
* explicitly define built-in features at configure time
* Tue Sep 22 2009 Fabio M. Di Nitto <fdinitto@redhat.com> - 1.0.1-1
- New upstream release
- spec file updates:
* use proper configure macro
* Tue Jul 28 2009 Fabio M. Di Nitto <fdinitto@redhat.com> - 1.0.0-3
- spec file updates:
* more consistent use of macros across the board
* fix directory ownership
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Wed Jul 8 2009 Fabio M. Di Nitto <fdinitto@redhat.com> - 1.0.0-1
- New upstream release
* Thu Jul 2 2009 Fabio M. Di Nitto <fdinitto@redhat.com> - 0.100-1
- New upstream release
* Sat Jun 20 2009 Fabio M. Di Nitto <fdinitto@redhat.com> - 0.98-1
- New upstream release
- spec file updates:
* Drop corosync-trunk patch and alpha tag.
* Fix alphatag vs buildtrunk handling.
* Drop requirement on ais user/group and stop creating them.
* New config file locations from upstream: /etc/corosync/corosync.conf.
* Wed Jun 10 2009 Fabio M. Di Nitto <fdinitto@redhat.com> - 0.97-1.svn2233
- spec file updates:
* Update to svn version 2233 to include library linking fixes
* Wed Jun 10 2009 Fabio M. Di Nitto <fdinitto@redhat.com> - 0.97-1.svn2232
- New upstream release
- spec file updates:
* Drop pkgconfig fix that's now upstream
* Update to svn version 2232
* Define buildtrunk if we are using svn snapshots
* BuildRequires: nss-devel to enable nss crypto for network communication
* Force autogen invokation if buildtrunk is defined
* Whitespace cleanup
* Stop shipping corosync.conf in favour of a generic example
* Update file list
* Mon Mar 30 2009 Fabio M. Di Nitto <fdinitto@redhat.com> - 0.95-2
- Backport svn commit 1913 to fix pkgconfig files generation
and unbreak lvm2 build.

View file

@ -1,24 +0,0 @@
diff -Naurd corosync-0.95.orig/pkgconfig/Makefile.am corosync-0.95/pkgconfig/Makefile.am
--- corosync-0.95.orig/pkgconfig/Makefile.am 2009-03-22 19:44:33.000000000 +0100
+++ corosync-0.95/pkgconfig/Makefile.am 2009-03-30 08:48:32.000000000 +0200
@@ -44,7 +44,7 @@
-e 's#@PREFIX@#$(exec_prefix)#g' \
-e 's#@LIBDIR@#$(libdir)#g' \
-e 's#@LIBVERSION@#$(VERSION)#g' \
- -e 's#@LIB@#'$@'#g' \
+ -e 's#@LIB@#'$(@:lib%=%)'#g' \
> $@.pc;
touch $@
diff -Naurd corosync-0.95.orig/pkgconfig/Makefile.in corosync-0.95/pkgconfig/Makefile.in
--- corosync-0.95.orig/pkgconfig/Makefile.in 2009-03-23 23:14:38.000000000 +0100
+++ corosync-0.95/pkgconfig/Makefile.in 2009-03-30 08:48:56.000000000 +0200
@@ -353,7 +353,7 @@
-e 's#@PREFIX@#$(exec_prefix)#g' \
-e 's#@LIBDIR@#$(libdir)#g' \
-e 's#@LIBVERSION@#$(VERSION)#g' \
- -e 's#@LIB@#'$@'#g' \
+ -e 's#@LIB@#'$(@:lib%=%)'#g' \
> $@.pc;
touch $@

View file

@ -1,2 +0,0 @@
corosync-0_92-1_fc10:HEAD:corosync-0.92-1.fc10.src.rpm:1222323286
corosync-0_92-2_fc10:HEAD:corosync-0.92-2.fc10.src.rpm:1222462910

811
revision-2770.patch Normal file
View file

@ -0,0 +1,811 @@
Index: include/corosync/ipc_cpg.h
===================================================================
--- include/corosync/ipc_cpg.h (revision 2769)
+++ include/corosync/ipc_cpg.h (revision 2770)
@@ -65,6 +65,7 @@
MESSAGE_RES_CPG_ITERATIONNEXT = 10,
MESSAGE_RES_CPG_ITERATIONFINALIZE = 11,
MESSAGE_RES_CPG_FINALIZE = 12,
+ MESSAGE_RES_CPG_TOTEM_CONFCHG_CALLBACK = 13,
};
enum lib_cpg_confchg_reason {
@@ -149,10 +150,24 @@
marshall_from_mar_cpg_name_t (&dest->group, &src->group);
};
+typedef struct {
+ mar_uint32_t nodeid __attribute__((aligned(8)));
+ mar_uint64_t seq __attribute__((aligned(8)));
+} mar_cpg_ring_id_t;
+
+static inline void marshall_from_mar_cpg_ring_id_t (
+ struct cpg_ring_id *dest,
+ const mar_cpg_ring_id_t *src)
+{
+ dest->nodeid = src->nodeid;
+ dest->seq = src->seq;
+}
+
struct req_lib_cpg_join {
coroipc_request_header_t header __attribute__((aligned(8)));
mar_cpg_name_t group_name __attribute__((aligned(8)));
mar_uint32_t pid __attribute__((aligned(8)));
+ mar_uint32_t flags __attribute__((aligned(8)));
};
struct res_lib_cpg_join {
@@ -238,6 +253,13 @@
// struct cpg_address joined_list[];
};
+struct res_lib_cpg_totem_confchg_callback {
+ coroipc_response_header_t header __attribute__((aligned(8)));
+ mar_cpg_ring_id_t ring_id __attribute__((aligned(8)));
+ mar_uint32_t member_list_entries __attribute__((aligned(8)));
+ mar_uint32_t member_list[];
+};
+
struct req_lib_cpg_leave {
coroipc_request_header_t header __attribute__((aligned(8)));
mar_cpg_name_t group_name __attribute__((aligned(8)));
Index: include/corosync/cpg.h
===================================================================
--- include/corosync/cpg.h (revision 2769)
+++ include/corosync/cpg.h (revision 2770)
@@ -78,6 +78,10 @@
CPG_ITERATION_ALL = 3,
} cpg_iteration_type_t;
+typedef enum {
+ CPG_MODEL_V1 = 1,
+} cpg_model_t;
+
struct cpg_address {
uint32_t nodeid;
uint32_t pid;
@@ -98,6 +102,11 @@
uint32_t pid;
};
+struct cpg_ring_id {
+ uint32_t nodeid;
+ uint64_t seq;
+};
+
typedef void (*cpg_deliver_fn_t) (
cpg_handle_t handle,
const struct cpg_name *group_name,
@@ -117,11 +126,32 @@
const struct cpg_address *left_list, size_t left_list_entries,
const struct cpg_address *joined_list, size_t joined_list_entries);
+typedef void (*cpg_totem_confchg_fn_t) (
+ cpg_handle_t handle,
+ struct cpg_ring_id ring_id,
+ uint32_t member_list_entries,
+ const uint32_t *member_list);
+
typedef struct {
cpg_deliver_fn_t cpg_deliver_fn;
cpg_confchg_fn_t cpg_confchg_fn;
} cpg_callbacks_t;
+typedef struct {
+ cpg_model_t model;
+} cpg_model_data_t;
+
+#define CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF 0x01
+
+typedef struct {
+ cpg_model_t model;
+ cpg_deliver_fn_t cpg_deliver_fn;
+ cpg_confchg_fn_t cpg_confchg_fn;
+ cpg_totem_confchg_fn_t cpg_totem_confchg_fn;
+ unsigned int flags;
+} cpg_model_v1_data_t;
+
+
/** @} */
/*
@@ -132,6 +162,15 @@
cpg_callbacks_t *callbacks);
/*
+ * Create a new cpg connection, initialize with model
+ */
+cs_error_t cpg_model_initialize (
+ cpg_handle_t *handle,
+ cpg_model_t model,
+ cpg_model_data_t *model_data,
+ void *context);
+
+/*
* Close the cpg handle
*/
cs_error_t cpg_finalize (
Index: services/cpg.c
===================================================================
--- services/cpg.c (revision 2769)
+++ services/cpg.c (revision 2770)
@@ -133,6 +133,8 @@
mar_cpg_name_t group_name;
uint32_t pid;
enum cpd_state cpd_state;
+ unsigned int flags;
+ int initial_totem_conf_sent;
struct list_head list;
struct list_head iteration_instance_list_head;
};
@@ -160,6 +162,8 @@
static enum cpg_sync_state my_sync_state = CPGSYNC_DOWNLIST;
+static mar_cpg_ring_id_t last_sync_ring_id;
+
struct process_info {
unsigned int nodeid;
uint32_t pid;
@@ -255,6 +259,11 @@
static void cpg_sync_abort (void);
+static int notify_lib_totem_membership (
+ void *conn,
+ int member_list_entries,
+ const unsigned int *member_list);
+
/*
* Library Handler Definition
*/
@@ -432,6 +441,9 @@
sizeof (unsigned int));
my_member_list_entries = member_list_entries;
+ last_sync_ring_id.nodeid = ring_id->rep.nodeid;
+ last_sync_ring_id.seq = ring_id->seq;
+
for (i = 0; i < my_member_list_entries; i++) {
if (my_member_list[i] < lowest_nodeid) {
lowest_nodeid = my_member_list[i];
@@ -482,14 +494,51 @@
memcpy (my_old_member_list, my_member_list,
my_member_list_entries * sizeof (unsigned int));
my_old_member_list_entries = my_member_list_entries;
+
+ notify_lib_totem_membership (NULL, my_member_list_entries, my_member_list);
}
static void cpg_sync_abort (void)
{
}
+static int notify_lib_totem_membership (
+ void *conn,
+ int member_list_entries,
+ const unsigned int *member_list)
+{
+ struct list_head *iter;
+ char *buf;
+ int size;
+ struct res_lib_cpg_totem_confchg_callback *res;
+ size = sizeof(struct res_lib_cpg_totem_confchg_callback) +
+ sizeof(mar_uint32_t) * (member_list_entries);
+ buf = alloca(size);
+ if (!buf)
+ return CPG_ERR_LIBRARY;
+ res = (struct res_lib_cpg_totem_confchg_callback *)buf;
+ res->member_list_entries = member_list_entries;
+ res->header.size = size;
+ res->header.id = MESSAGE_RES_CPG_TOTEM_CONFCHG_CALLBACK;
+ res->header.error = CS_OK;
+
+ memcpy (&res->ring_id, &last_sync_ring_id, sizeof (mar_cpg_ring_id_t));
+ memcpy (res->member_list, member_list, res->member_list_entries * sizeof (mar_uint32_t));
+
+ if (conn == NULL) {
+ for (iter = cpg_pd_list_head.next; iter != &cpg_pd_list_head; iter = iter->next) {
+ struct cpg_pd *cpg_pd = list_entry (iter, struct cpg_pd, list);
+ api->ipc_dispatch_send (cpg_pd->conn, buf, size);
+ }
+ } else {
+ api->ipc_dispatch_send (conn, buf, size);
+ }
+
+ return CPG_OK;
+}
+
static int notify_lib_joinlist(
const mar_cpg_name_t *group_name,
void *conn,
@@ -604,6 +653,20 @@
}
}
+
+ /*
+ * Traverse thru cpds and send totem membership for cpd, where it is not send yet
+ */
+ for (iter = cpg_pd_list_head.next; iter != &cpg_pd_list_head; iter = iter->next) {
+ struct cpg_pd *cpd = list_entry (iter, struct cpg_pd, list);
+
+ if ((cpd->flags & CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF) && (cpd->initial_totem_conf_sent == 0)) {
+ cpd->initial_totem_conf_sent = 1;
+
+ notify_lib_totem_membership (cpd->conn, my_old_member_list_entries, my_old_member_list);
+ }
+ }
+
return CPG_OK;
}
@@ -1093,6 +1156,7 @@
error = CPG_OK;
cpd->cpd_state = CPD_STATE_JOIN_STARTED;
cpd->pid = req_lib_cpg_join->pid;
+ cpd->flags = req_lib_cpg_join->flags;
memcpy (&cpd->group_name, &req_lib_cpg_join->group_name,
sizeof (cpd->group_name));
Index: lib/cpg.c
===================================================================
--- lib/cpg.c (revision 2769)
+++ lib/cpg.c (revision 2770)
@@ -62,8 +62,11 @@
struct cpg_inst {
hdb_handle_t handle;
int finalize;
- cpg_callbacks_t callbacks;
void *context;
+ union {
+ cpg_model_data_t model_data;
+ cpg_model_v1_data_t model_v1_data;
+ };
struct list_head iteration_list_head;
};
@@ -118,9 +121,32 @@
cpg_handle_t *handle,
cpg_callbacks_t *callbacks)
{
+ cpg_model_v1_data_t model_v1_data;
+
+ memset (&model_v1_data, 0, sizeof (cpg_model_v1_data_t));
+
+ if (callbacks) {
+ model_v1_data.cpg_deliver_fn = callbacks->cpg_deliver_fn;
+ model_v1_data.cpg_confchg_fn = callbacks->cpg_confchg_fn;
+ }
+
+ return (cpg_model_initialize (handle, CPG_MODEL_V1, (cpg_model_data_t *)&model_v1_data, NULL));
+}
+
+cs_error_t cpg_model_initialize (
+ cpg_handle_t *handle,
+ cpg_model_t model,
+ cpg_model_data_t *model_data,
+ void *context)
+{
cs_error_t error;
struct cpg_inst *cpg_inst;
+ if (model != CPG_MODEL_V1) {
+ error = CPG_ERR_INVALID_PARAM;
+ goto error_no_destroy;
+ }
+
error = hdb_error_to_cs (hdb_handle_create (&cpg_handle_t_db, sizeof (struct cpg_inst), handle));
if (error != CS_OK) {
goto error_no_destroy;
@@ -142,10 +168,26 @@
goto error_put_destroy;
}
- if (callbacks) {
- memcpy (&cpg_inst->callbacks, callbacks, sizeof (cpg_callbacks_t));
+ if (model_data != NULL) {
+ switch (model) {
+ case CPG_MODEL_V1:
+ memcpy (&cpg_inst->model_v1_data, model_data, sizeof (cpg_model_v1_data_t));
+ if ((cpg_inst->model_v1_data.flags & ~(CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF)) != 0) {
+ error = CS_ERR_INVALID_PARAM;
+
+ goto error_destroy;
+ }
+ break;
+ default:
+ error = CS_ERR_LIBRARY;
+ goto error_destroy;
+ break;
+ }
}
+ cpg_inst->model_data.model = model;
+ cpg_inst->context = context;
+
list_init(&cpg_inst->iteration_list_head);
hdb_handle_put (&cpg_handle_t_db, *handle);
@@ -283,7 +325,8 @@
struct cpg_inst *cpg_inst;
struct res_lib_cpg_confchg_callback *res_cpg_confchg_callback;
struct res_lib_cpg_deliver_callback *res_cpg_deliver_callback;
- cpg_callbacks_t callbacks;
+ struct res_lib_cpg_totem_confchg_callback *res_cpg_totem_confchg_callback;
+ struct cpg_inst cpg_inst_copy;
coroipc_response_header_t *dispatch_data;
struct cpg_address member_list[CPG_MEMBERS_MAX];
struct cpg_address left_list[CPG_MEMBERS_MAX];
@@ -292,6 +335,8 @@
mar_cpg_address_t *left_list_start;
mar_cpg_address_t *joined_list_start;
unsigned int i;
+ struct cpg_ring_id ring_id;
+ uint32_t totem_member_list[CPG_MEMBERS_MAX];
error = hdb_error_to_cs (hdb_handle_get (&cpg_handle_t_db, handle, (void *)&cpg_inst));
if (error != CS_OK) {
@@ -332,74 +377,96 @@
* A risk of this dispatch method is that the callback routines may
* operate at the same time that cpgFinalize has been called.
*/
- memcpy (&callbacks, &cpg_inst->callbacks, sizeof (cpg_callbacks_t));
- /*
- * Dispatch incoming message
- */
- switch (dispatch_data->id) {
- case MESSAGE_RES_CPG_DELIVER_CALLBACK:
- if (callbacks.cpg_deliver_fn == NULL) {
+ memcpy (&cpg_inst_copy, cpg_inst, sizeof (struct cpg_inst));
+
+ switch (cpg_inst_copy.model_data.model) {
+ case CPG_MODEL_V1:
+ /*
+ * Dispatch incoming message
+ */
+ switch (dispatch_data->id) {
+ case MESSAGE_RES_CPG_DELIVER_CALLBACK:
+ if (cpg_inst_copy.model_v1_data.cpg_deliver_fn == NULL) {
+ break;
+ }
+
+ res_cpg_deliver_callback = (struct res_lib_cpg_deliver_callback *)dispatch_data;
+
+ marshall_from_mar_cpg_name_t (
+ &group_name,
+ &res_cpg_deliver_callback->group_name);
+
+ cpg_inst_copy.model_v1_data.cpg_deliver_fn (handle,
+ &group_name,
+ res_cpg_deliver_callback->nodeid,
+ res_cpg_deliver_callback->pid,
+ &res_cpg_deliver_callback->message,
+ res_cpg_deliver_callback->msglen);
break;
- }
- res_cpg_deliver_callback = (struct res_lib_cpg_deliver_callback *)dispatch_data;
+ case MESSAGE_RES_CPG_CONFCHG_CALLBACK:
+ if (cpg_inst_copy.model_v1_data.cpg_confchg_fn == NULL) {
+ break;
+ }
- marshall_from_mar_cpg_name_t (
- &group_name,
- &res_cpg_deliver_callback->group_name);
+ res_cpg_confchg_callback = (struct res_lib_cpg_confchg_callback *)dispatch_data;
- callbacks.cpg_deliver_fn (handle,
- &group_name,
- res_cpg_deliver_callback->nodeid,
- res_cpg_deliver_callback->pid,
- &res_cpg_deliver_callback->message,
- res_cpg_deliver_callback->msglen);
- break;
+ for (i = 0; i < res_cpg_confchg_callback->member_list_entries; i++) {
+ marshall_from_mar_cpg_address_t (&member_list[i],
+ &res_cpg_confchg_callback->member_list[i]);
+ }
+ left_list_start = res_cpg_confchg_callback->member_list +
+ res_cpg_confchg_callback->member_list_entries;
+ for (i = 0; i < res_cpg_confchg_callback->left_list_entries; i++) {
+ marshall_from_mar_cpg_address_t (&left_list[i],
+ &left_list_start[i]);
+ }
+ joined_list_start = res_cpg_confchg_callback->member_list +
+ res_cpg_confchg_callback->member_list_entries +
+ res_cpg_confchg_callback->left_list_entries;
+ for (i = 0; i < res_cpg_confchg_callback->joined_list_entries; i++) {
+ marshall_from_mar_cpg_address_t (&joined_list[i],
+ &joined_list_start[i]);
+ }
+ marshall_from_mar_cpg_name_t (
+ &group_name,
+ &res_cpg_confchg_callback->group_name);
- case MESSAGE_RES_CPG_CONFCHG_CALLBACK:
- if (callbacks.cpg_confchg_fn == NULL) {
+ cpg_inst_copy.model_v1_data.cpg_confchg_fn (handle,
+ &group_name,
+ member_list,
+ res_cpg_confchg_callback->member_list_entries,
+ left_list,
+ res_cpg_confchg_callback->left_list_entries,
+ joined_list,
+ res_cpg_confchg_callback->joined_list_entries);
+
break;
- }
+ case MESSAGE_RES_CPG_TOTEM_CONFCHG_CALLBACK:
+ if (cpg_inst_copy.model_v1_data.cpg_totem_confchg_fn == NULL) {
+ break;
+ }
- res_cpg_confchg_callback = (struct res_lib_cpg_confchg_callback *)dispatch_data;
+ res_cpg_totem_confchg_callback = (struct res_lib_cpg_totem_confchg_callback *)dispatch_data;
- for (i = 0; i < res_cpg_confchg_callback->member_list_entries; i++) {
- marshall_from_mar_cpg_address_t (&member_list[i],
- &res_cpg_confchg_callback->member_list[i]);
- }
- left_list_start = res_cpg_confchg_callback->member_list +
- res_cpg_confchg_callback->member_list_entries;
- for (i = 0; i < res_cpg_confchg_callback->left_list_entries; i++) {
- marshall_from_mar_cpg_address_t (&left_list[i],
- &left_list_start[i]);
- }
- joined_list_start = res_cpg_confchg_callback->member_list +
- res_cpg_confchg_callback->member_list_entries +
- res_cpg_confchg_callback->left_list_entries;
- for (i = 0; i < res_cpg_confchg_callback->joined_list_entries; i++) {
- marshall_from_mar_cpg_address_t (&joined_list[i],
- &joined_list_start[i]);
- }
- marshall_from_mar_cpg_name_t (
- &group_name,
- &res_cpg_confchg_callback->group_name);
+ marshall_from_mar_cpg_ring_id_t (&ring_id, &res_cpg_totem_confchg_callback->ring_id);
+ for (i = 0; i < res_cpg_totem_confchg_callback->member_list_entries; i++) {
+ totem_member_list[i] = res_cpg_totem_confchg_callback->member_list[i];
+ }
- callbacks.cpg_confchg_fn (handle,
- &group_name,
- member_list,
- res_cpg_confchg_callback->member_list_entries,
- left_list,
- res_cpg_confchg_callback->left_list_entries,
- joined_list,
- res_cpg_confchg_callback->joined_list_entries);
- break;
-
- default:
- coroipcc_dispatch_put (cpg_inst->handle);
- error = CS_ERR_LIBRARY;
- goto error_put;
- break;
- }
+ cpg_inst_copy.model_v1_data.cpg_totem_confchg_fn (handle,
+ ring_id,
+ res_cpg_totem_confchg_callback->member_list_entries,
+ totem_member_list);
+ break;
+ default:
+ coroipcc_dispatch_put (cpg_inst->handle);
+ error = CS_ERR_LIBRARY;
+ goto error_put;
+ break;
+ } /* - switch (dispatch_data->id) */
+ break; /* case CPG_MODEL_V1 */
+ } /* - switch (cpg_inst_copy.model_data.model) */
coroipcc_dispatch_put (cpg_inst->handle);
/*
@@ -434,6 +501,14 @@
req_lib_cpg_join.header.size = sizeof (struct req_lib_cpg_join);
req_lib_cpg_join.header.id = MESSAGE_REQ_CPG_JOIN;
req_lib_cpg_join.pid = getpid();
+ req_lib_cpg_join.flags = 0;
+
+ switch (cpg_inst->model_data.model) {
+ case CPG_MODEL_V1:
+ req_lib_cpg_join.flags = cpg_inst->model_v1_data.flags;
+ break;
+ }
+
marshall_to_mar_cpg_name_t (&req_lib_cpg_join.group_name,
group);
Index: lib/libcpg.verso
===================================================================
--- lib/libcpg.verso (revision 2769)
+++ lib/libcpg.verso (revision 2770)
@@ -1 +1 @@
-4.0.1
+4.1.0
Index: man/cpg_initialize.3
===================================================================
--- man/cpg_initialize.3 (revision 2769)
+++ man/cpg_initialize.3 (revision 2770)
@@ -41,7 +41,10 @@
.SH DESCRIPTION
The
.B cpg_initialize
-function is used to initialize a connection to the closed process groups API.
+function is used to initialize a connection to the closed process groups API. This function is deprecated
+and
+.B cpg_model_initialize
+should be used in newly written code.
.PP
Each application may have several connections to the CPG API. Each application
uses the
@@ -167,5 +170,6 @@
.BR cpg_context_get (3)
.BR cpg_context_set (3)
.BR cpg_local_get (3)
+.BR cpg_model_initialize (3)
.PP
Index: man/cpg_overview.8
===================================================================
--- man/cpg_overview.8 (revision 2769)
+++ man/cpg_overview.8 (revision 2770)
@@ -61,6 +61,7 @@
.BR cpg_join (3),
.BR cpg_leave (3),
.BR cpg_mcast_joined (3),
+.BR cpg_model_initialize (3),
.BR cpg_membership_get (3)
.BR cpg_zcb_alloc (3)
.BR cpg_zcb_free (3)
Index: man/cpg_model_initialize.3
===================================================================
--- man/cpg_model_initialize.3 (revision 0)
+++ man/cpg_model_initialize.3 (revision 2770)
@@ -0,0 +1,231 @@
+.\"/*
+.\" * Copyright (c) 2010 Red Hat, Inc.
+.\" *
+.\" * All rights reserved.
+.\" *
+.\" * Author: Jan Friesse <jfriesse@redhat.com>
+.\" * Author: Christine Caulfield <ccaulfie@redhat.com>
+.\" *
+.\" * This software licensed under BSD license, the text of which follows:
+.\" *
+.\" * Redistribution and use in source and binary forms, with or without
+.\" * modification, are permitted provided that the following conditions are met:
+.\" *
+.\" * - Redistributions of source code must retain the above copyright notice,
+.\" * this list of conditions and the following disclaimer.
+.\" * - Redistributions in binary form must reproduce the above copyright notice,
+.\" * this list of conditions and the following disclaimer in the documentation
+.\" * and/or other materials provided with the distribution.
+.\" * - Neither the name of the MontaVista Software, Inc. nor the names of its
+.\" * contributors may be used to endorse or promote products derived from this
+.\" * software without specific prior written permission.
+.\" *
+.\" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+.\" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+.\" * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+.\" * THE POSSIBILITY OF SUCH DAMAGE.
+.\" */
+.TH CPG_MODEL_INITIALIZE 3 2010-04-07 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
+.SH NAME
+cpg_model_initialize \- Create a new connection to the CPG service
+.SH SYNOPSIS
+.B #include <corosync/cpg.h>
+.sp
+.BI "cs_error_t cpg_model_initialize(cpg_handle_t *" handle ", cpg_model_t " model ", cpg_model_data_t *" model_data ", void *" context ");
+
+.SH DESCRIPTION
+The
+.B cpg_model_initialize
+function is used to initialize a connection to the closed process groups API.
+.PP
+Each application may have several connections to the CPG API. Each application
+uses the
+.I handle
+argument to uniquely identify the connection. The
+.I handle
+argument is then used in other function calls to identify the connection to be used
+for communication with the CPG service.
+.PP
+Argument
+.I model
+is used to explicitly choose set of callbacks and internal parameters. Currently only model
+.I CPG_MODEL_V1
+is defined.
+.PP
+Callbacks and internal parameters are passed by
+.I model_data
+argument. This is casted pointer (idea is similar as in sockaddr function) to one of structures
+corresponding to chosen model. Currently only
+.I cpg_model_v1_data_t
+is needed.
+.SH MODEL_V1
+The
+.I MODEL_V1
+is backwards compatible with original callbacks initialized by
+.I cpg_initialize
+but new callback
+.I cpg_totem_confchg_fn
+is defined.
+.PP
+Every time an CPG event occurs within the joined group, one of the callbacks specified by the argument
+.I callbacks
+is called. The callback functions are described by the following type definitions:
+.PP
+.PP
+.IP
+.RS
+.ne 18
+.nf
+.ta 4n 20n 32n
+
+typedef void (*cpg_deliver_fn_t) (
+ cpg_handle_t handle,
+ const struct cpg_name *group_name,
+ uint32_t nodeid,
+ uint32_t pid,
+ const void *msg,
+ size_t msg_len);
+
+
+typedef void (*cpg_confchg_fn_t) (
+ cpg_handle_t handle,
+ const struct cpg_name *group_name,
+ const struct cpg_address *member_list, size_t member_list_entries,
+ const struct cpg_address *left_list, size_t left_list_entries,
+ const struct cpg_address *joined_list, size_t joined_list_entries);
+
+
+typedef void (*cpg_totem_confchg_fn_t) (
+ cpg_handle_t handle,
+ struct cpg_ring_id ring_id,
+ uint32_t member_list_entries,
+ const uint32_t *member_list);
+.ta
+.fi
+.RE
+.IP
+.PP
+.PP
+The
+.I cpg_model_v1_data_t
+structure is defined as:
+.IP
+.RS
+.ne 18
+.nf
+.PP
+typedef struct {
+ cpg_model_t model;
+ cpg_deliver_fn_t cpg_deliver_fn;
+ cpg_confchg_fn_t cpg_confchg_fn;
+ cpg_totem_confchg_fn_t cpg_totem_confchg_fn;
+ unsigned int flags;
+} cpg_model_v1_data_t;
+.ta
+.fi
+.RE
+.IP
+.PP
+When a configuration change occurs or a message is to be delivered one of the callbacks
+is called from the
+.B cpg_dispatch()
+function. If a configuration change occurs,
+.I cpg_confchg_fn
+is called. If a delivery of a message occurs,
+.I cpg_deliver_fn
+is called.
+When totem membership change occurs,
+.I cpg_totem_confchg_fn
+is called. You can OR
+.I CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF
+constant to flags to get callback after first confchg event.
+
+The
+.I cpg_address
+structure is defined
+.IP
+.RS
+.ne 18
+.nf
+.PP
+struct cpg_address {
+ unsigned int nodeid;
+ unsigned int pid;
+ unsigned int reason;
+};
+.ta
+.fi
+.RE
+.IP
+.PP
+where nodeid is a 32 bit unique node identifier, pid is the process ID of the process that has joined/left the group
+or sent the message, and reason is an integer code indicating why the node joined/left the group.
+.PP
+.IP
+.RS
+.ne 18
+.nf
+.PP
+CPG_REASON_JOIN - the process joined a group using cpg_join().
+CPG_REASON_LEAVE - the process left a group using cpg_leave()
+CPG_REASON_NODEDOWN - the process left a group because the node left the cluster.
+CPG_REASON_NODEUP - the process joined a group because it was already a member of a group on a node that has just joined the cluster
+CPG_REASON_PROCDOWN - the process left a group without calling cpg_leave()
+.ta
+.fi
+.RE
+.IP
+.PP
+The
+.I cpg_ring_id
+structure is defined
+.IP
+.RS
+.ne 18
+.nf
+.PP
+struct cpg_ring_id {
+ uint32_t nodeid;
+ uint64_t seq;
+};
+.ta
+.fi
+.RE
+.IP
+.PP
+where
+.I nodeid
+is if of node of current Totem leader and seq is increasing number.
+
+.PP
+.SH RETURN VALUE
+This call returns the CPG_OK value if successful, otherwise an error is returned.
+.PP
+.SH ERRORS
+The errors are undocumented.
+.SH "SEE ALSO"
+.BR cpg_overview (8),
+.BR cpg_initialize (3),
+.BR cpg_finalize (3),
+.BR cpg_fd_get (3),
+.BR cpg_dispatch (3),
+.BR cpg_join (3),
+.BR cpg_leave (3),
+.BR cpg_mcast_joined (3),
+.BR cpg_membership_get (3)
+.BR cpg_zcb_alloc (3)
+.BR cpg_zcb_free (3)
+.BR cpg_zcb_mcast_joined (3)
+.BR cpg_context_get (3)
+.BR cpg_context_set (3)
+.BR cpg_local_get (3)
+.BR cpg_model_initialize (3)
+
+.PP
Index: man/Makefile.am
===================================================================
--- man/Makefile.am (revision 2769)
+++ man/Makefile.am (revision 2770)
@@ -71,6 +71,7 @@
cpg_leave.3 \
cpg_local_get.3 \
cpg_mcast_joined.3 \
+ cpg_model_initialize.3 \
cpg_zcb_mcast_joined.3 \
cpg_zcb_alloc.3 \
cpg_zcb_free.3 \

View file

@ -1 +1 @@
24b268b66d95b09f7177c73bb226de74 corosync-0.95.tar.gz
03b8cc311619c07ae1a84a5d59f13d0b corosync-1.2.3.tar.gz