if (!cmdmap_from_json(m->cmd, &cmdmap, ss)) {
// ss has reason for failure
string rs = ss.str();
- mon->reply_command(m, -EINVAL, rs, rdata, get_last_committed());
+ mon->reply_command(op, -EINVAL, rs, rdata, get_last_committed());
return true;
}
MonSession *session = m->get_session();
if (!session) {
- mon->reply_command(m, -EACCES, "access denied", rdata, get_last_committed());
+ mon->reply_command(op, -EACCES, "access denied", rdata, get_last_committed());
return true;
}
EntityName entity;
if (!entity_name.empty() && !entity.from_str(entity_name)) {
ss << "invalid entity_auth " << entity_name;
- mon->reply_command(m, -EINVAL, ss.str(), get_last_committed());
+ mon->reply_command(op, -EINVAL, ss.str(), get_last_committed());
return true;
}
rdata.append(ds);
string rs;
getline(ss, rs, '\0');
- mon->reply_command(m, r, rs, rdata, get_last_committed());
+ mon->reply_command(op, r, rs, rdata, get_last_committed());
return true;
}
if (!cmdmap_from_json(m->cmd, &cmdmap, ss)) {
// ss has reason for failure
string rs = ss.str();
- mon->reply_command(m, -EINVAL, rs, rdata, get_last_committed());
+ mon->reply_command(op, -EINVAL, rs, rdata, get_last_committed());
return true;
}
MonSession *session = m->get_session();
if (!session) {
- mon->reply_command(m, -EACCES, "access denied", rdata, get_last_committed());
+ mon->reply_command(op, -EACCES, "access denied", rdata, get_last_committed());
return true;
}
if (bl.length() == 0) {
ss << "auth import: no data supplied";
getline(ss, rs);
- mon->reply_command(m, -EINVAL, rs, get_last_committed());
+ mon->reply_command(op, -EINVAL, rs, get_last_committed());
return true;
}
bufferlist::iterator iter = bl.begin();
done:
rdata.append(ds);
getline(ss, rs, '\0');
- mon->reply_command(m, err, rs, rdata, get_last_committed());
+ mon->reply_command(op, err, rs, rdata, get_last_committed());
return false;
}
out:
if (!cmd->get_source().is_mon()) {
string rs = ss.str();
- mon->reply_command(cmd, ret, rs, rdata, 0);
+ mon->reply_command(op, ret, rs, rdata, 0);
}
return (ret == 0);
bool LogMonitor::preprocess_command(MonOpRequestRef op)
{
op->mark_logmon_event("preprocess_command");
- MMonCommand *m = static_cast<MMonCommand*>(op->get_req());
int r = -1;
bufferlist rdata;
stringstream ss;
if (r != -1) {
string rs;
getline(ss, rs);
- mon->reply_command(m, r, rs, rdata, get_last_committed());
+ mon->reply_command(op, r, rs, rdata, get_last_committed());
return true;
} else
return false;
if (!cmdmap_from_json(m->cmd, &cmdmap, ss)) {
// ss has reason for failure
string rs = ss.str();
- mon->reply_command(m, -EINVAL, rs, get_last_committed());
+ mon->reply_command(op, -EINVAL, rs, get_last_committed());
return true;
}
MonSession *session = m->get_session();
if (!session) {
- mon->reply_command(m, -EACCES, "access denied", get_last_committed());
+ mon->reply_command(op, -EACCES, "access denied", get_last_committed());
return true;
}
}
getline(ss, rs);
- mon->reply_command(m, err, rs, get_last_committed());
+ mon->reply_command(op, err, rs, get_last_committed());
return false;
}
if (!cmdmap_from_json(m->cmd, &cmdmap, ss)) {
// ss has reason for failure
string rs = ss.str();
- mon->reply_command(m, -EINVAL, rs, rdata, get_last_committed());
+ mon->reply_command(op, -EINVAL, rs, rdata, get_last_committed());
return true;
}
MonSession *session = m->get_session();
if (!session) {
- mon->reply_command(m, -EACCES, "access denied", rdata, get_last_committed());
+ mon->reply_command(op, -EACCES, "access denied", rdata, get_last_committed());
return true;
}
rdata.append(ds);
string rs;
getline(ss, rs);
- mon->reply_command(m, r, rs, rdata, get_last_committed());
+ mon->reply_command(op, r, rs, rdata, get_last_committed());
return true;
} else
return false;
map<string, cmd_vartype> cmdmap;
if (!cmdmap_from_json(m->cmd, &cmdmap, ss)) {
string rs = ss.str();
- mon->reply_command(m, -EINVAL, rs, rdata, get_last_committed());
+ mon->reply_command(op, -EINVAL, rs, rdata, get_last_committed());
return true;
}
/* Refuse access if message not associated with a valid session */
MonSession *session = m->get_session();
if (!session) {
- mon->reply_command(m, -EACCES, "access denied", rdata, get_last_committed());
+ mon->reply_command(op, -EACCES, "access denied", rdata, get_last_committed());
return true;
}
return true;
} else {
// reply immediately
- mon->reply_command(m, r, rs, rdata, get_last_committed());
+ mon->reply_command(op, r, rs, rdata, get_last_committed());
return false;
}
}
MMonCommand *m = static_cast<MMonCommand*>(op->get_req());
if (m->fsid != monmap->fsid) {
dout(0) << "handle_command on fsid " << m->fsid << " != " << monmap->fsid << dendl;
- reply_command(m, -EPERM, "wrong fsid", 0);
+ reply_command(op, -EPERM, "wrong fsid", 0);
return;
}
MonSession *session = m->get_session();
if (!session) {
string rs = "Access denied";
- reply_command(m, -EACCES, rs, 0);
+ reply_command(op, -EACCES, rs, 0);
return;
}
if (m->cmd.empty()) {
string rs = "No command supplied";
- reply_command(m, -EINVAL, rs, 0);
+ reply_command(op, -EINVAL, rs, 0);
return;
}
r = -EINVAL;
rs = ss.str();
if (!m->get_source().is_mon()) // don't reply to mon->mon commands
- reply_command(m, r, rs, 0);
+ reply_command(op, r, rs, 0);
return;
}
format_command_descriptions(leader_supported_mon_commands,
leader_supported_mon_commands_size, f, &rdata);
delete f;
- reply_command(m, 0, "", rdata, 0);
+ reply_command(op, 0, "", rdata, 0);
return;
}
const_cast<MonCommand*>(leader_supported_mon_commands),
leader_supported_mon_commands_size);
if (!leader_cmd) {
- reply_command(m, -EINVAL, "command not known", 0);
+ reply_command(op, -EINVAL, "command not known", 0);
return;
}
// validate command is in our map & matches, or forward if it is allowed
if (!is_leader()) {
if (!mon_cmd) {
if (leader_cmd->is_noforward()) {
- reply_command(m, -EINVAL,
+ reply_command(op, -EINVAL,
"command not locally supported and not allowed to forward",
0);
return;
return;
} else if (!mon_cmd->is_compat(leader_cmd)) {
if (mon_cmd->is_noforward()) {
- reply_command(m, -EINVAL,
+ reply_command(op, -EINVAL,
"command not compatible with leader and not allowed to forward",
0);
return;
if (mon_cmd->is_obsolete() ||
(cct->_conf->mon_debug_deprecated_as_obsolete
&& mon_cmd->is_deprecated())) {
- reply_command(m, -ENOTSUP,
+ reply_command(op, -ENOTSUP,
"command is obsolete; please check usage and/or man page",
0);
return;
if (session->proxy_con && mon_cmd->is_noforward()) {
dout(10) << "Got forward for noforward command " << m << dendl;
- reply_command(m, -EINVAL, "forward for noforward command", rdata, 0);
+ reply_command(op, -EINVAL, "forward for noforward command", rdata, 0);
return;
}
<< "from='" << session->inst << "' "
<< "entity='" << session->entity_name << "' "
<< "cmd=" << m->cmd << ": access denied";
- reply_command(m, -EACCES, "access denied", 0);
+ reply_command(op, -EACCES, "access denied", 0);
return;
}
ds << monmap->fsid;
rdata.append(ds);
}
- reply_command(m, 0, "", rdata, 0);
+ reply_command(op, 0, "", rdata, 0);
return;
}
wait_for_paxos_write();
if (is_leader()) {
int r = scrub_start();
- reply_command(m, r, "", rdata, 0);
+ reply_command(op, r, "", rdata, 0);
} else if (is_peon()) {
forward_request_leader(m);
} else {
- reply_command(m, -EAGAIN, "no quorum", rdata, 0);
+ reply_command(op, -EAGAIN, "no quorum", rdata, 0);
}
return;
}
out:
if (!m->get_source().is_mon()) // don't reply to mon->mon commands
- reply_command(m, r, rs, rdata, 0);
+ reply_command(op, r, rs, rdata, 0);
}
void Monitor::reply_command(MMonCommand *m, int rc, const string &rs, version_t version)
ss << "cmd='" << m->cmd << "': finished";
mon->audit_clog->info() << ss.str();
- mon->reply_command(m, rc, rs, rdata, version);
+ mon->reply_command(op, rc, rs, rdata, version);
}
else if (r == -ECANCELED)
return;
map<string, cmd_vartype> cmdmap;
if (!cmdmap_from_json(m->cmd, &cmdmap, ss)) {
string rs = ss.str();
- mon->reply_command(m, -EINVAL, rs, rdata, get_last_committed());
+ mon->reply_command(op, -EINVAL, rs, rdata, get_last_committed());
return true;
}
MonSession *session = m->get_session();
if (!session) {
- mon->reply_command(m, -EACCES, "access denied", get_last_committed());
+ mon->reply_command(op, -EACCES, "access denied", get_last_committed());
return true;
}
string rs;
getline(ss, rs);
- mon->reply_command(m, r, rs, rdata, get_last_committed());
+ mon->reply_command(op, r, rs, rdata, get_last_committed());
return true;
} else
return false;
map<string, cmd_vartype> cmdmap;
if (!cmdmap_from_json(m->cmd, &cmdmap, ss)) {
string rs = ss.str();
- mon->reply_command(m, -EINVAL, rs, get_last_committed());
+ mon->reply_command(op, -EINVAL, rs, get_last_committed());
return true;
}
MonSession *session = m->get_session();
if (!session) {
- mon->reply_command(m, -EACCES, "access denied", get_last_committed());
+ mon->reply_command(op, -EACCES, "access denied", get_last_committed());
return true;
}
ss << "removed mon." << name << " at " << addr << ", there are now " << pending_map.size() << " monitors" ;
getline(ss, rs);
// send reply immediately in case we get removed
- mon->reply_command(m, 0, rs, get_last_committed());
+ mon->reply_command(op, 0, rs, get_last_committed());
return true;
}
else
out:
getline(ss, rs);
- mon->reply_command(m, err, rs, get_last_committed());
+ mon->reply_command(op, err, rs, get_last_committed());
return false;
}
map<string, cmd_vartype> cmdmap;
if (!cmdmap_from_json(m->cmd, &cmdmap, ss)) {
string rs = ss.str();
- mon->reply_command(m, -EINVAL, rs, get_last_committed());
+ mon->reply_command(op, -EINVAL, rs, get_last_committed());
return true;
}
MonSession *session = m->get_session();
if (!session) {
- mon->reply_command(m, -EACCES, "access denied", rdata, get_last_committed());
+ mon->reply_command(op, -EACCES, "access denied", rdata, get_last_committed());
return true;
}
reply:
string rs;
getline(ss, rs);
- mon->reply_command(m, r, rs, rdata, get_last_committed());
+ mon->reply_command(op, r, rs, rdata, get_last_committed());
return true;
}
map<string, cmd_vartype> cmdmap;
if (!cmdmap_from_json(m->cmd, &cmdmap, ss)) {
string rs = ss.str();
- mon->reply_command(m, -EINVAL, rs, get_last_committed());
+ mon->reply_command(op, -EINVAL, rs, get_last_committed());
return true;
}
MonSession *session = m->get_session();
if (!session) {
- mon->reply_command(m, -EACCES, "access denied", get_last_committed());
+ mon->reply_command(op, -EACCES, "access denied", get_last_committed());
return true;
}
getline(ss, rs);
if (err < 0 && rs.length() == 0)
rs = cpp_strerror(err);
- mon->reply_command(m, err, rs, rdata, get_last_committed());
+ mon->reply_command(op, err, rs, rdata, get_last_committed());
return ret;
update:
if (!cmdmap_from_json(m->cmd, &cmdmap, ss)) {
// ss has reason for failure
string rs = ss.str();
- mon->reply_command(m, -EINVAL, rs, rdata, get_last_committed());
+ mon->reply_command(op, -EINVAL, rs, rdata, get_last_committed());
return true;
}
MonSession *session = m->get_session();
if (!session) {
- mon->reply_command(m, -EACCES, "access denied", rdata, get_last_committed());
+ mon->reply_command(op, -EACCES, "access denied", rdata, get_last_committed());
return true;
}
r = -ENOENT;
ss << "pool " << poolstr << " does not exist";
string rs = ss.str();
- mon->reply_command(m, r, rs, get_last_committed());
+ mon->reply_command(op, r, rs, get_last_committed());
return true;
}
cmd_putval(g_ceph_context, cmdmap, "pool", pool);
string rs;
getline(ss, rs);
rdata.append(ds);
- mon->reply_command(m, r, rs, rdata, get_last_committed());
+ mon->reply_command(op, r, rs, rdata, get_last_committed());
return true;
}
if (!cmdmap_from_json(m->cmd, &cmdmap, ss)) {
// ss has reason for failure
string rs = ss.str();
- mon->reply_command(m, -EINVAL, rs, get_last_committed());
+ mon->reply_command(op, -EINVAL, rs, get_last_committed());
return true;
}
MonSession *session = m->get_session();
if (!session) {
- mon->reply_command(m, -EACCES, "access denied", get_last_committed());
+ mon->reply_command(op, -EACCES, "access denied", get_last_committed());
return true;
}
getline(ss, rs);
if (r < 0 && rs.length() == 0)
rs = cpp_strerror(r);
- mon->reply_command(m, r, rs, get_last_committed());
+ mon->reply_command(op, r, rs, get_last_committed());
return false;
update: