From 17f02a71bd27f4c343601847dcf44808a6624ef2 Mon Sep 17 00:00:00 2001 From: Surya Gupta Date: Mon, 28 Sep 2026 11:20:50 +0530 Subject: [PATCH] [CCS-5] Volume Resize Fix for IOPS and Size (#106) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Description On Resize Volume, the form did not show the volume’s current size and IOPS. It also used the first disk offering in the list, not the offering already attached to the volume. So the dialog often opened empty or with the wrong IOPS fields, and a resize could send the wrong values. Root cause Three UI issues in fetchData(): Size unit — the API stores size in bytes. The form label is GB. Size was never copied onto the form, so the GB field stayed empty. Wrong offering — the code always used this.offerings[0] (first offering returned by listDiskOfferings), not this.resource.diskofferingid (the volume’s offering). Custom size / custom IOPS flags could be wrong. IOPS not filled — even when min/max IOPS existed on the volume, they were not copied into form.miniops / form.maxiops. Steps to reproduce Create a volume with a custom IOPS disk offering (for example min 2000, max 5000) and a known size (for example 20 GB). Open Storage → Volumes → Resize. Check the Size (GB) field and the Min/Max IOPS fields. ### Types of changes - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] New feature (non-breaking change which adds functionality) - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] Enhancement (improves an existing feature and functionality) - [ ] Cleanup (Code refactoring and cleanup, that may add test cases) - [ ] Build/CI - [ ] Test (unit or integration test code) ### Feature/Enhancement Scale or Bug Severity #### Feature/Enhancement Scale - [ ] Major - [ ] Minor #### Bug Severity - [ ] BLOCKER - [ ] Critical - [ ] Major - [ ] Minor - [ ] Trivial ### Screenshots (if appropriate): Before Fix: image After Fix: image ### How Has This Been Tested? Tested with both Fix and Custom IOPS: 1- Resize Shows IOPS value for custom IOPS not for fix, along with size 2- Exact 20 GB volume → shows as 20 float 20.1 -> shows on UI as 20 #### How did you try to break this feature and the system with this change? --------- Co-authored-by: Gupta, Surya --- ui/src/views/storage/ResizeVolume.vue | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/ui/src/views/storage/ResizeVolume.vue b/ui/src/views/storage/ResizeVolume.vue index 5f9efd6ed506..2b6d4cb17901 100644 --- a/ui/src/views/storage/ResizeVolume.vue +++ b/ui/src/views/storage/ResizeVolume.vue @@ -83,8 +83,6 @@ export default { }, data () { return { - offerings: [], - customDiskOffering: false, loading: false, customDiskOfferingIops: false } @@ -105,14 +103,23 @@ export default { }, fetchData () { this.loading = true + if (this.resource.size != null) { + this.form.size = this.resource.size / (1024 * 1024 * 1024) + } + if (!this.resource.diskofferingid) { + this.loading = false + return + } getAPI('listDiskOfferings', { - zoneid: this.resource.zoneid, - listall: true + id: this.resource.diskofferingid, + state: 'all' }).then(json => { - this.offerings = json.listdiskofferingsresponse.diskoffering || [] - this.form.diskofferingid = this.offerings[0].id || '' - this.customDiskOffering = this.offerings[0].iscustomized || false - this.customDiskOfferingIops = this.offerings[0].iscustomizediops || false + const currentOffering = (json.listdiskofferingsresponse.diskoffering || [])[0] + this.customDiskOfferingIops = currentOffering?.iscustomizediops || false + if (this.customDiskOfferingIops) { + this.form.miniops = this.resource.miniops + this.form.maxiops = this.resource.maxiops + } }).finally(() => { this.loading = false })