]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD: add a get_latest_osdmap command to the admin socket 3309/head
authorMykola Golub <mgolub@mirantis.com>
Wed, 7 Jan 2015 11:39:33 +0000 (13:39 +0200)
committerMykola Golub <mgolub@mirantis.com>
Sat, 10 Jan 2015 13:56:35 +0000 (15:56 +0200)
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>
src/osd/OSD.cc
src/osd/OSD.h

index 68f5fe6417087754eac2a649d4ecf5d2e94b5318..31187576fba8b92b0f60201a829fcd0a32ec9d5a 100644 (file)
@@ -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());
index c80920aa78602c2fe1c6ae44c4ae6e223a1caa56..5638f39b6a917b8ff36046698d0127a6a1c71391 100644 (file)
@@ -1085,6 +1085,7 @@ private:
   bool paused_recovery;
 
   void set_disk_tp_priority();
+  void get_latest_osdmap();
 
   // -- sessions --
 public: