@@ -71,11 +71,11 @@ type ScaleControllerServer struct {
71
71
csi.UnimplementedControllerServer
72
72
}
73
73
74
- func (cs * ScaleControllerServer ) IfSameVolReqInProcess (scVol * scaleVolume ) (bool , error ) {
74
+ func (cs * ScaleControllerServer ) IfSameVolReqInProcess (scVol * scaleVolume , requestedSize int64 ) (bool , error ) {
75
75
capacity , volpresent := cs .Driver .reqmap [scVol .VolName ]
76
76
if volpresent {
77
77
/* #nosec G115 -- false positive */
78
- if capacity == int64 ( scVol . VolSize ) {
78
+ if capacity == requestedSize {
79
79
return true , nil
80
80
} else {
81
81
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
1117
1117
}
1118
1118
1119
1119
}
1120
-
1121
- volReqInProcess , err := cs .IfSameVolReqInProcess (scaleVol )
1120
+ volReqInProcess , err := cs .IfSameVolReqInProcess (scaleVol , req .GetCapacityRange ().GetRequiredBytes ()) //volReqInProcess, err := cs.IfSameVolReqInProcess(scaleVol,blockInfo)
1122
1121
if err != nil {
1123
1122
return nil , err
1124
1123
}
@@ -1127,6 +1126,9 @@ func (cs *ScaleControllerServer) CreateVolume(newctx context.Context, req *csi.C
1127
1126
klog .Errorf ("[%s] volume:[%v] - volume creation already in process " , loggerId , scaleVol .VolName )
1128
1127
return nil , status .Error (codes .Aborted , fmt .Sprintf ("volume creation already in process : %v" , scaleVol .VolName ))
1129
1128
}
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 )
1130
1132
1131
1133
volResponse , err := cs .getCopyJobStatus (ctx , req , volSrc , scaleVol , isVolSource , isSnapSource , snapIdMembers )
1132
1134
if err != nil {
0 commit comments