]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/tools/crushtool.cc
import quincy beta 17.1.0
[ceph.git] / ceph / src / tools / crushtool.cc
index a4defb04890cc325e53a4a7ca5a19ae13a351fd7..a7a63d1c45ab31bd2e57502eb7f7a1df2801fa2d 100644 (file)
 #define dout_context g_ceph_context
 #define dout_subsys ceph_subsys_crush
 
+using std::cerr;
+using std::cout;
+using std::decay_t;
+using std::ifstream;
+using std::ios;
+using std::is_same_v;
+using std::map;
+using std::ofstream;
+using std::pair;
+using std::set;
+using std::string;
+using std::vector;
 
 const char *infn = "stdin";
 
@@ -199,8 +211,8 @@ void usage()
   cout << "                         show location for given device id\n";
   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] [--ruleset rs]\n";
-  cout << "      [--num-rep n]\n";
+  cout << "      [--min-rule r] [--max-rule r] [--rule r]\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";
@@ -364,8 +376,7 @@ int do_move_item(CephContext* cct,
 
 int main(int argc, const char **argv)
 {
-  vector<const char*> args;
-  argv_to_vec(argc, argv, args);
+  auto args = argv_to_vec(argc, argv);
   if (args.empty()) {
     cerr << argv[0] << ": -h or --help for usage" << std::endl;
     exit(1);
@@ -741,6 +752,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;
@@ -783,12 +806,6 @@ int main(int argc, const char **argv)
        return EXIT_FAILURE;
       }
       tester.set_rule(x);
-    } else if (ceph_argparse_witharg(args, i, &x, err, "--ruleset", (char*)NULL)) {
-      if (!err.str().empty()) {
-       cerr << err.str() << std::endl;
-       return EXIT_FAILURE;
-      }
-      tester.set_ruleset(x);
     } else if (ceph_argparse_witharg(args, i, &x, err, "--batches", (char*)NULL)) {
       if (!err.str().empty()) {
        cerr << err.str() << std::endl;
@@ -1031,7 +1048,7 @@ int main(int argc, const char **argv)
       set<int> roots;
       crush.find_roots(&roots);
       if (roots.size() > 1) {
-       cerr << "The crush rulesets will use the root " << root << "\n"
+       cerr << "The crush rules 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"
@@ -1260,7 +1277,6 @@ int main(int argc, const char **argv)
   }
 
   if (check) {
-    tester.check_overlapped_rules();
     if (max_id >= 0) {
       if (!tester.check_name_maps(max_id)) {
        return EXIT_FAILURE;