Skip to content

Commit

Permalink
Merge pull request #2785 from k8s-infra-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…2783-to-release-1.30

[release-1.30] fix: get disk stuck issue
  • Loading branch information
k8s-ci-robot authored Jan 3, 2025
2 parents adbbe9b + 8bf42c4 commit 51d6388
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion pkg/azuredisk/azuredisk.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/azuredisk/controllerserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ func TestControllerModifyVolume(t *testing.T) {
}
diskClient := mock_diskclient.NewMockInterface(cntl)
d.getClientFactory().(*mock_azclient.MockClientFactory).EXPECT().GetDiskClientForSub(gomock.Any()).Return(diskClient, nil).AnyTimes()
diskClient.EXPECT().Get(gomock.Eq(ctx), gomock.Any(), gomock.Any()).Return(disk, nil).AnyTimes()
diskClient.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any()).Return(disk, nil).AnyTimes()
diskClient.EXPECT().Patch(gomock.Eq(ctx), gomock.Any(), gomock.Any(), gomock.Any()).Return(disk, nil).AnyTimes()

result, err := d.ControllerModifyVolume(ctx, test.req)
Expand Down

0 comments on commit 51d6388

Please sign in to comment.