Whamcloud - gitweb
LU-18114 llog: split "lctl llog_*" group into subcommands 40/56040/8
authorEmoly Liu <emoly@whamcloud.com>
Wed, 11 Dec 2024 09:23:38 +0000 (17:23 +0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 26 Mar 2025 03:59:23 +0000 (03:59 +0000)
Split "lctl llog_*" command group into subcommands, e.g.
"lctl llog_info" to "lctl llog info".
Also, conf-sanity.sh test_123ad is modified to verify
this patch.

Signed-off-by: Emoly Liu <emoly@whamcloud.com>
Change-Id: Iea1cbfac61ff807d793a7a48dafa73915b06639d
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56040
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Zhenyu Xu <bobijam@hotmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/doc/lctl-llog-cancel.8 [new file with mode: 0644]
lustre/doc/lctl-llog-catlist.8 [new file with mode: 0644]
lustre/doc/lctl-llog-info.8 [new file with mode: 0644]
lustre/doc/lctl-llog-print.8 [new file with mode: 0644]
lustre/tests/conf-sanity.sh
lustre/utils/lctl.c

diff --git a/lustre/doc/lctl-llog-cancel.8 b/lustre/doc/lctl-llog-cancel.8
new file mode 100644 (file)
index 0000000..12682db
--- /dev/null
@@ -0,0 +1 @@
+.so man8/lctl-llog-cancel.8
\ No newline at end of file
diff --git a/lustre/doc/lctl-llog-catlist.8 b/lustre/doc/lctl-llog-catlist.8
new file mode 100644 (file)
index 0000000..07ec8f9
--- /dev/null
@@ -0,0 +1 @@
+.so man8/lctl-llog-catlist.8
\ No newline at end of file
diff --git a/lustre/doc/lctl-llog-info.8 b/lustre/doc/lctl-llog-info.8
new file mode 100644 (file)
index 0000000..044e38d
--- /dev/null
@@ -0,0 +1 @@
+.so man8/lctl-llog-info.8
\ No newline at end of file
diff --git a/lustre/doc/lctl-llog-print.8 b/lustre/doc/lctl-llog-print.8
new file mode 100644 (file)
index 0000000..d13928d
--- /dev/null
@@ -0,0 +1 @@
+.so man8/lctl-llog_print.8
\ No newline at end of file
index 769dce7..eaa5837 100755 (executable)
@@ -10552,6 +10552,13 @@ run_test 123ac "llog_print with --start and --end"
 
 test_123ad() { # LU-11566
        remote_mgs_nodsh && skip "remote MGS with nodsh"
+       if (( $MDS1_VERSION >= $(version_code 2.16.50) )); then
+               llog_info="llog info"
+               llog_print="llog print"
+       else
+               llog_info="llog_info"
+               llog_print="llog_print"
+       fi
        # older versions of lctl may not print all records properly
        (( MGS_VERSION >= $(version_code 2.15.90) )) ||
                skip "Need MGS version at least 2.15.90"
@@ -10567,17 +10574,17 @@ test_123ad() { # LU-11566
        # flags:            4 (plain)
        # records_count:    72
        # last_index:       72
-       local num=$(do_facet mgs $LCTL --device MGS llog_info $FSNAME-client |
+       local num=$(do_facet mgs $LCTL --device MGS $llog_info $FSNAME-client |
                    awk '/last_index:/ { print $2 }')
 
-       do_facet mgs $LCTL --device MGS llog_print $FSNAME-client |
+       do_facet mgs $LCTL --device MGS $llog_print $FSNAME-client |
                grep -q "$FSNAME-OST0000.*osc\.max_dirty_mb=$old" ||
                error "ocs.max_dirty_mb=$old not found in $FSNAME-client"
 
        # - { index: 72, event: marker, flags: 0x06, ... }
-       local last=$(do_facet mgs $LCTL --device MGS llog_print -r $FSNAME-client |
+       local last=$(do_facet mgs $LCTL --device MGS $llog_print -r $FSNAME-client |
                     tail -1 | awk '{ print $4 }' | tr -d , )
-       (( last == num )) || error "llog_print only showed $last/$num records"
+       (( last == num )) || error "$llog_print only showed $last/$num records"
 }
 run_test 123ad "llog_print shows all records"
 
index c30fd8b..cffbada 100644 (file)
@@ -280,6 +280,34 @@ command_t snapshot_cmdlist[] = {
 JT_SUBCMD(snapshot);
 
 /**
+ * command_t llog_cmdlist - lctl llog commands.
+ */
+command_t llog_cmdlist[] = {
+       { .pc_name = "catlist", .pc_func = jt_llog_catlist,
+         .pc_help = "list Lustre configuration log files\n"
+        "usage: llog catlist"},
+       { .pc_name = "info", .pc_func = jt_llog_info,
+         .pc_help = "print log header information\n"
+        "usage: llog info {LOGNAME|FID}"},
+       { .pc_name = "print", .pc_func = jt_llog_print,
+         .pc_help = "print the content of a configuration log\n"
+        "usage: llog print {LOGNAME|FID} [--start INDEX] [--end INDEX]\n"
+        "                  [--raw]"},
+       { .pc_name = "cancel", .pc_func = jt_llog_cancel,
+         .pc_help = "cancel one record in specified log.\n"
+        "usage:llog cancel {LOGNAME|FID} --log_idx INDEX"},
+       { .pc_name = "check", .pc_func = jt_llog_check,
+         .pc_help = "verify that log content is valid.\n"
+        "usage: llog_check {LOGNAME|FID} [--start INDEX] [--end INDEX]\n"
+        "       check all records from index 1 by default."},
+       { .pc_name = "remove", .pc_func = jt_llog_check,
+         .pc_help = "remove one log and erase it from disk.\n"
+        "usage: llog remove {LOGNAME|FID} [--log_id ID]"},
+       { .pc_help = NULL }
+};
+JT_SUBCMD(llog);
+
+/**
  * command_t lfsck_cmdlist - lctl lfsck commands.
  */
 command_t lfsck_cmdlist[] = {
@@ -674,15 +702,15 @@ command_t cmdlist[] = {
         "usage: llog_catlist"},
        {"llog_info", jt_llog_info, 0,
         "print log header information.\n"
-        "usage: llog_info {LOGNAME|FID}\n"},
+        "usage: llog_info {LOGNAME|FID}"},
        {"llog_print", jt_llog_print, 0,
         "print all effective log records by default, or within given range.\n"
         "With --raw option skipped records are printed as well.\n"
         "usage: llog_print {LOGNAME|FID} [--start INDEX] [--end INDEX]\n"
-        "                  [--raw]\n"},
+        "                  [--raw]"},
        {"llog_cancel", jt_llog_cancel, 0,
         "cancel one record in specified log.\n"
-        "usage:llog_cancel {LOGNAME|FID} --log_idx INDEX\n"},
+        "usage:llog_cancel {LOGNAME|FID} --log_idx INDEX"},
        {"llog_check", jt_llog_check, 0,
         "verify that log content is valid.\n"
         "usage: llog_check {LOGNAME|FID} [--start INDEX] [--end INDEX]\n"
@@ -690,6 +718,8 @@ command_t cmdlist[] = {
        {"llog_remove", jt_llog_remove, 0,
         "remove one log from catalog or plain log, erase it from disk.\n"
         "usage: llog_remove {LOGNAME|FID} [--log_id ID]"},
+       {"llog", jt_llog, llog_cmdlist, ""},
+
        {"lcfg_clear", jt_lcfg_clear, 0,
         "drop unused config llog records for a device or filesystem.\n"
         "clients and servers must be unmounted during this operation.\n"