@@ -42,10 +42,6 @@ type GCEControllerServer struct {
42
42
Driver * GCEDriver
43
43
CloudProvider gce.GCECompute
44
44
MetadataService metadataservice.MetadataService
45
-
46
- // A map storing all volumes with ongoing operations so that additional operations
47
- // for that same volume (as defined by Volume Key) return an Aborted error
48
- volumeLocks * common.VolumeLocks
49
45
}
50
46
51
47
var _ csi.ControllerServer = & GCEControllerServer {}
@@ -143,15 +139,6 @@ func (gceCS *GCEControllerServer) CreateVolume(ctx context.Context, req *csi.Cre
143
139
return nil , status .Error (codes .InvalidArgument , fmt .Sprintf ("CreateVolume replication type '%s' is not supported" , replicationType ))
144
140
}
145
141
146
- volumeID , err := common .KeyToVolumeID (volKey , gceCS .MetadataService .GetProject ())
147
- if err != nil {
148
- return nil , status .Errorf (codes .Internal , "Failed to convert volume key to volume ID: %v" , err )
149
- }
150
- if acquired := gceCS .volumeLocks .TryAcquire (volumeID ); ! acquired {
151
- return nil , status .Errorf (codes .Aborted , common .VolumeOperationAlreadyExistsFmt , volumeID )
152
- }
153
- defer gceCS .volumeLocks .Release (volumeID )
154
-
155
142
// Validate if disk already exists
156
143
existingDisk , err := gceCS .CloudProvider .GetDisk (ctx , volKey )
157
144
if err != nil {
@@ -235,11 +222,6 @@ func (gceCS *GCEControllerServer) DeleteVolume(ctx context.Context, req *csi.Del
235
222
return nil , status .Error (codes .NotFound , fmt .Sprintf ("Could not find volume with ID %v: %v" , volumeID , err ))
236
223
}
237
224
238
- if acquired := gceCS .volumeLocks .TryAcquire (volumeID ); ! acquired {
239
- return nil , status .Errorf (codes .Aborted , common .VolumeOperationAlreadyExistsFmt , volumeID )
240
- }
241
- defer gceCS .volumeLocks .Release (volumeID )
242
-
243
225
err = gceCS .CloudProvider .DeleteDisk (ctx , volKey )
244
226
if err != nil {
245
227
return nil , status .Error (codes .Internal , fmt .Sprintf ("unknown Delete disk error: %v" , err ))
@@ -276,14 +258,6 @@ func (gceCS *GCEControllerServer) ControllerPublishVolume(ctx context.Context, r
276
258
return nil , status .Error (codes .NotFound , fmt .Sprintf ("Could not find volume with ID %v: %v" , volumeID , err ))
277
259
}
278
260
279
- // Acquires the lock for the volume on that node only, because we need to support the ability
280
- // to publish the same volume onto different nodes concurrently
281
- lockingVolumeID := fmt .Sprintf ("%s/%s" , nodeID , volumeID )
282
- if acquired := gceCS .volumeLocks .TryAcquire (lockingVolumeID ); ! acquired {
283
- return nil , status .Errorf (codes .Aborted , common .VolumeOperationAlreadyExistsFmt , lockingVolumeID )
284
- }
285
- defer gceCS .volumeLocks .Release (lockingVolumeID )
286
-
287
261
// TODO(#253): Check volume capability matches for ALREADY_EXISTS
288
262
if err = validateVolumeCapability (volumeCapability ); err != nil {
289
263
return nil , status .Error (codes .InvalidArgument , fmt .Sprintf ("VolumeCapabilities is invalid: %v" , err ))
@@ -369,14 +343,6 @@ func (gceCS *GCEControllerServer) ControllerUnpublishVolume(ctx context.Context,
369
343
return nil , err
370
344
}
371
345
372
- // Acquires the lock for the volume on that node only, because we need to support the ability
373
- // to unpublish the same volume from different nodes concurrently
374
- lockingVolumeID := fmt .Sprintf ("%s/%s" , nodeID , volumeID )
375
- if acquired := gceCS .volumeLocks .TryAcquire (lockingVolumeID ); ! acquired {
376
- return nil , status .Errorf (codes .Aborted , common .VolumeOperationAlreadyExistsFmt , lockingVolumeID )
377
- }
378
- defer gceCS .volumeLocks .Release (lockingVolumeID )
379
-
380
346
instanceZone , instanceName , err := common .NodeIDToZoneAndName (nodeID )
381
347
if err != nil {
382
348
return nil , status .Error (codes .InvalidArgument , fmt .Sprintf ("could not split nodeID: %v" , err ))
@@ -423,12 +389,6 @@ func (gceCS *GCEControllerServer) ValidateVolumeCapabilities(ctx context.Context
423
389
if err != nil {
424
390
return nil , status .Error (codes .NotFound , fmt .Sprintf ("Volume ID is of improper format, got %v" , volumeID ))
425
391
}
426
-
427
- if acquired := gceCS .volumeLocks .TryAcquire (volumeID ); ! acquired {
428
- return nil , status .Errorf (codes .Aborted , common .VolumeOperationAlreadyExistsFmt , volumeID )
429
- }
430
- defer gceCS .volumeLocks .Release (volumeID )
431
-
432
392
_ , err = gceCS .CloudProvider .GetDisk (ctx , volKey )
433
393
if err != nil {
434
394
if gce .IsGCEError (err , "notFound" ) {
@@ -536,11 +496,6 @@ func (gceCS *GCEControllerServer) CreateSnapshot(ctx context.Context, req *csi.C
536
496
return nil , status .Error (codes .NotFound , fmt .Sprintf ("Could not find volume with ID %v: %v" , volumeID , err ))
537
497
}
538
498
539
- if acquired := gceCS .volumeLocks .TryAcquire (volumeID ); ! acquired {
540
- return nil , status .Errorf (codes .Aborted , common .VolumeOperationAlreadyExistsFmt , volumeID )
541
- }
542
- defer gceCS .volumeLocks .Release (volumeID )
543
-
544
499
// Check if snapshot already exists
545
500
var snapshot * compute.Snapshot
546
501
snapshot , err = gceCS .CloudProvider .GetSnapshot (ctx , req .Name )
0 commit comments