Repository navigation
Conversation
The image selection list emits the selected template twice when it auto-selects one: once for the row click and once when the selected prop comes back. Each call resets the template state and drops form.rootdisksize. The root DiskSizeSelection only re-emits its value when minrootdisksize changes, and it does not change for the same template, so the size is never set again. When the first compute offering is auto-selected and links a disk offering with a custom size, deployVirtualMachine is then sent without rootdisksize and fails with error 431. Keep the root disk size when the selected template does not change. Fixes: apache#14524
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes the deploy instance wizard sending
deployVirtualMachinewithoutrootdisksizewhen the auto-selected compute offering links a disk offering with a custom size. The API then rejects the request with error 431, "This disk offering requires a custom size specified".Fixes: #14524
Evidence tags: [code] = read at a permalink, [executed] = run locally, [inference] = reasoning I did not run.
Root cause
imagesListwatcher (onClickRow), and again from theselectedwatcher when the parent passes the id back. [code]cloudstack/ui/src/views/compute/wizard/OsBasedImageRadioGroup.vue
Lines 146 to 184 in d02adcd
updateFieldValue('templateid', id), which callsresetFromTemplateConfiguration(). That method deletesrootdisksizefrominstanceConfig, which is the same object as the form. [code]cloudstack/ui/src/views/compute/DeployVM.vue
Lines 2039 to 2045 in d02adcd
cloudstack/ui/src/views/compute/DeployVM.vue
Lines 3289 to 3290 in d02adcd
DiskSizeSelectionemits its value on mount and whenminDiskSizechanges. For the second emit of the same template,minrootdisksizedoes not change, so the size is not emitted again. [code]cloudstack/ui/src/views/compute/wizard/DiskSizeSelection.vue
Lines 80 to 117 in d02adcd
rootdisksizeis only added when the form has it. [code]cloudstack/ui/src/views/compute/DeployVM.vue
Lines 2407 to 2412 in d02adcd
This only happens when the compute offering, and with it the size input, is already in place before the template is selected. That is the case when the first offering is auto-selected. Switching to another offering and back remounts
DiskSizeSelection, which emits the size again. This matches the workaround in the issue. [inference], consistent with the trace below.Change
updateFieldValue('templateid', id)now keepsform.rootdisksizewhen the selected template does not change. Selecting a different template still clears it, as before.Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
ui/tests/unit/views/compute/DeployVMRootDiskSize.spec.js. "keeps the root disk size when the same template is selected again" fails without the change (Expected: 8, Received: undefined) and passes with it. "clears the root disk size when another template is selected" passes both before and after.npm run test:uniton 4.22 with this change: 195 of 196 pass. The one failure isUsageRecords.spec.js(the daylight-saving end date case). It also fails without this change, so it is not caused by this PR.vue-cli-service lint --no-fixon the changed files: no errors.DeployVM.vuein jest with mocked API responses for one zone, one 8 GB template, one compute offering linked to a custom size disk offering, and the default image selection. Without the change, the call order wasupdateFieldValue("rootdisksize", 8),updateFieldValue("templateid", "t1"), thenresetFromTemplateConfiguration(), and the result was a form withoutrootdisksizeand an empty disk size in the summary. With the change, the form keepsrootdisksize: 8and the summary shows8 GB (Root). The same harness with the legacy image selection, or with the compute offerings loading after the template, already had the size before the change.Manual check:
rootdisksize.How did you try to break this feature and the system with this change?
DiskSizeSelectionthrough the changedminrootdisksize.main.Assisted-by: Claude Opus 5.5 (Claude Code)