Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions ui/src/views/storage/ResizeVolume.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ export default {
},
data () {
return {
offerings: [],
customDiskOffering: false,
loading: false,
customDiskOfferingIops: false
}
Expand All @@ -105,14 +103,23 @@ export default {
},
fetchData () {
this.loading = true
if (this.resource.size != null) {
this.form.size = this.resource.size / (1024 * 1024 * 1024)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens when the volume isnt a whole number of gb, like a root disk from a 2.2 gb template? resize only takes whole numbers so hitting ok without touching the size looks like it fails

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Damans227 for reviewing this PR
Root and data disk sizes are entered in GB, and both parameters are LONG, so a fractional value is rejected before the VM or volume is created. For example:
deployVirtualMachine with rootdisksize=3.5 returns: Unable to execute API command deployvirtualmachine due to invalid value 3.5 for parameter rootdisksize
createVolume with size=5.6 returns: Unable to execute API command createvolume due to invalid value 5.6 for parameter size
resizeVolume.size is also a LONG in GB. A volume created through these calls therefore has a whole-GB size, and that is the value prefilled on Resize.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about a root disk deployed without a size? it takes the template's size, so a 2.2 gb template still gives a 2.2 gb disk and ok fails on it

}
if (!this.resource.diskofferingid) {
this.loading = false
return
}
getAPI('listDiskOfferings', {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this find the offering for a root disk? listing disk offerings skips the ones that belong to a compute offering, so the iops fields wont show there

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
})
Expand Down