Add volumesize roundoff for expandrequest

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
Humble Chirammal
2019-11-26 13:59:28 +05:30
committed by mergify[bot]
parent ac09c5553c
commit 671e2d814a
6 changed files with 10 additions and 4 deletions

View File

@ -324,13 +324,15 @@ func (cs *ControllerServer) ControllerExpandVolume(ctx context.Context, req *csi
return nil, status.Error(codes.InvalidArgument, err.Error())
}
if err = createVolume(ctx, volOptions, cr, volumeID(volIdentifier.FsSubvolName), req.GetCapacityRange().GetRequiredBytes()); err != nil {
RoundOffSize := util.RoundOffBytes(req.GetCapacityRange().GetRequiredBytes())
if err = createVolume(ctx, volOptions, cr, volumeID(volIdentifier.FsSubvolName), RoundOffSize); err != nil {
klog.Errorf("failed to expand volume %s: %v", volumeID(volIdentifier.FsSubvolName), err)
return nil, status.Error(codes.Internal, err.Error())
}
return &csi.ControllerExpandVolumeResponse{
CapacityBytes: req.GetCapacityRange().GetRequiredBytes(),
CapacityBytes: RoundOffSize,
NodeExpansionRequired: false,
}, nil