From bed335605085ca4b807dd186bdbccd36592d9e86 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Thu, 14 Dec 2017 19:04:33 -0500 Subject: [PATCH] rbd: 'trash list --long' will return a failure on non-cloned images Signed-off-by: Jason Dillaman --- src/tools/rbd/action/Trash.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/tools/rbd/action/Trash.cc b/src/tools/rbd/action/Trash.cc index d46cfe2b9de..85f976c0c38 100644 --- a/src/tools/rbd/action/Trash.cc +++ b/src/tools/rbd/action/Trash.cc @@ -234,12 +234,14 @@ int do_list(librbd::RBD &rbd, librados::IoCtx& io_ctx, bool long_flag, std::string time_str = ctime(&entry.deletion_time); time_str = time_str.substr(0, time_str.length() - 1); + bool has_parent = false; std::string pool, image, snap, parent; r = im.parent_info(&pool, &image, &snap); - if (r < 0 && r != -ENOENT) + if (r == -ENOENT) { + r = 0; + } else if (r < 0) { return r; - bool has_parent = false; - if (r != -ENOENT) { + } else { parent = pool + "/" + image + "@" + snap; has_parent = true; } -- 2.47.3