]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: combined error message for expected Trash::purge() errors
authorIlya Dryomov <idryomov@gmail.com>
Wed, 26 May 2021 12:21:22 +0000 (14:21 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 2 Jun 2021 18:30:54 +0000 (20:30 +0200)
Output to stderr instead of the log where regular users wouldn't see
it given the elevated log level.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit 0bcb9102174e5d1279fbc507acb161160a366dff)

src/librbd/api/Trash.cc
src/tools/rbd/action/Trash.cc

index 0559db2194fa312c7f05e81a84ddda725623c928..678bf8c9f289d4e1f0fda66bfb71fee97702f838 100644 (file)
@@ -523,26 +523,6 @@ int Trash<I>::purge(IoCtx& io_ctx, time_t expire_ts,
   for (const auto &entry_id : to_be_removed) {
     r = librbd::api::Trash<I>::remove(io_ctx, entry_id, true, remove_pctx);
     if (r < 0) {
-      if (r == -ENOTEMPTY) {
-        ldout(cct, 5) << "image has snapshots - these must be deleted "
-                      << "with 'rbd snap purge' before the image can be "
-                      << "removed." << dendl;
-      } else if (r == -EBUSY) {
-        ldout(cct, 5) << "error: image still has watchers" << std::endl
-                      << "This means the image is still open or the client "
-                      << "using it crashed. Try again after closing/unmapping "
-                      << "it or waiting 30s for the crashed client to timeout."
-                      << dendl;
-      } else if (r == -EUCLEAN) {
-        ldout(cct, 5) << "Image is not in the expected state. Ensure moving "
-                      << "the image to the trash completed successfully."
-                      << dendl;
-      } else if (r == -EMLINK) {
-        ldout(cct, 5) << "Remove the image from the group and try again."
-                      << dendl;
-      } else {
-        lderr(cct) << "remove error: " << cpp_strerror(r) << dendl;
-      }
       return r;
     }
     pctx.update_progress(++i, list_size);
index f26dc79a07f0827bf6e5c472ed719601b6bdc018..c4a17e4134b8935927cad669fb1f1431e7a8f955 100644 (file)
@@ -441,6 +441,15 @@ int execute_purge(const po::variables_map &vm,
   r = rbd.trash_purge_with_progress(io_ctx, expire_ts, threshold, pc);
   if (r < 0) {
     pc.fail();
+    if (r == -ENOTEMPTY || r == -EBUSY || r == -EMLINK || r == -EUCLEAN) {
+      std::cerr << "rbd: some expired images could not be removed"
+                << std::endl
+                << "Ensure that they are closed/unmapped, do not have "
+                << "snapshots (including trashed snapshots with linked "
+                << "clones), are not in a group and were moved to the "
+                << "trash successfully."
+                << std::endl;
+    }
     return r;
   }