Skip to content

Commit a4b2fc8

Browse files
committed
squash commits
1 parent 597c90a commit a4b2fc8

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

pkg/gce-pd-csi-driver/controller.go

+2-7
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func (gceCS *GCEControllerServer) CreateVolume(ctx context.Context, req *csi.Cre
180180
return nil, status.Error(codes.Internal, fmt.Sprintf("CreateVolume disk %v had error checking ready status: %v", volKey, err))
181181
}
182182
if !ready {
183-
return nil, status.Error(codes.Internal, fmt.Sprintf("CreateVolume existing disk %v is not ready. Existing disk state= name: %v, ID: %v, status: %v, zone: %v, location-type: %v", volKey, existingDisk.GetName(), existingDisk.GetSourceDiskId(), existingDisk.GetStatus(), existingDisk.GetZone(), existingDisk.LocationType()))
183+
return nil, status.Error(codes.Internal, fmt.Sprintf("CreateVolume existing disk %v is not ready.", volKey))
184184
}
185185

186186
// If there is no validation error, immediately return success
@@ -207,15 +207,10 @@ func (gceCS *GCEControllerServer) CreateVolume(ctx context.Context, req *csi.Cre
207207
if content.GetVolume() != nil {
208208
volumeContentSourceVolumeID = content.GetVolume().GetVolumeId()
209209
// Verify that the source VolumeID is in the correct format.
210-
_, _, err := common.VolumeIDToKey(volumeContentSourceVolumeID)
210+
project, volKey, err := common.VolumeIDToKey(volumeContentSourceVolumeID)
211211
if err != nil {
212212
return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("CreateVolume source volume ID is invalid: %v", err))
213213
}
214-
// Verify the volume in VolumeContentSource exists.
215-
if acquired := gceCS.volumeLocks.TryAcquire(volumeContentSourceVolumeID); acquired {
216-
return nil, status.Errorf(codes.NotFound, "CreateVolume source volume %s does not exist", volumeContentSourceVolumeID)
217-
}
218-
defer gceCS.volumeLocks.Release(volumeContentSourceVolumeID)
219214

220215
// Verify that the volume in VolumeContentSource exists.
221216
diskFromSourceVolume, err := gceCS.CloudProvider.GetDisk(ctx, project, volKey, gceAPIVersion)

0 commit comments

Comments
 (0)