}
+void MDS::handle_command(MMonCommand *m)
+{
+ dout(20) << "handle_command args: " << m->cmd << dendl;
+ if (m->cmd[0] == "injectargs")
+ parse_config_option_string(m->cmd[1]);
+ else
+ dout(0) << "unrecognized command! " << m->cmd << dendl;
+ delete m;
+}
void MDS::handle_mds_map(MMDSMap *m)
{
// misc
case MSG_MON_COMMAND:
ALLOW_MESSAGES_FROM(CEPH_ENTITY_TYPE_MON);
- parse_config_option_string(((MMonCommand*)m)->cmd[0]);
- delete m;
+ handle_command((MMonCommand*)m);
break;
default:
void ms_handle_remote_reset(Connection *con);
// special message types
+ void handle_command(class MMonCommand *m);
void handle_mds_map(class MMDSMap *m);
};
ss << "specify mds number or *";
}
}
+ else if (m->cmd[1] == "tell") {
+ m->cmd.erase(m->cmd.begin()); //take out first two args; don't need them
+ m->cmd.erase(m->cmd.begin());
+ if (m->cmd[0] == "*") {
+ m->cmd.erase(m->cmd.begin()); //and now we're done with the target num
+ for (unsigned i = 0; i < mdsmap.get_max_mds(); ++i) {
+ if (mdsmap.is_active(i))
+ mon->send_command(mdsmap.get_inst(i), m->cmd, paxos->get_version());
+ }
+ } else {
+ errno = 0;
+ int who = strtol(m->cmd[0].c_str(), 0, 10);
+ m->cmd.erase(m->cmd.begin()); //done with target num now
+ if (!errno && who >= 0) {
+ if (mdsmap.is_up(who)) {
+ mon->send_command(mdsmap.get_inst(who), m->cmd, paxos->get_version());
+ r = 0;
+ ss << "ok";
+ } else {
+ ss << "mds" << who << " no up";
+ r = -ENOENT;
+ }
+ } else ss << "specify mds number or *";
+ }
+ }
}
if (r != -1) {
void Monitor::inject_args(const entity_inst_t& inst, vector<string>& args, version_t version)
{
dout(10) << "inject_args " << inst << " " << args << dendl;
+ vector<string> new_args = args;
+ new_args.insert(new_args.begin(), "injectargs");
+ send_command(inst, new_args, version);
+}
+
+void Monitor::send_command(const entity_inst_t& inst,
+ const vector<string>& com, version_t version)
+{
+ dout(10) << "send_command " << inst << "" << com << dendl;
MMonCommand *c = new MMonCommand(monmap->fsid, version);
- c->cmd = args;
+ c->cmd = com;
try_send_message(c, inst);
}
-
-
void Monitor::stop_cluster()
{
dout(0) << "stop_cluster -- initiating shutdown" << dendl;
inject_args(inst, a, version);
}
void inject_args(const entity_inst_t& inst, vector<string>& args, version_t version);
+void send_command(const entity_inst_t& inst,
+ const vector<string>& com, version_t version);
public:
struct C_Command : public Context {
ss << "specify osd number or *";
}
}
+ else if (m->cmd[1] == "tell") {
+ m->cmd.erase(m->cmd.begin()); //take out first two args; don't need them
+ m->cmd.erase(m->cmd.begin());
+ if (m->cmd[0] == "*") {
+ m->cmd.erase(m->cmd.begin()); //and now we're done with the target num
+ for (int i = 0; i < osdmap.get_max_osd(); ++i) {
+ mon->send_command(osdmap.get_inst(i), m->cmd, paxos->get_version());
+ }
+ } else {
+ errno = 0;
+ int who = strtol(m->cmd[0].c_str(), 0, 10);
+ m->cmd.erase(m->cmd.begin()); //done with target num now
+ if (!errno && who >= 0) {
+ if (osdmap.is_up(who)) {
+ mon->send_command(osdmap.get_inst(who), m->cmd, paxos->get_version());
+ r = 0;
+ ss << "ok";
+ } else {
+ ss << "osd" << who << " no up";
+ r = -ENOENT;
+ }
+ } else ss << "specify osd number or *";
+ }
+ }
else if ((m->cmd[1] == "scrub" || m->cmd[1] == "repair") && m->cmd.size() > 2) {
if (m->cmd[2] == "*") {
ss << "osds ";
delete ack;
}
+void OSD::handle_command(MMonCommand *m)
+{
+ dout(20) << "handle_command args: " << m->cmd << dendl;
+ if (m->cmd[0] == "injectargs")
+ parse_config_option_string(m->cmd[1]);
+ else
+ dout(0) << "unrecognized command! " << m->cmd << dendl;
+ delete m;
+}
+
case MSG_MON_COMMAND:
ALLOW_MESSAGES_FROM(CEPH_ENTITY_TYPE_MON);
- parse_config_option_string(((MMonCommand*)m)->cmd[0]);
- delete m;
+ handle_command((MMonCommand*) m);
break;
case MSG_OSD_SCRUB:
void send_pg_stats();
void handle_pg_stats_ack(class MPGStatsAck *ack);
+ void handle_command(class MMonCommand *m);
+
void pg_stat_queue_enqueue(PG *pg) {
pg_stat_queue_lock.Lock();
if (pg->is_primary() && !pg->stat_queue_item.is_on_xlist()) {