From: Sage Weil Date: Thu, 29 Jun 2017 19:15:32 +0000 (-0400) Subject: crush/CrushTester: remove old test_with_crushtool helper X-Git-Tag: v12.1.1~110^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=857867fabd5ea0c3dffb798fcdfb3ea340681c41;p=ceph.git crush/CrushTester: remove old test_with_crushtool helper test_with_fork is superior in all ways :) Signed-off-by: Sage Weil --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 1500def7ba97..6455bf846d96 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -28,7 +28,6 @@ OPTION(lockdep_force_backtrace, OPT_BOOL, false) // always gather current backtr OPTION(run_dir, OPT_STR, "/var/run/ceph") // the "/var/run/ceph" dir, created on daemon startup OPTION(admin_socket, OPT_STR, "$run_dir/$cluster-$name.asok") // default changed by common_preinit() OPTION(admin_socket_mode, OPT_STR, "") // permission bits to set for admin socket file, e.g., "0775", "0755" -OPTION(crushtool, OPT_STR, "crushtool") // crushtool utility path OPTION(daemonize, OPT_BOOL, false) // default changed by common_preinit() OPTION(setuser, OPT_STR, "") // uid or user name diff --git a/src/crush/CrushTester.cc b/src/crush/CrushTester.cc index c24448a1d359..ac58c882feb9 100644 --- a/src/crush/CrushTester.cc +++ b/src/crush/CrushTester.cc @@ -372,49 +372,6 @@ int CrushTester::test_with_fork(int timeout) return r; } -int CrushTester::test_with_crushtool(const char *crushtool_cmd, - int max_id, int timeout, - int ruleset) -{ - SubProcessTimed crushtool(crushtool_cmd, SubProcess::PIPE, SubProcess::CLOSE, SubProcess::PIPE, timeout); - string opt_max_id = boost::lexical_cast(max_id); - crushtool.add_cmd_args( - "-i", "-", - "--test", "--check", opt_max_id.c_str(), - "--min-x", "1", - "--max-x", "50", - NULL); - if (ruleset >= 0) { - crushtool.add_cmd_args( - "--ruleset", - stringify(ruleset).c_str(), - NULL); - } - int ret = crushtool.spawn(); - if (ret != 0) { - err << "failed run crushtool: " << crushtool.err(); - return ret; - } - - bufferlist bl; - ::encode(crush, bl, CEPH_FEATURES_SUPPORTED_DEFAULT); - bl.write_fd(crushtool.get_stdin()); - crushtool.close_stdin(); - bl.clear(); - ret = bl.read_fd(crushtool.get_stderr(), 100 * 1024); - if (ret < 0) { - err << "failed read from crushtool: " << cpp_strerror(-ret); - return ret; - } - bl.write_stream(err); - if (crushtool.join() != 0) { - err << crushtool.err(); - return -EINVAL; - } - - return 0; -} - namespace { class BadCrushMap : public std::runtime_error { public: diff --git a/src/crush/CrushTester.h b/src/crush/CrushTester.h index 0982f342a3a2..e58c24875749 100644 --- a/src/crush/CrushTester.h +++ b/src/crush/CrushTester.h @@ -359,10 +359,6 @@ public: void check_overlapped_rules() const; int test(); int test_with_fork(int timeout); - int test_with_crushtool(const char *crushtool_cmd = "crushtool", - int max_id = -1, - int timeout = 0, - int ruleset = -1); }; #endif