mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 18:43:34 +00:00
cephfs: check ENOTEMPTY when removing subvolume
return a proper error message to the user when the subvolume has the snapshots and it cannot be removed until the snapshots on the subvolume have to be deleted. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
f41cd105c4
commit
89b326c896
@ -343,7 +343,10 @@ func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
|
||||
|
||||
if err = purgeVolume(ctx, volumeID(vID.FsSubvolName), cr, volOptions, false); err != nil {
|
||||
util.ErrorLog(ctx, "failed to delete volume %s: %v", volID, err)
|
||||
// All errors other than ErrVolumeNotFound should return an error back to the caller
|
||||
if errors.Is(err, ErrVolumeHasSnapshots) {
|
||||
return nil, status.Error(codes.FailedPrecondition, err.Error())
|
||||
}
|
||||
|
||||
if !errors.Is(err, ErrVolumeNotFound) {
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
|
Reference in New Issue
Block a user