osd: Add check_osdmap_full() to check for shard OSD fullness

Signed-off-by: David Zafman <dzafman@redhat.com>
This commit is contained in:
David Zafman 2017-03-16 08:05:58 -07:00
parent 94e253ce37
commit c7e8dcad34
5 changed files with 19 additions and 0 deletions

View 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();

View 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 --

View 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;

View 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()

View 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(