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 <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2021-12-20 19:19:35 +05:30 committed by mergify[bot]
parent 22365ab77f
commit 124281519f
2 changed files with 6 additions and 1 deletions

View File

@ -136,6 +136,8 @@ func (cs *ControllerServer) parseVolCreateRequest(
// always round up the request size in bytes to the nearest MiB/GiB // always round up the request size in bytes to the nearest MiB/GiB
rbdVol.VolSize = util.RoundOffBytes(volSizeBytes) 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 // start with pool the same as journal pool, in case there is a topology
// based split, pool for the image will be updated subsequently // based split, pool for the image will be updated subsequently

View File

@ -164,6 +164,9 @@ type rbdVolume struct {
VolName string `json:"volName"` VolName string `json:"volName"`
MonValueFromSecret string `json:"monValueFromSecret"` MonValueFromSecret string `json:"monValueFromSecret"`
VolSize int64 `json:"volSize"` VolSize int64 `json:"volSize"`
// 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"` DisableInUseChecks bool `json:"disableInUseChecks"`
readOnly bool readOnly bool
Primary bool Primary bool