Merge pull request #22793 from justinsb/fix_22792

Auto commit by PR queue bot
This commit is contained in:
k8s-merge-robot 2016-03-11 20:37:25 -08:00
commit 45064e19d1
2 changed files with 13 additions and 4 deletions

View File

@ -161,7 +161,7 @@ type EC2Metadata interface {
type VolumeOptions struct {
CapacityGB int
Tags *map[string]string
Tags map[string]string
}
// Volumes is an interface for managing cloud-provisioned volumes
@ -1387,8 +1387,17 @@ func (s *AWSCloud) CreateDisk(volumeOptions *VolumeOptions) (string, error) {
volumeName := "aws://" + az + "/" + awsID
// apply tags
if volumeOptions.Tags != nil {
if err := s.createTags(awsID, *volumeOptions.Tags); err != nil {
tags := make(map[string]string)
for k, v := range volumeOptions.Tags {
tags[k] = v
}
if s.getClusterName() != "" {
tags[TagNameKubernetesCluster] = s.getClusterName()
}
if len(tags) != 0 {
if err := s.createTags(awsID, tags); err != nil {
// delete the volume and hope it succeeds
_, delerr := s.DeleteDisk(volumeName)
if delerr != nil {

View File

@ -148,7 +148,7 @@ func (util *AWSDiskUtil) CreateVolume(c *awsElasticBlockStoreProvisioner) (strin
requestGB := int(volume.RoundUpSize(requestBytes, 1024*1024*1024))
volumeOptions := &aws.VolumeOptions{
CapacityGB: requestGB,
Tags: &tags,
Tags: tags,
}
name, err := cloud.CreateDisk(volumeOptions)