Fix rounding-up of Vsphere volume size

k3s-v1.15.3
Fabio Bertinatto 2019-04-17 14:50:55 +02:00
parent 0889c3e4e9
commit c2fc91adc7
1 changed files with 3 additions and 2 deletions

View File

@ -94,11 +94,12 @@ func (util *VsphereDiskUtil) CreateVolume(v *vsphereVolumeProvisioner, selectedZ
}
capacity := v.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
// vSphere works with kilobytes, convert to KiB with rounding up
volSizeKiB, err := volumehelpers.RoundUpToKiBInt(capacity)
// vSphere works with KiB, but its minimum allocation unit is 1 MiB
volSizeMiB, err := volumehelpers.RoundUpToMiBInt(capacity)
if err != nil {
return nil, err
}
volSizeKiB := volSizeMiB * 1024
name := volumeutil.GenerateVolumeName(v.options.ClusterName, v.options.PVName, 255)
volumeOptions := &vclib.VolumeOptions{
CapacityKB: volSizeKiB,