mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
Fix rounding-up of Vsphere volume size
This commit is contained in:
parent
0889c3e4e9
commit
c2fc91adc7
@ -94,11 +94,12 @@ func (util *VsphereDiskUtil) CreateVolume(v *vsphereVolumeProvisioner, selectedZ
|
|||||||
}
|
}
|
||||||
|
|
||||||
capacity := v.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
|
capacity := v.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
|
||||||
// vSphere works with kilobytes, convert to KiB with rounding up
|
// vSphere works with KiB, but its minimum allocation unit is 1 MiB
|
||||||
volSizeKiB, err := volumehelpers.RoundUpToKiBInt(capacity)
|
volSizeMiB, err := volumehelpers.RoundUpToMiBInt(capacity)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
volSizeKiB := volSizeMiB * 1024
|
||||||
name := volumeutil.GenerateVolumeName(v.options.ClusterName, v.options.PVName, 255)
|
name := volumeutil.GenerateVolumeName(v.options.ClusterName, v.options.PVName, 255)
|
||||||
volumeOptions := &vclib.VolumeOptions{
|
volumeOptions := &vclib.VolumeOptions{
|
||||||
CapacityKB: volSizeKiB,
|
CapacityKB: volSizeKiB,
|
||||||
|
Loading…
Reference in New Issue
Block a user