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>
+v0.75
+~~~~~
+
+- '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.
+
v0.74
~~~~~
{
std::vector<string> names;
int r = rbd.list(io_ctx, names);
+ if (r == -ENOENT)
+ r = 0;
if (r < 0)
return r;
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;
- }
+ cerr << "rbd: list: " << cpp_strerror(-r) << std::endl;
return -r;
}
break;
+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