From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26464 invoked by alias); 27 Mar 2009 21:16:19 -0000 Received: (qmail 26457 invoked by alias); 27 Mar 2009 21:16:19 -0000 X-SWARE-Spam-Status: No, hits=-0.7 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_43,J_CHICKENPOX_52,J_CHICKENPOX_63,J_CHICKENPOX_83,SPF_HELO_PASS X-Spam-Status: No, hits=-0.7 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_43,J_CHICKENPOX_52,J_CHICKENPOX_63,J_CHICKENPOX_83,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bastion.fedora.phx.redhat.com Subject: cluster: STABLE3 - group_tool: compat command To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/STABLE3 X-Git-Reftype: branch X-Git-Oldrev: a77eb4aaf93bbf1d1616eab487b81314ff1ce050 X-Git-Newrev: 957db633dde58f6f1acbad1e63b0d8a8d1d6493a From: David Teigland Message-Id: <20090327211556.32DE812020C@lists.fedorahosted.org> Date: Fri, 27 Mar 2009 21:16:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2009-q1/txt/msg00973.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=957db633dde58f6f1acbad1e63b0d8a8d1d6493a Commit: 957db633dde58f6f1acbad1e63b0d8a8d1d6493a Parent: a77eb4aaf93bbf1d1616eab487b81314ff1ce050 Author: David Teigland AuthorDate: Fri Mar 27 16:09:48 2009 -0500 Committer: David Teigland CommitterDate: Fri Mar 27 16:09:48 2009 -0500 group_tool: compat command 'group_tool compat' just queries groupd and reports if it's running and if so what compat mode it's running. If groupd is not running it exits with 1. Also remove the log option and fix up the help. Signed-off-by: David Teigland --- group/tool/main.c | 83 ++++++++++++++++++++++++++++------------------------ 1 files changed, 45 insertions(+), 38 deletions(-) diff --git a/group/tool/main.c b/group/tool/main.c index e1d911c..683323f 100644 --- a/group/tool/main.c +++ b/group/tool/main.c @@ -30,7 +30,7 @@ #define OP_LIST 1 #define OP_DUMP 2 -#define OP_LOG 3 +#define OP_COMPAT 3 static char *prog_name; static int operation; @@ -81,28 +81,28 @@ static void print_usage(void) { printf("Usage:\n"); printf("\n"); - printf("%s [options] [ls|dump]\n", prog_name); + printf("%s [options] [compat|ls|dump]\n", prog_name); printf("\n"); printf("Options:\n"); - printf(" -v Verbose output, extra event information\n"); - printf(" -a fence_tool ls; dlm_tool ls; gfs_control ls\n"); - printf(" -n Show all node information with -a\n"); printf(" -h Print this help, then exit\n"); printf(" -V Print program version information, then exit\n"); printf("\n"); - printf("Display group information from groupd\n"); - printf("ls Show information for all groups\n"); - printf("ls Show information one group. If\n"); - printf(" we are not a member of the group,\n"); - printf(" return 1.\n"); + + printf("compat Show compatibility mode that groupd is running\n"); printf("\n"); - printf("Display debugging information\n"); - printf("dump Show debug log from groupd\n"); - printf("dump fence Show debug log from fenced\n"); - printf("dump gfs Show debug log from gfs_controld\n"); - printf("dump plocks Show posix locks for gfs with given name\n"); + + printf("ls Show group state for fence, dlm, gfs\n"); + printf(" -a fence_tool ls; dlm_tool ls; gfs_control ls\n"); + printf(" -n Show all node information with -a\n"); + printf(" -v Show extra event information (with compat 1)\n"); printf("\n"); - printf("log Add information to the groupd log.\n"); + + printf("dump Show debug log from groupd\n"); + printf("dump fence Show debug log from fenced (fence_tool dump)\n"); + printf("dump dlm Show debug log from dlm_controld (dlm_tool dump)\n"); + printf("dump gfs Show debug log from gfs_controld (gfs_control dump)\n"); + printf("dump plocks Show posix locks from dlm_controld for lockspace \n"); + printf(" (dlm_tool plocks )\n"); printf("\n"); } @@ -168,8 +168,8 @@ static void decode_arguments(int argc, char **argv) operation = OP_LIST; opt_ind = optind + 1; break; - } else if (strcmp(argv[optind], "log") == 0) { - operation = OP_LOG; + } else if (strcmp(argv[optind], "compat") == 0) { + operation = OP_COMPAT; opt_ind = optind + 1; break; } @@ -591,21 +591,6 @@ static void groupd_dump_debug(int argc, char **argv, char *inbuf) close(fd); } -static int do_log(char *comment) -{ - char buf[GROUPD_MSGLEN]; - int fd, rv; - - fd = connect_daemon(GROUPD_SOCK_PATH); - if (fd < 0) - return fd; - memset(buf, 0, sizeof(buf)); - snprintf(buf, sizeof(buf), "log %s", comment); - rv = write(fd, &buf, GROUPD_MSGLEN); - close(fd); - return rv; -} - int main(int argc, char **argv) { int rv, version = 0; @@ -614,6 +599,33 @@ int main(int argc, char **argv) decode_arguments(argc, argv); switch (operation) { + case OP_COMPAT: + rv = group_get_version(&version); + if (rv < 0) + version = -1; + + switch (version) { + case -1: + printf("groupd not running\n"); + break; + case -EAGAIN: + printf("groupd compatibility mode 2 (pending)\n"); + break; + case GROUP_LIBGROUP: + printf("groupd compatibility mode 1\n"); + break; + case GROUP_LIBCPG: + printf("groupd compatibility mode 0\n"); + break; + default: + printf("groupd compatibility mode %d\n", version); + break; + } + + if (rv < 0) + exit(EXIT_FAILURE); + break; + case OP_LIST: rv = group_get_version(&version); @@ -734,11 +746,6 @@ int main(int argc, char **argv) } break; - - case OP_LOG: - if (opt_ind && opt_ind < argc) { - return do_log(argv[opt_ind]); - } } return 0;