mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-26 16:20:28 +00:00
cephfs: fix wrong error check in CreateVolume rollback action
Previously the purgeVolume error was ignored due to wrong error variable check in the createVolume. With this change it checks on the proper error. Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
parent
af922f267a
commit
9dee064b77
@ -188,11 +188,13 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
|
|||||||
// explictly
|
// explictly
|
||||||
err = resizeVolume(ctx, volOptions, cr, volumeID(vID.FsSubvolName), volOptions.Size)
|
err = resizeVolume(ctx, volOptions, cr, volumeID(vID.FsSubvolName), volOptions.Size)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if purgeErr := purgeVolume(ctx, volumeID(vID.FsSubvolName), cr, volOptions, false); err != nil {
|
purgeErr := purgeVolume(ctx, volumeID(vID.FsSubvolName), cr, volOptions, false)
|
||||||
|
if purgeErr != nil {
|
||||||
util.ErrorLog(ctx, "failed to delete volume %s: %v", requestName, purgeErr)
|
util.ErrorLog(ctx, "failed to delete volume %s: %v", requestName, purgeErr)
|
||||||
// All errors other than ErrVolumeNotFound should return an error back to the caller
|
// All errors other than ErrVolumeNotFound should return an error back to the caller
|
||||||
if !errors.Is(purgeErr, ErrVolumeNotFound) {
|
if !errors.Is(purgeErr, ErrVolumeNotFound) {
|
||||||
return nil, status.Error(codes.Internal, purgeErr.Error())
|
return nil, status.Error(codes.Internal, purgeErr.Error())
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
errUndo := undoVolReservation(ctx, volOptions, *vID, secret)
|
errUndo := undoVolReservation(ctx, volOptions, *vID, secret)
|
||||||
|
Loading…
Reference in New Issue
Block a user