Fix detached-check logic, warn on multiple attachments

pull/6/head
Justin Santa Barbara 2015-04-03 11:10:55 -07:00
parent 3689bf0298
commit 0101bf2081
1 changed files with 10 additions and 3 deletions

View File

@ -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++