Skip to content

Commit

Permalink
rbd: the DeleteVolume CSI procedure should succeed on deleted images
Browse files Browse the repository at this point in the history
If the RBD-image is deleted already, the DeleteVolume CSI procedure is
expected to report success (as it should be idempotent). In case the
returned error indicates "RBD image not found", the error is ignored and
the DeleteVolume procedure continues.

Signed-off-by: Niels de Vos <ndevos@ibm.com>
  • Loading branch information
nixpanic committed Nov 27, 2023
1 parent 373c670 commit d0231ca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/rbd/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1017,9 +1017,10 @@ func cleanupRBDImage(ctx context.Context,
}
}

// Deleting rbd image
// Deleting rbd image, it isn't a failure if the image was deleted already.
log.DebugLog(ctx, "deleting image %s", rbdVol.RbdImageName)
if err = rbdVol.deleteImage(ctx); err != nil {
err = rbdVol.deleteImage(ctx)
if err != nil && !errors.Is(err, librbd.ErrNotFound) {
log.ErrorLog(ctx, "failed to delete rbd image: %s with error: %v",
rbdVol, err)

Expand Down

0 comments on commit d0231ca

Please sign in to comment.