From 9238207cc795423502e4b22363057c9f302135d0 Mon Sep 17 00:00:00 2001 From: Humble Chirammal Date: Wed, 1 Sep 2021 12:29:17 +0530 Subject: [PATCH] cephfs: save space in the cluster by avoiding roundoff CephFS controller round off ( by util.RoundOffBytes) on the size passed in from the provisioner at present, however this can cause wastage of space in the cluster. The CephFS filesystem is capable of creating volume with the exact size passed in. so no need of Roundoff here before we reach out to the cluster ``` $ ceph fs subvolume create [--size ]... ``` Clone scenario: This shouldnt be an issue as cephfs keep the parent size while the clone is performed, we also have an extra measure at clone to make the requested size is achieved by resize if the backend is not having the requested size. This shouldnt be a case falling into with this patch though. Signed-off-by: Humble Chirammal --- internal/cephfs/controllerserver.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/cephfs/controllerserver.go b/internal/cephfs/controllerserver.go index 6d32837f72a1..d7cf9b2f2a5c 100644 --- a/internal/cephfs/controllerserver.go +++ b/internal/cephfs/controllerserver.go @@ -186,7 +186,12 @@ func (cs *ControllerServer) CreateVolume( defer volOptions.Destroy() if req.GetCapacityRange() != nil { - volOptions.Size = util.RoundOffBytes(req.GetCapacityRange().GetRequiredBytes()) + // we were doing round off ( by util.RoundOffBytes) to the size passed + // in from the provisioner before ceph csi v3.4.0, however this can + // cause wastage of space in the cluster. The CephFS filesystem is capable + // of creating volume with the exact size passed in. so no need of Roundoff + // here before we reach out to the cluster + volOptions.Size = req.GetCapacityRange().GetRequiredBytes() } parentVol, pvID, sID, err := checkContentSource(ctx, req, cr)