mon: OSDMonitor: reply ENOENT if specified osd does not exist

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
This commit is contained in:
xie xingguo 2016-03-07 22:56:15 +08:00
parent 2bba53f457
commit fd6c023f49
2 changed files with 9 additions and 1 deletions

View File

@ -1374,6 +1374,7 @@ function test_mon_pg()
ceph osd primary-affinity osd.0 .9
expect_false ceph osd primary-affinity osd.0 -2
expect_false ceph osd primary-affinity osd.9999 .5
ceph osd primary-affinity osd.0 1
ceph osd pg-temp 0.0 0 1 2

View File

@ -6546,6 +6546,10 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
wait_for_finished_proposal(op, new Monitor::C_Command(mon, op, 0, rs,
get_last_committed() + 1));
return true;
} else {
ss << "osd." << id << " does not exist";
err = -ENOENT;
goto reply;
}
} else if (prefix == "osd reweight") {
int64_t id;
@ -6575,8 +6579,11 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
wait_for_finished_proposal(op, new Monitor::C_Command(mon, op, 0, rs,
get_last_committed() + 1));
return true;
} else {
ss << "osd." << id << " does not exist";
err = -ENOENT;
goto reply;
}
} else if (prefix == "osd lost") {
int64_t id;
if (!cmd_getval(g_ceph_context, cmdmap, "id", id)) {