From 700d92c2a83cf9661285cf5b1233192460fee1ba Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Tue, 15 Dec 2015 10:18:00 +0100 Subject: [PATCH] AWS: Use GiB as units for disk sizes. From some reason, MiBs were used for public functions and AWS cloud provider recalculated them to GiB. Let's expose what AWS really supports and don't hide real allocation units. --- pkg/cloudprovider/providers/aws/aws.go | 4 ++-- test/e2e/pd.go | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/cloudprovider/providers/aws/aws.go b/pkg/cloudprovider/providers/aws/aws.go index 442100da023..2120a75410f 100644 --- a/pkg/cloudprovider/providers/aws/aws.go +++ b/pkg/cloudprovider/providers/aws/aws.go @@ -135,7 +135,7 @@ type EC2Metadata interface { } type VolumeOptions struct { - CapacityMB int + CapacityGB int } // Volumes is an interface for managing cloud-provisioned volumes @@ -1222,7 +1222,7 @@ func (aws *AWSCloud) CreateVolume(volumeOptions *VolumeOptions) (string, error) request := &ec2.CreateVolumeInput{} request.AvailabilityZone = &aws.availabilityZone - volSize := (int64(volumeOptions.CapacityMB) + 1023) / 1024 + volSize := int64(volumeOptions.CapacityGB) request.Size = &volSize response, err := aws.ec2.CreateVolume(request) if err != nil { diff --git a/test/e2e/pd.go b/test/e2e/pd.go index d9c1a1f01ba..ab1c8c65179 100644 --- a/test/e2e/pd.go +++ b/test/e2e/pd.go @@ -18,11 +18,12 @@ package e2e import ( "fmt" - "google.golang.org/api/googleapi" mathrand "math/rand" "strings" "time" + "google.golang.org/api/googleapi" + . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "k8s.io/kubernetes/pkg/api" @@ -326,7 +327,7 @@ func createPD() (string, error) { return "", fmt.Errorf("Provider does not support volumes") } volumeOptions := &awscloud.VolumeOptions{} - volumeOptions.CapacityMB = 10 * 1024 + volumeOptions.CapacityGB = 10 return volumes.CreateVolume(volumeOptions) } }