From 717446f76601921699b171d53c9480bb72cb03fa Mon Sep 17 00:00:00 2001 From: Amarnath Valluri Date: Thu, 10 Oct 2019 15:56:32 +0300 Subject: [PATCH] mock-driver: Treat 0 as valid source volume ID Creating new volume from existing volume stored at index 0 is a valid source. --- mock/service/controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mock/service/controller.go b/mock/service/controller.go index 7e6c1d7a..4674981b 100644 --- a/mock/service/controller.go +++ b/mock/service/controller.go @@ -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)