Skip to content

Commit 2826bde

Browse files
committed
add existing disk isDiskReady check
1 parent be025c0 commit 2826bde

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

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

+7-8
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,13 @@ func (gceCS *GCEControllerServer) CreateVolume(ctx context.Context, req *csi.Cre
175175
return nil, status.Error(codes.AlreadyExists, fmt.Sprintf("CreateVolume disk already exists with same name and is incompatible: %v", err))
176176
}
177177

178-
// ready, err := isDiskReady(existingDisk)
179-
// if err != nil {
180-
// return nil, status.Error(codes.Internal, fmt.Sprintf("CreateVolume disk %v had error checking ready status: %v", volKey, err))
181-
// }
182-
183-
// if !ready {
184-
// return nil, status.Error(codes.Internal, fmt.Sprintf("CreateVolume existing disk %v is not ready. The existing disk %v has status %v. ", volKey, existingDisk, existingDisk.GetStatus()))
185-
// }
178+
ready, err := isDiskReady(existingDisk)
179+
if err != nil {
180+
return nil, status.Error(codes.Internal, fmt.Sprintf("CreateVolume disk %v had error checking ready status: %v", volKey, err))
181+
}
182+
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.GetDiskId(), existingDisk.GetStatus(), existingDisk.GetZone(), existingDisk.LocationType()))
184+
}
186185

187186
// If there is no validation error, immediately return success
188187
klog.V(4).Infof("CreateVolume succeeded for disk %v, it already exists and was compatible", volKey)

0 commit comments

Comments
 (0)