]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Add check_osdmap_full() to check for shard OSD fullness
authorDavid Zafman <dzafman@redhat.com>
Thu, 16 Mar 2017 15:05:58 +0000 (08:05 -0700)
committerDavid Zafman <dzafman@redhat.com>
Mon, 17 Apr 2017 15:00:24 +0000 (08:00 -0700)
Signed-off-by: David Zafman <dzafman@redhat.com>
src/osd/OSD.cc
src/osd/OSD.h
src/osd/PGBackend.h
src/osd/PrimaryLogPG.cc
src/osd/PrimaryLogPG.h

index 2bc8cce857e8b49e6a8d94ed8ddaa1b41452412e..2b2aa97beb0b10bc01030ff75e7d20b81247eaee 100644 (file)
@@ -921,6 +921,16 @@ void OSDService::update_osd_stat(vector<int>& hb_peers)
   check_full_status(osd_stat);
 }
 
+bool OSDService::check_osdmap_full(const set<pg_shard_t> &missing_on)
+{
+  OSDMapRef osdmap = get_osdmap();
+  for (auto shard : missing_on) {
+    if (osdmap->get_state(shard.osd) & CEPH_OSD_FULL)
+      return true;
+  }
+  return false;
+}
+
 void OSDService::send_message_osd_cluster(int peer, Message *m, epoch_t from_epoch)
 {
   OSDMapRef next_map = get_nextmap_reserved();
index 591e5d2d2c7127ae02c860e483bfa0281b9aff74..9429640a9b51f01da5fc827fc90e7fb7f41ec69a 100644 (file)
@@ -1181,6 +1181,7 @@ public:
   bool is_nearfull() const;
   bool need_fullness_update();  ///< osdmap state needs update
   void set_injectfull(s_names type, int64_t count);
+  bool check_osdmap_full(const set<pg_shard_t> &missing_on);
 
 
   // -- epochs --
index ddd0612b1313c0fd9b9073f8c8483930cc0c200a..66bb890af013700c26f548533a6c4d9f6f375aa2 100644 (file)
@@ -263,6 +263,8 @@ typedef ceph::shared_ptr<const OSDMap> OSDMapRef;
 
      virtual bool check_failsafe_full(ostream &ss) = 0;
 
+     virtual bool check_osdmap_full(const set<pg_shard_t> &missing_on) = 0;
+
      virtual ~Listener() {}
    };
    Listener *parent;
index 9398783d86701d67e5fca750e0fc7ebf6b5efebb..71846caabf80eeb4b8938caa014b71c05cf11023 100644 (file)
@@ -13031,6 +13031,11 @@ void PrimaryLogPG::_scrub_finish()
   }
 }
 
+bool PrimaryLogPG::check_osdmap_full(const set<pg_shard_t> &missing_on)
+{
+    return osd->check_osdmap_full(missing_on);
+}
+
 /*---SnapTrimmer Logging---*/
 #undef dout_prefix
 #define dout_prefix *_dout << pg->gen_prefix() 
index f5b025db0e4fd68e86e10a2a2bccdf104c306efd..a7e812fe8da6f7c85b0b649c232101db13bfa5d4 100644 (file)
@@ -1732,6 +1732,7 @@ public:
   void on_removal(ObjectStore::Transaction *t) override;
   void on_shutdown() override;
   bool check_failsafe_full(ostream &ss) override;
+  bool check_osdmap_full(const set<pg_shard_t> &missing_on) override;
 
   // attr cache handling
   void setattr_maybe_cache(