@@ -71,11 +71,11 @@ type ScaleControllerServer struct {
7171 csi.UnimplementedControllerServer
7272}
7373
74- func (cs * ScaleControllerServer ) IfSameVolReqInProcess (scVol * scaleVolume ) (bool , error ) {
74+ func (cs * ScaleControllerServer ) IfSameVolReqInProcess (scVol * scaleVolume , requestedSize int64 ) (bool , error ) {
7575 capacity , volpresent := cs .Driver .reqmap [scVol .VolName ]
7676 if volpresent {
7777 /* #nosec G115 -- false positive */
78- if capacity == int64 ( scVol . VolSize ) {
78+ if capacity == requestedSize {
7979 return true , nil
8080 } else {
8181 return false , status .Error (codes .Internal , fmt .Sprintf ("Volume %v present in map but requested size %v does not match with size %v in map" , scVol .VolName , scVol .VolSize , capacity ))
@@ -1117,8 +1117,7 @@ func (cs *ScaleControllerServer) CreateVolume(newctx context.Context, req *csi.C
11171117 }
11181118
11191119 }
1120-
1121- volReqInProcess , err := cs .IfSameVolReqInProcess (scaleVol )
1120+ volReqInProcess , err := cs .IfSameVolReqInProcess (scaleVol , req .GetCapacityRange ().GetRequiredBytes ()) //volReqInProcess, err := cs.IfSameVolReqInProcess(scaleVol,blockInfo)
11221121 if err != nil {
11231122 return nil , err
11241123 }
@@ -1127,6 +1126,9 @@ func (cs *ScaleControllerServer) CreateVolume(newctx context.Context, req *csi.C
11271126 klog .Errorf ("[%s] volume:[%v] - volume creation already in process " , loggerId , scaleVol .VolName )
11281127 return nil , status .Error (codes .Aborted , fmt .Sprintf ("volume creation already in process : %v" , scaleVol .VolName ))
11291128 }
1129+ // This is to simulate a delay in volume creation to test IfSameVolReqInProcess
1130+ klog .Infof ("[%s] Simulating a delay of 4 minutes to test IfSameVolReqInProcess" , loggerId )
1131+ time .Sleep (4 * time .Minute )
11301132
11311133 volResponse , err := cs .getCopyJobStatus (ctx , req , volSrc , scaleVol , isVolSource , isSnapSource , snapIdMembers )
11321134 if err != nil {
0 commit comments