Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define versioned instance specs (#472)
Define a VersionedInstanceSpec enum and rearrange the instance spec types to support it. The biggest rearrangement here is that spec types are now logically separated into "components" and "structural types" that have slightly different versioning and compatibility rules. The idea is to make it inexpensive to amend components (which will change more often but can be usually be changed in backward-compatible ways) while retaining some strong versioning for specs as a whole (so that we can change spec formats wholesale if we need to without having to add API endpoints). See the new theory statement in instance_spec/mod.rs and the most recent updates to RFD 283 for more details and discussion. Make a few additional changes along the way: * Switch the CrucibleStorageBackend type back from embedding a crucible_client_types::VolumeConstructionRequest to using a serialized VolumeConstructionRequest. This is needed to ensure that changes to the VCR obey our component versioning rules. For a time I'd thought we could do without this because Nexus and sled agent would have to reconstruct "fresh" volume construction requests with the correct format every time they created a new Propolis. I think that's still true at this point, but I would rather not have any exceptions to the versioning rules if we can help it. * "Flatten" the DeviceKind and BackendKind enum types into individual structs. That is, instead of having a struct StorageBackend that contains an enum StorageBackendKind with File, Crucible, and InMemory variants, have separate FileStorageBackend, CrucibleStorageBackend, and InMemoryBackend types, then define supporting enums for them in the versioned spec structures. This makes it easier to impl traits or helper routines for an individual component (e.g. this makes it easier to have a Display or Debug impl for InMemoryStorageBackend that doesn't yeet a giant base64 string into the output formatter). * Rearrange some migration compatibility traits and errors. Notably, remove the BackendNames type from the instance spec library and instead put it in the propolis-server migration code (where it belongs; the type only matters when constructing an LM preamble). * Finally, add an affordance to pretty-print instance specs and properties to the log when starting a new VM, so that it's easy to see at a glance what configuration has been requested. Fixes #421. Fixes #467.
- Loading branch information