Skip to content

Commit 5d4a5d6

Browse files
committed
mock-driver: Treat 0 as valid source volume ID
Creating new volume from existing volume stored at index 0 is a valid source.
1 parent e0fc992 commit 5d4a5d6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mock/service/controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (s *service) CreateVolume(
7373
case *csi.VolumeContentSource_Volume:
7474
vid := req.GetVolumeContentSource().GetVolume().GetVolumeId()
7575
// Check if the source volume exists.
76-
if volID, _ := s.findVolNoLock("id", vid); volID > 0 {
76+
if volID, _ := s.findVolNoLock("id", vid); volID >= 0 {
7777
v = s.newVolumeFromVolume(req.Name, capacity, volID)
7878
} else {
7979
return nil, status.Errorf(codes.NotFound, "Requested source volume %s not found", vid)

0 commit comments

Comments
 (0)