From: Sage Weil Date: Sat, 26 Jun 2021 16:23:54 +0000 (-0400) Subject: crushtool: take --min-rep and --max-rep explicitly X-Git-Tag: v17.1.0~1398^2~13 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9c22cc64beccb9388bff589261a7a1af8ab2e15a;p=ceph.git crushtool: take --min-rep and --max-rep explicitly ...instead of only --num-rep or pulling it from the ruleset_mask Signed-off-by: Sage Weil --- diff --git a/src/test/cli/crushtool/help.t b/src/test/cli/crushtool/help.t index d0b41a7863d..72085688c68 100644 --- a/src/test/cli/crushtool/help.t +++ b/src/test/cli/crushtool/help.t @@ -92,7 +92,7 @@ -i mapfn --test test a range of inputs on the map [--min-x x] [--max-x x] [--x x] [--min-rule r] [--max-rule r] [--rule r] - [--num-rep n] + [--min-rep n] [--max-rep n] [--num-rep n] [--pool-id n] specifies pool id [--batches b] split the CRUSH mapping into b > 1 rounds [--weight|-w devno weight] diff --git a/src/test/cli/crushtool/test-map-tries-vs-retries.t b/src/test/cli/crushtool/test-map-tries-vs-retries.t index 2a49838d6f0..f5ac220442f 100644 --- a/src/test/cli/crushtool/test-map-tries-vs-retries.t +++ b/src/test/cli/crushtool/test-map-tries-vs-retries.t @@ -1,4 +1,4 @@ - $ crushtool -i "$TESTDIR/test-map-tries-vs-retries.crushmap" --test --show-mappings --show-statistics --weight 0 0 --weight 8 0 + $ crushtool -i "$TESTDIR/test-map-tries-vs-retries.crushmap" --test --show-mappings --show-statistics --weight 0 0 --weight 8 0 --min-rep 1 --max-rep 10 rule 0 (replicated_ruleset), x = 0..1023, numrep = 1..10 CRUSH rule 0 x 0 [7] CRUSH rule 0 x 1 [10] diff --git a/src/tools/crushtool.cc b/src/tools/crushtool.cc index df8d2cf45b3..20dd45eca6f 100644 --- a/src/tools/crushtool.cc +++ b/src/tools/crushtool.cc @@ -200,7 +200,7 @@ void usage() cout << " -i mapfn --test test a range of inputs on the map\n"; cout << " [--min-x x] [--max-x x] [--x x]\n"; cout << " [--min-rule r] [--max-rule r] [--rule r]\n"; - cout << " [--num-rep n]\n"; + cout << " [--min-rep n] [--max-rep n] [--num-rep n]\n"; cout << " [--pool-id n] specifies pool id\n"; cout << " [--batches b] split the CRUSH mapping into b > 1 rounds\n"; cout << " [--weight|-w devno weight]\n"; @@ -741,6 +741,18 @@ int main(int argc, const char **argv) return EXIT_FAILURE; } tester.set_num_rep(x); + } else if (ceph_argparse_witharg(args, i, &x, err, "--min_rep", (char*)NULL)) { + if (!err.str().empty()) { + cerr << err.str() << std::endl; + return EXIT_FAILURE; + } + tester.set_min_rep(x); + } else if (ceph_argparse_witharg(args, i, &x, err, "--max_rep", (char*)NULL)) { + if (!err.str().empty()) { + cerr << err.str() << std::endl; + return EXIT_FAILURE; + } + tester.set_max_rep(x); } else if (ceph_argparse_witharg(args, i, &x, err, "--max_x", (char*)NULL)) { if (!err.str().empty()) { cerr << err.str() << std::endl;