From: Sage Weil Date: Wed, 30 Jan 2013 08:51:49 +0000 (-0800) Subject: osdmap: method to check if a crush ruleset is in use X-Git-Tag: v0.58~141^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a19cdd490a78e78021ab5c70bb8bd527d523381f;p=ceph.git osdmap: method to check if a crush ruleset is in use Signed-off-by: Sage Weil --- diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index c7d044ac6fde..6b692d407a8f 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 d161fa7436b5..70ec263e4d8d 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;