From: Ilya Dryomov Date: Thu, 23 Jul 2015 12:55:47 +0000 (+0300) Subject: rbd: du command should take spec as an argument X-Git-Tag: v9.0.3~14^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=afbf90d5b5629edae9cac09e926fd6a783fa79ca;p=ceph.git rbd: du command should take spec as an argument Change du to take | as an argument instead of going through --image option. The new synopsis is (du | disk-usage) [ | ] This is to make it look more like the rest of the commands: the only other command that takes pool as an argument is ls and it can't really serve as a prototype for du, because the latter has to work on images and snapshots as well. Examples: # stats for pool rbd $ rbd du $ rbd -p rbd du # stats for pool foo $ rbd -p foo du # stats for snapshot mysnap of image baz in pool rbd $ rbd du baz@mysnap # stats for image bar in pool foo $ rbd du foo/bar Signed-off-by: Ilya Dryomov --- diff --git a/doc/man/8/rbd.rst b/doc/man/8/rbd.rst index 3e11875db9d5..b894d577ecaf 100644 --- a/doc/man/8/rbd.rst +++ b/doc/man/8/rbd.rst @@ -163,10 +163,10 @@ Commands -l, also show snapshots, and use longer-format output including size, parent (if clone), format, etc. -:command:`du` [--image *image-name*] [*pool-name*] +:command:`du` [-p | --pool *pool-name*] [*image-spec* | *snap-spec*] Will calculate the provisioned and actual disk usage of all images and - associated snapshots within the specified pool. It can also be used against - individual images. + associated snapshots within the specified pool. It can also be used against + individual images and snapshots. If the RBD fast-diff feature isn't enabled on images, this operation will require querying the OSDs for every potential object within the image. diff --git a/src/rbd.cc b/src/rbd.cc index 878cfeacbd2c..e0cf488b87ef 100644 --- a/src/rbd.cc +++ b/src/rbd.cc @@ -93,8 +93,9 @@ void usage() "where 'pool' is a rados pool name (default is 'rbd') and 'cmd' is one of:\n" " (ls | list) [-l | --long ] [pool-name] list rbd images\n" " (-l includes snapshots/clones)\n" -" (du | disk-usage) [--image ] [pool-name]\n" -" show pool image disk usage stats\n" +" (du | disk-usage) [ | ]\n" +" show disk usage stats for pool,\n" +" image or snapshot\n" " info | show information about image size,\n" " striping, etc.\n" " create [--order ] [--image-features ] [--image-shared]\n" @@ -3182,7 +3183,6 @@ if (!set_conf_param(v, p1, p2, p3)) { \ const char *v = *i; switch (opt_cmd) { case OPT_LIST: - case OPT_DISK_USAGE: SET_CONF_PARAM(v, &poolname, NULL, NULL); break; case OPT_INFO: @@ -3206,6 +3206,7 @@ if (!set_conf_param(v, p1, p2, p3)) { \ case OPT_METADATA_LIST: case OPT_DIFF: case OPT_OBJECT_MAP_REBUILD: + case OPT_DISK_USAGE: SET_CONF_PARAM(v, &imgname, NULL, NULL); break; case OPT_EXPORT: diff --git a/src/test/cli/rbd/help.t b/src/test/cli/rbd/help.t index 8e69fe6f2a25..e025f204d3ac 100644 --- a/src/test/cli/rbd/help.t +++ b/src/test/cli/rbd/help.t @@ -3,8 +3,9 @@ where 'pool' is a rados pool name (default is 'rbd') and 'cmd' is one of: (ls | list) [-l | --long ] [pool-name] list rbd images (-l includes snapshots/clones) - (du | disk-usage) [--image ] [pool-name] - show pool image disk usage stats + (du | disk-usage) [ | ] + show disk usage stats for pool, + image or snapshot info | show information about image size, striping, etc. create [--order ] [--image-features ] [--image-shared]