@@ -26,6 +26,7 @@ import (
26
26
"github.com/container-storage-interface/spec/lib/go/csi"
27
27
"github.com/csi-driver/blobfuse-csi-driver/pkg/util"
28
28
29
+ "k8s.io/apimachinery/pkg/util/wait"
29
30
"k8s.io/klog"
30
31
31
32
"google.golang.org/grpc/codes"
@@ -157,9 +158,15 @@ func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest)
157
158
blobClient := client .GetBlobService ()
158
159
container := blobClient .GetContainerReference (containerName )
159
160
// todo: check what value to add into DeleteContainerOptions
160
- _ , err = container .DeleteIfExists (nil )
161
+ err = wait .ExponentialBackoff (d .cloud .RequestBackoff (), func () (bool , error ) {
162
+ _ , err := container .DeleteIfExists (nil )
163
+ if err != nil && ! strings .Contains (err .Error (), "ContainerBeingDeleted" ) {
164
+ return false , fmt .Errorf ("failed to delete container(%s) on account(%s), error: %v" , containerName , accountName , err )
165
+ }
166
+ return true , nil
167
+ })
161
168
if err != nil {
162
- return nil , fmt . Errorf ( "failed to delete container(%s) on account(%s), error: %v" , containerName , accountName , err )
169
+ return nil , err
163
170
}
164
171
165
172
klog .V (2 ).Infof ("container(%s) under rg(%s) account(%s) volumeID(%s) is deleted successfully" , containerName , resourceGroupName , accountName , volumeID )
0 commit comments