public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* master - group_tool: show groupd compat info
@ 2008-11-13 22:31 David Teigland
  0 siblings, 0 replies; only message in thread
From: David Teigland @ 2008-11-13 22:31 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=c8f58589edcdee624dafbd1c2ebbcb40ace9c660
Commit:        c8f58589edcdee624dafbd1c2ebbcb40ace9c660
Parent:        ee73f9c154f8c5ba91d9eac980e5dd9895535040
Author:        David Teigland <teigland@redhat.com>
AuthorDate:    Thu Nov 13 16:25:25 2008 -0600
Committer:     David Teigland <teigland@redhat.com>
CommitterDate: Thu Nov 13 16:25:25 2008 -0600

group_tool: show groupd compat info

Show the groupd compatibility mode in output of group_tool ls.

Suggest 'group_tool ls' if compat mode is 1 and daemons were
queried (with -a) instead of groupd.

Suggest 'group_tool ls -a' if compat mode is 0 and groupd was
queried (without -a) instead of the daemons.

Signed-off-by: David Teigland <teigland@redhat.com>
---
 group/tool/main.c |   47 +++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/group/tool/main.c b/group/tool/main.c
index d7283a0..55a94d2 100644
--- a/group/tool/main.c
+++ b/group/tool/main.c
@@ -608,14 +608,40 @@ static int do_log(char *comment)
 
 int main(int argc, char **argv)
 {
-	int rv, version;
+	int rv, version = 0; 
 
 	prog_name = argv[0];
 	decode_arguments(argc, argv);
 
 	switch (operation) {
 	case OP_LIST:
+
+		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 (all_daemons) {
+			/* show the new cluster3 data (from daemons) in
+			   the new daemon-specific format */
+
 			if (verbose || ls_all_nodes) {
 				system("fence_tool ls -n");
 				system("dlm_tool ls -n");
@@ -625,17 +651,26 @@ int main(int argc, char **argv)
 				system("dlm_tool ls");
 				system("gfs_control ls");
 			}
+
+			if (version == GROUP_LIBGROUP)
+				printf("Run 'group_tool ls' for groupd information.\n");
+
 		} else {
-			rv = group_get_version(&version);
+			if (version == GROUP_LIBGROUP) {
+				/* show the same old cluster2 data (from groupd)
+				   in the same old format as cluster2 */
 
-			if (version == -EAGAIN) {
-				printf("groupd detecting version...\n");
-			} else if (!rv && version == GROUP_LIBGROUP) {
 				groupd_list(argc, argv);
-			} else {
+
+			} else if (version == GROUP_LIBCPG || version == -1) {
+				/* show the new cluster3 data (from daemons)
+				   in the (nearly) same old format as cluster2 */
+
 				fenced_list();
 				dlm_controld_list();
 				gfs_controld_list();
+
+				printf("Run 'group_tool ls -a' for daemon information.\n");
 			}
 		}
 		break;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-11-13 22:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-13 22:31 master - group_tool: show groupd compat info David Teigland

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).