Skip to content

Commit

Permalink
Merge pull request #2786 from andyzhangx/fix-get-disk-timeout-1.29
Browse files Browse the repository at this point in the history
[release-1.29] fix: get disk stuck issue
  • Loading branch information
andyzhangx authored Jan 3, 2025
2 parents 78845d6 + 3f8bb83 commit 7a68298
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/azuredisk/azuredisk.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,12 @@ func (d *Driver) checkDiskExists(ctx context.Context, diskURI string) (*compute.
return nil, nil
}
subsID := azureutils.GetSubscriptionIDFromURI(diskURI)
disk, rerr := d.cloud.DisksClient.Get(ctx, subsID, resourceGroup, diskName)

// get disk operation should timeout within 1min if it takes too long time
newCtx, cancel := context.WithTimeout(ctx, time.Minute)
defer cancel()

disk, rerr := d.cloud.DisksClient.Get(newCtx, subsID, resourceGroup, diskName)
if rerr != nil {
if rerr.IsThrottled() || strings.Contains(rerr.RawError.Error(), consts.RateLimited) {
klog.Warningf("checkDiskExists(%s) is throttled with error: %v", diskURI, rerr.Error())
Expand Down

0 comments on commit 7a68298

Please sign in to comment.