Avoid overflowing int64 in RoundUpSize and return error if overflow int
This commit is contained in:
@@ -579,7 +579,10 @@ func (util *RBDUtil) CreateImage(p *rbdVolumeProvisioner) (r *v1.RBDPersistentVo
|
||||
capacity := p.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
|
||||
volSizeBytes := capacity.Value()
|
||||
// Convert to MB that rbd defaults on.
|
||||
sz := int(volutil.RoundUpSize(volSizeBytes, 1024*1024))
|
||||
sz, err := volutil.RoundUpSizeInt(volSizeBytes, 1024*1024)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
volSz := fmt.Sprintf("%d", sz)
|
||||
mon := util.kernelRBDMonitorsOpt(p.Mon)
|
||||
if p.rbdMounter.imageFormat == rbdImageFormat2 {
|
||||
|
||||
Reference in New Issue
Block a user