From a009c9b772c1bd26fdaeb9ec8a83541e15de2d3f Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Fri, 3 Jan 2025 04:00:16 +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 65066bb9f9..5cf65726d7 100644 --- a/pkg/azuredisk/azuredisk.go +++ b/pkg/azuredisk/azuredisk.go @@ -410,7 +410,12 @@ func (d *Driver) checkDiskExists(ctx context.Context, diskURI string) (*armcompu if err != nil { return nil, err } - disk, err := diskClient.Get(ctx, 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, err := diskClient.Get(newCtx, resourceGroup, diskName) if err != nil { return nil, err }