Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rbd: do not return an error when deleting a non-existing image #4885

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/rbd/rbd_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ func (ri *rbdImage) Delete(ctx context.Context) error {

rbdImage := librbd.GetImage(ri.ioctx, image)
err = rbdImage.Trash(0)
if err != nil {
if err != nil && !errors.Is(err, librbd.ErrNotFound) {
log.ErrorLog(ctx, "failed to delete rbd image: %s, error: %v", ri, err)

return err
Expand All @@ -694,7 +694,7 @@ func (ri *rbdImage) trashRemoveImage(ctx context.Context) error {
_, err = ta.AddTrashRemove(admin.NewImageSpec(ri.Pool, ri.RadosNamespace, ri.ImageID))

rbdCephMgrSupported := isCephMgrSupported(ctx, ri.ClusterID, err)
if rbdCephMgrSupported && err != nil {
if rbdCephMgrSupported && err != nil && !errors.Is(err, librbd.ErrNotFound) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nixpanic is AddTrashRemove Mrg API is also support this error message?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it seemed so. I have been testing with the Ceph main branch, maybe things changed there?

log.ErrorLog(ctx, "failed to add task to delete rbd image: %s, %v", ri, err)

return err
Expand Down