From 124281519f0c3ccfcefbb7f401ec8ea3ad91d4ec Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 20 Dec 2021 19:19:35 +0530 Subject: [PATCH] rbd: add RequestedVolSize to rbdVolume struct when doing the internal operation to get the latest details the rbd image size is also getting updated and this will update the volume size also without actual requested size we cannot do the resize operation for bigger clones. This commit adds a new field called RequestedVolSize to rbdVolume struct to hold the user requested size. Signed-off-by: Madhu Rajanna --- internal/rbd/controllerserver.go | 2 ++ internal/rbd/rbd_util.go | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/rbd/controllerserver.go b/internal/rbd/controllerserver.go index 0cd9dcc0b..7d576cf22 100644 --- a/internal/rbd/controllerserver.go +++ b/internal/rbd/controllerserver.go @@ -136,6 +136,8 @@ func (cs *ControllerServer) parseVolCreateRequest( // always round up the request size in bytes to the nearest MiB/GiB rbdVol.VolSize = util.RoundOffBytes(volSizeBytes) + // RequestedVolSize has the size of the volume requested by the user. + rbdVol.RequestedVolSize = rbdVol.VolSize // start with pool the same as journal pool, in case there is a topology // based split, pool for the image will be updated subsequently diff --git a/internal/rbd/rbd_util.go b/internal/rbd/rbd_util.go index 9fc149d14..ed758d8c7 100644 --- a/internal/rbd/rbd_util.go +++ b/internal/rbd/rbd_util.go @@ -164,7 +164,10 @@ type rbdVolume struct { VolName string `json:"volName"` MonValueFromSecret string `json:"monValueFromSecret"` VolSize int64 `json:"volSize"` - DisableInUseChecks bool `json:"disableInUseChecks"` + // RequestedVolSize has the size of the volume requested by the user and + // this value will not be updated when doing getImageInfo() on rbdVolume. + RequestedVolSize int64 + DisableInUseChecks bool `json:"disableInUseChecks"` readOnly bool Primary bool ThickProvision bool