From abaefe0dcde7191c73d0623c587ad7277ca454c0 Mon Sep 17 00:00:00 2001 From: Eddie Torres Date: Wed, 1 Nov 2023 00:08:08 +0000 Subject: [PATCH] bug hunting Signed-off-by: Eddie Torres --- pkg/cloud/cloud.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/cloud/cloud.go b/pkg/cloud/cloud.go index 9dbd0ef9a..ab4532782 100644 --- a/pkg/cloud/cloud.go +++ b/pkg/cloud/cloud.go @@ -701,7 +701,11 @@ func (c *cloud) WaitForAttachmentState(ctx context.Context, volumeID, expectedSt // attached as /dev/xvdbb, where it was attached before and it was already detached. // Retry couple of times, hoping AWS starts reporting the right status. device := aws.StringValue(attachment.Device) - if expectedDevice != "" && device != "" && device != expectedDevice { + if device != expectedDevice { + if expectedState == volumeDetachedState && attachmentState == volumeDetachedState { + attachment = nil + return true, nil + } klog.InfoS("Expected device for volume not found", "expectedDevice", expectedDevice, "expectedState", expectedState, "volumeID", volumeID, "device", device, "attachmentState", attachmentState) return false, nil }