From 7e8b4a2d608c4b06b5c496803d5194e0a464354b Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Mon, 11 Sep 2017 14:04:04 -0400 Subject: [PATCH 1/2] Glusterfs expands in units of GB not GiB --- pkg/volume/glusterfs/glusterfs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/volume/glusterfs/glusterfs.go b/pkg/volume/glusterfs/glusterfs.go index a3225e16a44..af73b27f23c 100644 --- a/pkg/volume/glusterfs/glusterfs.go +++ b/pkg/volume/glusterfs/glusterfs.go @@ -1080,7 +1080,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} From 77be9123f7f38ffb3a0a4ae79f698e49ffff56a6 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Mon, 11 Sep 2017 16:25:28 -0400 Subject: [PATCH 2/2] Fix glusterfs creating volumes in GiB As per glusterfs documentation it can't create volumes in GiB and all sizes must be specified in GB. This code was slightly buggy because we were creating volumes of sizes lesser than user asked for --- pkg/volume/glusterfs/glusterfs.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/volume/glusterfs/glusterfs.go b/pkg/volume/glusterfs/glusterfs.go index af73b27f23c..d1476d8f099 100644 --- a/pkg/volume/glusterfs/glusterfs.go +++ b/pkg/volume/glusterfs/glusterfs.go @@ -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")