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);
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;
}