Skip to content

Commit

Permalink
mock-driver: Treat 0 as valid source volume ID
Browse files Browse the repository at this point in the history
Creating new volume from existing volume stored at index 0 is a valid source.
  • Loading branch information
avalluri committed Oct 10, 2019
1 parent e0fc992 commit 5d4a5d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mock/service/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (s *service) CreateVolume(
case *csi.VolumeContentSource_Volume:
vid := req.GetVolumeContentSource().GetVolume().GetVolumeId()
// Check if the source volume exists.
if volID, _ := s.findVolNoLock("id", vid); volID > 0 {
if volID, _ := s.findVolNoLock("id", vid); volID >= 0 {
v = s.newVolumeFromVolume(req.Name, capacity, volID)
} else {
return nil, status.Errorf(codes.NotFound, "Requested source volume %s not found", vid)
Expand Down

0 comments on commit 5d4a5d6

Please sign in to comment.