return commands;
};
-int MDSDaemon::_handle_command(
- const cmdmap_t &cmdmap,
- const cref_t<MCommand> &m,
- bufferlist *outbl,
- std::string *outs,
- Context **run_later,
- bool *need_reply)
-{
- ceph_assert(outbl != NULL);
- ceph_assert(outs != NULL);
-
- std::stringstream ds;
- std::stringstream ss;
- std::string prefix;
- std::string format;
- std::unique_ptr<Formatter> f(Formatter::create(format));
- cmd_getval(cct, cmdmap, "prefix", prefix);
-
- int r = 0;
-
- if (prefix == "get_command_descriptions") {
- int cmdnum = 0;
- std::unique_ptr<JSONFormatter> f(std::make_unique<JSONFormatter>());
- f->open_object_section("command_descriptions");
- for (auto& c : get_commands()) {
- ostringstream secname;
- secname << "cmd" << setfill('0') << std::setw(3) << cmdnum;
- dump_cmddesc_to_json(f.get(), m->get_connection()->get_features(),
- secname.str(), c.cmdstring, c.helpstring,
- c.module, "*", 0);
- cmdnum++;
- }
- f->close_section(); // command_descriptions
-
- f->flush(ds);
- goto out;
- }
-
- cmd_getval(cct, cmdmap, "format", format);
- if (true) {
- // Give MDSRank a shot at the command
- if (!mds_rank) {
- ss << "MDS not active";
- r = -EINVAL;
- }
- else {
- bool handled;
- try {
- handled = mds_rank->handle_command(cmdmap, m, &r, &ds, &ss,
- run_later, need_reply);
- if (!handled) {
- // MDSDaemon doesn't know this command
- ss << "unrecognized command! " << prefix;
- r = -EINVAL;
- }
- } catch (const bad_cmd_get& e) {
- ss << e.what();
- r = -EINVAL;
- }
- }
- }
-
-out:
- *outs = ss.str();
- outbl->append(ds);
- return r;
-}
-
void MDSDaemon::handle_mds_map(const cref_t<MMDSMap> &m)
{
version_t epoch = m->get_epoch();
static void send_command_reply(const cref_t<MCommand> &m, MDSRank* mds_rank, int r,
bufferlist outbl, std::string_view outs);
- int _handle_command(
- const cmdmap_t &cmdmap,
- const cref_t<MCommand> &m,
- bufferlist *outbl,
- std::string *outs,
- Context **run_later,
- bool *need_reply);
void handle_command(const cref_t<MCommand> &m);
void handle_mds_map(const cref_t<MMDSMap> &m);
g_conf().add_observer(this);
}
-bool MDSRankDispatcher::handle_command(
- const cmdmap_t &cmdmap,
- const cref_t<MCommand> &m,
- int *r,
- std::stringstream *ds,
- std::stringstream *ss,
- Context **run_later,
- bool *need_reply)
-{
- ceph_assert(r != nullptr);
- ceph_assert(ds != nullptr);
- ceph_assert(ss != nullptr);
-
- *need_reply = true;
-
- std::string prefix;
- cmd_getval(g_ceph_context, cmdmap, "prefix", prefix);
-
- return false;
-}
-
void MDSRank::command_cache_drop(uint64_t timeout, Formatter *f, Context *on_finish) {
dout(20) << __func__ << dendl;
const char** get_tracked_conf_keys() const override final;
void handle_conf_change(const ConfigProxy& conf, const std::set<std::string>& changed) override;
- bool handle_command(
- const cmdmap_t &cmdmap,
- const cref_t<MCommand> &m,
- int *r,
- std::stringstream *ds,
- std::stringstream *ss,
- Context **run_later,
- bool *need_reply);
-
void dump_sessions(const SessionFilter &filter, Formatter *f) const;
void evict_clients(const SessionFilter &filter,
std::function<void(int,const std::string&,bufferlist&)> on_finish);