]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crushtool: take --min-rep and --max-rep explicitly
authorSage Weil <sage@newdream.net>
Sat, 26 Jun 2021 16:23:54 +0000 (12:23 -0400)
committerSage Weil <sage@newdream.net>
Mon, 28 Jun 2021 22:34:31 +0000 (18:34 -0400)
...instead of only --num-rep or pulling it from the ruleset_mask

Signed-off-by: Sage Weil <sage@newdream.net>
src/test/cli/crushtool/help.t
src/test/cli/crushtool/test-map-tries-vs-retries.t
src/tools/crushtool.cc

index d0b41a7863d095c35770c8877b4fab5447f95cb0..72085688c680d073e85c971c8c4899031dfa6224 100644 (file)
@@ -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]
index 2a49838d6f06a3c4e5f35d4744ef5c7d81887b3f..f5ac220442f5e3d08a4f5b3e78d9fe5381fbc076 100644 (file)
@@ -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]
index df8d2cf45b35414bbaa52a4e1b96914f88b23500..20dd45eca6fd54ccd7b036b2fad272fbc6fbcbad 100644 (file)
@@ -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;