public inbox for cluster-cvs@sourceware.org help / color / mirror / Atom feed
From: David Teigland <teigland@fedoraproject.org> To: cluster-cvs-relay@redhat.com Subject: master - dlm_controld: use group_mode detection Date: Wed, 30 Jul 2008 20:33:00 -0000 [thread overview] Message-ID: <20080730203257.56AEB120020@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=b991d064c1866f31c2bf0ae3f1558cf4806c12b3 Commit: b991d064c1866f31c2bf0ae3f1558cf4806c12b3 Parent: 16ea71248f91435c5489f3c1c2d9375a9024c92e Author: David Teigland <teigland@redhat.com> AuthorDate: Wed Jul 30 14:25:18 2008 -0500 Committer: David Teigland <teigland@redhat.com> CommitterDate: Wed Jul 30 14:25:18 2008 -0500 dlm_controld: use group_mode detection The new default is to use group mode detection from groupd. This is -g2 (command line) or <group groupd_compat="2"> (cluster.conf). Signed-off-by: David Teigland <teigland@redhat.com> --- group/dlm_controld/config.h | 2 +- group/dlm_controld/dlm_daemon.h | 7 ++++++ group/dlm_controld/group.c | 28 +++++++++++++++++++++++++++ group/dlm_controld/main.c | 40 ++++++++------------------------------ 4 files changed, 45 insertions(+), 32 deletions(-) diff --git a/group/dlm_controld/config.h b/group/dlm_controld/config.h index 4e4f33c..93d3f93 100644 --- a/group/dlm_controld/config.h +++ b/group/dlm_controld/config.h @@ -4,7 +4,7 @@ /* the kernel has default values for debug, timewarn and protocol; we only change them if new values are given on command line or in ccs */ -#define DEFAULT_GROUPD_COMPAT 1 +#define DEFAULT_GROUPD_COMPAT 2 #define DEFAULT_DEBUG_LOGSYS 0 #define DEFAULT_ENABLE_FENCING 1 #define DEFAULT_ENABLE_QUORUM 1 diff --git a/group/dlm_controld/dlm_daemon.h b/group/dlm_controld/dlm_daemon.h index 5fef0a3..22e82b1 100644 --- a/group/dlm_controld/dlm_daemon.h +++ b/group/dlm_controld/dlm_daemon.h @@ -60,6 +60,11 @@ #define MAXLINE 256 +/* group_mode */ + +#define GROUP_LIBGROUP 2 +#define GROUP_LIBCPG 3 + extern int daemon_debug_opt; extern int daemon_quit; extern int poll_fencing; @@ -77,6 +82,7 @@ extern int dump_point; extern int dump_wrap; extern char plock_dump_buf[DLMC_DUMP_SIZE]; extern int plock_dump_len; +extern int group_mode; void daemon_dump_save(void); @@ -292,6 +298,7 @@ int set_lockspace_info_group(struct lockspace *ls, int set_lockspaces_group(int *count, struct dlmc_lockspace **lss_out); int set_lockspace_nodes_group(struct lockspace *ls, int option, int *node_count, struct dlmc_node **nodes); +void set_group_mode(void); /* logging.c */ diff --git a/group/dlm_controld/group.c b/group/dlm_controld/group.c index 06530cb..acedd08 100644 --- a/group/dlm_controld/group.c +++ b/group/dlm_controld/group.c @@ -260,3 +260,31 @@ int set_lockspace_nodes_group(struct lockspace *ls, int option, int *node_count, return 0; } +void set_group_mode(void) +{ + int i = 0, rv, version; + + while (1) { + rv = group_get_version(&version); + if (rv) { + log_error("group_get_version error %d", rv); + break; + } else if (version == GROUP_LIBGROUP) { + group_mode = GROUP_LIBGROUP; + break; + } else if (version == GROUP_LIBCPG) { + group_mode = GROUP_LIBCPG; + break; + } else if (version != -EAGAIN) { + log_error("group_get_version result %d", version); + break; + } + + if (i++ > 10) { + log_error("no version from groupd"); + break; + } + sleep(1); + } +} + diff --git a/group/dlm_controld/main.c b/group/dlm_controld/main.c index ac79818..e30e711 100644 --- a/group/dlm_controld/main.c +++ b/group/dlm_controld/main.c @@ -10,14 +10,11 @@ #define LOCKFILE_NAME "/var/run/dlm_controld.pid" #define CLIENT_NALLOC 32 -#define GROUP_LIBGROUP 2 -#define GROUP_LIBCPG 3 static int client_maxi; static int client_size = 0; static struct client *client = NULL; static struct pollfd *pollfd = NULL; -static int group_mode; static pthread_t query_thread; static pthread_mutex_t query_mutex; @@ -842,32 +839,10 @@ static void loop(void) client_add(rv, process_groupd, cluster_dead); group_mode = GROUP_LIBGROUP; - - if (cfgd_groupd_compat == 2) { - /* cfgd_groupd_compat of 2 uses new groupd feature that - figures out whether all other groupd's in the cluster - are in LIGCPG mode, and if they are group_mode is - changed to LIBCPG. If any groupd in the cluster - is from cluster2/stable2/rhel5, or any groupd is - in LIBGROUP mode, then group_mode remains LIBGROUP. - - set_group_mode() figures this out by joining the - groupd cpg, sending a new "mode" message, and - waiting to see if it gets a mode reply from - all other groupd's. If it does, and all modes - are LIGCPG, then we set groupd_mode to LIBCPG. - Any previous generation groupd's won't recognize - the new mode message and won't reply; their lack - of reply (or seeing an old-style message from them) - indicates they are a cluster2 version. - - Not yet implemented. In the future, it may set - group_mode to GROUP_LIBCPG. */ - - /* set_group_mode(); */ - group_mode = GROUP_LIBGROUP; - } + if (cfgd_groupd_compat == 2) + set_group_mode(); } + log_debug("group_mode %d compat %d", group_mode, cfgd_groupd_compat); if (group_mode == GROUP_LIBCPG) { rv = setup_cpg(); @@ -1004,9 +979,11 @@ static void print_usage(void) printf(" -D Enable daemon debugging and don't fork\n"); printf(" -L <num> Enable (1) or disable (0) debugging to logsys (default %d)\n", DEFAULT_DEBUG_LOGSYS); printf(" -K Enable kernel dlm debugging messages\n"); - printf(" -g <num> groupd compatibility, 0 off, 1 on\n"); - printf(" on: use libgroup, compat with cluster2/stable2/rhel5\n"); - printf(" off: use libcpg, no backward compatability\n"); + printf(" -g <num> groupd compatibility mode, 0 off, 1 on, 2 detect\n"); + printf(" 0: use libcpg, no backward compat, best performance\n"); + printf(" 1: use libgroup for compat with cluster2/rhel5\n"); + printf(" 2: use groupd to detect old, or mode 1, nodes that\n" + " require compat, use libcpg if none found\n"); printf(" Default is %d\n", DEFAULT_GROUPD_COMPAT); printf(" -f <num> Enable (1) or disable (0) fencing recovery dependency\n"); printf(" Default is %d\n", DEFAULT_ENABLE_FENCING); @@ -1240,4 +1217,5 @@ int dump_point; int dump_wrap; char plock_dump_buf[DLMC_DUMP_SIZE]; int plock_dump_len; +int group_mode;
reply other threads:[~2008-07-30 20:33 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080730203257.56AEB120020@lists.fedorahosted.org \ --to=teigland@fedoraproject.org \ --cc=cluster-cvs-relay@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).