From: Vedant Nanda Date: Wed, 15 Mar 2017 10:44:23 +0000 (+0530) Subject: updated osdmaptool's usage and added documentation X-Git-Tag: v14.1.0~1055^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3da7c403c0bf07dc47988c44ed9450f2d95c8029;p=ceph.git updated osdmaptool's usage and added documentation Fixes: http://tracker.ceph.com/issues/3214 Signed-off-by: Vedant Nanda --- diff --git a/doc/man/8/osdmaptool.rst b/doc/man/8/osdmaptool.rst index f58d29cdd382..0b615450c94b 100644 --- a/doc/man/8/osdmaptool.rst +++ b/doc/man/8/osdmaptool.rst @@ -29,6 +29,11 @@ Options will simply make the tool print a plaintext dump of the map, after any modifications are made. +.. option:: --dump + + displays the map in plain text when is 'plain', 'json' if specified + format is not supported. This is an alternative to the print option. + .. option:: --clobber will allow osdmaptool to overwrite mapfilename if changes are made. @@ -42,22 +47,75 @@ Options will extract the CRUSH map from the OSD map and write it to mapfile. -.. option:: --createsimple numosd [--pgbits bitsperosd] +.. option:: --createsimple numosd [--pg-bits bitsperosd] [--pgp-bits bits] will create a relatively generic OSD map with the numosd devices. - If --pgbits is specified, the initial placement group counts will + If --pg-bits is specified, the initial placement group counts will be set with bitsperosd bits per OSD. That is, the pg_num map attribute will be set to numosd shifted by bitsperosd. + If --pgp-bits is specified, then the pgp_num map attribute will + be set to numosd shifted by bits. + +.. option:: --create-from-conf -.. option:: --test-map-pgs [--pool poolid] + creates an osd map with default configurations. + +.. option:: --test-map-pgs [--pool poolid] [--range-first --range-last ] will print out the mappings from placement groups to OSDs. + If range is specified, then it iterates from first to last in the directory + specified by argument to osdmaptool. + Eg: **osdmaptool --test-map-pgs --range-first 0 --range-last 2 osdmap_dir**. + This will iterate through the files named 0,1,2 in osdmap_dir. + +.. option:: --test-map-pgs-dump [--pool poolid] [--range-first --range-last ] -.. option:: --test-map-pgs-dump [--pool poolid] + will print out the summary of all placement groups and the mappings from them to the mapped OSDs. + If range is specified, then it iterates from first to last in the directory + specified by argument to osdmaptool. + Eg: **osdmaptool --test-map-pgs-dump --range-first 0 --range-last 2 osdmap_dir**. + This will iterate through the files named 0,1,2 in osdmap_dir. + +.. option:: --test-map-pgs-dump-all [--pool poolid] [--range-first --range-last ] will print out the summary of all placement groups and the mappings - from them to the mapped OSDs. + from them to all the OSDs. + If range is specified, then it iterates from first to last in the directory + specified by argument to osdmaptool. + Eg: **osdmaptool --test-map-pgs-dump-all --range-first 0 --range-last 2 osdmap_dir**. + This will iterate through the files named 0,1,2 in osdmap_dir. + +.. option:: --test-random + + does a random mapping of placement groups to the OSDs. + +.. option:: --test-map-pg + + map a particular placement group(specified by pgid) to the OSDs. + +.. option:: --test-map-object [--pool ] + + map a particular placement group(specified by objectname) to the OSDs. + +.. option:: --test-crush [--range-first --range-last ] + + map placement groups to acting OSDs. + If range is specified, then it iterates from first to last in the directory + specified by argument to osdmaptool. + Eg: **osdmaptool --test-crush --range-first 0 --range-last 2 osdmap_dir**. + This will iterate through the files named 0,1,2 in osdmap_dir. + +.. option:: --mark-up-in + + mark osds up and in (but do not persist). + +.. option:: --tree + + Displays a hierarchical tree of the map. + +.. option:: --clear-temp + clears pg_temp and primary_temp variables. Example ======= diff --git a/src/test/cli/osdmaptool/help.t b/src/test/cli/osdmaptool/help.t index 8fd313a765ad..e697ba3b71ca 100644 --- a/src/test/cli/osdmaptool/help.t +++ b/src/test/cli/osdmaptool/help.t @@ -1,12 +1,17 @@ # TODO be user-friendly $ osdmaptool --help - usage: [--print] [--createsimple [--clobber] [--pg_bits ]] + usage: [--print] + --create-from-conf creates an osd map with default configurations + --createsimple [--clobber] [--pg-bits ] [--pgp-bits ] creates a relatively generic OSD map with devices + --pgp-bits pgp_num map attribute will be shifted by + --pg-bits pg_num map attribute will be shifted by + --clobber allows osdmaptool to overwrite if it already exists --export-crush write osdmap's crush map to --import-crush replace osdmap's crush map with - --test-map-pgs [--pool ] [--pg_num ] map all pgs - --test-map-pgs-dump [--pool ] map all pgs - --test-map-pgs-dump-all [--pool ] map all pgs to osds --health dump health checks + --test-map-pgs [--pool ] [--pg_num ] [--range-first --range-last ] map all pgs + --test-map-pgs-dump [--pool ] [--range-first --range-last ] map all pgs + --test-map-pgs-dump-all [--pool ] [--range-first --range-last ] map all pgs to osds --mark-up-in mark osds up and in (but do not persist) --mark-out mark an osd as out (but do not persist) --with-default-pool include default pool when creating map @@ -23,4 +28,7 @@ max deviation from target [default: .01] --upmap-pool restrict upmap balancing to 1 or more pools --upmap-save write modified OSDMap with upmap changes + --dump displays the map in plain text when is 'plain', 'json' if specified format is not supported + --tree displays a tree of the map + --test-crush [--range-first --range-last ] map pgs to acting osds [1] diff --git a/src/test/cli/osdmaptool/missing-argument.t b/src/test/cli/osdmaptool/missing-argument.t index db1745bd857d..ebd3ce10c0d7 100644 --- a/src/test/cli/osdmaptool/missing-argument.t +++ b/src/test/cli/osdmaptool/missing-argument.t @@ -1,12 +1,17 @@ $ osdmaptool osdmaptool: must specify osdmap filename - usage: [--print] [--createsimple [--clobber] [--pg_bits ]] + usage: [--print] + --create-from-conf creates an osd map with default configurations + --createsimple [--clobber] [--pg-bits ] [--pgp-bits ] creates a relatively generic OSD map with devices + --pgp-bits pgp_num map attribute will be shifted by + --pg-bits pg_num map attribute will be shifted by + --clobber allows osdmaptool to overwrite if it already exists --export-crush write osdmap's crush map to --import-crush replace osdmap's crush map with - --test-map-pgs [--pool ] [--pg_num ] map all pgs - --test-map-pgs-dump [--pool ] map all pgs - --test-map-pgs-dump-all [--pool ] map all pgs to osds --health dump health checks + --test-map-pgs [--pool ] [--pg_num ] [--range-first --range-last ] map all pgs + --test-map-pgs-dump [--pool ] [--range-first --range-last ] map all pgs + --test-map-pgs-dump-all [--pool ] [--range-first --range-last ] map all pgs to osds --mark-up-in mark osds up and in (but do not persist) --mark-out mark an osd as out (but do not persist) --with-default-pool include default pool when creating map @@ -23,4 +28,7 @@ max deviation from target [default: .01] --upmap-pool restrict upmap balancing to 1 or more pools --upmap-save write modified OSDMap with upmap changes + --dump displays the map in plain text when is 'plain', 'json' if specified format is not supported + --tree displays a tree of the map + --test-crush [--range-first --range-last ] map pgs to acting osds [1] diff --git a/src/tools/osdmaptool.cc b/src/tools/osdmaptool.cc index e89f23eacb8a..eef846982d1d 100644 --- a/src/tools/osdmaptool.cc +++ b/src/tools/osdmaptool.cc @@ -26,13 +26,18 @@ void usage() { - cout << " usage: [--print] [--createsimple [--clobber] [--pg_bits ]] " << std::endl; + cout << " usage: [--print] " << std::endl; + cout << " --create-from-conf creates an osd map with default configurations" << std::endl; + cout << " --createsimple [--clobber] [--pg-bits ] [--pgp-bits ] creates a relatively generic OSD map with devices" << std::endl; + cout << " --pgp-bits pgp_num map attribute will be shifted by " << std::endl; + cout << " --pg-bits pg_num map attribute will be shifted by " << std::endl; + cout << " --clobber allows osdmaptool to overwrite if it already exists" << std::endl; cout << " --export-crush write osdmap's crush map to " << std::endl; cout << " --import-crush replace osdmap's crush map with " << std::endl; - cout << " --test-map-pgs [--pool ] [--pg_num ] map all pgs" << std::endl; - cout << " --test-map-pgs-dump [--pool ] map all pgs" << std::endl; - cout << " --test-map-pgs-dump-all [--pool ] map all pgs to osds" << std::endl; cout << " --health dump health checks" << std::endl; + cout << " --test-map-pgs [--pool ] [--pg_num ] [--range-first --range-last ] map all pgs" << std::endl; + cout << " --test-map-pgs-dump [--pool ] [--range-first --range-last ] map all pgs" << std::endl; + cout << " --test-map-pgs-dump-all [--pool ] [--range-first --range-last ] map all pgs to osds" << std::endl; cout << " --mark-up-in mark osds up and in (but do not persist)" << std::endl; cout << " --mark-out mark an osd as out (but do not persist)" << std::endl; cout << " --with-default-pool include default pool when creating map" << std::endl; @@ -50,6 +55,9 @@ void usage() cout << " max deviation from target [default: .01]" << std::endl; cout << " --upmap-pool restrict upmap balancing to 1 or more pools" << std::endl; cout << " --upmap-save write modified OSDMap with upmap changes" << std::endl; + cout << " --dump displays the map in plain text when is 'plain', 'json' if specified format is not supported" << std::endl; + cout << " --tree displays a tree of the map" << std::endl; + cout << " --test-crush [--range-first --range-last ] map pgs to acting osds" << std::endl; exit(1); }