add vsf none option for those that don't want a virtual synchrony filter

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1018 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Steven Dake 2006-04-30 04:52:21 +00:00
parent 2439b397fb
commit e92d65ba90
6 changed files with 90 additions and 23 deletions

View File

@ -238,7 +238,6 @@ static void aisexec_mempool_init (void)
static void aisexec_tty_detach (void)
{
#define DEBUG
#ifndef DEBUG
/*
* Disconnect from TTY if this is not a debug run
@ -268,7 +267,7 @@ static void aisexec_setscheduler (void)
res = sched_get_priority_max (SCHED_RR);
if (res != -1) {
sched_param.sched_priority = res;
res = sched_setscheduler (0, SCHED_RR, &sched_param);
// res = sched_setscheduler (0, SCHED_RR, &sched_param);
if (res == -1) {
log_printf (LOG_LEVEL_WARNING, "Could not set SCHED_RR at priority %d: %s\n",
sched_param.sched_priority, strerror (errno));
@ -518,7 +517,8 @@ int main (int argc, char **argv)
openais_exit_error (AIS_DONE_INIT_SERVICES);
}
sync_register (openais_sync_callbacks_retrieve, openais_sync_completed);
sync_register (openais_sync_callbacks_retrieve, openais_sync_completed,
totem_config.vsf_type);
/*
* Drop root privleges to user 'ais'

View File

@ -71,6 +71,8 @@ struct barrier_data {
static struct memb_ring_id *sync_ring_id;
static int vsf_none = 0;
static int (*sync_callbacks_retrieve) (int sync_id, struct sync_callbacks *callack);
static struct sync_callbacks sync_callbacks;
@ -262,37 +264,68 @@ static int sync_service_process (enum totem_callback_token_type type, void *data
return (0);
}
void sync_register (
int sync_register (
int (*callbacks_retrieve) (int sync_id, struct sync_callbacks *callack),
void (*synchronization_completed) (void))
void (*synchronization_completed) (void),
char *vsf_type)
{
unsigned int res;
unsigned int ykd_handle;
unsigned int vsf_handle;
void *vsf_iface_p;
char openais_vsf_type[1024];
log_init ("SYNC");
totempg_groups_initialize (
res = totempg_groups_initialize (
&sync_group_handle,
sync_deliver_fn,
sync_confchg_fn);
if (res == -1) {
log_printf (LOG_LEVEL_ERROR,
"Couldn't initialize groups interface.\n");
return (-1);
}
totempg_groups_join (
res = totempg_groups_join (
sync_group_handle,
&sync_group,
1);
if (res == -1) {
log_printf (LOG_LEVEL_ERROR, "Couldn't join group.\n");
return (-1);
}
if (strcmp (vsf_type, "none") == 0) {
log_printf (LOG_LEVEL_NOTICE,
"Not using a virtual synchrony filter.\n");
vsf_none = 1;
} else {
vsf_none = 0;
sprintf (openais_vsf_type, "openais_vsf_%s", vsf_type);
res = lcr_ifact_reference (
&vsf_handle,
openais_vsf_type,
0,
&vsf_iface_p,
0);
res = lcr_ifact_reference (
&ykd_handle,
"openais_vsf_ykd",
0,
(void **)(void *)&vsf_iface,
0);
if (res == -1) {
log_printf (LOG_LEVEL_NOTICE,
"Couldn't load virtual synchrony filter %s\n",
vsf_type);
return (-1);
}
vsf_iface->init (sync_primary_callback_fn);
log_printf (LOG_LEVEL_NOTICE,
"Using virtual synchrony filter %s\n", openais_vsf_type);
vsf_iface = (struct openais_vsf_iface_ver0 *)vsf_iface_p;
vsf_iface->init (sync_primary_callback_fn);
}
sync_callbacks_retrieve = callbacks_retrieve;
sync_synchronization_completed = synchronization_completed;
return (0);
}
static void sync_primary_callback_fn (
@ -425,8 +458,19 @@ static void sync_confchg_fn (
struct memb_ring_id *ring_id)
{
sync_ring_id = ring_id;
}
/*
* If no virtual synchrony filter configured, then start
* synchronization process
*/
if (vsf_none == 1) {
sync_primary_callback_fn (
member_list,
member_list_entries,
1,
ring_id);
}
}
int sync_in_process (void)
{
@ -435,5 +479,9 @@ int sync_in_process (void)
int sync_primary_designated (void)
{
return (vsf_iface->primary());
if (vsf_none == 1) {
return (1);
} else {
return (vsf_iface->primary());
}
}

View File

@ -47,9 +47,10 @@ struct sync_callbacks {
unsigned char *name;
};
void sync_register (
int sync_register (
int (*sync_callbacks_retrieve) (int sync_id, struct sync_callbacks *callbacks),
void (*synchronization_completed) (void));
void (*synchronization_completed) (void),
char *vsf_type);
int sync_in_process (void);

View File

@ -132,6 +132,8 @@ struct totem_config {
unsigned int window_size;
unsigned int max_messages;
char *vsf_type;
};
enum totem_configuration_type {

View File

@ -202,6 +202,7 @@ extern int totem_config_read (
objdb_get_int (objdb,object_totem_handle, "max_network_delay", &totem_config->max_network_delay);
objdb_get_int (objdb,object_totem_handle, "window_size", &totem_config->window_size);
objdb_get_string (objdb, object_totem_handle, "vsftype", &totem_config->vsf_type);
objdb_get_int (objdb,object_totem_handle, "max_messages", &totem_config->max_messages);
}
@ -450,6 +451,9 @@ int totem_config_validate (
error_reason = "This net_mtu parameter is greater then the maximum frame size";
goto parse_error;
}
if (totem_config->vsf_type == NULL) {
totem_config->vsf_type = "ykd";
}
return (0);

View File

@ -1,6 +1,6 @@
.\"/*
.\" * Copyright (c) 2005 MontaVista Software, Inc.
.\" * Copyright (c) 2006 RedHat, Inc.
.\" * Copyright (c) 2006 Red Hat, Inc.
.\" *
.\" * All rights reserved.
.\" *
@ -110,8 +110,8 @@ UDP ports.
.PP
Within the
.B totem
directive, there are six configuration options of which 1 is required,
4 are optional, and 1 is requierd when IPV6 is configured in the interface
directive, there are seven configuration options of which one is required,
five are optional, and one is required when IPV6 is configured in the interface
subdirective. The required directive controls the version of the totem
configuration. The optional option unless using IPV6 directive controls
identification of the processor. The optional options control secrecy and
@ -212,6 +212,18 @@ mode offers best performance for non-SMP systems.
The default is 0.
.TP
vsftype
This directive controls the virtual synchrony filter type used to identify
a primary component. The preferred choice is YKD dynamic linear voting,
however, for clusters larger then 32 nodes YKD consumes alot of memory. For
large scale clusters that are created by changing the MAX_PROCESSORS_COUNT
#define in the C code totem.h file, the virtual synchrony filter "none" is
recommended but then AMF and DLCK services (which are currently experimental)
are not safe for use.
The default is ykd. The vsftype can also be set to none.
Within the
.B totem
directive, there are several configuration options which are used to control