]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: du command should take spec as an argument
authorIlya Dryomov <idryomov@gmail.com>
Thu, 23 Jul 2015 12:55:47 +0000 (15:55 +0300)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 27 Jul 2015 09:22:04 +0000 (12:22 +0300)
Change du to take <image-spec> | <snap-spec> as an argument instead of
going through --image option.  The new synopsis is

    (du | disk-usage) [<image-spec> | <snap-spec>]

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 <idryomov@gmail.com>
doc/man/8/rbd.rst
src/rbd.cc
src/test/cli/rbd/help.t

index 3e11875db9d55139204a12293723be4125654762..b894d577ecaf3e807678ddf1277699bc6f067ddc 100644 (file)
@@ -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.
index 878cfeacbd2c08f8e81933946e96cdefce6dfb90..e0cf488b87ef819eb818ddf20427b11ce623067f 100644 (file)
@@ -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 <name>] [pool-name]\n"
-"                                              show pool image disk usage stats\n"
+"  (du | disk-usage) [<image-spec> | <snap-spec>]\n"
+"                                              show disk usage stats for pool,\n"
+"                                              image or snapshot\n"
 "  info <image-spec> | <snap-spec>             show information about image size,\n"
 "                                              striping, etc.\n"
 "  create [--order <bits>] [--image-features <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:
index 8e69fe6f2a2542855330bb2a8ec62bb00902355b..e025f204d3ac9125ee99b7e3cdecdaa240901769 100644 (file)
@@ -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 <name>] [pool-name]
-                                                show pool image disk usage stats
+    (du | disk-usage) [<image-spec> | <snap-spec>]
+                                                show disk usage stats for pool,
+                                                image or snapshot
     info <image-spec> | <snap-spec>             show information about image size,
                                                 striping, etc.
     create [--order <bits>] [--image-features <features>] [--image-shared]