]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crush: crushtool --build informative messages
authorLoic Dachary <loic@dachary.org>
Sun, 12 Jan 2014 16:24:39 +0000 (17:24 +0100)
committerLoic Dachary <loic@dachary.org>
Sun, 12 Jan 2014 16:48:33 +0000 (17:48 +0100)
* dump the crush tree created by --build at debug level 1.

* display a warning at debug level 1 if there is more than one root. In
  most cases it is not what the user wants and it may be confusing
  because the ruleset will only apply to the first of root and have less
  devices under it as expected.

Signed-off-by: Loic Dachary <loic@dachary.org>
src/tools/crushtool.cc

index fc91c336a0d8f576a80edd1a555e04542f043ef9..57680ae7d3f2f82bcab8213e9eadf15830bf1be8 100644 (file)
@@ -600,8 +600,28 @@ int main(int argc, const char **argv)
       lower_items.swap(cur_items);
       lower_weights.swap(cur_weights);
     }
+
+    {
+      ostringstream oss;
+      vector<__u32> weights(crush.get_max_devices(), 0x10000);
+      crush.dump_tree(weights, &oss, NULL);
+      dout(1) << "\n" << oss.str() << dendl;
+    }
+
     string root = layers.back().size == 0 ? layers.back().name :
       string(layers.back().name) + "0";
+
+    {
+      set<int> roots;
+      crush.find_roots(roots);
+      if (roots.size() > 1)
+       dout(1) << "The crush rulesets will use the root " << root << "\n"
+               << "and ignore the others.\n"
+               << "There are " << roots.size() << " roots, they can be\n"
+               << "grouped into a single root by appending something like:\n"
+               << "  root straw 0\n"
+               << dendl;
+    }
     
     if (OSDMap::build_simple_crush_rulesets(g_ceph_context, crush, root, &cerr))
       exit(EXIT_FAILURE);