expect_false test $cal_raw_used_size != $raw_used_size
}
+function test_mon_tell_help_command()
+{
+ ceph tell mon.a help
+
+ # wrong target
+ expect_false ceph tell mon.zzz help
+}
+
+function test_osd_tell_help_command()
+{
+ ceph tell osd.1 help
+ expect_false ceph tell osd.100 help
+}
+
+function test_mds_tell_help_command()
+{
+ FS_NAME=cephfs
+ if ! mds_exists ; then
+ echo "Skipping test, no MDS found"
+ return
+ fi
+
+ remove_all_fs
+ ceph osd pool create fs_data 10
+ ceph osd pool create fs_metadata 10
+ ceph fs new $FS_NAME fs_metadata fs_data
+ wait_mds_active $FS_NAME
+
+
+ ceph tell mds.a help
+ expect_false ceph tell mds.z help
+
+ remove_all_fs
+ ceph osd pool delete fs_data fs_data --yes-i-really-really-mean-it
+ ceph osd pool delete fs_metadata fs_metadata --yes-i-really-really-mean-it
+}
+
+function test_mgr_tell_help_command()
+{
+ ceph tell mgr help
+}
+
#
# New tests should be added to the TESTS array below
#
MON_TESTS+=" mon_deprecated_commands"
MON_TESTS+=" mon_caps"
MON_TESTS+=" mon_cephdf_commands"
+MON_TESTS+=" mon_tell_help_command"
+
OSD_TESTS+=" osd_bench"
OSD_TESTS+=" osd_negative_filestore_merge_threshold"
OSD_TESTS+=" tiering_agent"
OSD_TESTS+=" admin_heap_profiler"
+OSD_TESTS+=" osd_tell_help_command"
MDS_TESTS+=" mds_tell"
MDS_TESTS+=" mon_mds"
MDS_TESTS+=" mon_mds_metadata"
+MDS_TESTS+=" mds_tell_help_command"
+
+MGR_TESTS+=" mgr_tell_help_command"
TESTS+=$MON_TESTS
TESTS+=$OSD_TESTS
TESTS+=$MDS_TESTS
+TESTS+=$MGR_TESTS
#
# "main" follows
"--test-mds" )
tests_to_run+="$MDS_TESTS"
;;
+ "--test-mgr" )
+ tests_to_run+="$MGR_TESTS"
+ ;;
"-t" )
shift
if [[ -z "$1" ]]; then
""", file=sys.stdout)
-def do_extended_help(parser, args):
+def do_extended_help(parser, args, target, partial):
def help_for_sigs(sigs, partial=None):
sys.stdout.write(format_help(parse_json_funcsigs(sigs, 'cli'),
partial=partial))
if ret:
print("couldn't get command descriptions for {0}: {1}".\
format(target, outs), file=sys.stderr)
+ return 1
else:
- help_for_sigs(outbuf.decode('utf-8'), partial)
+ return help_for_sigs(outbuf.decode('utf-8'), partial)
- partial = ' '.join(args)
assert(cluster_handle.state == "connected")
- help_for_target(target=('mon', ''), partial=partial)
- return 0
+ return help_for_target(target, partial)
DONTSPLIT = string.ascii_letters + '{[<>]}'
return 1
if parsed_args.help:
- return do_extended_help(parser, childargs)
+ return do_extended_help(parser, childargs, ('mon', ''), ' '.join(childargs))
+
+ # implement "tell service.id help"
+ if len(childargs) >= 3 and childargs[0] == 'tell' and childargs[2] == 'help':
+ return do_extended_help(parser, childargs, childargs[1].split('.'), None)
# implement -w/--watch_*
# This is ugly, but Namespace() isn't quite rich enough.
"mgr", pyc.perm, "cli", 0);
cmdnum++;
}
-#if 0
- for (MgrCommand *cp = mgr_commands;
- cp < &mgr_commands[ARRAY_SIZE(mgr_commands)]; cp++) {
+ for (const auto &cp : mgr_commands) {
ostringstream secname;
secname << "cmd" << setfill('0') << std::setw(3) << cmdnum;
- dump_cmddesc_to_json(f, secname.str(), cp->cmdstring, cp->helpstring,
- cp->module, cp->perm, cp->availability, 0);
+ dump_cmddesc_to_json(&f, secname.str(), cp.cmdstring, cp.helpstring,
+ cp.module, cp.perm, cp.availability, 0);
cmdnum++;
}
-#endif
f.close_section(); // command_descriptions
f.flush(cmdctx->odata);
cmdctx->reply(0, ss);
* helpstring: displays in CLI help, API help (nice if it refers to
* parameter names from signature, 40-a few hundred chars)
* modulename: the monitor module or daemon this applies to:
- * mds, osd, pg (osd), mon, auth, log, config-key
+ * mds, osd, pg (osd), mon, auth, log, config-key, mgr
* req perms: required permission in that modulename space to execute command
* this also controls what type of REST command is accepted
* availability: cli, rest, or both