Whamcloud - gitweb
LU-10966 utils: Fix `lfs check` documentation and arguments 75/33775/6
authorGeorge Melikov <mail@gmelikov.ru>
Sun, 13 Jan 2019 22:50:58 +0000 (17:50 -0500)
committerOleg Drokin <green@whamcloud.com>
Wed, 23 Jan 2019 09:18:00 +0000 (09:18 +0000)
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 <mail@gmelikov.ru>
Reviewed-on: https://review.whamcloud.com/33775
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Ben Evans <bevans@cray.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/doc/lfs.1
lustre/utils/lfs.c

index 5390b17..ffad328 100644 (file)
@@ -7,7 +7,7 @@ lfs \- client utility for Lustre-specific file layout and other attributes
 .br
 .B lfs changelog_clear <mdtname> <id> <endrec>
 .br
-.B lfs check <mds|osts|servers>
+.B lfs check <mgts|mdts|osts|all>
 .br
 .B lfs data_version [-nrw] \fB<filename>\fR
 .br
@@ -155,8 +155,9 @@ interest to a particular consumer <id>, potentially allowing the MDT to
 free up disk space. An <endrec> 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 <mgts|mdts|osts|all>
+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] <filename>
 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
index 0cc1fed..63d4aa4 100644 (file)
@@ -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 <osts|mds|servers>"},
+        "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 <mgts|osts|mdts|all>"},
         {"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]);