From: Mykola Golub Date: Wed, 7 Jan 2015 11:39:33 +0000 (+0200) Subject: OSD: add a get_latest_osdmap command to the admin socket X-Git-Tag: v0.92~34^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2bbab0592dd8e2b140ad321d81e9e1065ba52513;p=ceph.git 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 --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 68f5fe641708..31187576fba8 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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(op->get_req()); diff --git a/src/osd/OSD.h b/src/osd/OSD.h index c80920aa7860..5638f39b6a91 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -1085,6 +1085,7 @@ private: bool paused_recovery; void set_disk_tp_priority(); + void get_latest_osdmap(); // -- sessions -- public: