From c2fc91adc7ca05e66a6b4a03303236c4e9a5325d Mon Sep 17 00:00:00 2001 From: Fabio Bertinatto Date: Wed, 17 Apr 2019 14:50:55 +0200 Subject: [PATCH] Fix rounding-up of Vsphere volume size --- pkg/volume/vsphere_volume/vsphere_volume_util.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/volume/vsphere_volume/vsphere_volume_util.go b/pkg/volume/vsphere_volume/vsphere_volume_util.go index 35dacb5ce9..98d4ae28ea 100644 --- a/pkg/volume/vsphere_volume/vsphere_volume_util.go +++ b/pkg/volume/vsphere_volume/vsphere_volume_util.go @@ -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,