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:
internal/rbd
@ -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
|
||||
|
Reference in New Issue
Block a user