@@ -73,9 +73,14 @@ type ScaleControllerServer struct {
73
73
74
74
func (cs * ScaleControllerServer ) IfSameVolReqInProcess (scVol * scaleVolume , requestedSize int64 ) (bool , error ) {
75
75
capacity , volpresent := cs .Driver .reqmap [scVol .VolName ]
76
+
76
77
if volpresent {
77
78
/* #nosec G115 -- false positive */
79
+ << << << < Updated upstream
78
80
if capacity == requestedSize {
81
+ == == == =
82
+ if int64 (scVol .VolSize ) == capacity {
83
+ >> >> >> > Stashed changes
79
84
return true , nil
80
85
} else {
81
86
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 ))
@@ -269,6 +274,7 @@ func (cs *ScaleControllerServer) setQuota(ctx context.Context, scVol *scaleVolum
269
274
}
270
275
271
276
filesetQuotaBytes , err := ConvertToBytes (quota )
277
+
272
278
if err != nil {
273
279
if strings .Contains (err .Error (), "invalid number specified" ) {
274
280
// Invalid number specified means quota is not set
@@ -278,6 +284,21 @@ func (cs *ScaleControllerServer) setQuota(ctx context.Context, scVol *scaleVolum
278
284
}
279
285
}
280
286
287
+ << << << < Updated upstream
288
+ == == == =
289
+ // changing volsize here for pvc size in decimal units to align with scale block size
290
+ // filesystemName := scVol.VolBackendFs
291
+ // klog.Info("Filesystemname", filesystemName)
292
+ // filesystemDetails, err := scVol.Connector.GetFilesystemDetails(ctx, filesystemName)
293
+ // if err != nil {
294
+ // klog.Errorf("Unable to get the filesystemdetails")
295
+ // }
296
+ // klog.Info("filesystem details", filesystemDetails)
297
+ // blockInfo := filesystemDetails.Block.BlockSize
298
+ // roundedBlock := uint64(math.Floor(float64(scVol.VolSize) / float64(blockInfo)))
299
+ // scVol.VolSize = roundedBlock * uint64(blockInfo)
300
+
301
+ >> >> >> > Stashed changes
281
302
if filesetQuotaBytes != scVol .VolSize {
282
303
var hardLimit , softLimit string
283
304
hardLimit = strconv .FormatUint (scVol .VolSize , 10 )
@@ -664,6 +685,8 @@ func (cs *ScaleControllerServer) createFilesetVol(ctx context.Context, scVol *sc
664
685
}
665
686
}
666
687
targetBasePath := ""
688
+ // changing the quota
689
+
667
690
if ! isCGIndependentFset {
668
691
if scVol .VolSize != 0 {
669
692
err = cs .setQuota (ctx , scVol , volName )
@@ -726,7 +749,8 @@ func handleUpdateComment(ctx context.Context, scVol *scaleVolume, setAfmAttribut
726
749
727
750
func (cs * ScaleControllerServer ) getVolumeSizeInBytes (req * csi.CreateVolumeRequest ) int64 {
728
751
capacity := req .GetCapacityRange ()
729
- return capacity .GetRequiredBytes ()
752
+ requiredBytes := capacity .GetRequiredBytes ()
753
+ return requiredBytes
730
754
}
731
755
732
756
func updateComment (ctx context.Context , scVol * scaleVolume , setAfmAttributes bool , afmTuningParams map [string ]interface {}) error {
@@ -905,7 +929,6 @@ func (cs *ScaleControllerServer) CreateVolume(newctx context.Context, req *csi.C
905
929
906
930
/* Get volume size in bytes */
907
931
volSize := cs .getVolumeSizeInBytes (req )
908
-
909
932
reqCapabilities := req .GetVolumeCapabilities ()
910
933
if reqCapabilities == nil {
911
934
return nil , status .Error (codes .InvalidArgument , "Volume Capabilities is a required field" )
@@ -1095,7 +1118,12 @@ func (cs *ScaleControllerServer) CreateVolume(newctx context.Context, req *csi.C
1095
1118
1096
1119
return & csi.CreateVolumeResponse {
1097
1120
Volume : & csi.Volume {
1121
+ << << << < Updated upstream
1098
1122
VolumeId : volID ,
1123
+ == == == =
1124
+ VolumeId : volID ,
1125
+ //CapacityBytes: int64(scaleVol.VolSize), // #nosec G115 -- false positive
1126
+ >> >> >> > Stashed changes
1099
1127
CapacityBytes : req .GetCapacityRange ().GetRequiredBytes (), // #nosec G115 -- false positive
1100
1128
VolumeContext : req .GetParameters (),
1101
1129
ContentSource : volSrc ,
@@ -1178,7 +1206,24 @@ func (cs *ScaleControllerServer) CreateVolume(newctx context.Context, req *csi.C
1178
1206
if capRange == nil {
1179
1207
return nil , status .Error (codes .InvalidArgument , "volume range is not provided" )
1180
1208
}
1209
+ << << << < Updated upstream
1210
+ capacity := uint64 (capRange .GetRequiredBytes ()) // #nosec G115 -- false positive
1211
+ == == == =
1212
+
1213
+ // changing capacity here for pvc size in decimal units to align with scale block size
1181
1214
capacity := uint64 (capRange .GetRequiredBytes ()) // #nosec G115 -- false positive
1215
+ // filesystemName := scaleVol.VolBackendFs
1216
+ // filesystemDetails, err := scaleVol.Connector.GetFilesystemDetails(ctx, filesystemName)
1217
+ // if err != nil {
1218
+ // klog.Errorf("[%s] Create Volume - unable to get filesystem details ", err)
1219
+ // return nil, status.Error(codes.Internal, fmt.Sprintf("CreateVolume - unable to get filesystem details for Filesystem", err))
1220
+ // }
1221
+ // blockinfo := filesystemDetails.Block.BlockSize
1222
+ // roundedblock := uint64(math.Floor(float64(capacity) / float64(blockinfo)))
1223
+ // capacity = roundedblock * uint64(blockinfo)
1224
+ // klog.Info("new capacity", capacity)
1225
+
1226
+ >> >> >> > Stashed changes
1182
1227
targetPath , err = cs .createStaticBasedVol (ctx , scaleVol , filesetName , capacity )
1183
1228
} else if scaleVol .IsFilesetBased {
1184
1229
targetPath , err = cs .createFilesetBasedVol (ctx , scaleVol , isCGVolume , volFsInfo .Type , req .Secrets , afmTuningParams , gatewayNodeName )
@@ -1232,7 +1277,12 @@ func (cs *ScaleControllerServer) CreateVolume(newctx context.Context, req *csi.C
1232
1277
1233
1278
return & csi.CreateVolumeResponse {
1234
1279
Volume : & csi.Volume {
1280
+ << << << < Updated upstream
1235
1281
VolumeId : volID ,
1282
+ == == == =
1283
+ VolumeId : volID ,
1284
+ //CapacityBytes: int64(scaleVol.VolSize) // #nosec G115 -- false positive
1285
+ >> >> >> > Stashed changes
1236
1286
CapacityBytes : req .GetCapacityRange ().GetRequiredBytes (), // #nosec G115 -- false positive
1237
1287
VolumeContext : req .GetParameters (),
1238
1288
ContentSource : volSrc ,
@@ -1374,9 +1424,15 @@ func (cs *ScaleControllerServer) setScaleVolume(ctx context.Context, req *csi.Cr
1374
1424
//getting the filesystemname
1375
1425
filesystemName := scaleVol .VolBackendFs
1376
1426
klog .Info ("Filesystemname" , filesystemName )
1427
+ << << << < Updated upstream
1377
1428
filesystemDetails , err := cs .Driver .connmap ["primary" ].GetFilesystemDetails (ctx , filesystemName )
1378
1429
if err != nil {
1379
1430
klog .Errorf ("%s Unable to get the filesystemdetails for Filesystem %s. Error: %v" , utils .GetLoggerId (ctx ), filesystemName , err )
1431
+ == == == =
1432
+ filesystemDetails , err := scaleVol .Connector .GetFilesystemDetails (ctx , filesystemName )
1433
+ if err != nil {
1434
+ klog .Errorf ("Unable to get the filesystemdetails" )
1435
+ >> >> >> > Stashed changes
1380
1436
return nil , false , "" , status .Error (codes .Internal , fmt .Sprintf ("unable to get filesystem details for Filesystem %s. Error: %v" , filesystemName , err ))
1381
1437
}
1382
1438
klog .V (4 ).Infof ("[%s] filesystemDetails: %+v" , utils .GetLoggerId (ctx ), filesystemDetails )
@@ -1394,6 +1450,7 @@ func (cs *ScaleControllerServer) setScaleVolume(ctx context.Context, req *csi.Cr
1394
1450
scaleVol .VolSize = smallestVolSize
1395
1451
} else {
1396
1452
scaleVol .VolSize = uint64 (volSize ) // #nosec G115 -- false positive
1453
+
1397
1454
}
1398
1455
1399
1456
/* Get details for Primary Cluster */
0 commit comments