]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: return 0 and an empty list when pool is entirely empty
authorJosh Durgin <josh.durgin@inktank.com>
Wed, 1 Jan 2014 01:00:06 +0000 (17:00 -0800)
committerJosh Durgin <josh.durgin@inktank.com>
Thu, 3 Apr 2014 19:20:22 +0000 (12:20 -0700)
rbd_list will return -ENOENT when no rbd_directory object
exists. Handle this in the cli tool and interpret it as success with
an empty list.

Add this to the release notes since it changes command line behavior.

Fixes: #6693
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
(cherry picked from commit ac547a5b7dc94282f079aef78e66348d99d9d5e9)

Conflicts:
PendingReleaseNotes
src/rbd.cc

PendingReleaseNotes
src/rbd.cc
src/test/cli-integration/rbd/formatted-output.t

index b1c141492f60d9e21ab4a6a27e23f84c774cf7ed..6f462c81f5070936d51afba35ae87c6d73da6b45 100644 (file)
@@ -1,40 +1,8 @@
-v0.67
-~~~~~
-
-* The output of 'ceph status --format=json' or 'ceph -s --format=json'
-  has changed to return status information in a more structured and
-  usable format.
-
-* The 'ceph pg dump_stuck [threshold]' command used to require a
-  --threshold or -t prefix to the threshold argument, but now does
-  not.
-
-* Many more ceph commands now output formatted information; select
-  with '--format=<format>', where <format> can be 'json', 'json-pretty',
-  'xml', or 'xml-pretty'.
-
-* ceph-rest-api, a wrapper around ceph_rest_api.py, can be used to start
-  up a test single-threaded HTTP server that provides access to cluster
-  information and administration in very similar ways to the ceph
-  commandline tool.  ceph_rest_api.py can be used as a WSGI application
-  for deployment in a more-capable web server.  See ceph-rest-api.8
-  for more.
-
-* rgw copy object operation may return extra progress info during the
-  operation. At this point it will only happen when doing cross zone
-  copy operations. The S3 response will now return extra <Progress>
-  field under the <CopyResult> container. The Swift response will
-  now send the progress as a json array.
-
-* ceph-osd now requires a max fd limit of at least
-  filestore_wbthrottle_(xfs|btrfs)_inodes_hard_limit (5000 by default)
-  in order to accomodate the new write back throttle system.  upstart
-  now sets the fd limit to 32k.  sysvinit will set it to 32k by default
-  (still overrideable via max_open_files).
-
-* The 'ceph pg <pgid> ...' commands (like 'ceph pg <pgid> query') are
-  deprecated in favor of 'ceph tell <pgid> ...'.  This makes the
-  distinction between 'ceph pg <command> <pgid>' and 'ceph pg <pgid>
-  <command>' less awkward by making it clearer that the 'tell'
-  commands are talking to the OSD serving the placement group, not the
-  monitor.
+v0.67.8
+=======
+
+- 'rbd ls' on a pool which never held rbd images now exits with code
+  0. It outputs nothing in plain format, or an empty list in
+  non-plain format. This is consistent with the behavior for a pool
+  which used to hold images, but contains none. Scripts relying on
+  this behavior should be updated.
index 6041ddeff1b70b71715b94b85d7f43a5f0bb02f0..15b85e100e00f285015f3c5aeb57ebd7054cc6ba 100644 (file)
@@ -245,6 +245,8 @@ static int do_list(librbd::RBD &rbd, librados::IoCtx& io_ctx, bool lflag,
 {
   std::vector<string> names;
   int r = rbd.list(io_ctx, names);
+  if (r == -ENOENT)
+    r = 0;
   if (r < 0)
     return r;
 
@@ -2555,15 +2557,8 @@ if (!set_conf_param(v, p1, p2, p3)) { \
   case OPT_LIST:
     r = do_list(rbd, io_ctx, lflag, formatter.get());
     if (r < 0) {
-      switch (r) {
-      case -ENOENT:
-        cerr << "rbd: pool " << poolname << " doesn't contain rbd images"
-            << std::endl;
-        break;
-      default:
-        cerr << "rbd: list: " << cpp_strerror(-r) << std::endl;
-      }
-      return EXIT_FAILURE;
+      cerr << "rbd: list: " << cpp_strerror(-r) << std::endl;
+      return -r;
     }
     break;
 
index bece14f11f161d26ee988c48de1f3c22180e887f..99577c3a0e1ec7575e0f4bc236bfff22b6ad8288 100644 (file)
@@ -1,3 +1,12 @@
+ls on empty pool never containing images
+========================================
+  $ rados -p rbd rm rbd_directory || true
+  $ rbd ls
+  $ rbd ls --format json
+  [] (no-eol)
+  $ rbd ls --format xml
+  <images></images> (no-eol)
+
 create
 =======
   $ rbd create -s 1024 foo