From 0101bf2081bb9e324cffe33166fad8f168386d84 Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Fri, 3 Apr 2015 11:10:55 -0700 Subject: [PATCH] Fix detached-check logic, warn on multiple attachments --- pkg/cloudprovider/aws/aws.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkg/cloudprovider/aws/aws.go b/pkg/cloudprovider/aws/aws.go index b7c41ae89e4..41572d6e65a 100644 --- a/pkg/cloudprovider/aws/aws.go +++ b/pkg/cloudprovider/aws/aws.go @@ -784,13 +784,20 @@ func (self *awsDisk) waitForAttachmentStatus(status string) error { if len(info.Attachments) > 1 { glog.Warningf("Found multiple attachments for volume: %v", info) } - attachmentStatus := "detached" + attachmentStatus := "" for _, attachment := range info.Attachments { - if attachment.Status == status { - return nil + if attachmentStatus != "" { + glog.Warning("Found multiple attachments: ", info) } attachmentStatus = attachment.Status } + if attachmentStatus == "" { + attachmentStatus = "detached" + } + if attachmentStatus == status { + return nil + } + glog.V(2).Infof("Waiting for volume state: actual=%s, desired=%s", attachmentStatus, status) attempt++