From a8f7404a13f9db64606b6607fef3efd9655374d6 Mon Sep 17 00:00:00 2001 From: Huamin Chen Date: Tue, 16 Jan 2018 16:43:10 +0000 Subject: [PATCH] azure disk: if the disk is not found, immediately detach it. This prevents azure keeps the bad request and stops issuing new request Signed-off-by: Huamin Chen --- .../providers/azure/azure_controllerCommon.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/cloudprovider/providers/azure/azure_controllerCommon.go b/pkg/cloudprovider/providers/azure/azure_controllerCommon.go index ad40f3c5b85..8cef635c3bb 100644 --- a/pkg/cloudprovider/providers/azure/azure_controllerCommon.go +++ b/pkg/cloudprovider/providers/azure/azure_controllerCommon.go @@ -43,6 +43,7 @@ const ( errLeaseFailed = "AcquireDiskLeaseFailed" errLeaseIDMissing = "LeaseIdMissing" errContainerNotFound = "ContainerNotFound" + errDiskBlobNotFound = "DiskBlobNotFound" ) var defaultBackOff = kwait.Backoff{ @@ -124,9 +125,9 @@ func (c *controllerCommon) AttachDisk(isManagedDisk bool, diskName, diskURI stri if err != nil { glog.Errorf("azureDisk - azure attach failed, err: %v", err) detail := err.Error() - if strings.Contains(detail, errLeaseFailed) { - // if lease cannot be acquired, immediately detach the disk and return the original error - glog.Infof("azureDisk - failed to acquire disk lease, try detach") + if strings.Contains(detail, errLeaseFailed) || strings.Contains(detail, errDiskBlobNotFound) { + // if lease cannot be acquired or disk not found, immediately detach the disk and return the original error + glog.Infof("azureDisk - err %s, try detach", detail) c.cloud.DetachDiskByName(diskName, diskURI, nodeName) } } else {