diff options
author | Sage Weil <sage@inktank.com> | 2013-02-05 16:35:43 -0800 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-02-05 16:35:43 -0800 |
commit | 9f4d4ac9cc4db5f5186cfdfd8f3522a7f677e43e (patch) | |
tree | abd1b23fd5a751f9c0e4fb8b614acfb0c59b8aa4 | |
parent | b79067a863220449469d478c42d521769a1d0bb5 (diff) | |
download | ceph-9f4d4ac9cc4db5f5186cfdfd8f3522a7f677e43e.tar.gz |
crush: add list_rules() method
Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r-- | src/crush/CrushWrapper.cc | 9 | ||||
-rw-r--r-- | src/crush/CrushWrapper.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index bb60d5b3ca8..a22f23509c9 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<CrushWrapper*>& o) { o.push_back(new CrushWrapper); diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h index 8bd43f0d925..0b919cba3ec 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<CrushWrapper*>& o); }; WRITE_CLASS_ENCODER(CrushWrapper) |