You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Make PATCH /machine-config requests transactional
Ensure that modifications to the machine configuration are "all or
nothing", e.g. no modifications happen if any part of the update causes
an error (such as incorrect guest memory size). This fixes various
possible bugs where, say, the validation of an updated vcpu field
succeeds (meaning the vcpu field of the machine configuration is
updated), but then a subsequent validation of the mem_size_mib field
fails (say, because its 0), causing a error response to be returned to
the user, yet not reverting the update to the vcpu field (in maybe more
severe situations, it is possible to bypass the check that the balloon
device is not configured to have a balloon larger than the total guest
memory size, as mem_size_mib is updated before this check is being
done).
We fix this by using a Haskell-style approach to updating the
configuration: In the update method, construct a new VmConfig object and
return this; then only update the vm_config field on the VmResources
struct if all validations have passed with the new vm_config object.
Signed-off-by: Patrick Roy <[email protected]>
0 commit comments