From dd4129590098fc69d5f29a1ccf4a69428fd9f2b4 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Tue, 12 Mar 2019 18:37:10 +0530 Subject: [PATCH] store volume size in bytes in configmap during volume creation we check volume size in bytes, and even during listing of volumes and snapshots we need to check size in bytes Signed-off-by: Madhu Rajanna --- pkg/rbd/controllerserver.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/rbd/controllerserver.go b/pkg/rbd/controllerserver.go index 4313576f7..d3bda5ce6 100644 --- a/pkg/rbd/controllerserver.go +++ b/pkg/rbd/controllerserver.go @@ -181,6 +181,9 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol if err != nil { return nil, err } + // store volume size in bytes (snapshot and check existing volume needs volume + // size in bytes) + rbdVol.VolSize = rbdVol.VolSize * util.MiB rbdVolumes[rbdVol.VolID] = rbdVol @@ -191,7 +194,7 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol return &csi.CreateVolumeResponse{ Volume: &csi.Volume{ VolumeId: rbdVol.VolID, - CapacityBytes: rbdVol.VolSize * util.MiB, + CapacityBytes: rbdVol.VolSize, VolumeContext: req.GetParameters(), }, }, nil