[nexus] Accept DiskSource::{Image, Snapshot}s without read_only
#9766
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.
@ahl rightly points out that the common case for the
disk_createAPIs is to create read-write disks, and it seems like kind of a drag to require all calls to create a read-write disk from an image or snapshot to include a"read_only": falsefield in the JSON body. Thus, this commit adds#[serde(default)]so that disk source params without a"read_only"are the same as"read_only": false.Unfortunately, we didn't catch this until after #9731 merged, so fixing it the proper way requires a whole new API version. Since the conversion between the Rust params types in
nexus-typesis trivial, it might have been possible to bend the rules a bit here and just tweak the previously-generated API version to make the field nullable --- clients operating with the slightly-older version of that version would still always be accepted since they would always send the field. But, bending the rules makes me scared I'm gonna get in trouble, so I did it the proper way, at the expense of a whole lot of code that does basically nothing.