From db7b1f2ae3e791615b64e92acd68d9048e28dd4e Mon Sep 17 00:00:00 2001 From: lasith-kg Date: Mon, 25 Dec 2023 07:10:16 +0000 Subject: [PATCH] (feat): Rename ShouldResize() --- internal/backend/resize.go | 2 +- internal/layer/resize.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/backend/resize.go b/internal/backend/resize.go index 33721c9..970bf22 100644 --- a/internal/backend/resize.go +++ b/internal/backend/resize.go @@ -14,7 +14,7 @@ type BlockDeviceMetrics struct { BlockDeviceSize uint64 } -func (bdm *BlockDeviceMetrics) ShouldResize(threshold float64) bool { +func (bdm *BlockDeviceMetrics) WithinThreshold(threshold float64) bool { // Minimum File System Size (mfss) mfss := float64(bdm.BlockDeviceSize) * (threshold / 100) return float64(bdm.FileSystemSize) < mfss diff --git a/internal/layer/resize.go b/internal/layer/resize.go index 889153c..b528e67 100644 --- a/internal/layer/resize.go +++ b/internal/layer/resize.go @@ -41,7 +41,7 @@ func (fdl *ResizeDeviceLayer) Modify(c *config.Config) ([]action.Action, error) // If the resize threshold is set to 0, let us ensure that there is always // an attempt to resize the block device. For the currently supported file systems // xfs and ext4, the commands to resize the block device are idempotent - if rt == 0 || metrics.ShouldResize(rt) { + if rt == 0 || metrics.WithinThreshold(rt) { a, err := fdl.deviceResizeBackend.Resize(bd) if err != nil { return nil, err @@ -65,7 +65,7 @@ func (fdl *ResizeDeviceLayer) Validate(c *config.Config) error { rt := c.GetResizeThreshold(name) // If the resize threshold is 0, then the device would always be resized // Therefore, lets ignore that case from our validation checks - if rt > 0 && metrics.ShouldResize(rt) { + if rt > 0 && metrics.WithinThreshold(rt) { return fmt.Errorf("🔴 %s: Failed to resize file system. File System=%d Block Device=%d (bytes)", name, metrics.FileSystemSize, metrics.BlockDeviceSize) } }