Repository navigation
fix(instances): a new VM's vCPUs, memory and disk size are at least 1 - #179
Merged
Merged
Conversation
The create form and the API took 0 or a negative number for vCPUs, memory and a new disk's size: the API queued the job (202) and it failed later in libvirt; the page did the same, its formnovalidate skipping the browser's min. The create model's fields now refuse values below 1, so the form shows the error beside its field and the API answers 400 naming it. The form also checks the MAC addresses as the API and the job do (one per NIC at most, each a MAC address), so a bad one is an error on the form instead of a job that fails. Closes #175
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.
Closes #175.
The create form and the API accepted 0 or a negative number for vCPUs, memory and a new disk's size:
formnovalidate, so the browser'smin=1was skipped.The fix
CreateInstancemodel'svcpu,memoryandhdd_sizefields refuse values below 1 (MinValueValidator(1)). Both the form and the API serializer are built on this model, so both check it. No migration is needed (makemigrations --checkis clean).NewVMFormchecks the MAC addresses withnic_macs, as the API and the job already do. A bad MAC is now an error on the form instead of a job that fails.Verification
🤖 Generated with Claude Code