Skip to content

Commit

Permalink
cancel the context when timeout of deleting file share
Browse files Browse the repository at this point in the history
Signed-off-by: Ji An Liu <jiliu8@microsoft.com>
  • Loading branch information
ZeroMagic committed Sep 14, 2022
1 parent 8f01387 commit 710fccd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/azurefile/azurefile.go
Expand Up @@ -755,7 +755,7 @@ func (d *Driver) CreateFileShare(accountOptions *azure.AccountOptions, shareOpti
}

// DeleteFileShare deletes a file share using storage account name and key
func (d *Driver) DeleteFileShare(subsID, resourceGroup, accountName, shareName string, secrets map[string]string) error {
func (d *Driver) DeleteFileShare(ctx context.Context, subsID, resourceGroup, accountName, shareName string, secrets map[string]string) error {
return wait.ExponentialBackoff(d.cloud.RequestBackoff(), func() (bool, error) {
var err error
if len(secrets) > 0 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/azurefile/controllerserver.go
Expand Up @@ -600,7 +600,7 @@ func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest)
mc.ObserveOperationWithResult(isOperationSucceeded, VolumeID, volumeID)
}()

if err := d.DeleteFileShare(subsID, resourceGroupName, accountName, fileShareName, secret); err != nil {
if err := d.DeleteFileShare(ctx, subsID, resourceGroupName, accountName, fileShareName, secret); err != nil {
return nil, status.Errorf(codes.Internal, "DeleteFileShare %s under account(%s) rg(%s) failed with error: %v", fileShareName, accountName, resourceGroupName, err)
}
klog.V(2).Infof("azure file(%s) under subsID(%s) rg(%s) account(%s) volume(%s) is deleted successfully", fileShareName, subsID, resourceGroupName, accountName, volumeID)
Expand Down

0 comments on commit 710fccd

Please sign in to comment.