From fd42f2a9ccc5016660b9c205f6aa0104ffdd0b10 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 11 Oct 2017 17:45:19 +0800 Subject: [PATCH] crushtool: print error message to stderr not dout(1) in hope to fix the mysterious test failure where cli/crushtool/build.t prints nothing when error message is expected. Fixes: http://tracker.ceph.com/issues/21758 Signed-off-by: Kefu Chai (cherry picked from commit dc78d40af77ff8d5e4f3d39497e6e3c98c309306) --- src/test/cli/crushtool/build.t | 2 +- src/tools/crushtool.cc | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/test/cli/crushtool/build.t b/src/test/cli/crushtool/build.t index eadd969428113..4061d8fb4a43b 100644 --- a/src/test/cli/crushtool/build.t +++ b/src/test/cli/crushtool/build.t @@ -14,7 +14,7 @@ # display a warning if there is more than one root # $ crushtool --outfn "$map" --build --num_osds 5 node straw 2 rack straw 1 - .* The crush rulesets will use the root rack0 (re) + The crush rulesets will use the root rack0 (re) and ignore the others. There are 3 roots, they can be grouped into a single root by appending something like: diff --git a/src/tools/crushtool.cc b/src/tools/crushtool.cc index c2dbaae84fce2..7ecae9529ce9a 100644 --- a/src/tools/crushtool.cc +++ b/src/tools/crushtool.cc @@ -830,13 +830,14 @@ int main(int argc, const char **argv) { 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 (roots.size() > 1) { + cerr << "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" + << std::endl; + } } if (OSDMap::build_simple_crush_rules(g_ceph_context, crush, root, &cerr)) -- 2.39.5