mirror of
https://github.com/ceph/ceph
synced 2024-12-26 21:43:10 +00:00
crush/CrushTester: remove old test_with_crushtool helper
test_with_fork is superior in all ways :) Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
e189f11fcd
commit
857867fabd
@ -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
|
||||
|
@ -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<string>(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:
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user