]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdmaptool: --test-map-pgs-dump
authorSage Weil <sage@redhat.com>
Tue, 2 Dec 2014 16:36:41 +0000 (08:36 -0800)
committerSage Weil <sage@redhat.com>
Sat, 7 Feb 2015 20:33:23 +0000 (12:33 -0800)
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 7a99b489909b368bade36d8cc9722ad33d03a2e8)

src/test/cli/osdmaptool/help.t
src/test/cli/osdmaptool/missing-argument.t
src/tools/osdmaptool.cc

index 2c5a41de95396abc6a1b154e45de8cff8d64d803..02f56efddfffeaf003dca6032aae533f7dfefc12 100644 (file)
@@ -4,6 +4,7 @@
      --export-crush <file>   write osdmap's crush map to <file>
      --import-crush <file>   replace osdmap's crush map with <file>
      --test-map-pgs [--pool <poolid>] map all pgs
+     --test-map-pgs-dump [--pool <poolid>] map all pgs
      --mark-up-in            mark osds up and in (but do not persist)
      --clear-temp            clear pg_temp and primary_temp
      --test-random           do random placements
index d0740ab1df6bf37fb0fcf80aa9b50634c3b16953..87ab3eb10d64e5055437492a4e80593be34b5c43 100644 (file)
@@ -4,6 +4,7 @@
      --export-crush <file>   write osdmap's crush map to <file>
      --import-crush <file>   replace osdmap's crush map with <file>
      --test-map-pgs [--pool <poolid>] map all pgs
+     --test-map-pgs-dump [--pool <poolid>] map all pgs
      --mark-up-in            mark osds up and in (but do not persist)
      --clear-temp            clear pg_temp and primary_temp
      --test-random           do random placements
index 0db39da52cf16eed29c789efc5845160b2c33555..bfeae4f46bf2f2a335d9a99f4ad0b326fa1b49b6 100644 (file)
@@ -35,6 +35,7 @@ void usage()
   cout << "   --export-crush <file>   write osdmap's crush map to <file>" << std::endl;
   cout << "   --import-crush <file>   replace osdmap's crush map with <file>" << std::endl;
   cout << "   --test-map-pgs [--pool <poolid>] map all pgs" << std::endl;
+  cout << "   --test-map-pgs-dump [--pool <poolid>] map all pgs" << std::endl;
   cout << "   --mark-up-in            mark osds up and in (but do not persist)" << std::endl;
   cout << "   --clear-temp            clear pg_temp and primary_temp" << std::endl;
   cout << "   --test-random           do random placements" << std::endl;
@@ -75,6 +76,7 @@ int main(int argc, const char **argv)
   bool mark_up_in = false;
   bool clear_temp = false;
   bool test_map_pgs = false;
+  bool test_map_pgs_dump = false;
   bool test_random = false;
 
   std::string val;
@@ -104,6 +106,8 @@ int main(int argc, const char **argv)
       clear_temp = true;
     } else if (ceph_argparse_flag(args, i, "--test-map-pgs", (char*)NULL)) {
       test_map_pgs = true;
+    } else if (ceph_argparse_flag(args, i, "--test-map-pgs-dump", (char*)NULL)) {
+      test_map_pgs_dump = true;
     } else if (ceph_argparse_flag(args, i, "--test-random", (char*)NULL)) {
       test_random = true;
     } else if (ceph_argparse_flag(args, i, "--clobber", (char*)NULL)) {
@@ -313,7 +317,7 @@ int main(int argc, const char **argv)
          << ") acting (" << acting << ", p" << acting_primary << ")"
          << std::endl;
   }
-  if (test_map_pgs) {
+  if (test_map_pgs || test_map_pgs_dump) {
     if (pool != -1 && !osdmap.have_pg_pool(pool)) {
       cerr << "There is no pool " << pool << std::endl;
       exit(1);
@@ -348,6 +352,9 @@ int main(int argc, const char **argv)
        }
        size[osds.size()]++;
 
+       if (test_map_pgs_dump)
+         cout << pgid << "\t" << osds << "\t" << primary << std::endl;
+
        for (unsigned i=0; i<osds.size(); i++) {
          //cout << " rep " << i << " on " << osds[i] << std::endl;
          count[osds[i]]++;
@@ -452,7 +459,7 @@ int main(int argc, const char **argv)
   if (!print && !print_json && !tree && !modified && 
       export_crush.empty() && import_crush.empty() && 
       test_map_pg.empty() && test_map_object.empty() &&
-      !test_map_pgs) {
+      !test_map_pgs && !test_map_pgs_dump) {
     cerr << me << ": no action specified?" << std::endl;
     usage();
   }