Commit a8f7404a authored by Huamin Chen's avatar Huamin Chen

azure disk: if the disk is not found, immediately detach it. This prevents azure…

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: 's avatarHuamin Chen <hchen@redhat.com>
parent 0b6b8cda
...@@ -43,6 +43,7 @@ const ( ...@@ -43,6 +43,7 @@ const (
errLeaseFailed = "AcquireDiskLeaseFailed" errLeaseFailed = "AcquireDiskLeaseFailed"
errLeaseIDMissing = "LeaseIdMissing" errLeaseIDMissing = "LeaseIdMissing"
errContainerNotFound = "ContainerNotFound" errContainerNotFound = "ContainerNotFound"
errDiskBlobNotFound = "DiskBlobNotFound"
) )
var defaultBackOff = kwait.Backoff{ var defaultBackOff = kwait.Backoff{
...@@ -124,9 +125,9 @@ func (c *controllerCommon) AttachDisk(isManagedDisk bool, diskName, diskURI stri ...@@ -124,9 +125,9 @@ func (c *controllerCommon) AttachDisk(isManagedDisk bool, diskName, diskURI stri
if err != nil { if err != nil {
glog.Errorf("azureDisk - azure attach failed, err: %v", err) glog.Errorf("azureDisk - azure attach failed, err: %v", err)
detail := err.Error() detail := err.Error()
if strings.Contains(detail, errLeaseFailed) { if strings.Contains(detail, errLeaseFailed) || strings.Contains(detail, errDiskBlobNotFound) {
// if lease cannot be acquired, immediately detach the disk and return the original error // if lease cannot be acquired or disk not found, immediately detach the disk and return the original error
glog.Infof("azureDisk - failed to acquire disk lease, try detach") glog.Infof("azureDisk - err %s, try detach", detail)
c.cloud.DetachDiskByName(diskName, diskURI, nodeName) c.cloud.DetachDiskByName(diskName, diskURI, nodeName)
} }
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment