]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crush: expand info about tunables that we dump
authorSage Weil <sage@inktank.com>
Tue, 17 Dec 2013 20:15:51 +0000 (12:15 -0800)
committerSage Weil <sage@inktank.com>
Wed, 18 Dec 2013 16:35:25 +0000 (08:35 -0800)
Include the tunables profile, and flags indicating whether it is optimal,
legacy, or requires certain features.

Signed-off-by: Sage Weil <sage@inktank.com>
src/crush/CrushWrapper.cc
src/crush/CrushWrapper.h

index eb0d556ffd82fbe1e78c3d3029099f3ecc90d2f1..5318ddd8a79cd89322cb3afafc2011eb179ea3b9 100644 (file)
@@ -1071,11 +1071,29 @@ void CrushWrapper::dump(Formatter *f) const
   f->close_section();
 
   f->open_object_section("tunables");
+  dump_tunables(f);
+  f->close_section();
+}
+
+void CrushWrapper::dump_tunables(Formatter *f) const
+{
   f->dump_int("choose_local_tries", get_choose_local_tries());
   f->dump_int("choose_local_fallback_tries", get_choose_local_fallback_tries());
   f->dump_int("choose_total_tries", get_choose_total_tries());
   f->dump_int("chooseleaf_descend_once", get_chooseleaf_descend_once());
-  f->close_section();
+
+  // be helpful about it
+  if (has_bobtail_tunables())
+    f->dump_string("profile", "bobtail");
+  else if (has_argonaut_tunables())
+    f->dump_string("profile", "argonaut");
+  else
+    f->dump_string("profile", "unknown");
+  f->dump_int("optimal_tunables", (int)has_optimal_tunables());
+  f->dump_int("legacy_tunables", (int)has_legacy_tunables());
+
+  f->dump_int("require_feature_tunables", (int)has_nondefault_tunables());
+  f->dump_int("require_feature_tunables2", (int)has_nondefault_tunables2());
 }
 
 void CrushWrapper::dump_rules(Formatter *f) const
index c0315c32a477f0936e6ecd7cdb6bef928348f9c9..9931fae1e7f40f5122025e52edb3e10763baa2d5 100644 (file)
@@ -151,6 +151,28 @@ public:
     crush->chooseleaf_descend_once = !!n;
   }
 
+  bool has_argonaut_tunables() const {
+    return
+      crush->choose_local_tries == 2 &&
+      crush->choose_local_fallback_tries == 5 &&
+      crush->choose_total_tries == 19 &&
+      crush->chooseleaf_descend_once == 0;
+  }
+  bool has_bobtail_tunables() const {
+    return
+      crush->choose_local_tries == 0 &&
+      crush->choose_local_fallback_tries == 0 &&
+      crush->choose_total_tries == 50 &&
+      crush->chooseleaf_descend_once == 1;
+  }
+
+  bool has_optimal_tunables() const {
+    return has_bobtail_tunables();
+  }
+  bool has_legacy_tunables() const {
+    return has_argonaut_tunables();
+  }
+
   bool has_nondefault_tunables() const {
     return
       (crush->choose_local_tries != 2 ||
@@ -163,13 +185,6 @@ public:
   }
   bool has_v2_rules() const;
 
-  bool has_optimal_tunables() const {
-    return
-      crush->choose_local_tries == 0 &&
-      crush->choose_local_fallback_tries == 0 &&
-      crush->choose_total_tries == 50 &&
-      crush->chooseleaf_descend_once == 1;
-  }
 
   // bucket types
   int get_num_type_names() const {
@@ -817,6 +832,7 @@ public:
   void decode_crush_bucket(crush_bucket** bptr, bufferlist::iterator &blp);
   void dump(Formatter *f) const;
   void dump_rules(Formatter *f) const;
+  void dump_tunables(Formatter *f) const;
   void list_rules(Formatter *f) const;
   void dump_tree(const vector<__u32>& w, ostream *out, Formatter *f) const;
   static void generate_test_instances(list<CrushWrapper*>& o);