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 - gfs_controld: use group_mode detection Date: Wed, 30 Jul 2008 21:00:00 -0000 [thread overview] Message-ID: <20080730203257.313B812001F@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=08028d26e6522bcf1c07adc82634fdc65ddf78a3 Commit: 08028d26e6522bcf1c07adc82634fdc65ddf78a3 Parent: b991d064c1866f31c2bf0ae3f1558cf4806c12b3 Author: David Teigland <teigland@redhat.com> AuthorDate: Wed Jul 30 14:35:32 2008 -0500 Committer: David Teigland <teigland@redhat.com> CommitterDate: Wed Jul 30 14:35:32 2008 -0500 gfs_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/gfs_controld/config.h | 2 +- group/gfs_controld/gfs_daemon.h | 7 +++++++ group/gfs_controld/group.c | 28 ++++++++++++++++++++++++++++ group/gfs_controld/main.c | 21 +++++++++------------ 4 files changed, 45 insertions(+), 13 deletions(-) diff --git a/group/gfs_controld/config.h b/group/gfs_controld/config.h index c1b619c..7ab2ad1 100644 --- a/group/gfs_controld/config.h +++ b/group/gfs_controld/config.h @@ -1,7 +1,7 @@ #ifndef __CONFIG_DOT_H__ #define __CONFIG_DOT_H__ -#define DEFAULT_GROUPD_COMPAT 1 +#define DEFAULT_GROUPD_COMPAT 2 #define DEFAULT_DEBUG_LOGSYS 0 #define DEFAULT_ENABLE_WITHDRAW 1 #define DEFAULT_ENABLE_PLOCK 1 diff --git a/group/gfs_controld/gfs_daemon.h b/group/gfs_controld/gfs_daemon.h index 3c6c0df..e16aeca 100644 --- a/group/gfs_controld/gfs_daemon.h +++ b/group/gfs_controld/gfs_daemon.h @@ -57,6 +57,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_dlm; @@ -76,6 +81,7 @@ extern int plock_dump_len; extern int dmsetup_wait; extern cpg_handle_t libcpg_handle; extern int libcpg_flow_control_on; +extern int group_mode; void daemon_dump_save(void); @@ -256,6 +262,7 @@ int set_node_info_group(struct mountgroup *mg, int nodeid, int set_mountgroups_group(int *count, struct gfsc_mountgroup **mgs_out); int set_mountgroup_nodes_group(struct mountgroup *mg, int option, int *node_count, struct gfsc_node **nodes_out); +void set_group_mode(void); /* main.c */ int do_read(int fd, void *buf, size_t count); diff --git a/group/gfs_controld/group.c b/group/gfs_controld/group.c index 72e142a..ca2e376 100644 --- a/group/gfs_controld/group.c +++ b/group/gfs_controld/group.c @@ -202,3 +202,31 @@ int set_mountgroup_nodes_group(struct mountgroup *mg, int option, int *node_coun 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/gfs_controld/main.c b/group/gfs_controld/main.c index 145d8f6..00e227d 100644 --- a/group/gfs_controld/main.c +++ b/group/gfs_controld/main.c @@ -7,14 +7,11 @@ #define LOCKFILE_NAME "/var/run/gfs_controld.pid" #define CLIENT_NALLOC 32 -#define GROUP_LIBGROUP 2 -#define GROUP_LIBCPG 3 static int client_maxi; static int client_size; static struct client *client; static struct pollfd *pollfd; -static int group_mode; static pthread_t query_thread; static pthread_mutex_t query_mutex; @@ -1056,13 +1053,10 @@ static void loop(void) client_add(rv, process_groupd, cluster_dead); group_mode = GROUP_LIBGROUP; - - if (cfgd_groupd_compat == 2) { - /* set_group_mode(); */ - /* might set group_mode to GROUP_LIBCPG */ - 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) { @@ -1224,9 +1218,11 @@ static void print_usage(void) printf("\n"); printf(" -D Enable debugging code and don't fork\n"); printf(" -L <num> Enable (1) or disable (0) debugging to logsys (default %d)\n", DEFAULT_DEBUG_LOGSYS); - 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(" -w <num> Enable (1) or disable (0) withdraw\n"); printf(" Default is %d\n", DEFAULT_ENABLE_WITHDRAW); @@ -1440,4 +1436,5 @@ int plock_dump_len; int dmsetup_wait; cpg_handle_t libcpg_handle; int libcpg_flow_control_on; +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.313B812001F@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).