@@ -394,6 +394,14 @@ func (gceCS *GCEControllerServer) ControllerUnpublishVolume(ctx context.Context,
394
394
return nil , status .Error (codes .InvalidArgument , fmt .Sprintf ("ControllerUnpublishVolume Volume ID is invalid: %v" , err ))
395
395
}
396
396
397
+ project , volKey , err = gceCS .CloudProvider .RepairUnderspecifiedVolumeKey (ctx , project , volKey )
398
+ if err != nil {
399
+ if gce .IsGCENotFoundError (err ) {
400
+ return nil , status .Errorf (codes .NotFound , "ControllerUnpublishVolume could not find volume with ID %v: %v" , volumeID , err )
401
+ }
402
+ return nil , status .Errorf (codes .Internal , "ControllerUnpublishVolume error repairing underspecified volume key: %v" , err )
403
+ }
404
+
397
405
// Acquires the lock for the volume on that node only, because we need to support the ability
398
406
// to unpublish the same volume from different nodes concurrently
399
407
lockingVolumeID := fmt .Sprintf ("%s/%s" , nodeID , volumeID )
@@ -451,6 +459,14 @@ func (gceCS *GCEControllerServer) ValidateVolumeCapabilities(ctx context.Context
451
459
return nil , status .Error (codes .InvalidArgument , fmt .Sprintf ("Volume ID is invalid: %v" , err ))
452
460
}
453
461
462
+ project , volKey , err = gceCS .CloudProvider .RepairUnderspecifiedVolumeKey (ctx , project , volKey )
463
+ if err != nil {
464
+ if gce .IsGCENotFoundError (err ) {
465
+ return nil , status .Errorf (codes .NotFound , "ValidateVolumeCapabilities could not find volume with ID %v: %v" , volumeID , err )
466
+ }
467
+ return nil , status .Errorf (codes .Internal , "ValidateVolumeCapabilities error repairing underspecified volume key: %v" , err )
468
+ }
469
+
454
470
if acquired := gceCS .volumeLocks .TryAcquire (volumeID ); ! acquired {
455
471
return nil , status .Errorf (codes .Aborted , common .VolumeOperationAlreadyExistsFmt , volumeID )
456
472
}
@@ -715,6 +731,14 @@ func (gceCS *GCEControllerServer) ControllerExpandVolume(ctx context.Context, re
715
731
return nil , status .Error (codes .InvalidArgument , fmt .Sprintf ("ControllerExpandVolume Volume ID is invalid: %v" , err ))
716
732
}
717
733
734
+ project , volKey , err = gceCS .CloudProvider .RepairUnderspecifiedVolumeKey (ctx , project , volKey )
735
+ if err != nil {
736
+ if gce .IsGCENotFoundError (err ) {
737
+ return nil , status .Errorf (codes .NotFound , "ControllerExpandVolume could not find volume with ID %v: %v" , volumeID , err )
738
+ }
739
+ return nil , status .Errorf (codes .Internal , "ControllerExpandVolume error repairing underspecified volume key: %v" , err )
740
+ }
741
+
718
742
resizedGb , err := gceCS .CloudProvider .ResizeDisk (ctx , project , volKey , reqBytes )
719
743
if err != nil {
720
744
return nil , status .Error (codes .Internal , fmt .Sprintf ("ControllerExpandVolume failed to resize disk: %v" , err ))
0 commit comments