Skip to content

Commit

Permalink
Define versioned instance specs (#472)
Browse files Browse the repository at this point in the history
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
gjcolombo authored Aug 18, 2023
1 parent d17770b commit fd76baa
Show file tree
Hide file tree
Showing 27 changed files with 2,322 additions and 1,617 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions bin/propolis-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ cfg-if.workspace = true
chrono = { workspace = true, features = [ "serde" ] }
clap = { workspace = true, features = ["derive"] }
const_format.workspace = true
crucible-client-types.workspace = true
dropshot = { workspace = true, features = ["usdt-probes"] }
enum-iterator.workspace = true
erased-serde.workspace = true
Expand Down
Loading

0 comments on commit fd76baa

Please sign in to comment.