@@ -45,7 +45,7 @@ type GCEControllerServer struct {
45
45
46
46
// A map storing all volumes with ongoing operations so that additional operations
47
47
// for that same volume (as defined by Volume Key) return an Aborted error
48
- volumes * common.VolumeLocks
48
+ volumeLocks * common.VolumeLocks
49
49
}
50
50
51
51
var _ csi.ControllerServer = & GCEControllerServer {}
@@ -147,10 +147,10 @@ func (gceCS *GCEControllerServer) CreateVolume(ctx context.Context, req *csi.Cre
147
147
if err != nil {
148
148
return nil , status .Errorf (codes .Internal , "Failed to convert volume key to volume ID: %v" , err )
149
149
}
150
- if acquired := gceCS .volumes .TryAcquire (volumeID ); ! acquired {
150
+ if acquired := gceCS .volumeLocks .TryAcquire (volumeID ); ! acquired {
151
151
return nil , status .Errorf (codes .Aborted , common .VolumeOperationAlreadyExistsFmt , volumeID )
152
152
}
153
- defer gceCS .volumes .Release (volumeID )
153
+ defer gceCS .volumeLocks .Release (volumeID )
154
154
155
155
// Validate if disk already exists
156
156
existingDisk , err := gceCS .CloudProvider .GetDisk (ctx , volKey )
@@ -235,10 +235,10 @@ func (gceCS *GCEControllerServer) DeleteVolume(ctx context.Context, req *csi.Del
235
235
return nil , status .Errorf (codes .NotFound , "Could not find volume with ID %v: %v" , volumeID , err )
236
236
}
237
237
238
- if acquired := gceCS .volumes .TryAcquire (volumeID ); ! acquired {
238
+ if acquired := gceCS .volumeLocks .TryAcquire (volumeID ); ! acquired {
239
239
return nil , status .Errorf (codes .Aborted , common .VolumeOperationAlreadyExistsFmt , volumeID )
240
240
}
241
- defer gceCS .volumes .Release (volumeID )
241
+ defer gceCS .volumeLocks .Release (volumeID )
242
242
243
243
err = gceCS .CloudProvider .DeleteDisk (ctx , volKey )
244
244
if err != nil {
@@ -277,10 +277,10 @@ func (gceCS *GCEControllerServer) ControllerPublishVolume(ctx context.Context, r
277
277
}
278
278
279
279
lockingVolumeID := fmt .Sprintf ("%s/%s" , nodeID , volumeID )
280
- if acquired := gceCS .volumes .TryAcquire (lockingVolumeID ); ! acquired {
280
+ if acquired := gceCS .volumeLocks .TryAcquire (lockingVolumeID ); ! acquired {
281
281
return nil , status .Errorf (codes .Aborted , common .VolumeOperationAlreadyExistsFmt , lockingVolumeID )
282
282
}
283
- defer gceCS .volumes .Release (lockingVolumeID )
283
+ defer gceCS .volumeLocks .Release (lockingVolumeID )
284
284
285
285
// TODO(#253): Check volume capability matches for ALREADY_EXISTS
286
286
if err = validateVolumeCapability (volumeCapability ); err != nil {
@@ -368,10 +368,10 @@ func (gceCS *GCEControllerServer) ControllerUnpublishVolume(ctx context.Context,
368
368
}
369
369
370
370
lockingVolumeID := fmt .Sprintf ("%s/%s" , nodeID , volumeID )
371
- if acquired := gceCS .volumes .TryAcquire (lockingVolumeID ); ! acquired {
371
+ if acquired := gceCS .volumeLocks .TryAcquire (lockingVolumeID ); ! acquired {
372
372
return nil , status .Errorf (codes .Aborted , common .VolumeOperationAlreadyExistsFmt , lockingVolumeID )
373
373
}
374
- defer gceCS .volumes .Release (lockingVolumeID )
374
+ defer gceCS .volumeLocks .Release (lockingVolumeID )
375
375
376
376
instanceZone , instanceName , err := common .NodeIDToZoneAndName (nodeID )
377
377
if err != nil {
@@ -420,10 +420,10 @@ func (gceCS *GCEControllerServer) ValidateVolumeCapabilities(ctx context.Context
420
420
return nil , status .Errorf (codes .NotFound , "Volume ID is of improper format, got %v" , volumeID )
421
421
}
422
422
423
- if acquired := gceCS .volumes .TryAcquire (volumeID ); ! acquired {
423
+ if acquired := gceCS .volumeLocks .TryAcquire (volumeID ); ! acquired {
424
424
return nil , status .Errorf (codes .Aborted , common .VolumeOperationAlreadyExistsFmt , volumeID )
425
425
}
426
- defer gceCS .volumes .Release (volumeID )
426
+ defer gceCS .volumeLocks .Release (volumeID )
427
427
428
428
_ , err = gceCS .CloudProvider .GetDisk (ctx , volKey )
429
429
if err != nil {
@@ -532,10 +532,10 @@ func (gceCS *GCEControllerServer) CreateSnapshot(ctx context.Context, req *csi.C
532
532
return nil , status .Errorf (codes .NotFound , "Could not find volume with ID %v: %v" , volumeID , err )
533
533
}
534
534
535
- if acquired := gceCS .volumes .TryAcquire (volumeID ); ! acquired {
535
+ if acquired := gceCS .volumeLocks .TryAcquire (volumeID ); ! acquired {
536
536
return nil , status .Errorf (codes .Aborted , common .VolumeOperationAlreadyExistsFmt , volumeID )
537
537
}
538
- defer gceCS .volumes .Release (volumeID )
538
+ defer gceCS .volumeLocks .Release (volumeID )
539
539
540
540
// Check if snapshot already exists
541
541
var snapshot * compute.Snapshot
0 commit comments