]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osdmap_service: add get_mnow(), get_up_epoch()
authorSage Weil <sage@redhat.com>
Mon, 22 Jul 2019 16:58:40 +0000 (11:58 -0500)
committerSage Weil <sage@redhat.com>
Mon, 5 Aug 2019 18:53:25 +0000 (13:53 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/crimson/osd/osd.cc
src/crimson/osd/osd.h
src/crimson/osd/osdmap_service.h

index 4e9dca1a81466ce6a9f190aa3c2d413a772253f0..45921dcae3ff0bf50310c474392023a93b36fa8b 100644 (file)
@@ -185,6 +185,8 @@ seastar::future<> OSD::start()
 {
   logger().info("start");
 
+  startup_time = ceph::mono_clock::now();
+
   return store->mount().then([this] {
     meta_coll = make_unique<OSDMeta>(store->open_collection(coll_t::meta()),
                                      store.get());
@@ -526,6 +528,11 @@ MessageRef OSD::get_stats()
   return m;
 }
 
+ceph::signedspan OSD::get_mnow() const
+{
+  return ceph::mono_clock::now() - startup_time;
+}
+
 OSD::cached_map_t OSD::get_map() const
 {
   return osdmap;
index 1d12d70fbd24d33a80946c6e6a228768aa9dba7d..97ebaf92af8fa5446880c617b2f76c54f61038a1 100644 (file)
@@ -92,6 +92,8 @@ class OSD final : public ceph::net::Dispatcher,
   //< since when there is no more pending pg creates from mon
   epoch_t last_pg_create_epoch = 0;
 
+  ceph::mono_time startup_time;
+
   OSDSuperblock superblock;
 
   // Dispatcher methods
@@ -137,6 +139,10 @@ private:
   seastar::future<> _send_alive();
 
   // OSDMapService methods
+  ceph::signedspan get_mnow() const final;
+  epoch_t get_up_epoch() const final {
+    return up_epoch;
+  }
   seastar::future<cached_map_t> get_map(epoch_t e) final;
   cached_map_t get_map() const final;
   seastar::future<std::unique_ptr<OSDMap>> load_map(epoch_t e);
index 307d3e2843cffb83e03593439f87a80005a71830..f50b7ac6c2257cc480ec718e9cbc57d2ec582fd8 100644 (file)
@@ -16,4 +16,6 @@ public:
   virtual seastar::future<cached_map_t> get_map(epoch_t e) = 0;
   /// get the latest map
   virtual cached_map_t get_map() const = 0;
+  virtual ceph::signedspan get_mnow() const = 0;
+  virtual epoch_t get_up_epoch() const = 0;
 };