1
0
mirror of https://github.com/ceph/ceph-csi.git synced 2025-06-14 18:53:35 +00:00

rbd: add rbdSnap.Delete() function

This function deletes rbd snap and rbd image
backing k8s snapshot.
The same function is used for deleting
individual snapshots in group snapshot.

Signed-off-by: Praveen M <m.praveen@ibm.com>
This commit is contained in:
Praveen M
2024-12-16 16:03:46 +05:30
committed by mergify[bot]
parent 77d8306504
commit 797eceebb2
3 changed files with 43 additions and 21 deletions

@ -680,6 +680,10 @@ func (ri *rbdImage) Delete(ctx context.Context) error {
rbdImage := librbd.GetImage(ri.ioctx, image)
err = rbdImage.Trash(0)
if err != nil {
if errors.Is(err, librbd.ErrNotFound) {
return fmt.Errorf("Failed as %w (internal %w)", ErrImageNotFound, err)
}
log.ErrorLog(ctx, "failed to delete rbd image: %s, error: %v", ri, err)
return err