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:
Madhu Rajanna
2020-09-21 11:08:14 +05:30
committed by mergify[bot]
parent f41cd105c4
commit 89b326c896
3 changed files with 12 additions and 1 deletions

View File

@ -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())
}