From d3d75a21658af342e920509f34b0fdc938b9c135 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Sun, 12 Jan 2014 17:24:39 +0100 Subject: [PATCH] crush: crushtool --build informative messages * 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 --- src/tools/crushtool.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/tools/crushtool.cc b/src/tools/crushtool.cc index fc91c336a0d8f..57680ae7d3f2f 100644 --- a/src/tools/crushtool.cc +++ b/src/tools/crushtool.cc @@ -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 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); -- 2.39.5