drop evs service

there are several reasons for this:

1) evs is only partially implemented with no plans to complete it

typedef enum {
       EVS_TYPE_UNORDERED, /* not implemented */
       EVS_TYPE_FIFO,          /* same as agreed */
       EVS_TYPE_AGREED,
       EVS_TYPE_SAFE           /* not implemented */
} evs_guarantee_t;

2) evs has no users in any upstream distribution and no search
   engine can find any other upstream using it.

3) the only reason (I was told) to carry around evs was that evs
   receives the full ring_id struct from totem. This is only
   partially correct because while the structures are prepared
   to carry around those data, they are never transmitted from
   corosync engine down the IPC line to the user.
   CPG ring_id contains the exact same information and it's
   actually less buggy (due to prototying of the info).

worst case scenario where a user really absolutely need libevs,
it can be easily reimplemented as libcpg wrapper and avoid
lots of code duplication.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
This commit is contained in:
Fabio M. Di Nitto 2012-03-11 07:50:58 +01:00
parent c00502a70a
commit 20a5289074
43 changed files with 17 additions and 3546 deletions

View File

@ -2,7 +2,7 @@ Last Updated Dec 2009
Main Developers
---------------
Steven Dake Maintainer, totem implementation, evs, cfg,
Steven Dake Maintainer, totem implementation, cfg,
logsys, service engine architecture, ipc system
poll, timers, objdb, hdb, sync, coroapi
Christine Caulfield cpg, cfg, quorum, confdb, totem ipv6 support, totem NSS

View File

@ -67,7 +67,7 @@ logging {
# timestamps can be annoying).
timestamp: on
logger_subsys {
subsys: EVS
subsys: QUORUM
debug: off
}
}

View File

@ -68,7 +68,7 @@ logging {
debug: off
timestamp: on
logger_subsys {
subsys: EVS
subsys: QUORUM
debug: off
}
}

View File

@ -103,7 +103,7 @@
subsys if needed.
-->
<logger_subsys subsys="EVS" debug="off" />
<logger_subsys subsys="QUORUM" debug="off" />
</logging>
</corosync>

View File

@ -216,7 +216,6 @@ SONAME="${SOMAJOR}.${SOMINOR}.${SOMICRO}"
# specific libraries SONAME
LIB_SONAME_IMPORT([cfg])
LIB_SONAME_IMPORT([cpg])
LIB_SONAME_IMPORT([evs])
LIB_SONAME_IMPORT([quorum])
LIB_SONAME_IMPORT([sam])
LIB_SONAME_IMPORT([votequorum])

View File

@ -235,7 +235,6 @@ This package contains corosync libraries.
%{_libdir}/libcfg.so.*
%{_libdir}/libcpg.so.*
%{_libdir}/libcmap.so.*
%{_libdir}/libevs.so.*
%{_libdir}/libtotem_pg.so.*
%{_libdir}/libquorum.so.*
%{_libdir}/libvotequorum.so.*
@ -267,7 +266,6 @@ The Corosync Cluster Engine APIs.
%{_includedir}/corosync/cmap.h
%{_includedir}/corosync/corotypes.h
%{_includedir}/corosync/cpg.h
%{_includedir}/corosync/evs.h
%{_includedir}/corosync/hdb.h
%{_includedir}/corosync/sam.h
%{_includedir}/corosync/quorum.h
@ -279,7 +277,6 @@ The Corosync Cluster Engine APIs.
%{_libdir}/libcfg.so
%{_libdir}/libcpg.so
%{_libdir}/libcmap.so
%{_libdir}/libevs.so
%{_libdir}/libtotem_pg.so
%{_libdir}/libquorum.so
%{_libdir}/libvotequorum.so
@ -287,12 +284,10 @@ The Corosync Cluster Engine APIs.
%{_libdir}/libcorosync_common.so
%{_libdir}/pkgconfig/*.pc
%{_mandir}/man3/cpg_*3*
%{_mandir}/man3/evs_*3*
%{_mandir}/man3/quorum_*3*
%{_mandir}/man3/votequorum_*3*
%{_mandir}/man3/sam_*3*
%{_mandir}/man8/cpg_overview.8*
%{_mandir}/man8/evs_overview.8*
%{_mandir}/man8/votequorum_overview.8*
%{_mandir}/man8/sam_overview.8*
%{_mandir}/man3/cmap_*3*

View File

@ -48,7 +48,7 @@ sbin_PROGRAMS = corosync
libtotem_pg_a_SOURCES = $(TOTEM_SRC)
corosync_SOURCES = vsf_ykd.c coroparse.c vsf_quorum.c sync.c \
logsys.c cfg.c cmap.c cpg.c evs.c mon.c pload.c \
logsys.c cfg.c cmap.c cpg.c mon.c pload.c \
votequorum.c wd.c util.c schedwrk.c main.c \
apidef.c quorum.c icmap.c timer.c \
ipc_glue.c service.c mainconfig.c totemconfig.c

View File

@ -1,490 +0,0 @@
/*
* Copyright (c) 2004-2006 MontaVista Software, Inc.
* Copyright (c) 2006-2012 Red Hat, Inc.
*
* All rights reserved.
*
* Author: Steven Dake (sdake@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.
*/
#include <config.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <sys/uio.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <assert.h>
#include <time.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <corosync/swab.h>
#include <corosync/corotypes.h>
#include <qb/qbipc_common.h>
#include <corosync/corodefs.h>
#include <corosync/mar_gen.h>
#include <corosync/coroapi.h>
#include <corosync/logsys.h>
#include <corosync/list.h>
#include <corosync/evs.h>
#include <corosync/ipc_evs.h>
#include "service.h"
LOGSYS_DECLARE_SUBSYS ("EVS");
enum evs_exec_message_req_types {
MESSAGE_REQ_EXEC_EVS_MCAST = 0
};
/*
* Service Interfaces required by service_message_handler struct
*/
static char *evs_exec_init_fn (
struct corosync_api_v1 *corosync_api);
static void evs_confchg_fn (
enum totem_configuration_type configuration_type,
const unsigned int *member_list, size_t member_list_entries,
const unsigned int *left_list, size_t left_list_entries,
const unsigned int *joined_list, size_t joined_list_entries,
const struct memb_ring_id *ring_id);
static void message_handler_req_exec_mcast (const void *msg, unsigned int nodeid);
static void req_exec_mcast_endian_convert (void *msg);
static void message_handler_req_evs_join (void *conn, const void *msg);
static void message_handler_req_evs_leave (void *conn, const void *msg);
static void message_handler_req_evs_mcast_joined (void *conn, const void *msg);
static void message_handler_req_evs_mcast_groups (void *conn, const void *msg);
static void message_handler_req_evs_membership_get (void *conn, const void *msg);
static int evs_lib_init_fn (void *conn);
static int evs_lib_exit_fn (void *conn);
struct evs_pd {
struct evs_group *groups;
int group_entries;
struct list_head list;
void *conn;
};
static struct corosync_api_v1 *api;
static struct corosync_lib_handler evs_lib_engine[] =
{
{ /* 0 */
.lib_handler_fn = message_handler_req_evs_join,
.flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED
},
{ /* 1 */
.lib_handler_fn = message_handler_req_evs_leave,
.flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED
},
{ /* 2 */
.lib_handler_fn = message_handler_req_evs_mcast_joined,
.flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
},
{ /* 3 */
.lib_handler_fn = message_handler_req_evs_mcast_groups,
.flow_control = CS_LIB_FLOW_CONTROL_REQUIRED
},
{ /* 4 */
.lib_handler_fn = message_handler_req_evs_membership_get,
.flow_control = CS_LIB_FLOW_CONTROL_NOT_REQUIRED
}
};
static struct corosync_exec_handler evs_exec_engine[] =
{
{
.exec_handler_fn = message_handler_req_exec_mcast,
.exec_endian_convert_fn = req_exec_mcast_endian_convert
}
};
struct corosync_service_engine evs_service_engine = {
.name = "corosync extended virtual synchrony service",
.id = EVS_SERVICE,
.priority = 1,
.private_data_size = sizeof (struct evs_pd),
.flow_control = CS_LIB_FLOW_CONTROL_REQUIRED,
.lib_init_fn = evs_lib_init_fn,
.lib_exit_fn = evs_lib_exit_fn,
.lib_engine = evs_lib_engine,
.lib_engine_count = sizeof (evs_lib_engine) / sizeof (struct corosync_lib_handler),
.exec_engine = evs_exec_engine,
.exec_engine_count = sizeof (evs_exec_engine) / sizeof (struct corosync_exec_handler),
.confchg_fn = evs_confchg_fn,
.exec_init_fn = evs_exec_init_fn,
.exec_dump_fn = NULL
};
static DECLARE_LIST_INIT (confchg_notify);
struct corosync_service_engine *evs_get_service_engine_ver0 (void)
{
return (&evs_service_engine);
}
static char *evs_exec_init_fn (
struct corosync_api_v1 *corosync_api)
{
#ifdef COROSYNC_SOLARIS
logsys_subsys_init();
#endif
api = corosync_api;
return NULL;
}
struct res_evs_confchg_callback res_evs_confchg_callback;
static void evs_confchg_fn (
enum totem_configuration_type configuration_type,
const unsigned int *member_list, size_t member_list_entries,
const unsigned int *left_list, size_t left_list_entries,
const unsigned int *joined_list, size_t joined_list_entries,
const struct memb_ring_id *ring_id)
{
struct list_head *list;
struct evs_pd *evs_pd;
/*
* Build configuration change message
*/
res_evs_confchg_callback.header.size = sizeof (struct res_evs_confchg_callback);
res_evs_confchg_callback.header.id = MESSAGE_RES_EVS_CONFCHG_CALLBACK;
res_evs_confchg_callback.header.error = CS_OK;
memcpy (res_evs_confchg_callback.member_list,
member_list, member_list_entries * sizeof(*member_list));
res_evs_confchg_callback.member_list_entries = member_list_entries;
memcpy (res_evs_confchg_callback.left_list,
left_list, left_list_entries * sizeof(*left_list));
res_evs_confchg_callback.left_list_entries = left_list_entries;
memcpy (res_evs_confchg_callback.joined_list,
joined_list, joined_list_entries * sizeof(*joined_list));
res_evs_confchg_callback.joined_list_entries = joined_list_entries;
/*
* Send configuration change message to every EVS library user
*/
for (list = confchg_notify.next; list != &confchg_notify; list = list->next) {
evs_pd = list_entry (list, struct evs_pd, list);
api->ipc_dispatch_send (evs_pd->conn,
&res_evs_confchg_callback,
sizeof (res_evs_confchg_callback));
}
}
static int evs_lib_init_fn (void *conn)
{
struct evs_pd *evs_pd = (struct evs_pd *)api->ipc_private_data_get (conn);
log_printf (LOGSYS_LEVEL_DEBUG, "Got request to initalize evs service.");
evs_pd->groups = NULL;
evs_pd->group_entries = 0;
evs_pd->conn = conn;
list_init (&evs_pd->list);
list_add (&evs_pd->list, &confchg_notify);
api->ipc_dispatch_send (conn, &res_evs_confchg_callback,
sizeof (res_evs_confchg_callback));
return (0);
}
static int evs_lib_exit_fn (void *conn)
{
struct evs_pd *evs_pd = (struct evs_pd *)api->ipc_private_data_get (conn);
list_del (&evs_pd->list);
return (0);
}
static void message_handler_req_evs_join (void *conn, const void *msg)
{
cs_error_t error = CS_OK;
const struct req_lib_evs_join *req_lib_evs_join = msg;
struct res_lib_evs_join res_lib_evs_join;
void *addr;
struct evs_pd *evs_pd = (struct evs_pd *)api->ipc_private_data_get (conn);
if (req_lib_evs_join->group_entries > 50) {
error = CS_ERR_TOO_MANY_GROUPS;
goto exit_error;
}
addr = realloc (evs_pd->groups, sizeof (struct evs_group) *
(evs_pd->group_entries + req_lib_evs_join->group_entries));
if (addr == NULL) {
error = CS_ERR_NO_MEMORY;
goto exit_error;
}
evs_pd->groups = addr;
memcpy (&evs_pd->groups[evs_pd->group_entries],
req_lib_evs_join->groups,
sizeof (struct evs_group) * req_lib_evs_join->group_entries);
evs_pd->group_entries += req_lib_evs_join->group_entries;
exit_error:
res_lib_evs_join.header.size = sizeof (struct res_lib_evs_join);
res_lib_evs_join.header.id = MESSAGE_RES_EVS_JOIN;
res_lib_evs_join.header.error = error;
api->ipc_response_send (conn, &res_lib_evs_join,
sizeof (struct res_lib_evs_join));
}
static void message_handler_req_evs_leave (void *conn, const void *msg)
{
const struct req_lib_evs_leave *req_lib_evs_leave = msg;
struct res_lib_evs_leave res_lib_evs_leave;
cs_error_t error = CS_OK;
int i, j;
int found;
struct evs_pd *evs_pd = (struct evs_pd *)api->ipc_private_data_get (conn);
for (i = 0; i < req_lib_evs_leave->group_entries; i++) {
found = 0;
for (j = 0; j < evs_pd->group_entries;) {
if (memcmp (&req_lib_evs_leave->groups[i],
&evs_pd->groups[j], sizeof (struct evs_group)) == 0) {
/*
* Delete entry
*/
memmove (&evs_pd->groups[j], &evs_pd->groups[j + 1],
(evs_pd->group_entries - j - 1) * sizeof (struct evs_group));
evs_pd->group_entries -= 1;
found = 1;
break;
} else {
j++;
}
}
if (found == 0) {
error = CS_ERR_NOT_EXIST;
break;
}
}
res_lib_evs_leave.header.size = sizeof (struct res_lib_evs_leave);
res_lib_evs_leave.header.id = MESSAGE_RES_EVS_LEAVE;
res_lib_evs_leave.header.error = error;
api->ipc_response_send (conn, &res_lib_evs_leave,
sizeof (struct res_lib_evs_leave));
}
static void message_handler_req_evs_mcast_joined (void *conn, const void *msg)
{
cs_error_t error = CS_ERR_TRY_AGAIN;
const struct req_lib_evs_mcast_joined *req_lib_evs_mcast_joined = msg;
struct res_lib_evs_mcast_joined res_lib_evs_mcast_joined;
struct iovec req_exec_evs_mcast_iovec[3];
struct req_exec_evs_mcast req_exec_evs_mcast;
int res;
struct evs_pd *evs_pd = (struct evs_pd *)api->ipc_private_data_get (conn);
req_exec_evs_mcast.header.size = sizeof (struct req_exec_evs_mcast) +
evs_pd->group_entries * sizeof (struct evs_group) +
req_lib_evs_mcast_joined->msg_len;
req_exec_evs_mcast.header.id =
SERVICE_ID_MAKE (EVS_SERVICE, MESSAGE_REQ_EXEC_EVS_MCAST);
req_exec_evs_mcast.msg_len = req_lib_evs_mcast_joined->msg_len;
req_exec_evs_mcast.group_entries = evs_pd->group_entries;
req_exec_evs_mcast_iovec[0].iov_base = (char *)&req_exec_evs_mcast;
req_exec_evs_mcast_iovec[0].iov_len = sizeof (req_exec_evs_mcast);
req_exec_evs_mcast_iovec[1].iov_base = (char *)evs_pd->groups;
req_exec_evs_mcast_iovec[1].iov_len = evs_pd->group_entries * sizeof (struct evs_group);
req_exec_evs_mcast_iovec[2].iov_base = (char *)&req_lib_evs_mcast_joined->msg;
req_exec_evs_mcast_iovec[2].iov_len = req_lib_evs_mcast_joined->msg_len;
res = api->totem_mcast (req_exec_evs_mcast_iovec, 3, TOTEM_AGREED);
// TODO
if (res == 0) {
error = CS_OK;
}
res_lib_evs_mcast_joined.header.size = sizeof (struct res_lib_evs_mcast_joined);
res_lib_evs_mcast_joined.header.id = MESSAGE_RES_EVS_MCAST_JOINED;
res_lib_evs_mcast_joined.header.error = error;
api->ipc_response_send (conn, &res_lib_evs_mcast_joined,
sizeof (struct res_lib_evs_mcast_joined));
}
static void message_handler_req_evs_mcast_groups (void *conn, const void *msg)
{
cs_error_t error = CS_ERR_TRY_AGAIN;
const struct req_lib_evs_mcast_groups *req_lib_evs_mcast_groups = msg;
struct res_lib_evs_mcast_groups res_lib_evs_mcast_groups;
struct iovec req_exec_evs_mcast_iovec[3];
struct req_exec_evs_mcast req_exec_evs_mcast;
const char *msg_addr;
int res;
req_exec_evs_mcast.header.size = sizeof (struct req_exec_evs_mcast) +
sizeof (struct evs_group) * req_lib_evs_mcast_groups->group_entries +
req_lib_evs_mcast_groups->msg_len;
req_exec_evs_mcast.header.id =
SERVICE_ID_MAKE (EVS_SERVICE, MESSAGE_REQ_EXEC_EVS_MCAST);
req_exec_evs_mcast.msg_len = req_lib_evs_mcast_groups->msg_len;
req_exec_evs_mcast.group_entries = req_lib_evs_mcast_groups->group_entries;
msg_addr = (const char *)req_lib_evs_mcast_groups +
sizeof (struct req_lib_evs_mcast_groups) +
(sizeof (struct evs_group) * req_lib_evs_mcast_groups->group_entries);
req_exec_evs_mcast_iovec[0].iov_base = (char *)&req_exec_evs_mcast;
req_exec_evs_mcast_iovec[0].iov_len = sizeof (req_exec_evs_mcast);
req_exec_evs_mcast_iovec[1].iov_base = (char *)&req_lib_evs_mcast_groups->groups;
req_exec_evs_mcast_iovec[1].iov_len = sizeof (struct evs_group) * req_lib_evs_mcast_groups->group_entries;
req_exec_evs_mcast_iovec[2].iov_base = (void *) msg_addr; /* discard const */
req_exec_evs_mcast_iovec[2].iov_len = req_lib_evs_mcast_groups->msg_len;
res = api->totem_mcast (req_exec_evs_mcast_iovec, 3, TOTEM_AGREED);
if (res == 0) {
error = CS_OK;
}
res_lib_evs_mcast_groups.header.size = sizeof (struct res_lib_evs_mcast_groups);
res_lib_evs_mcast_groups.header.id = MESSAGE_RES_EVS_MCAST_GROUPS;
res_lib_evs_mcast_groups.header.error = error;
api->ipc_response_send (conn, &res_lib_evs_mcast_groups,
sizeof (struct res_lib_evs_mcast_groups));
}
static void message_handler_req_evs_membership_get (void *conn, const void *msg)
{
struct res_lib_evs_membership_get res_lib_evs_membership_get;
res_lib_evs_membership_get.header.size = sizeof (struct res_lib_evs_membership_get);
res_lib_evs_membership_get.header.id = MESSAGE_RES_EVS_MEMBERSHIP_GET;
res_lib_evs_membership_get.header.error = CS_OK;
res_lib_evs_membership_get.local_nodeid = api->totem_nodeid_get ();
memcpy (&res_lib_evs_membership_get.member_list,
&res_evs_confchg_callback.member_list,
sizeof (res_lib_evs_membership_get.member_list));
res_lib_evs_membership_get.member_list_entries =
res_evs_confchg_callback.member_list_entries;
api->ipc_response_send (conn, &res_lib_evs_membership_get,
sizeof (struct res_lib_evs_membership_get));
}
static void req_exec_mcast_endian_convert (void *msg)
{
struct req_exec_evs_mcast *req_exec_evs_mcast =
(struct req_exec_evs_mcast *)msg;
req_exec_evs_mcast->group_entries =
swab32 (req_exec_evs_mcast->group_entries);
req_exec_evs_mcast->msg_len = swab32 (req_exec_evs_mcast->msg_len);
}
static void message_handler_req_exec_mcast (
const void *msg,
unsigned int nodeid)
{
const struct req_exec_evs_mcast *req_exec_evs_mcast = msg;
struct res_evs_deliver_callback res_evs_deliver_callback;
const char *msg_addr;
struct list_head *list;
int found = 0;
int i, j;
struct evs_pd *evs_pd;
struct iovec iov[2];
res_evs_deliver_callback.header.size = sizeof (struct res_evs_deliver_callback) +
req_exec_evs_mcast->msg_len;
res_evs_deliver_callback.header.id = MESSAGE_RES_EVS_DELIVER_CALLBACK;
res_evs_deliver_callback.header.error = CS_OK;
res_evs_deliver_callback.msglen = req_exec_evs_mcast->msg_len;
msg_addr = (const char *)req_exec_evs_mcast + sizeof (struct req_exec_evs_mcast) +
(sizeof (struct evs_group) * req_exec_evs_mcast->group_entries);
for (list = confchg_notify.next; list != &confchg_notify; list = list->next) {
found = 0;
evs_pd = list_entry (list, struct evs_pd, list);
for (i = 0; i < evs_pd->group_entries; i++) {
for (j = 0; j < req_exec_evs_mcast->group_entries; j++) {
if (memcmp (&evs_pd->groups[i], &req_exec_evs_mcast->groups[j],
sizeof (struct evs_group)) == 0) {
found = 1;
break;
}
}
if (found) {
break;
}
}
if (found) {
res_evs_deliver_callback.local_nodeid = nodeid;
iov[0].iov_base = (void *)&res_evs_deliver_callback;
iov[0].iov_len = sizeof (struct res_evs_deliver_callback);
iov[1].iov_base = (void *) msg_addr; /* discard const */
iov[1].iov_len = req_exec_evs_mcast->msg_len;
api->ipc_dispatch_iov_send (
evs_pd->conn,
iov,
2);
}
}
}

View File

@ -118,9 +118,6 @@ static const char* cs_ipcs_serv_short_name(int32_t service_id)
{
const char *name;
switch (service_id) {
case EVS_SERVICE:
name = "evs";
break;
case CFG_SERVICE:
name = "cfg";
break;

View File

@ -60,9 +60,9 @@ LOGSYS_DECLARE_SUBSYS ("SERV");
static struct default_service default_services[] = {
{
.name = "corosync_evs",
.name = "corosync_cmap",
.ver = 0,
.loader = evs_get_service_engine_ver0
.loader = cmap_get_service_engine_ver0
},
{
.name = "corosync_cfg",
@ -98,11 +98,6 @@ static struct default_service default_services[] = {
.ver = 0,
.loader = vsf_quorum_get_service_engine_ver0
},
{
.name = "corosync_cmap",
.ver = 0,
.loader = cmap_get_service_engine_ver0
},
};
/*

View File

@ -85,7 +85,6 @@ struct corosync_service_engine *vsf_quorum_get_service_engine_ver0 (void);
struct corosync_service_engine *quorum_get_service_handler_ver0 (void);
struct corosync_service_engine *pload_get_service_engine_ver0 (void);
struct corosync_service_engine *cfg_get_service_engine_ver0 (void);
struct corosync_service_engine *evs_get_service_engine_ver0 (void);
struct corosync_service_engine *cpg_get_service_engine_ver0 (void);
struct corosync_service_engine *mon_get_service_engine_ver0 (void);
struct corosync_service_engine *wd_get_service_engine_ver0 (void);

View File

@ -58,7 +58,6 @@ struct service_names {
static struct service_names servicenames[] =
{
{ "EVS", EVS_SERVICE },
{ "CFG", CFG_SERVICE },
{ "CPG", CPG_SERVICE },
{ "QUORUM", QUORUM_SERVICE },

View File

@ -31,10 +31,10 @@
MAINTAINERCLEANFILES = Makefile.in corosync/config.h.in
CS_H = hdb.h cpg.h cfg.h evs.h corodefs.h \
CS_H = hdb.h cpg.h cfg.h corodefs.h \
corotypes.h quorum.h votequorum.h sam.h cmap.h
CS_INTERNAL_H = ipc_cfg.h ipc_cpg.h ipc_evs.h ipc_quorum.h \
CS_INTERNAL_H = ipc_cfg.h ipc_cpg.h ipc_quorum.h \
quorum.h sq.h ipc_votequorum.h ipc_cmap.h \
logsys.h coroapi.h icmap.h mar_gen.h list.h swab.h

View File

@ -38,7 +38,7 @@
#include <netinet/in.h>
enum corosync_service_types {
EVS_SERVICE = 0,
CMAP_SERVICE = 0,
CFG_SERVICE = 1,
CPG_SERVICE = 2,
QUORUM_SERVICE = 3,
@ -46,7 +46,6 @@ enum corosync_service_types {
VOTEQUORUM_SERVICE = 5,
MON_SERVICE = 6,
WD_SERVICE = 7,
CMAP_SERVICE = 8,
};
#ifdef HAVE_SMALL_MEMORY_FOOTPRINT

View File

@ -1,202 +0,0 @@
/*
* Copyright (c) 2004 MontaVista Software, Inc.
* Copyright (c) 2006-2011 Red Hat, Inc.
*
* All rights reserved.
*
* Author: Steven Dake (sdake@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.
*/
#ifndef COROSYNC_EVS_H_DEFINED
#define COROSYNC_EVS_H_DEFINED
#include <inttypes.h>
#include <netinet/in.h>
#include <corosync/corotypes.h>
#include <corosync/hdb.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @defgroup corosync Other API services provided by corosync
*/
/**
* @addtogroup evs_corosync
*
* @{
*/
typedef uint64_t evs_handle_t;
typedef enum {
EVS_TYPE_UNORDERED, /* not implemented */
EVS_TYPE_FIFO, /* same as agreed */
EVS_TYPE_AGREED,
EVS_TYPE_SAFE /* not implemented */
} evs_guarantee_t;
#define TOTEMIP_ADDRLEN (sizeof(struct in6_addr))
/** These are the things that get passed around */
struct evs_group {
char key[32];
};
struct evs_ring_id {
unsigned int nodeid;
unsigned long long seq;
};
typedef void (*evs_deliver_fn_t) (
hdb_handle_t handle,
unsigned int nodeid,
const void *msg,
size_t msg_len);
typedef void (*evs_confchg_fn_t) (
hdb_handle_t handle,
const unsigned int *member_list, size_t member_list_entries,
const unsigned int *left_list, size_t left_list_entries,
const unsigned int *joined_list, size_t joined_list_entries,
const struct evs_ring_id *ring_id);
typedef struct {
evs_deliver_fn_t evs_deliver_fn;
evs_confchg_fn_t evs_confchg_fn;
} evs_callbacks_t;
/** @} */
/**
* Create a new evs connection
*/
cs_error_t evs_initialize (
evs_handle_t *handle,
evs_callbacks_t *callbacks);
/**
* Close the evs handle
*/
cs_error_t evs_finalize (
evs_handle_t handle);
/**
* Get a file descriptor on which to poll.
*
* evs_handle_t is NOT a file descriptor and may not be used directly.
*/
cs_error_t evs_fd_get (
evs_handle_t handle,
int *fd);
/**
* Get contexts for a EVS handle
*/
cs_error_t evs_context_get (
evs_handle_t handle,
void **context);
/**
* Set contexts for a EVS handle
*/
cs_error_t evs_context_set (
evs_handle_t handle,
void *context);
/**
* Dispatch messages and configuration changes
*/
cs_error_t evs_dispatch (
evs_handle_t handle,
cs_dispatch_flags_t dispatch_types);
/**
* Join one or more groups.
*
* messages multicasted with evs_mcast_joined will be sent to every
* group that has been joined on handle handle. Any message multicasted
* to a group that has been previously joined will be delivered in evs_dispatch
*/
cs_error_t evs_join (
evs_handle_t handle,
const struct evs_group *groups,
size_t group_cnt);
/**
* Leave one or more groups
*/
cs_error_t evs_leave (
evs_handle_t handle,
const struct evs_group *groups,
size_t group_cnt);
/**
* Multicast to groups joined with evs_join.
*
* @param handle
* @param guarantee
* @param iovec This iovec will be multicasted to all groups joined with
* the evs_join interface for handle.
* @param iov_len
*/
cs_error_t evs_mcast_joined (
evs_handle_t handle,
evs_guarantee_t guarantee,
const struct iovec *iovec,
unsigned int iov_len);
/**
* Multicast to specified groups.
*
* Messages will be multicast to groups specified in the api call and not those
* that have been joined (unless they are in the groups parameter).
*/
cs_error_t evs_mcast_groups (
evs_handle_t handle,
evs_guarantee_t guarantee,
const struct evs_group *groups,
size_t group_cnt,
const struct iovec *iovec,
unsigned int iov_len);
/**
* Get membership information from evs
*/
cs_error_t evs_membership_get (
evs_handle_t handle,
unsigned int *local_nodeid,
unsigned int *member_list,
size_t *member_list_entries);
#ifdef __cplusplus
}
#endif
#endif /* COROSYNC_EVS_H_DEFINED */

View File

@ -1,140 +0,0 @@
/*
* Copyright (c) 2002-2004 MontaVista Software, Inc.
* Copyright (c) 2006-2012 Red Hat, Inc.
*
* All rights reserved.
*
* Author: Steven Dake (sdake@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.
*/
#ifndef IPC_EVS_H_DEFINED
#define IPC_EVS_H_DEFINED
#include <inttypes.h>
#include <corosync/corotypes.h>
#include <qb/qbipc_common.h>
#include <corosync/mar_gen.h>
enum req_lib_evs_types {
MESSAGE_REQ_EVS_JOIN = 0,
MESSAGE_REQ_EVS_LEAVE = 1,
MESSAGE_REQ_EVS_MCAST_JOINED = 2,
MESSAGE_REQ_EVS_MCAST_GROUPS = 3,
MESSAGE_REQ_EVS_MEMBERSHIP_GET = 4
};
enum res_lib_evs_types {
MESSAGE_RES_EVS_DELIVER_CALLBACK = 0,
MESSAGE_RES_EVS_CONFCHG_CALLBACK = 1,
MESSAGE_RES_EVS_JOIN = 2,
MESSAGE_RES_EVS_LEAVE = 3,
MESSAGE_RES_EVS_MCAST_JOINED = 4,
MESSAGE_RES_EVS_MCAST_GROUPS = 5,
MESSAGE_RES_EVS_MEMBERSHIP_GET = 6
};
struct res_evs_deliver_callback {
struct qb_ipc_response_header header;
unsigned int local_nodeid;
size_t msglen;
char msg[0];
};
struct res_evs_confchg_callback {
struct qb_ipc_response_header header;
size_t member_list_entries;
size_t left_list_entries;
size_t joined_list_entries;
unsigned int member_list[PROCESSOR_COUNT_MAX];
unsigned int left_list[PROCESSOR_COUNT_MAX];
unsigned int joined_list[PROCESSOR_COUNT_MAX];
};
struct req_lib_evs_join {
struct qb_ipc_response_header header;
size_t group_entries;
struct evs_group groups[0];
};
struct res_lib_evs_join {
struct qb_ipc_response_header header;
};
struct req_lib_evs_leave {
struct qb_ipc_response_header header;
size_t group_entries;
struct evs_group groups[0];
};
struct res_lib_evs_leave {
struct qb_ipc_response_header header;
};
struct req_lib_evs_mcast_joined {
struct qb_ipc_response_header header;
evs_guarantee_t guarantee;
size_t msg_len;
char msg[0];
};
struct res_lib_evs_mcast_joined {
struct qb_ipc_response_header header;
};
struct req_lib_evs_mcast_groups {
struct qb_ipc_response_header header;
evs_guarantee_t guarantee;
size_t msg_len;
size_t group_entries;
struct evs_group groups[0];
};
struct res_lib_evs_mcast_groups {
struct qb_ipc_response_header header;
};
struct req_exec_evs_mcast {
struct qb_ipc_request_header header;
size_t group_entries;
size_t msg_len;
struct evs_group groups[0];
/* data goes here */
};
struct req_lib_evs_membership_get {
struct qb_ipc_request_header header;
};
struct res_lib_evs_membership_get {
struct qb_ipc_response_header header;
unsigned int local_nodeid;
unsigned int member_list[PROCESSOR_COUNT_MAX];
size_t member_list_entries;
};
#endif /* IPC_EVS_H_DEFINED */

View File

@ -46,13 +46,12 @@ AM_LDFLAGS = -lpthread -L../common_lib -lcorosync_common
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
lib_LIBRARIES = libcpg.a libquorum.a libevs.a libcfg.a \
lib_LIBRARIES = libcpg.a libquorum.a libcfg.a \
libvotequorum.a libsam.a libcmap.a
SHARED_LIBS_SO = $(lib_LIBRARIES:%.a=%.so)
libcpg_a_SOURCES = cpg.c
libcfg_a_SOURCES = cfg.c
libevs_a_SOURCES = evs.c
libquorum_a_SOURCES = quorum.c
libvotequorum_a_SOURCES = votequorum.c
libcmap_a_SOURCES = cmap.c
@ -62,7 +61,6 @@ libsam_a_SOURCES = sam.c
noinst_HEADERS = util.h \
libcfg.versions \
libcpg.versions \
libevs.versions \
libquorum.versions libvotequorum.versions \
libsam.versions libcmap.versions

569
lib/evs.c
View File

@ -1,569 +0,0 @@
/*
* vi: set autoindent tabstop=4 shiftwidth=4 :
* Copyright (c) 2004-2005 MontaVista Software, Inc.
* Copyright (c) 2006-2012 Red Hat, Inc.
*
* All rights reserved.
*
* Author: Steven Dake (sdake@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.
*/
/*
* Provides an extended virtual synchrony API using the corosync executive
*/
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <errno.h>
#include <qb/qbipcc.h>
#include <corosync/corotypes.h>
#include <corosync/corodefs.h>
#include <corosync/hdb.h>
#include <corosync/evs.h>
#include <corosync/ipc_evs.h>
#include "util.h"
struct evs_inst {
qb_ipcc_connection_t *c;
int finalize;
evs_callbacks_t callbacks;
void *context;
};
DECLARE_HDB_DATABASE (evs_handle_t_db,NULL);
/*
* Clean up function for an evt instance (saEvtInitialize) handle
*/
/**
* @defgroup evs_coroipcc The extended virtual synchrony passthrough API
* @ingroup coroipcc
*
* @{
*/
/**
* test
* @param handle The handle of evs initialize
* @param callbacks The callbacks for evs_initialize
* @returns CS_OK
*/
cs_error_t evs_initialize (
evs_handle_t *handle,
evs_callbacks_t *callbacks)
{
cs_error_t error;
struct evs_inst *evs_inst;
error = hdb_error_to_cs(hdb_handle_create (&evs_handle_t_db, sizeof (struct evs_inst), handle));
if (error != CS_OK) {
goto error_no_destroy;
}
error = hdb_error_to_cs(hdb_handle_get (&evs_handle_t_db, *handle, (void *)&evs_inst));
if (error != CS_OK) {
goto error_destroy;
}
evs_inst->c = qb_ipcc_connect ("evs", IPC_REQUEST_SIZE);
if (evs_inst->c == NULL) {
error = qb_to_cs_error(-errno);
goto error_put_destroy;
}
if (callbacks) {
memcpy (&evs_inst->callbacks, callbacks, sizeof (evs_callbacks_t));
}
hdb_handle_put (&evs_handle_t_db, *handle);
return (CS_OK);
error_put_destroy:
hdb_handle_put (&evs_handle_t_db, *handle);
error_destroy:
hdb_handle_destroy (&evs_handle_t_db, *handle);
error_no_destroy:
return (error);
}
cs_error_t evs_finalize (
evs_handle_t handle)
{
struct evs_inst *evs_inst;
cs_error_t error;
error = hdb_error_to_cs(hdb_handle_get (&evs_handle_t_db, handle, (void *)&evs_inst));
if (error != CS_OK) {
return (error);
}
/*
* Another thread has already started finalizing
*/
if (evs_inst->finalize) {
hdb_handle_put (&evs_handle_t_db, handle);
return (CS_ERR_BAD_HANDLE);
}
evs_inst->finalize = 1;
qb_ipcc_disconnect (evs_inst->c);
hdb_handle_destroy (&evs_handle_t_db, handle);
hdb_handle_put (&evs_handle_t_db, handle);
return (CS_OK);
}
cs_error_t evs_fd_get (
evs_handle_t handle,
int *fd)
{
cs_error_t error;
struct evs_inst *evs_inst;
error = hdb_error_to_cs(hdb_handle_get (&evs_handle_t_db, handle, (void *)&evs_inst));
if (error != CS_OK) {
return (error);
}
qb_ipcc_fd_get (evs_inst->c, fd);
hdb_handle_put (&evs_handle_t_db, handle);
return (CS_OK);
}
cs_error_t evs_context_get (
evs_handle_t handle,
void **context)
{
cs_error_t error;
struct evs_inst *evs_inst;
error = hdb_error_to_cs (hdb_handle_get (&evs_handle_t_db, handle, (void *)&evs_inst));
if (error != CS_OK) {
return (error);
}
*context = evs_inst->context;
hdb_handle_put (&evs_handle_t_db, handle);
return (CS_OK);
}
cs_error_t evs_context_set (
evs_handle_t handle,
void *context)
{
cs_error_t error;
struct evs_inst *evs_inst;
error = hdb_error_to_cs (hdb_handle_get (&evs_handle_t_db, handle, (void *)&evs_inst));
if (error != CS_OK) {
return (error);
}
evs_inst->context = context;
hdb_handle_put (&evs_handle_t_db, handle);
return (CS_OK);
}
cs_error_t evs_dispatch (
evs_handle_t handle,
cs_dispatch_flags_t dispatch_types)
{
int timeout = -1;
cs_error_t error;
int cont = 1; /* always continue do loop except when set to 0 */
struct evs_inst *evs_inst;
struct res_evs_confchg_callback *res_evs_confchg_callback;
struct res_evs_deliver_callback *res_evs_deliver_callback;
evs_callbacks_t callbacks;
struct qb_ipc_response_header *dispatch_data;
char dispatch_buf[IPC_DISPATCH_SIZE];
error = hdb_error_to_cs(hdb_handle_get (&evs_handle_t_db, handle, (void *)&evs_inst));
if (error != CS_OK) {
return (error);
}
/*
* Timeout instantly for CS_DISPATCH_ONE_NONBLOCKING or CS_DISPATCH_ALL and
* wait indefinately for CS_DISPATCH_ONE or CS_DISPATCH_BLOCKING
*/
if (dispatch_types == CS_DISPATCH_ALL || dispatch_types == CS_DISPATCH_ONE_NONBLOCKING) {
timeout = 0;
}
dispatch_data = (struct qb_ipc_response_header *)dispatch_buf;
do {
error = qb_to_cs_error(qb_ipcc_event_recv (
evs_inst->c,
dispatch_buf,
IPC_DISPATCH_SIZE,
timeout));
if (error == CS_ERR_BAD_HANDLE) {
error = CS_OK;
goto error_put;
}
if (error == CS_ERR_TRY_AGAIN) {
if (dispatch_types == CS_DISPATCH_ONE_NONBLOCKING) {
/*
* Don't mask error
*/
goto error_put;
}
error = CS_OK;
if (dispatch_types == CS_DISPATCH_ALL) {
break; /* exit do while cont is 1 loop */
} else {
continue; /* next poll */
}
}
if (error != CS_OK) {
goto error_put;
}
/*
* Make copy of callbacks, message data, unlock instance, and call callback
* A risk of this dispatch method is that the callback routines may
* operate at the same time that evsFinalize has been called.
*/
memcpy (&callbacks, &evs_inst->callbacks, sizeof (evs_callbacks_t));
/*
* Dispatch incoming message
*/
switch (dispatch_data->id) {
case MESSAGE_RES_EVS_DELIVER_CALLBACK:
if (callbacks.evs_deliver_fn == NULL) {
break;
}
res_evs_deliver_callback = (struct res_evs_deliver_callback *)dispatch_data;
callbacks.evs_deliver_fn (
handle,
res_evs_deliver_callback->local_nodeid,
&res_evs_deliver_callback->msg,
res_evs_deliver_callback->msglen);
break;
case MESSAGE_RES_EVS_CONFCHG_CALLBACK:
if (callbacks.evs_confchg_fn == NULL) {
break;
}
res_evs_confchg_callback = (struct res_evs_confchg_callback *)dispatch_data;
callbacks.evs_confchg_fn (
handle,
res_evs_confchg_callback->member_list,
res_evs_confchg_callback->member_list_entries,
res_evs_confchg_callback->left_list,
res_evs_confchg_callback->left_list_entries,
res_evs_confchg_callback->joined_list,
res_evs_confchg_callback->joined_list_entries,
NULL);
break;
default:
error = CS_ERR_LIBRARY;
goto error_put;
break;
}
/*
* Determine if more messages should be processed
*/
if (dispatch_types == CS_DISPATCH_ONE || dispatch_types == CS_DISPATCH_ONE_NONBLOCKING) {
cont = 0;
}
} while (cont);
error_put:
hdb_handle_put (&evs_handle_t_db, handle);
return (error);
}
cs_error_t evs_join (
evs_handle_t handle,
const struct evs_group *groups,
size_t group_entries)
{
cs_error_t error;
struct evs_inst *evs_inst;
struct iovec iov[2];
struct req_lib_evs_join req_lib_evs_join;
struct res_lib_evs_join res_lib_evs_join;
error = hdb_error_to_cs(hdb_handle_get (&evs_handle_t_db, handle, (void *)&evs_inst));
if (error != CS_OK) {
return (error);
}
req_lib_evs_join.header.size = sizeof (struct req_lib_evs_join) +
(group_entries * sizeof (struct evs_group));
req_lib_evs_join.header.id = MESSAGE_REQ_EVS_JOIN;
req_lib_evs_join.group_entries = group_entries;
iov[0].iov_base = (void *)&req_lib_evs_join;
iov[0].iov_len = sizeof (struct req_lib_evs_join);
iov[1].iov_base = (void*) groups; /* cast away const */
iov[1].iov_len = (group_entries * sizeof (struct evs_group));
error = qb_to_cs_error(qb_ipcc_sendv_recv (evs_inst->c, iov, 2,
&res_lib_evs_join, sizeof (struct res_lib_evs_join), CS_IPC_TIMEOUT_MS));
if (error != CS_OK) {
goto error_exit;
}
error = res_lib_evs_join.header.error;
error_exit:
hdb_handle_put (&evs_handle_t_db, handle);
return (error);
}
cs_error_t evs_leave (
evs_handle_t handle,
const struct evs_group *groups,
size_t group_entries)
{
cs_error_t error;
struct evs_inst *evs_inst;
struct iovec iov[2];
struct req_lib_evs_leave req_lib_evs_leave;
struct res_lib_evs_leave res_lib_evs_leave;
error = hdb_error_to_cs(hdb_handle_get (&evs_handle_t_db, handle, (void *)&evs_inst));
if (error != CS_OK) {
return (error);
}
req_lib_evs_leave.header.size = sizeof (struct req_lib_evs_leave) +
(group_entries * sizeof (struct evs_group));
req_lib_evs_leave.header.id = MESSAGE_REQ_EVS_LEAVE;
req_lib_evs_leave.group_entries = group_entries;
iov[0].iov_base = (void *)&req_lib_evs_leave;
iov[0].iov_len = sizeof (struct req_lib_evs_leave);
iov[1].iov_base = (void *) groups; /* cast away const */
iov[1].iov_len = (group_entries * sizeof (struct evs_group));
error = qb_to_cs_error(qb_ipcc_sendv_recv (evs_inst->c, iov, 2,
&res_lib_evs_leave, sizeof (struct res_lib_evs_leave), CS_IPC_TIMEOUT_MS));
if (error != CS_OK) {
goto error_exit;
}
error = res_lib_evs_leave.header.error;
error_exit:
hdb_handle_put (&evs_handle_t_db, handle);
return (error);
}
cs_error_t evs_mcast_joined (
evs_handle_t handle,
evs_guarantee_t guarantee,
const struct iovec *iovec,
unsigned int iov_len)
{
int i;
cs_error_t error;
struct evs_inst *evs_inst;
struct iovec iov[64];
struct req_lib_evs_mcast_joined req_lib_evs_mcast_joined;
struct res_lib_evs_mcast_joined res_lib_evs_mcast_joined;
size_t msg_len = 0;
error = hdb_error_to_cs(hdb_handle_get (&evs_handle_t_db, handle, (void *)&evs_inst));
if (error != CS_OK) {
return (error);
}
for (i = 0; i < iov_len; i++ ) {
msg_len += iovec[i].iov_len;
}
req_lib_evs_mcast_joined.header.size = sizeof (struct req_lib_evs_mcast_joined) +
msg_len;
req_lib_evs_mcast_joined.header.id = MESSAGE_REQ_EVS_MCAST_JOINED;
req_lib_evs_mcast_joined.guarantee = guarantee;
req_lib_evs_mcast_joined.msg_len = msg_len;
iov[0].iov_base = (void *)&req_lib_evs_mcast_joined;
iov[0].iov_len = sizeof (struct req_lib_evs_mcast_joined);
memcpy (&iov[1], iovec, iov_len * sizeof (struct iovec));
error = qb_to_cs_error(qb_ipcc_sendv_recv (evs_inst->c, iov,
iov_len + 1,
&res_lib_evs_mcast_joined,
sizeof (struct res_lib_evs_mcast_joined), CS_IPC_TIMEOUT_MS));
if (error != CS_OK) {
goto error_exit;
}
error = res_lib_evs_mcast_joined.header.error;
error_exit:
hdb_handle_put (&evs_handle_t_db, handle);
return (error);
}
cs_error_t evs_mcast_groups (
evs_handle_t handle,
evs_guarantee_t guarantee,
const struct evs_group *groups,
size_t group_entries,
const struct iovec *iovec,
unsigned int iov_len)
{
int i;
cs_error_t error;
struct evs_inst *evs_inst;
struct iovec iov[64]; /* FIXME: what if iov_len > 62 ? use malloc */
struct req_lib_evs_mcast_groups req_lib_evs_mcast_groups;
struct res_lib_evs_mcast_groups res_lib_evs_mcast_groups;
size_t msg_len = 0;
error = hdb_error_to_cs(hdb_handle_get (&evs_handle_t_db, handle, (void *)&evs_inst));
if (error != CS_OK) {
return (error);
}
for (i = 0; i < iov_len; i++) {
msg_len += iovec[i].iov_len;
}
req_lib_evs_mcast_groups.header.size = sizeof (struct req_lib_evs_mcast_groups) +
(group_entries * sizeof (struct evs_group)) + msg_len;
req_lib_evs_mcast_groups.header.id = MESSAGE_REQ_EVS_MCAST_GROUPS;
req_lib_evs_mcast_groups.guarantee = guarantee;
req_lib_evs_mcast_groups.msg_len = msg_len;
req_lib_evs_mcast_groups.group_entries = group_entries;
iov[0].iov_base = (void *)&req_lib_evs_mcast_groups;
iov[0].iov_len = sizeof (struct req_lib_evs_mcast_groups);
iov[1].iov_base = (void *) groups; /* cast away const */
iov[1].iov_len = (group_entries * sizeof (struct evs_group));
memcpy (&iov[2], iovec, iov_len * sizeof (struct iovec));
error = qb_to_cs_error(qb_ipcc_sendv_recv (evs_inst->c, iov,
iov_len + 2,
&res_lib_evs_mcast_groups,
sizeof (struct res_lib_evs_mcast_groups), CS_IPC_TIMEOUT_MS));
if (error != CS_OK) {
goto error_exit;
}
error = res_lib_evs_mcast_groups.header.error;
error_exit:
hdb_handle_put (&evs_handle_t_db, handle);
return (error);
}
cs_error_t evs_membership_get (
evs_handle_t handle,
unsigned int *local_nodeid,
unsigned int *member_list,
size_t *member_list_entries)
{
cs_error_t error;
struct evs_inst *evs_inst;
struct iovec iov;
struct req_lib_evs_membership_get req_lib_evs_membership_get;
struct res_lib_evs_membership_get res_lib_evs_membership_get;
error = hdb_error_to_cs(hdb_handle_get (&evs_handle_t_db, handle, (void *)&evs_inst));
if (error != CS_OK) {
return (error);
}
req_lib_evs_membership_get.header.size = sizeof (struct req_lib_evs_membership_get);
req_lib_evs_membership_get.header.id = MESSAGE_REQ_EVS_MEMBERSHIP_GET;
iov.iov_base = (void *)&req_lib_evs_membership_get;
iov.iov_len = sizeof (struct req_lib_evs_membership_get);
error = qb_to_cs_error(qb_ipcc_sendv_recv (evs_inst->c,
&iov,
1,
&res_lib_evs_membership_get,
sizeof (struct res_lib_evs_membership_get), CS_IPC_TIMEOUT_MS));
if (error != CS_OK) {
goto error_exit;
}
error = res_lib_evs_membership_get.header.error;
/*
* Copy results to caller
*/
if (local_nodeid) {
*local_nodeid = res_lib_evs_membership_get.local_nodeid;
}
*member_list_entries = QB_MIN (*member_list_entries,
res_lib_evs_membership_get.member_list_entries);
if (member_list) {
memcpy (member_list, &res_lib_evs_membership_get.member_list,
*member_list_entries * sizeof (struct in_addr));
}
error_exit:
hdb_handle_put (&evs_handle_t_db, handle);
return (error);
}
/** @} */

View File

@ -1,14 +0,0 @@
# Version and symbol export for libSaClm.so
COROSYNC_EVS_2.0 {
global:
evs_initialize;
evs_finalize;
evs_fd_get;
evs_dispatch;
evs_join;
evs_leave;
evs_mcast_joined;
evs_mcast_groups;
evs_membership_get;
};

View File

@ -1 +0,0 @@
4.0.0

View File

@ -57,17 +57,6 @@ autogen_man = cpg_context_get.3 \
cpg_iteration_finalize.3 \
cpg_iteration_initialize.3 \
cpg_iteration_next.3 \
evs_dispatch.3 \
evs_fd_get.3 \
evs_finalize.3 \
evs_initialize.3 \
evs_join.3 \
evs_leave.3 \
evs_mcast_groups.3 \
evs_mcast_joined.3 \
evs_membership_get.3 \
evs_context_get.3 \
evs_context_set.3 \
quorum_initialize.3 \
quorum_finalize.3 \
quorum_fd_get.3 \
@ -139,7 +128,6 @@ dist_man_MANS = corosync.conf.5 \
corosync-quorumtool.8 \
corosync_overview.8 \
cpg_overview.8 \
evs_overview.8 \
quorum_overview.8 \
votequorum_overview.8 \
sam_overview.8 \

View File

@ -214,10 +214,6 @@ of 8982 seems to work for the few large frame devices that have been tested.
Some manufacturers claim large frame support when in fact they support frame
sizes of 4500 bytes.
Increasing the MTU from 1500 to 8982 doubles throughput performance from 30MB/sec
to 60MB/sec as measured with evsbench with 175000 byte messages with the secauth
directive set to off.
When sending multicast traffic, if the network frequently reconfigures, chances are
that some device in the network doesn't support large frames.

View File

@ -56,9 +56,9 @@ Corosync. Corosync is designed for applications to replicate their state to
up to 16 processors. The processors all contain a replica of the application
state.
The corosync project provides two group message APIs called CPG and EVS.
The corosync project provides a group message API called CPG.
The project developers recommend CPG be used for most applications. The CPG
service implmeents a closed group messaging model presenting extended virtual
service implements a closed group messaging model presenting extended virtual
synchrony guarantees.
To manage conditions where the process executing the CPG application exchange
@ -168,8 +168,7 @@ The default is /etc/corosync/authkey.
The corosync executive optionally encrypts all messages sent over the network
using the SOBER-128 stream cipher. The corosync executive uses HMAC and SHA1 to
authenticate all messages. The corosync executive library uses SOBER-128
as a pseudo random number generator. The EVS library feeds the PRNG using
the /dev/random Linux device.
as a pseudo random number generator.
If membership messages can be captured by intruders, it is possible to execute
a denial of service attack on the cluster. In this scenario, the cluster is
@ -191,7 +190,6 @@ None that are known.
.SH "SEE ALSO"
.BR corosync.conf (5),
.BR corosync-keygen (8),
.BR evs_overview (8),
.BR cpg_overview (8),
.BR sam_overview (8)
.PP

View File

@ -1,64 +0,0 @@
.\"/*
.\" * Copyright (c) 2007 Red Hat, Inc.
.\" *
.\" * All rights reserved.
.\" *
.\" * Author: Patrick Caulfield <pcaulfie@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 EVS_CONTEXT_GET 3 2004-08-31 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
.SH NAME
evs_context_get \- Gets the context variable for a EVS instance
.SH SYNOPSIS
.B #include <corosync/evs.h>
.sp
.BI "int evs_context_get(evs_handle_t " handle ", void **" context ");
.SH DESCRIPTION
The
.B evs_context_get
function is used to retrieve the context variable previously stored using
.B evs_context_set(3)
.SH RETURN VALUE
This call returns the CS_OK value if successful, otherwise an error is returned.
.PP
.SH ERRORS
The errors are undocumented.
.SH "SEE ALSO"
.BR evs_overview (8),
.BR evs_initialize (3),
.BR evs_finalize (3),
.BR evs_fd_get (3),
.BR evs_dispatch (3),
.BR evs_join (3),
.BR evs_leave (3),
.BR evs_mcast_joined (3),
.BR evs_mcast_groups (3),
.BR evs_mmembership_get (3)
.BR evs_context_get (3)
.BR evs_context_set (3)
.PP

View File

@ -1,66 +0,0 @@
.\"/*
.\" * Copyright (c) 2007 Red Hat, Inc.
.\" *
.\" * All rights reserved.
.\" *
.\" * Author: Patrick Caulfield <pcaulfie@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 EVS_CONTEXT_SET 3 2004-08-31 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
.SH NAME
evs_context_set \- Sets the context variable for a EVS instance
.SH SYNOPSIS
.B #include <corosync/evs.h>
.sp
.BI "int evs_context_set(evs_handle_t " handle ", void *" context ");
.SH DESCRIPTION
The
.B evs_context_set
function is used to set the context variable for a evs instance. It has no
meaning insire libevs itself and will not be touched by the library. It can
be retrieved using
.B evs_context_get(3)
.SH RETURN VALUE
This call returns the CS_OK value if successful, otherwise an error is returned.
.PP
.SH ERRORS
The errors are undocumented.
.SH "SEE ALSO"
.BR evs_overview (8),
.BR evs_initialize (3),
.BR evs_finalize (3),
.BR evs_fd_get (3),
.BR evs_dispatch (3),
.BR evs_join (3),
.BR evs_leave (3),
.BR evs_mcast_joined (3),
.BR evs_mcast_groups (3),
.BR evs_mmembership_get (3)
.BR evs_context_get (3)
.BR evs_context_set (3)
.PP

View File

@ -1,107 +0,0 @@
.\"/*
.\" * Copyright (c) 2004 MontaVista Software, Inc.
.\" *
.\" * All rights reserved.
.\" *
.\" * Author: Steven Dake (sdake@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 EVS_DISPATCH 3 2004-08-31 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
.SH NAME
evs_dispatch \- Dispatches callbacks from the EVS service
.SH SYNOPSIS
.B #include <corosync/evs.h>
.sp
.BI "int evs_dispatch(evs_handle_t " handle ", evs_dispatch_t *" dispatch_types ");
.SH DESCRIPTION
The
.B evs_dispatch
function is used to dispatch configuration changes or messages from the
extended virtual synchrony API.
.PP
Each application may have several connections to the EVS API. Each application
uses the
.I handle
argument to uniquely identify the connection.
.PP
The
.I dispatch_types
argument is used to identify the type of dispatch to execute. The possible types are
defined by the structure:
.IP
.RS
.ne 18
.nf
.ta 4n 30n 33n
typedef enum {
CS_DISPATCH_ONE,
CS_DISPATCH_ALL,
CS_DISPATCH_BLOCKING
} cs_dispatch_flags_t;
.ta
.fi
.RE
.IP
.PP
.PP
The dispatch values have the following meanings:
.TP
.B CS_DISPATCH_ONE
Dispatch atleast one callback, blocking until the callback is dispatched.
.TP
.B CS_DISPATCH_ALL
Dispatch all waiting callbacks without blocking to wait for any callbacks.
.TP
.B CS_DISPATCH_BLOCKING
Dispatch all callbacks blocking indefinately. This is used in a threaded
program where a thread is created, and then evs_dispatch() is called immediately
from the created thread to execute callbacks.
.TP
.B CS_DISPATCH_ONE_NONBLOCKING
Dispatch at most one callback. If there is no pending callback,
CS_ERR_TRY_AGAIN is returned.
.SH RETURN VALUE
This call returns the CS_OK value if successful, otherwise an error is returned.
.PP
.SH ERRORS
The errors are undocumented.
.SH "SEE ALSO"
.BR evs_overview (8),
.BR evs_initialize (3),
.BR evs_finalize (3),
.BR evs_fd_get (3),
.BR evs_join (3),
.BR evs_leave (3),
.BR evs_mcast_joined (3),
.BR evs_mcast_groups (3),
.BR evs_mmembership_get (3)
.BR evs_context_get (3)
.BR evs_context_set (3)
.PP

View File

@ -1,70 +0,0 @@
.\"/*
.\" * Copyright (c) 2004 MontaVista Software, Inc.
.\" *
.\" * All rights reserved.
.\" *
.\" * Author: Steven Dake (sdake@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 EVS_FD_GET 3 2004-08-31 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
.SH NAME
evs_fd_get \- Dispatches callbacks from the EVS service
.SH SYNOPSIS
.B #include <corosync/evs.h>
.sp
.BI "int evs_fd_get(evs_handle_t " handle ", int *" fd ");
.SH DESCRIPTION
The
.B evs_fd_get
function is used to retrieve the file descriptor that may be used with the poll
system call to determine when
.B evs_dispatch(3)
won't block. The
.I handle
argument may not be used directly with
.B poll
because it is not the file descriptor, but instead an internal identifier used
by the EVS library.
.SH RETURN VALUE
This call returns the CS_OK value if successful, otherwise an error is returned.
.PP
.SH ERRORS
The errors are undocumented.
.SH "SEE ALSO"
.BR evs_overview (8),
.BR evs_initialize (3),
.BR evs_finalize (3),
.BR evs_dispatch (3),
.BR evs_join (3),
.BR evs_leave (3),
.BR evs_mcast_joined (3),
.BR evs_mcast_groups (3),
.BR evs_mmembership_get (3)
.BR evs_context_get (3)
.BR evs_context_set (3)
.PP

View File

@ -1,66 +0,0 @@
.\"/*
.\" * Copyright (c) 2004 MontaVista Software, Inc.
.\" *
.\" * All rights reserved.
.\" *
.\" * Author: Steven Dake (sdake@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 EVS_FINALIZE 3 2004-08-31 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
.SH NAME
evs_finalize \- Terminate a connection to the EVS service
.SH SYNOPSIS
.B #include <corosync/evs.h>
.sp
.BI "int evs_finalize(evs_handle_t " handle ");
.SH DESCRIPTION
The
.B evs_finalize
function is used to close a connection to the extended virtual synchrony API.
Once the connection is finalized, the handle may not be used again by applications.
No more callbacks will be dispatched from the
.B evs_dispatch function.
.PP
.SH RETURN VALUE
This call returns the CS_OK value if successful, otherwise an error is returned.
.PP
.SH ERRORS
The errors are undocumented.
.SH "SEE ALSO"
.BR evs_overview (8),
.BR evs_initialize (3),
.BR evs_fd_get (3),
.BR evs_dispatch (3),
.BR evs_join (3),
.BR evs_leave (3),
.BR evs_mcast_joined (3),
.BR evs_mcast_groups (3),
.BR evs_mmembership_get (3)
.BR evs_context_get (3)
.BR evs_context_set (3)
.PP

View File

@ -1,121 +0,0 @@
.\"/*
.\" * Copyright (c) 2004 MontaVista Software, Inc.
.\" *
.\" * All rights reserved.
.\" *
.\" * Author: Steven Dake (sdake@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 EVS_INITIALIZE 3 2004-08-31 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
.SH NAME
evs_initialize \- Create a new connection to the EVS service
.SH SYNOPSIS
.B #include <corosync/evs.h>
.sp
.BI "int evs_initialize(evs_handle_t *" handle ", evs_callbacks_t *" callbacks ");
.SH DESCRIPTION
The
.B evs_initialize
function is used to initialize a connection to the extended virtual synchrony API.
.PP
Each application may have several connections to the EVS 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 EVS service.
.PP
Every time an EVS event occurs, one of the callbacks specified by the argument
.I callbacks
is called. The callback functions are described by the following type definitions:
.PP
.IP
.RS
.ne 18
.nf
.ta 4n 20n 32n
typedef void (*evs_deliver_fn_t) (
unsigned int nodeid,
const void *msg,
size_t msg_len);
typedef void (*evs_confchg_fn_t) (
unsigned int *member_list, size_t member_list_entries,
unsigned int *left_list, size_t left_list_entries,
unsigned int *joined_list, size_t joined_list_entries);
.ta
.fi
.RE
.IP
.PP
.PP
The
.I callbacks
argument is of the type:
.IP
.RS
.ne 18
.nf
.PP
typedef struct {
evs_deliver_fn_t evs_deliver_fn;
evs_confchg_fn_t evs_confchg_fn;
} evs_callbacks_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 evs_dispatch()
function. If a configuration change occurs,
.I evs_confchg_fn
is called. If a delivery of a message occurs,
.I evs_deliver_fn
is called.
.SH RETURN VALUE
This call returns the CS_OK value if successful, otherwise an error is returned.
.PP
.SH ERRORS
The errors are undocumented.
.SH "SEE ALSO"
.BR evs_overview (8),
.BR evs_finalize (3),
.BR evs_fd_get (3),
.BR evs_dispatch (3),
.BR evs_join (3),
.BR evs_leave (3),
.BR evs_mcast_joined (3),
.BR evs_mcast_groups (3),
.BR evs_mmembership_get (3)
.BR evs_context_get (3)
.BR evs_context_set (3)
.PP

View File

@ -1,105 +0,0 @@
.\"/*
.\" * Copyright (c) 2004 MontaVista Software, Inc.
.\" *
.\" * All rights reserved.
.\" *
.\" * Author: Steven Dake (sdake@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 EVS_JOIN 3 2004-08-31 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
.SH NAME
evs_join \- Joins one or more groups in the EVS library
.SH SYNOPSIS
.B #include <corosync/evs.h>
.sp
.BI "int evs_join(evs_handle_t " handle ", evs_group_t *" groups ", int " group_entries ");
.SH DESCRIPTION
The
.B evs_join
function is used to join one or more groups. When a group is joined, using the
.B evs_mcast_joined(3)
function will multicast to the groups joined in the argument
.I handle.
Messages that are sent to any of the groups joined to the parameter
.I handle
will be delivered by
.B evs_dispatch(3).
.PP
This call may be used more then once on a handle, in which case the joined groups will
be all of the groups passed to the
.B evs_join(3)
function during the lifecycle of the parameter
.I handle.
.PP
The argument
.I groups
is used to specify the groups to join. A group is a 32 byte key. The key is
not a string, hence, the entire key is used when joining the channel. For that reason
the entire group should be initialized.
.PP
The argument
.I group_entries
specifies how many entries are located in the groups argument.
The
.I groups
argument is of the type evs_group_t which is defined by the structure:
.IP
.RS
.ne 18
.nf
.ta 4n 30n 33n
typedef struct {
char key[32];
} evs_groups_t;
.ta
.fi
.RE
.IP
.PP
.PP
.SH RETURN VALUE
This call returns the CS_OK value if successful, otherwise an error is returned.
.PP
.SH ERRORS
The errors are undocumented.
.SH "SEE ALSO"
.BR evs_overview (8),
.BR evs_initialize (3),
.BR evs_finalize (3),
.BR evs_fd_get (3),
.BR evs_dispatch (3),
.BR evs_leave (3),
.BR evs_mcast_joined (3),
.BR evs_mcast_groups (3),
.BR evs_mmembership_get (3)
.BR evs_context_get (3)
.BR evs_context_set (3)
.PP

View File

@ -1,100 +0,0 @@
.\"/*
.\" * Copyright (c) 2004 MontaVista Software, Inc.
.\" *
.\" * All rights reserved.
.\" *
.\" * Author: Steven Dake (sdake@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 EVS_LEAVE 3 2004-08-31 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
.SH NAME
evs_leave \- Leave one or more groups in the EVS library
.SH SYNOPSIS
.B #include <corosync/evs.h>
.sp
.BI "int evs_leave(evs_handle_t " handle ", evs_group_t *" groups ", int group_entries);
.SH DESCRIPTION
The
.B evs_leave
function is used to leave one or more groups. The joined groups are used with
.B evs_mcast_joined(3)
function to multicast to the groups joined in the argument
.I handle.
Messages that are sent to any of the joined groups to the parameter
.I handle
will be delivered by
.B evs_dispatch(3).
.PP
This call may be used more then once on a handle.
.PP
The argument
.I groups
is used to specify the groups to leave. A group is a 32 byte key. The key is
not a string, hence, the entire key is used when leaveing the channel. For that reason
the entire group should be initialized.
.PP
The argument
.I group_entries
specifies how many entries are located in the groups argument.
The
.I groups
argument is of the type evs_group_t which is defined by the structure:
.IP
.RS
.ne 18
.nf
.ta 4n 30n 33n
typedef struct {
char key[32];
} evs_groups_t;
.ta
.fi
.RE
.IP
.PP
.SH RETURN VALUE
This call returns the CS_OK value if successful, otherwise an error is returned.
.PP
.SH ERRORS
The errors are undocumented.
.SH "SEE ALSO"
.BR evs_overview (8),
.BR evs_initialize (3),
.BR evs_finalize (3),
.BR evs_fd_get (3),
.BR evs_dispatch (3),
.BR evs_join (3),
.BR evs_mcast_joined (3),
.BR evs_mcast_groups (3),
.BR evs_mmembership_get (3)
.BR evs_context_get (3)
.BR evs_context_set (3)
.PP

View File

@ -1,164 +0,0 @@
.\"/*
.\" * Copyright (c) 2004 MontaVista Software, Inc.
.\" *
.\" * All rights reserved.
.\" *
.\" * Author: Steven Dake (sdake@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 EVS_MCAST_GROUPS 3 2004-08-31 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
.SH NAME
evs_join \- Multicast a message to selected groups
.SH SYNOPSIS
.B #include <sys/uio.h>
.B #include <corosync/evs.h>
.sp
.BI "int evs_mcast_groups(evs_handle_t " handle ", evs_guraantee_t " guarantee ", evs_group_t *" groups ", int group_entries, struct iovec *" iovec ", int " iov_len ");
.SH DESCRIPTION
The
.B evs_mcast_groups(3)
function multicasts a message to all the groups specified in the arguemnt
.I groups.
Messages are delivered to all processors in the system that are described by the current
configuration.
.PP
The argument
.I handle
describes a handle created with
.B evs_initialize(3).
.PP
The argument
.I guarantee
requests a delivery guarantee for the message to be sent. The evs_guarantee_t type is
defined by:
.IP
.RS
.ne 18
.nf
.ta 4n 30n 33n
typedef enum {
EVS_TYPE_UNORDERED, /* not implemented */
EVS_TYPE_FIFO, /* same as agreed */
EVS_TYPE_AGREED, /* implemented */
EVS_TYPE_SAFE /* not implemented */
} evs_guarantee_t;
.ta
.fi
.RE
.IP
.PP
.PP
The meanings of the evs_guarantee_t typedef are:
.TP
.B EVS_GUARANTEE_UNORDERED
Messages are guaranteed to be delivered, but with no particular order. This
mode is unimplemented in the EVS library.
.TP
.B EVS_GUARANTEE_FIFO
Messages are guaranteed to be delivered in first sent first delivery order
from one one. In fact, this guarantee is actually the AGREED guarantee.
.TP
.B EVS_GUARANTEE_AGREED
All processors must agree on the order of delivery. If a message is sent
from two or more processors at about the same time, the delivery will occur
in the same order to all processors.
.TP
.B EVS_GUARANTEE_SAFE
All processors must agree on the order of delivery. Further all processors
must have a copy of the message before any delivery takes place. This mode is
unimplemented in the EVS library.
.PP
The
.I groups
argument is of the type evs_group_t which is defined by the structure:
.IP
.RS
.ne 18
.nf
.ta 4n 30n 33n
typedef struct {
char key[32];
} evs_groups_t;
.ta
.fi
.RE
.IP
.PP
.PP
The
.I group_entries
argument describes the number of entries in the
.I group
argument.
.PP
The
.I iovec
argument describes the scatter/gather list which is used to transmit a message. This
is a standard socket structure described by:
.IP
.RS
.ne 18
.nf
.ta 4n 30n 33n
struct iovec
{
void *iov_base; /* Pointer to data. */
unsigned int iov_len; /* Length of data. */
};
.ta
.fi
.RE
.IP
.PP
.PP
The
.I iovlen
argument describes the number of entires in the
.I iovec
argument.
.SH RETURN VALUE
This call returns the CS_OK value if successful, otherwise an error is returned.
.PP
.SH ERRORS
The errors are undocumented.
.SH "SEE ALSO"
.BR evs_overview (8),
.BR evs_initialize (3),
.BR evs_finalize (3),
.BR evs_fd_get (3),
.BR evs_dispatch (3),
.BR evs_leave (3),
.BR evs_join (3),
.BR evs_mcast_joined (3),
.BR evs_mmembership_get (3)
.BR evs_context_get (3)
.BR evs_context_set (3)
.PP

View File

@ -1,137 +0,0 @@
.\"/*
.\" * Copyright (c) 2004 MontaVista Software, Inc.
.\" *
.\" * All rights reserved.
.\" *
.\" * Author: Steven Dake (sdake@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 EVS_MCAST_JOINED 3 3004-08-31 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
.SH NAME
evs_join \- Multicasts to all groups joined to an handle
.SH SYNOPSIS
.B #include <sys/uio.h>
.B #include <corosync/evs.h>
.sp
.BI "int evs_mcast_joined(evs_handle_t " handle ", evs_guraantee_t " guarantee ", struct iovec *" iovec ", int " iov_len ");
.SH DESCRIPTION
The
.B evs_mcast_joined
function is multicast a message to all the groups that have been joined with the
.B evs_join(3)
function for the argument
.I handle.
Messages that are sent to any of the groups joined to the parameter
.I handle
will be delivered to all processors in the system.
.PP
The argument
.I guarantee
requests a delivery guarantee for the message to be sent. The evs_guarantee_t type is
defined by:
.IP
.RS
.ne 18
.nf
.ta 4n 30n 33n
typedef enum {
EVS_TYPE_UNORDERED, /* not implemented */
EVS_TYPE_FIFO, /* same as agreed */
EVS_TYPE_AGREED, /* implemented */
EVS_TYPE_SAFE /* not implemented */
} evs_guarantee_t;
.ta
.fi
.RE
.IP
.PP
.PP
The meanings of the evs_guarantee_t typedef are:
.TP
.B EVS_GUARANTEE_UNORDERED
Messages are guaranteed to be delivered, but with no particular order. This
mode is unimplemented in the EVS library.
.TP
.B EVS_GUARANTEE_FIFO
Messages are guaranteed to be delivered in first sent first delivery order
from one one. In fact, this guarantee is actually the AGREED guarantee.
.TP
.B EVS_GUARANTEE_AGREED
All processors must agree on the order of delivery. If a message is sent
from two or more processors at about the same time, the delivery will occur
in the same order to all processors.
.TP
.B EVS_GUARANTEE_SAFE
All processors must agree on the order of delivery. Further all processors
must have a copy of the message before any delivery takes place. This mode is
unimplemented in the EVS library.
.PP
The
.I iovec
argument describes the scatter/gather list which is used to transmit a message. This
is a standard socket structure described by:
.IP
.RS
.ne 18
.nf
.ta 4n 30n 33n
struct iovec
{
void *iov_base; /* Pointer to data. */
unsigned int iov_len; /* Length of data. */
};
.ta
.fi
.RE
.IP
.PP
.PP
The
.I iovlen
argument describes the number of entires in the
.I iovec
argument.
.SH RETURN VALUE
This call returns the CS_OK value if successful, otherwise an error is returned.
.PP
.SH ERRORS
The errors are undocumented.
.SH "SEE ALSO"
.BR evs_overview (8),
.BR evs_initialize (3),
.BR evs_finalize (3),
.BR evs_fd_get (3),
.BR evs_dispatch (3),
.BR evs_leave (3),
.BR evs_join (3),
.BR evs_mcast_groups (3),
.BR evs_mmembership_get (3)
.BR evs_context_get (3)
.BR evs_context_set (3)
.PP

View File

@ -1,74 +0,0 @@
.\"/*
.\" * Copyright (c) 2004 MontaVista Software, Inc.
.\" *
.\" * All rights reserved.
.\" *
.\" * Author: Steven Dake (sdake@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 EVS_JOIN 3 2004-08-31 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
.SH NAME
evs_join \- Joins one or more groups in the EVS library
.SH SYNOPSIS
.B #include <corosync/evs.h>
.sp
.BI "int evs_membership_get(evs_handle_t " handle ", unsigned int *" local_nodeid ", unsigned int *" member_list ", int *" member_list_entries ");
.SH DESCRIPTION
The
.B evs_membership_get
function is used to determine the current processors in the configuration and also
the local processor identifier.
The argument
.I handle
is used to reference the evs instantiation.
The argument
.I local_nodeid
will return the local node id of the processor.
The argument
.I member_list
will return the list of processors in the current membership.
The argument
.I member_list_entries
should be set with the size of member_list and will return the size of the
member_list after return from the function.
.PP
.SH ERRORS
The errors are undocumented.
.SH "SEE ALSO"
.BR evs_overview (8),
.BR evs_initialize (3),
.BR evs_finalize (3),
.BR evs_fd_get (3),
.BR evs_dispatch (3),
.BR evs_leave (3),
.BR evs_mcast_joined (3),
.BR evs_mcast_groups (3),
.BR evs_mmembership_get (3)
.BR evs_context_get (3)
.BR evs_context_set (3)
.PP

View File

@ -1,185 +0,0 @@
.\"/*
.\" * Copyright (c) 2004 MontaVista Software, Inc.
.\" *
.\" * All rights reserved.
.\" *
.\" * Author: Steven Dake (sdake@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 EVS_OVERVIEW 8 2004-08-31 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
.SH NAME
evs_overview \- EvS Library Overview
.SH OVERVIEW
The EVS library is delivered with the corosync project. This library is used
to create distributed applications that operate properly during partitions, merges,
and faults.
.PP
The library provides a mechanism to:
* handle abstraction for multiple instances of an EVS library in one application
* Deliver messages
* Deliver configuration changes
* join one or more groups
* leave one or more groups
* send messages to one or more groups
* send messages to currently joined groups
.PP
The EVS library implements a messaging model known as Extended Virtual Synchrony.
This model allows one sender to transmit to many receivers using standard UDP/IP.
UDP/IP is unreliable and unordered, so the EVS library applies ordering and reliability
to messages. Hardware multicast is used to avoid duplicated packets with two or more
receivers. Erroneous messages are corrected automatically by the library.
.PP
Certain guarantees are provided by the EVS library. These guarantees are related to
message delivery and configuration change delivery.
.SH DEFINITIONS
.TP
.B multicast
A multicast occurs when a network interface card sends a UDP packet to multiple
receivers simulatenously.
.TP
.B processor
A processor is the entity that executes the extended virtual synchrony algorithms.
.TP
.B configuration
A configuration is the current description of the processors executing the extended
virtual syncrhony algorithm.
.TP
.B configuration change
A configuration change occurs when a new configuration is delivered.
.TP
.B partition
A partition occurs when a configuration splits into two or more configurations, or
a processor fails or is stopped and leaves the configuration.
.TP
.B merge
A merge occurs when two or more configurations join into a larger new configuration. When
a new processor starts up, it is treated as a configuration with only one processor
and a merge occurs.
.TP
.B fifo ordering
A message is FIFO ordered when one sender and one receiver agree on the order of the
messages sent.
.TP
.B agreed ordering
A message is AGREED ordered when all processors agree on the order of the messages sent.
.TP
.B safe ordering
A message is SAFE ordered when all processors agree on the order of messages sent and
those messages are not delivered until all processors have a copy of the message to
deliver.
.TP
.B virtual syncrhony
Virtual syncrhony is obtained when all processors agree on the order of messages
sent and configuration changes sent for each new configuration.
.SH USING VIRTUAL SYNCHRONY
The virtual synchrony messaging model has many benefits for developing distributed
applications. Applications designed using replication have the most benefits. Applications
that must be able to partition and merge also benefit from the virtual synchrony messaging
model.
.PP
All applications receive a copy of transmitted messages even if there are errors on the
transmission media. This allows optimiziations when every processor must receive a copy
of the message for replication.
.PP
All messages are ordered according to agreed ordering. This mechanism allows the avoidance
of race conditions. Consider a lock service implemented over several processors. Two
requests occur at the same time on two seperate processors. The requests are ordered for
every processor in the same order and delivered to the processors. Then all processors
will get request A before request B and can reject request B. Any type of creation or
deletion of a shared data structure can benefit from this mechanism.
.PP
Self delivery ensures that messages that are sent by a processor are also delivered back
to that processor. This allows the processor sending the message to execute logic when
the message is self delivered according to agreed ordering and the virtual synchrony rules.
It also permits all logic to be placed in one message handler instead of two seperate places.
.PP
Virtual Synchrony allows the current configuration to be used to make decisions in partitions
and merges. Since the configuration is sent in the stream of messages to the application,
the application can alter its behavior based upon the configuration changes.
.SH ARCHITECTURE AND ALGORITHM
The EVS library is a thin IPC interface to the corosync executive. The corosync executive
provides services for the SA Forum AIS libraries as well as the EVS library.
.PP
The corosync executive uses a ring protocol and membership protocol to send messages
according to the semantics required by extended virtual synchrony. The ring protocol
creates a virtual ring of processors. A token is rotated around the ring of processors.
When the token is possessed by a processor, that processor may multicast messages to
other processors in the system.
.PP
The token is called the ORF token (for ordering, reliability, flow control). The ORF
token orders all messages by increasing a sequence number every time a message is
multicasted. In this way, an ordering is placed on all messages that all processors
agree to. The token also contains a retransmission list. If a token is received by
a processor that has not yet received a message it should have, a message sequence
number is added to the retransmission list. A processor that has a copy of the message
then retransmits the message. The ORF token provides configuration-wide flow control
by tracking the number of messages sent and limiting the number of messages that may
be sent by one processor on each posession of the token.
.PP
The membership protocol is responsible for ring formation and detecting when a processor
within a ring has failed. If the token fails to make a rotation within a timeout period
known as the token rotation timeout, the membership protocol will form a new ring.
If a new processor starts, it will also form a new ring. Two or more configurations
may be used to form a new ring, allowing many partitions to merge together into one
new configuration.
.SH PERFORMANCE
The EVS library obtains 8.5MB/sec throughput on 100 mbit network links with
many processors. Larger messages obtain better throughput results because the
time to access Ethernet is about the same for a small message as it is for a
larger message. Smaller messages obtain better messages per second, because the
time to send a message is not exactly the same.
.PP
80% of CPU utilization occurs because of encryption and authentication. The corosync
can be built without encryption and authentication for those with no security
requirements and low CPU utilization requirements. Even without encryption or
authentication, under heavy load, processor utilization can reach 25% on 1.5 GHZ
CPU processors.
.PP
The current corosync executive supports 16 processors, however, support for more processors is possible by changing defines in the corosync executive. This is untested, however.
.SH SECURITY
The EVS library encrypts all messages sent over the network using the SOBER-128
stream cipher. The EVS library uses HMAC and SHA1 to authenticate all messages.
The EVS library uses SOBER-128 as a pseudo random number generator. The EVS
library feeds the PRNG using the /dev/random Linux device.
.SH BUGS
This software is not yet production, so there may still be some bugs. But it appears
there are very few since nobody reports any unknown bugs at this point.
.SH "SEE ALSO"
.BR evs_initialize (3),
.BR evs_finalize (3),
.BR evs_fd_get (3),
.BR evs_dispatch (3),
.BR evs_join (3),
.BR evs_leave (3),
.BR evs_mcast_joined (3),
.BR evs_mcast_groups (3),
.BR evs_mmembership_get (3)
.BR evs_context_get (3)
.BR evs_context_set (3)
.PP

View File

@ -138,49 +138,6 @@
Description of the cpg_iteration_finalize interface.
<br>
<h3>EVS service</h3>
<a href="evs_overview.8.html">evs_overview(8)</a>:
Overview of the evs extended virtual synchrony group
communication toolkit.
<br>
<a href="evs_initialize.3.html">evs_initialize(3)</a>:
Description of the evs_initialize interface.
<br>
<a href="evs_finalize.3.html">evs_finalize(3)</a>:
Description of the evs_finalize interface.
<br>
<a href="evs_dispatch.3.html">evs_dispatch(3)</a>:
Description of the evs_dispatch interface.
<br>
<a href="evs_fd_get.3.html">evs_fd_get(3)</a>:
Description of the evs_fd_get interface.
<br>
<a href="evs_join.3.html">evs_join(3)</a>:
Description of the evs_join interface.
<br>
<a href="evs_leave.3.html">evs_leave(3)</a>:
Description of the evs_leave interface.
<br>
<a href="evs_mcast_groups.3.html">evs_mcast_groups(3)</a>:
Description of the evs_mcast_groups interface.
<br>
<a href="evs_mcast_joined.3.html">evs_mcast_joined(3)</a>:
Description of the evs_mcast_joined interface.
<br>
<a href="evs_membership_get.3.html">evs_membership_get(3)</a>:
Description of the evs_membership_get interface.
<br>
<h3>SAM service</h3>
<a href="sam_overview.8.html">sam_overview(8)</a>:

View File

@ -32,7 +32,7 @@ MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = libtemplate.pc.in corosync.pc.in
LIBS = cfg cpg evs quorum \
LIBS = cfg cpg quorum \
totem_pg votequorum sam cmap corosync_common
target_LIBS = $(LIBS:%=lib%.pc)

3
test/.gitignore vendored
View File

@ -1,8 +1,6 @@
cpgbench
cpgbound
cpgverify
evsbench
evsverify
logsys_s
logsys_t1
logsys_t2
@ -12,7 +10,6 @@ stress_cpgcontext
stress_cpgfdget
testcpg
testcpg2
testevs
testquorum
testsam
testvotequorum1

View File

@ -35,7 +35,7 @@ INCLUDES = -I$(top_builddir)/include/corosync -I$(top_srcdir)/include
EXTRA_DIST = ploadstart.sh
noinst_PROGRAMS = testevs evsbench evsverify cpgverify testcpg testcpg2 cpgbench \
noinst_PROGRAMS = cpgverify testcpg testcpg2 cpgbench \
testquorum testvotequorum1 testvotequorum2 \
stress_cpgfdget stress_cpgcontext cpgbound testsam \
testcpgzc cpgbenchzc testzcgc stress_cpgzc
@ -44,8 +44,6 @@ noinst_SCRIPTS = ploadstart
COMMON_OPTS = -L../lib -L../common_lib -Wl,-rpath,../common_lib
testevs_LDADD = -levs $(LIBQB_LIBS)
testevs_LDFLAGS = $(COMMON_OPTS)
testcpg_LDADD = -lcpg $(LIBQB_LIBS)
testcpg_LDFLAGS = $(COMMON_OPTS)
testcpg2_LDADD = -lcpg $(LIBQB_LIBS)
@ -66,14 +64,10 @@ testvotequorum1_LDADD = -lvotequorum $(LIBQB_LIBS)
testvotequorum1_LDFLAGS = $(COMMON_OPTS)
testvotequorum2_LDADD = -lvotequorum $(LIBQB_LIBS)
testvotequorum2_LDFLAGS = $(COMMON_OPTS)
evsverify_LDADD = -levs -ltotem_pg $(LIBQB_LIBS)
evsverify_LDFLAGS = $(COMMON_OPTS) -L../exec
cpgverify_LDADD = -lcpg -ltotem_pg $(LIBQB_LIBS)
cpgverify_LDFLAGS = $(COMMON_OPTS) -L../exec
cpgbound_LDADD = -lcpg $(LIBQB_LIBS)
cpgbound_LDFLAGS = $(COMMON_OPTS)
evsbench_LDADD = -levs $(LIBQB_LIBS)
evsbench_LDFLAGS = $(COMMON_OPTS)
cpgbench_LDADD = -lcpg $(LIBQB_LIBS)
cpgbench_LDFLAGS = $(COMMON_OPTS)
cpgbenchzc_LDADD = -lcpg -lcorosync_common $(LIBQB_LIBS)
@ -86,8 +80,7 @@ ploadstart: ploadstart.sh
chmod 755 $@
LINT_FILES1:=$(filter-out sa_error.c, $(wildcard *.c))
LINT_FILES2:=$(filter-out testevsth.c, $(LINT_FILES1))
LINT_FILES:=$(filter-out testparse.c, $(LINT_FILES2))
LINT_FILES:=$(filter-out testparse.c, $(LINT_FILES1))
lint:
-for f in $(LINT_FILES) ; do echo Splint $$f ; splint $(INCLUDES) $(LINT_FLAGS) $(CFLAGS) $$f ; done

View File

@ -1,197 +0,0 @@
#define _BSD_SOURCE
/*
* Copyright (c) 2004 MontaVista Software, Inc.
*
* All rights reserved.
*
* Author: Steven Dake (sdake@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.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <errno.h>
#include <unistd.h>
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <sys/un.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <corosync/corotypes.h>
#include <corosync/evs.h>
#ifdef COROSYNC_SOLARIS
#define timersub(a, b, result) \
do { \
(result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
(result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
if ((result)->tv_usec < 0) { \
--(result)->tv_sec; \
(result)->tv_usec += 1000000; \
} \
} while (0)
#endif
volatile static int alarm_notice = 0;
static void evs_deliver_fn (
hdb_handle_t handle,
unsigned int nodeid,
const void *msg,
size_t msg_len)
{
}
static void evs_confchg_fn (
hdb_handle_t handle,
const unsigned int *member_list, size_t member_list_entries,
const unsigned int *left_list, size_t left_list_entries,
const unsigned int *joined_list, size_t joined_list_entries,
const struct evs_ring_id *ring_id)
{
int i;
printf ("CONFIGURATION CHANGE\n");
printf ("--------------------\n");
printf ("New configuration\n");
for (i = 0; i < member_list_entries; i++) {
printf ("%x\n", member_list[i]);
}
printf ("Members Left:\n");
for (i = 0; i < left_list_entries; i++) {
printf ("%x\n", left_list[i]);
}
printf ("Members Joined:\n");
for (i = 0; i < joined_list_entries; i++) {
printf ("%x\n", joined_list[i]);
}
}
static evs_callbacks_t callbacks = {
evs_deliver_fn,
evs_confchg_fn
};
struct evs_group groups[3] = {
{ "key1" },
{ "key2" },
{ "key3" }
};
static char buffer[200000];
static struct iovec iov = {
.iov_base = buffer,
.iov_len = sizeof (buffer)
};
static void evs_benchmark (evs_handle_t handle,
int write_size)
{
struct timeval tv1, tv2, tv_elapsed;
cs_error_t result;
int write_count = 0;
/*
* Run benchmark for 10 seconds
*/
alarm (10);
gettimeofday (&tv1, NULL);
iov.iov_len = write_size;
do {
sprintf (buffer, "This is message %d\n", write_count);
result = evs_mcast_joined (handle, EVS_TYPE_AGREED, &iov, 1);
if (result != CS_ERR_TRY_AGAIN) {
write_count += 1;
}
result = evs_dispatch (handle, CS_DISPATCH_ALL);
} while (alarm_notice == 0);
gettimeofday (&tv2, NULL);
timersub (&tv2, &tv1, &tv_elapsed);
printf ("%5d Writes ", write_count);
printf ("%5d bytes per write ", write_size);
printf ("%7.3f Seconds runtime ",
(tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)));
printf ("%9.3f TP/s ",
((float)write_count) / (tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)));
printf ("%7.3f MB/s.\n",
((float)write_count) * ((float)write_size) / ((tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)) * 1000000.0));
alarm_notice = 0;
}
static void sigalrm_handler (int num)
{
alarm_notice = 1;
}
static void sigintr_handler (int num) __attribute__((__noreturn__));
static void sigintr_handler (int num)
{
exit (1);
}
int main (void) {
int size;
int i;
cs_error_t result;
evs_handle_t handle;
signal (SIGALRM, sigalrm_handler);
signal (SIGINT, sigintr_handler);
result = evs_initialize (&handle, &callbacks);
printf ("Init result %d\n", result);
result = evs_join (handle, groups, 3);
printf ("Join result %d\n", result);
size = 1;
for (i = 0; i < 225; i++) { /* number of repetitions - up to 50k */
evs_benchmark (handle, size);
/*
* Adjust count to 95% of previous count
* Adjust bytes to write per checkpoint up by 1500
*/
size += 1000;
}
return (0);
}

View File

@ -1,188 +0,0 @@
/*
* Copyright (c) 2004 MontaVista Software, Inc.
* Copyright (c) 2006-2007, 2009 Red Hat, Inc.
*
* All rights reserved.
*
* Author: Steven Dake (sdake@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.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <string.h>
#include <corosync/corotypes.h>
#include <corosync/evs.h>
#include "../exec/crypto.h"
const char *delivery_string;
struct my_msg {
unsigned int msg_size;
unsigned char sha1[20];
unsigned char buffer[0];
};
static int deliveries = 0;
static void evs_deliver_fn (
hdb_handle_t handle,
unsigned int nodeid,
const void *m,
size_t msg_len)
{
const struct my_msg *msg2 = m;
unsigned char sha1_compare[20];
hash_state sha1_hash;
unsigned int i;
printf ("API '%s' msg '%s'\n", delivery_string, msg2->buffer);
sha1_init (&sha1_hash);
sha1_process (&sha1_hash, msg2->buffer, msg2->msg_size);
sha1_done (&sha1_hash, sha1_compare);
printf ("SIZE %d HASH: ", msg2->msg_size);
for (i = 0; i < 20; i++) {
printf ("%x", sha1_compare[i]);
}
printf ("\n");
if (memcmp (sha1_compare, msg2->sha1, 20) != 0) {
printf ("incorrect hash\n");
exit (1);
}
deliveries++;
}
static void evs_confchg_fn (
hdb_handle_t handle,
const unsigned int *member_list, size_t member_list_entries,
const unsigned int *left_list, size_t left_list_entries,
const unsigned int *joined_list, size_t joined_list_entries,
const struct evs_ring_id *ring_id)
{
int i;
printf ("CONFIGURATION CHANGE\n");
printf ("--------------------\n");
printf ("New configuration\n");
for (i = 0; i < member_list_entries; i++) {
printf ("%x\n", member_list[i]);
}
printf ("Members Left:\n");
for (i = 0; i < left_list_entries; i++) {
printf ("%x\n", left_list[i]);
}
printf ("Members Joined:\n");
for (i = 0; i < joined_list_entries; i++) {
printf ("%x\n", joined_list[i]);
}
}
static evs_callbacks_t callbacks = {
evs_deliver_fn,
evs_confchg_fn
};
struct evs_group groups[3] = {
{ "key1" },
{ "key2" },
{ "key3" }
};
static unsigned char buffer[200000];
int main (void)
{
evs_handle_t handle;
cs_error_t result;
unsigned int i = 0, j;
int fd;
unsigned int member_list[32];
unsigned int local_nodeid;
size_t member_list_entries = 32;
struct my_msg msg;
hash_state sha1_hash;
struct iovec iov[2];
result = evs_initialize (&handle, &callbacks);
if (result != CS_OK) {
printf ("Couldn't initialize EVS service %d\n", result);
exit (0);
}
result = evs_membership_get (handle, &local_nodeid,
member_list, &member_list_entries);
printf ("Current membership from evs_membership_get entries %lu\n",
(unsigned long int) member_list_entries);
for (i = 0; i < member_list_entries; i++) {
printf ("member [%d] is %x\n", i, member_list[i]);
}
printf ("local processor from evs_membership_get %x\n", local_nodeid);
printf ("Init result %d\n", result);
result = evs_join (handle, groups, 3);
printf ("Join result %d\n", result);
result = evs_leave (handle, &groups[0], 1);
printf ("Leave result %d\n", result);
delivery_string = "evs_mcast_joined";
iov[0].iov_base = (void *)&msg;
iov[0].iov_len = sizeof (struct my_msg);
iov[1].iov_base = (void *)buffer;
/*
* Demonstrate evs_mcast_joined
*/
for (i = 0; i < 1000000000; i++) {
msg.msg_size = 100 + rand() % 100000;
iov[1].iov_len = msg.msg_size;
for (j = 0; j < msg.msg_size; j++) {
buffer[j] = j;
}
sprintf ((char *)buffer,
"evs_mcast_joined: This is message %12d", i);
sha1_init (&sha1_hash);
sha1_process (&sha1_hash, buffer, msg.msg_size);
sha1_done (&sha1_hash, msg.sha1);
try_again_one:
result = evs_mcast_joined (handle, EVS_TYPE_AGREED,
iov, 2);
if (result == CS_ERR_TRY_AGAIN) {
goto try_again_one;
}
result = evs_dispatch (handle, CS_DISPATCH_ALL);
}
evs_fd_get (handle, &fd);
evs_finalize (handle);
return (0);
}

View File

@ -1,193 +0,0 @@
/*
* Copyright (c) 2004 MontaVista Software, Inc.
* Copyright (c) 2006-2009 Red Hat, Inc.
*
* All rights reserved.
*
* Author: Steven Dake (sdake@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.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <corosync/corotypes.h>
#include <corosync/evs.h>
#include <qb/qblog.h>
static const char *delivery_string;
static int deliveries = 0;
static void evs_deliver_fn (
hdb_handle_t handle,
unsigned int nodeid,
const void *msg,
size_t msg_len)
{
const char *buf = msg;
printf ("API '%s' msg '%s'\n", delivery_string, buf);
deliveries++;
}
static void evs_confchg_fn (
hdb_handle_t handle,
const unsigned int *member_list, size_t member_list_entries,
const unsigned int *left_list, size_t left_list_entries,
const unsigned int *joined_list, size_t joined_list_entries,
const struct evs_ring_id *ring_id)
{
int i;
printf ("CONFIGURATION CHANGE\n");
printf ("--------------------\n");
printf ("New configuration\n");
for (i = 0; i < member_list_entries; i++) {
printf ("%x\n", member_list[i]);
}
printf ("Members Left:\n");
for (i = 0; i < left_list_entries; i++) {
printf ("%x\n", left_list[i]);
}
printf ("Members Joined:\n");
for (i = 0; i < joined_list_entries; i++) {
printf ("%x\n", joined_list[i]);
}
}
static evs_callbacks_t callbacks = {
evs_deliver_fn,
evs_confchg_fn
};
static struct evs_group groups[3] = {
{ "key1" },
{ "key2" },
{ "key3" }
};
static char buffer[2000];
struct iovec iov = {
.iov_base = buffer,
.iov_len = sizeof (buffer)
};
int main (void)
{
evs_handle_t handle;
cs_error_t result;
int i = 0;
int fd;
unsigned int member_list[32];
unsigned int local_nodeid;
size_t member_list_entries = 32;
qb_log_init("testevs", LOG_USER, LOG_ERR);
qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_ENABLED, QB_FALSE);
qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_ADD,
QB_LOG_FILTER_FILE, "*", LOG_TRACE);
qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_ENABLED, QB_TRUE);
qb_log_format_set(QB_LOG_STDERR, "[%p] %f %b");
result = evs_initialize (&handle, &callbacks);
if (result != CS_OK) {
printf ("Couldn't initialize EVS service %d\n", result);
exit (0);
}
result = evs_membership_get (handle, &local_nodeid,
member_list, &member_list_entries);
printf ("Current membership from evs_membership_get entries %lu\n",
(unsigned long int) member_list_entries);
for (i = 0; i < member_list_entries; i++) {
printf ("member [%d] is %x\n", i, member_list[i]);
}
printf ("local processor from evs_membership_get %x\n", local_nodeid);
printf ("Init result %d\n", result);
result = evs_join (handle, groups, 3);
printf ("Join result %d\n", result);
delivery_string = "evs_mcast_joined";
/*
* Demonstrate evs_mcast_joined
*/
for (i = 0; i < 500; i++) {
sprintf (buffer, "evs_mcast_joined: This is message %d", i);
#ifdef COMPILE_OUT
sprintf (buffer,
"%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d",
i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i,
i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i);
#endif
try_again_one:
result = evs_mcast_joined (handle, EVS_TYPE_AGREED,
&iov, 1);
if (result == CS_ERR_TRY_AGAIN) {
goto try_again_one;
}
result = evs_dispatch (handle, CS_DISPATCH_ALL);
}
do {
result = evs_dispatch (handle, CS_DISPATCH_ALL);
} while (deliveries < 20);
/*
* Demonstrate evs_mcast_joined
*/
delivery_string = "evs_mcast_groups";
for (i = 0; i < 500; i++) {
sprintf (buffer, "evs_mcast_groups: This is message %d", i);
try_again_two:
result = evs_mcast_groups (handle, EVS_TYPE_AGREED,
&groups[1], 1, &iov, 1);
if (result == CS_ERR_TRY_AGAIN) {
goto try_again_two;
}
result = evs_dispatch (handle, CS_DISPATCH_ALL);
}
/*
* Flush any pending callbacks
*/
do {
result = evs_dispatch (handle, CS_DISPATCH_ALL);
} while (deliveries < 500);
evs_fd_get (handle, &fd);
evs_finalize (handle);
return (0);
}

View File

@ -1,186 +0,0 @@
/*
* Copyright (c) 2004 MontaVista Software, Inc.
*
* All rights reserved.
*
* Author: Steven Dake (sdake@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.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <pthread.h>
#include "../include/evs.h"
char *delivery_string;
#define CALLBACKS 200000
int callback_count = 0;
void evs_deliver_fn (struct in_addr source_addr, const void *msg, size_t msg_len)
{
#ifdef PRINT_OUTPUT
char *buf;
buf += 100000;
printf ("Delivery callback\n");
printf ("callback %d '%s' msg '%s'\n", callback_count, delivery_string, buf);
#endif
callback_count += 1;
if (callback_count % 50 == 0) {
printf ("Callback %d\n", callback_count);
}
}
void evs_confchg_fn (
const struct in_addr *member_list, size_t member_list_entries,
const struct in_addr *left_list, size_t left_list_entries,
const struct in_addr *joined_list, size_t joined_list_entries)
{
int i;
printf ("CONFIGURATION CHANGE\n");
printf ("--------------------\n");
printf ("New configuration\n");
for (i = 0; i < member_list_entries; i++) {
printf ("%s\n", inet_ntoa (member_list[i]));
}
printf ("Members Left:\n");
for (i = 0; i < left_list_entries; i++) {
printf ("%s\n", inet_ntoa (left_list[i]));
}
printf ("Members Joined:\n");
for (i = 0; i < joined_list_entries; i++) {
printf ("%s\n", inet_ntoa (joined_list[i]));
}
}
evs_callbacks_t callbacks = {
evs_deliver_fn,
evs_confchg_fn
};
struct evs_group groups[3] = {
{ "key1" },
{ "key2" },
{ "key3" }
};
char buffer[1000];
struct iovec iov = {
.iov_base = buffer,
.iov_len = sizeof (buffer)
};
void *th_dispatch (void *arg)
{
cs_error_t result;
evs_handle_t handle = *(evs_handle_t *)arg;
printf ("THREAD DISPATCH starting.\n");
result = evs_dispatch (handle, CS_DISPATCH_BLOCKING);
printf ("THREAD DISPATCH return result is %d\n", result);
return (0);
}
static struct sched_param sched_param = {
sched_priority: 99
};
int main (void)
{
evs_handle_t handle;
cs_error_t result;
int i = 0;
pthread_t dispatch_thread;
pthread_attr_t dispatch_thread_attribute;
result = evs_initialize (&handle, &callbacks);
if (result != CS_OK) {
printf ("Couldn't initialize EVS service %d\n", result);
exit (0);
}
pthread_attr_init (&dispatch_thread_attribute);
pthread_attr_setschedpolicy (&dispatch_thread_attribute, SCHED_FIFO);
pthread_attr_setschedparam (&dispatch_thread_attribute, &sched_param);
pthread_create (&dispatch_thread, NULL, th_dispatch, &handle);
printf ("Init result %d\n", result);
result = evs_join (handle, groups, 3);
printf ("Join result %d\n", result);
result = evs_leave (handle, &groups[0], 1);
printf ("Leave result %d\n", result);
delivery_string = "evs_mcast_joined";
/*
* Demonstrate evs_mcast_joined
*/
for (i = 0; i < CALLBACKS/2; i++) {
sprintf (buffer, "evs_mcast_joined: This is message %d", i);
try_again_one:
result = evs_mcast_joined (handle, EVS_TYPE_AGREED, &iov, 1);
if (result == CS_ERR_TRY_AGAIN) {
goto try_again_one;
} else
if (result != CS_OK) {
printf ("Got error result, exiting %d\n", result);
exit (1);
}
}
/*
* Demonstrate evs_mcast_joined
*/
delivery_string = "evs_mcast_groups";
for (i = 0; i < CALLBACKS/2; i++) {
sprintf (buffer, "evs_mcast_groups: This is message %d", i);
try_again_two:
result = evs_mcast_groups (handle, EVS_TYPE_AGREED,
&groups[1], 1, &iov, 1);
if (result == CS_ERR_TRY_AGAIN) {
goto try_again_two;
}
}
/*
* Wait until all callbacks have been executed by dispatch thread
*/
for (;;) {
if (callback_count == CALLBACKS) {
printf ("Test completed successfully\n");
exit (0);
}
}
return (0);
}