mirror of
https://github.com/ceph/ceph
synced 2025-02-28 13:32:27 +00:00
OSD: add a get_latest_osdmap command to the admin socket
The command blocks and ensures we have the latest map from the mon. This is useful in testing and to "unstick" clusters in some odd situations. Fixes: #9483, #9484 (maybe) Signed-off-by: Mykola Golub <mgolub@mirantis.com>
This commit is contained in:
parent
585efcb7e4
commit
2bbab0592d
@ -1721,6 +1721,8 @@ bool OSD::asok_command(string command, cmdmap_t& cmdmap, string format,
|
||||
service.remote_reserver.dump(f);
|
||||
f->close_section();
|
||||
f->close_section();
|
||||
} else if (command == "get_latest_osdmap") {
|
||||
get_latest_osdmap();
|
||||
} else {
|
||||
assert(0 == "broken asok registration");
|
||||
}
|
||||
@ -1976,6 +1978,11 @@ void OSD::final_init()
|
||||
asok_hook,
|
||||
"show recovery reservations");
|
||||
assert(r == 0);
|
||||
r = admin_socket->register_command("get_latest_osdmap", "get_latest_osdmap",
|
||||
asok_hook,
|
||||
"force osd to update the latest map from "
|
||||
"the mon");
|
||||
assert(r == 0);
|
||||
|
||||
test_ops_hook = new TestOpsSocketHook(&(this->service), this->store);
|
||||
// Note: pools are CephString instead of CephPoolname because
|
||||
@ -2263,6 +2270,7 @@ int OSD::shutdown()
|
||||
cct->get_admin_socket()->unregister_command("dump_blacklist");
|
||||
cct->get_admin_socket()->unregister_command("dump_watchers");
|
||||
cct->get_admin_socket()->unregister_command("dump_reservations");
|
||||
cct->get_admin_socket()->unregister_command("get_latest_osdmap");
|
||||
delete asok_hook;
|
||||
asok_hook = NULL;
|
||||
|
||||
@ -8535,6 +8543,19 @@ void OSD::set_disk_tp_priority()
|
||||
|
||||
// --------------------------------
|
||||
|
||||
void OSD::get_latest_osdmap()
|
||||
{
|
||||
dout(10) << __func__ << " -- start" << dendl;
|
||||
|
||||
C_SaferCond cond;
|
||||
service.objecter->wait_for_latest_osdmap(&cond);
|
||||
cond.wait();
|
||||
|
||||
dout(10) << __func__ << " -- finish" << dendl;
|
||||
}
|
||||
|
||||
// --------------------------------
|
||||
|
||||
int OSD::init_op_flags(OpRequestRef& op)
|
||||
{
|
||||
MOSDOp *m = static_cast<MOSDOp*>(op->get_req());
|
||||
|
@ -1085,6 +1085,7 @@ private:
|
||||
bool paused_recovery;
|
||||
|
||||
void set_disk_tp_priority();
|
||||
void get_latest_osdmap();
|
||||
|
||||
// -- sessions --
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user