From a19cdd490a78e78021ab5c70bb8bd527d523381f Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 30 Jan 2013 00:51:49 -0800 Subject: [PATCH] osdmap: method to check if a crush ruleset is in use Signed-off-by: Sage Weil --- src/osd/OSDMap.cc | 9 +++++++++ src/osd/OSDMap.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index c7d044ac6fde1..6b692d407a8ff 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -1654,6 +1654,15 @@ void OSDMap::print_summary(ostream& out) const out << " nearfull"; } +bool OSDMap::crush_ruleset_in_use(int ruleset) const +{ + for (map::const_iterator p = pools.begin(); p != pools.end(); ++p) { + if (p->second.crush_ruleset == ruleset) + return true; + } + return false; +} + void OSDMap::build_simple(CephContext *cct, epoch_t e, uuid_d &fsid, int nosd, int pg_bits, int pgp_bits) { diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index d161fa7436b53..70ec263e4d8d1 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -553,6 +553,7 @@ public: static void build_simple_crush_map_from_conf(CephContext *cct, CrushWrapper& crush, map& rulesets); + bool crush_ruleset_in_use(int ruleset) const; private: void print_osd_line(int cur, ostream *out, Formatter *f) const; -- 2.39.5