From 3f8bb83ef064e3d92c86a6265c4fc2ef26472fbf Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Fri, 3 Jan 2025 07:14:27 +0000 Subject: [PATCH] fix: get disk stuck issue --- pkg/azuredisk/azuredisk.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/azuredisk/azuredisk.go b/pkg/azuredisk/azuredisk.go index f545329049..d637e0d428 100644 --- a/pkg/azuredisk/azuredisk.go +++ b/pkg/azuredisk/azuredisk.go @@ -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())