]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osdmap: method to check if a crush ruleset is in use
authorSage Weil <sage@inktank.com>
Wed, 30 Jan 2013 08:51:49 +0000 (00:51 -0800)
committerSage Weil <sage@inktank.com>
Tue, 5 Feb 2013 22:31:13 +0000 (14:31 -0800)
Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/OSDMap.cc
src/osd/OSDMap.h

index c7d044ac6fde198641f3501d9eb8ccd58bddedf4..6b692d407a8ffdb7ceaa4697e531729b316effe7 100644 (file)
@@ -1654,6 +1654,15 @@ void OSDMap::print_summary(ostream& out) const
     out << " nearfull";
 }
 
+bool OSDMap::crush_ruleset_in_use(int ruleset) const
+{
+  for (map<int64_t,pg_pool_t>::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)
 {
index d161fa7436b53e77a1778556070150a7032b8fe3..70ec263e4d8d159ec9d275e066f2e8fa145f145f 100644 (file)
@@ -553,6 +553,7 @@ public:
   static void build_simple_crush_map_from_conf(CephContext *cct, CrushWrapper& crush,
                                               map<int, const char*>& rulesets);
 
+  bool crush_ruleset_in_use(int ruleset) const;
 
 private:
   void print_osd_line(int cur, ostream *out, Formatter *f) const;