Merge pull request #52296 from gnufied/fix-glusterfs-expand-unit

Automatic merge from submit-queue (batch tested with PRs 51041, 52297, 52296, 52335, 52338)

Glusterfs expands in units of GB not GiB

When expanding glusterfs volumes, we should use GB units not GiB.  More information - https://github.com/heketi/heketi/wiki/API

Fixes https://github.com/kubernetes/kubernetes/issues/52298 

```release-note
Fixes Glusterfs storage allocation units
```
This commit is contained in:
Kubernetes Submit Queue 2017-09-12 11:10:13 -07:00 committed by GitHub
commit 51afd82cb8

View File

@ -737,7 +737,8 @@ func (p *glusterfsVolumeProvisioner) CreateVolume(gid int) (r *v1.GlusterfsVolum
var clusterIDs []string
capacity := p.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
volSizeBytes := capacity.Value()
sz := int(volume.RoundUpSize(volSizeBytes, 1024*1024*1024))
// Glusterfs creates volumes in units of GBs
sz := int(volume.RoundUpSize(volSizeBytes, 1000*1000*1000))
glog.V(2).Infof("create volume of size: %d bytes and configuration %+v", volSizeBytes, p.provisionerConfig)
if p.url == "" {
glog.Errorf("REST server endpoint is empty")
@ -1080,7 +1081,7 @@ func (plugin *glusterfsPlugin) ExpandVolumeDevice(spec *volume.Spec, newSize res
// Find out delta size
expansionSize := (newSize.Value() - oldSize.Value())
expansionSizeGB := int(volume.RoundUpSize(expansionSize, 1024*1024*1024))
expansionSizeGB := int(volume.RoundUpSize(expansionSize, 1000*1000*1000))
// Make volume expansion request
volumeExpandReq := &gapi.VolumeExpandRequest{Size: expansionSizeGB}