void Monitor::format_command_descriptions(const MonCommand *commands,
unsigned commands_size,
Formatter *f,
- bufferlist *rdata)
+ bufferlist *rdata,
+ bool hide_mgr_flag)
{
int cmdnum = 0;
f->open_object_section("command_descriptions");
for (const MonCommand *cp = commands;
cp < &commands[commands_size]; cp++) {
+ unsigned flags = cp->flags;
+ if (hide_mgr_flag) {
+ flags &= ~MonCommand::FLAG_MGR;
+ }
ostringstream secname;
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->flags);
+ cp->req_perms, cp->availability, flags);
cmdnum++;
}
f->close_section(); // command_descriptions
if (prefix == "get_command_descriptions") {
bufferlist rdata;
Formatter *f = Formatter::create("json");
+ // hide mgr commands until luminous upgrade is complete
+ bool hide_mgr_flag =
+ !osdmon()->osdmap.test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS);
format_command_descriptions(leader_supported_mon_commands,
- leader_supported_mon_commands_size, f, &rdata);
+ leader_supported_mon_commands_size, f, &rdata,
+ hide_mgr_flag);
delete f;
reply_command(op, 0, "", rdata, 0);
return;
static void format_command_descriptions(const MonCommand *commands,
unsigned commands_size,
Formatter *f,
- bufferlist *rdata);
+ bufferlist *rdata,
+ bool hide_mgr_flag=false);
void get_locally_supported_monitor_commands(const MonCommand **cmds, int *count);
/// the Monitor owns this pointer once you pass it in
void set_leader_supported_commands(const MonCommand *cmds, int size);