From 0652c828c93f266b9999883b1b2967bfaac11c89 Mon Sep 17 00:00:00 2001 From: George Melikov Date: Sun, 13 Jan 2019 17:50:58 -0500 Subject: [PATCH] LU-10966 utils: Fix `lfs check` documentation and arguments Several bugs exist for 'lfs check'. Add checking for MGS servers. Add 'lfs check mdts' which is inline with the other options but still keep mds for backwards compatibility. Do the same with the 'all' option which is equivalent to older 'servers' that is also kept for backwards compatibility. Update man pages to reflect these changes Change-Id: Ifffec8fd1498616036122f9af311cd6366d693bc Signed-off-by: George Melikov Reviewed-on: https://review.whamcloud.com/33775 Tested-by: Jenkins Reviewed-by: Andreas Dilger Reviewed-by: Ben Evans Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/doc/lfs.1 | 11 ++++++----- lustre/utils/lfs.c | 47 +++++++++++++++++++++++++++-------------------- 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/lustre/doc/lfs.1 b/lustre/doc/lfs.1 index 5390b17..ffad328 100644 --- a/lustre/doc/lfs.1 +++ b/lustre/doc/lfs.1 @@ -7,7 +7,7 @@ lfs \- client utility for Lustre-specific file layout and other attributes .br .B lfs changelog_clear .br -.B lfs check +.B lfs check .br .B lfs data_version [-nrw] \fB\fR .br @@ -155,8 +155,9 @@ interest to a particular consumer , potentially allowing the MDT to free up disk space. An of 0 indicates the current last record. Changelog consumers must be registered on the MDT node using \fBlctl\fR. .TP -.B check -Display the status of MDS or OSTs (as specified in the command) or all the servers (MDS and OSTs) +.B check +Display the status of the MGTs, MDTs or OSTs (as specified in the command) or +all the servers (MGTs, MDTs and OSTs). .TP .B data_version [-nrw] Display the current version of file data. If -n is specified, the data version @@ -265,8 +266,8 @@ Provides brief help on the various arguments Quit the interactive lfs session .SH EXAMPLES .TP -.B $ lfs check servers -Check the status of all servers (MDT, OST) +.B $ lfs check all +Check the status of all servers (MGT, MDT, OST) .TP .B $ lfs osts List all the OSTs diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 0cc1fed..63d4aa4 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -408,9 +408,9 @@ command_t cmdlist[] = { "\t fnv_1a_64 FNV-1a hash algorithm\n" "\t all_char sum of characters % MDT_COUNT\n"}, {"check", lfs_check, 0, - "Display the status of MDS or OSTs (as specified in the command)\n" - "or all the servers (MDS and OSTs).\n" - "usage: check "}, + "Display the status of MGTs, MDTs or OSTs (as specified in the command)\n" + "or all the servers (MGTs, MDTs and OSTs).\n" + "usage: check "}, {"osts", lfs_osts, 0, "list OSTs connected to client " "[for specified path only]\n" "usage: osts [path]"}, {"mdts", lfs_mdts, 0, "list MDTs connected to client " @@ -5414,12 +5414,13 @@ static int lfs_getname(int argc, char **argv) static int lfs_check(int argc, char **argv) { - int rc; - char mntdir[PATH_MAX] = {'\0'}; - int num_types = 1; - char *obd_types[2]; - char obd_type1[4]; - char obd_type2[4]; + char mntdir[PATH_MAX] = {'\0'}; + int num_types = 1; + char *obd_types[3]; + char obd_type1[4]; + char obd_type2[4]; + char obd_type3[4]; + int rc; if (argc != 2) { fprintf(stderr, "%s check: server type must be specified\n", @@ -5427,17 +5428,23 @@ static int lfs_check(int argc, char **argv) return CMD_HELP; } - obd_types[0] = obd_type1; - obd_types[1] = obd_type2; - - if (strcmp(argv[1], "osts") == 0) { - strcpy(obd_types[0], "osc"); - } else if (strcmp(argv[1], "mds") == 0) { - strcpy(obd_types[0], "mdc"); - } else if (strcmp(argv[1], "servers") == 0) { - num_types = 2; - strcpy(obd_types[0], "osc"); - strcpy(obd_types[1], "mdc"); + obd_types[0] = obd_type1; + obd_types[1] = obd_type2; + obd_types[2] = obd_type3; + + if (strcmp(argv[1], "osts") == 0) { + strcpy(obd_types[0], "osc"); + } else if (strcmp(argv[1], "mdts") == 0 || + strcmp(argv[1], "mds") == 0) { + strcpy(obd_types[0], "mdc"); + } else if (strcmp(argv[1], "mgts") == 0) { + strcpy(obd_types[0], "mgc"); + } else if (strcmp(argv[1], "all") == 0 || + strcmp(argv[1], "servers") == 0) { + num_types = 3; + strcpy(obd_types[0], "osc"); + strcpy(obd_types[1], "mdc"); + strcpy(obd_types[2], "mgc"); } else { fprintf(stderr, "%s check: unrecognized option '%s'\n", progname, argv[1]); -- 1.8.3.1