mirror of
https://github.com/ceph/ceph
synced 2025-04-01 00:26:47 +00:00
mon: omit deprecated commands in desc
This is useful for filtering out deprecated commands in help output. For example, `ceph mds -h` no longer lists commands like `mds set_max_mds`. Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
This commit is contained in:
parent
a39c3e8438
commit
61d63433df
@ -33,6 +33,11 @@ except NameError:
|
||||
CEPH_GIT_VER="@CEPH_GIT_VER@"
|
||||
CEPH_GIT_NICE_VER="@CEPH_GIT_NICE_VER@"
|
||||
|
||||
# Flags from src/mon/Monitor.h
|
||||
FLAG_NOFORWARD = (1 << 0)
|
||||
FLAG_OBSOLETE = (1 << 1)
|
||||
FLAG_DEPRECATED = (1 << 2)
|
||||
|
||||
# Make life easier on developers:
|
||||
# If in src/, and .libs and pybind exist here, assume we're running
|
||||
# from a Ceph source dir and tweak PYTHONPATH and LD_LIBRARY_PATH
|
||||
@ -337,6 +342,8 @@ def format_help(cmddict, partial=None):
|
||||
|
||||
if not cmd['help']:
|
||||
continue
|
||||
if cmd['flags'] is not None and ((cmd['flags'] & (FLAG_OBSOLETE | FLAG_DEPRECATED)) != 0):
|
||||
continue
|
||||
concise = concise_sig(cmd['sig'])
|
||||
if partial and not concise.startswith(partial):
|
||||
continue
|
||||
|
@ -123,7 +123,8 @@ dump_cmddesc_to_json(Formatter *jf,
|
||||
const string& helptext,
|
||||
const string& module,
|
||||
const string& perm,
|
||||
const string& avail)
|
||||
const string& avail,
|
||||
uint64_t flags)
|
||||
{
|
||||
jf->open_object_section(secname.c_str());
|
||||
jf->open_array_section("sig");
|
||||
@ -133,10 +134,10 @@ dump_cmddesc_to_json(Formatter *jf,
|
||||
jf->dump_string("module", module.c_str());
|
||||
jf->dump_string("perm", perm.c_str());
|
||||
jf->dump_string("avail", avail.c_str());
|
||||
jf->dump_int("flags", flags);
|
||||
jf->close_section(); // cmd
|
||||
}
|
||||
|
||||
|
||||
void cmdmap_dump(const cmdmap_t &cmdmap, Formatter *f)
|
||||
{
|
||||
assert(f != nullptr);
|
||||
|
@ -37,7 +37,8 @@ void dump_cmddesc_to_json(ceph::Formatter *jf,
|
||||
const std::string& helptext,
|
||||
const std::string& module,
|
||||
const std::string& perm,
|
||||
const std::string& avail);
|
||||
const std::string& avail,
|
||||
uint64_t flags);
|
||||
bool cmdmap_from_json(std::vector<std::string> cmd, cmdmap_t *mapp,
|
||||
std::stringstream &ss);
|
||||
void cmdmap_dump(const cmdmap_t &cmdmap, ceph::Formatter *f);
|
||||
|
@ -760,7 +760,7 @@ int MDSDaemon::_handle_command(
|
||||
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);
|
||||
cp->module, cp->perm, cp->availability, 0);
|
||||
cmdnum++;
|
||||
}
|
||||
f->close_section(); // command_descriptions
|
||||
|
@ -263,7 +263,7 @@ bool DaemonServer::handle_command(MCommand *m)
|
||||
dout(20) << "Dumping " << pyc.cmdstring << " (" << pyc.helpstring
|
||||
<< ")" << dendl;
|
||||
dump_cmddesc_to_json(&f, secname.str(), pyc.cmdstring, pyc.helpstring,
|
||||
"mgr", pyc.perm, "cli");
|
||||
"mgr", pyc.perm, "cli", 0);
|
||||
cmdnum++;
|
||||
}
|
||||
#if 0
|
||||
@ -273,7 +273,7 @@ bool DaemonServer::handle_command(MCommand *m)
|
||||
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);
|
||||
cp->module, cp->perm, cp->availability, 0);
|
||||
cmdnum++;
|
||||
}
|
||||
#endif
|
||||
|
@ -2559,7 +2559,7 @@ void Monitor::format_command_descriptions(const MonCommand *commands,
|
||||
secname << "cmd" << setfill('0') << std::setw(3) << cmdnum;
|
||||
dump_cmddesc_to_json(f, secname.str(),
|
||||
cp->cmdstring, cp->helpstring, cp->module,
|
||||
cp->req_perms, cp->availability);
|
||||
cp->req_perms, cp->availability, cp->flags);
|
||||
cmdnum++;
|
||||
}
|
||||
f->close_section(); // command_descriptions
|
||||
|
@ -5466,7 +5466,7 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector<string>& cmd, buffe
|
||||
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);
|
||||
cp->module, cp->perm, cp->availability, 0);
|
||||
cmdnum++;
|
||||
}
|
||||
f->close_section(); // command_descriptions
|
||||
|
Loading…
Reference in New Issue
Block a user