From: Sage Weil Date: Wed, 6 Feb 2013 00:35:43 +0000 (-0800) Subject: crush: add list_rules() method X-Git-Tag: v0.58~141^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9f4d4ac9cc4db5f5186cfdfd8f3522a7f677e43e;p=ceph.git crush: add list_rules() method Signed-off-by: Sage Weil --- diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index bb60d5b3ca81..a22f23509c9a 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -935,6 +935,15 @@ void CrushWrapper::dump_rules(Formatter *f) const } } +void CrushWrapper::list_rules(Formatter *f) const +{ + for (int rule = 0; rule < get_max_rules(); rule++) { + if (!rule_exists(rule)) + continue; + f->dump_string("name", get_rule_name(rule)); + } +} + void CrushWrapper::generate_test_instances(list& o) { o.push_back(new CrushWrapper); diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h index 8bd43f0d9251..0b919cba3ec5 100644 --- a/src/crush/CrushWrapper.h +++ b/src/crush/CrushWrapper.h @@ -742,6 +742,7 @@ public: void decode_crush_bucket(crush_bucket** bptr, bufferlist::iterator &blp); void dump(Formatter *f) const; void dump_rules(Formatter *f) const; + void list_rules(Formatter *f) const; static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(CrushWrapper)