Skip to content

Commit

Permalink
server: add a first-class error type to machine init
Browse files Browse the repository at this point in the history
Add a `MachineInitError` type and make `MachineInitializer` functions
return it. This makes it more convenient to handle new logic errors in
initializer functions. To handle the (many) cases where the initializer
calls bhyve ioctls or filesystem functions that return `std::io:Error`,
`MachineInitError` has a catchall `anyhow::Error` variant; this
encourages calls that produce I/O errors to call `context` or
`with_context` to better describe those errors.

Tested by running propolis-server ad hoc in a couple of invalid
configurations (file backend not pointing to an actual file; too many
vCPUs; more guest memory than the host has available) and verified that
the error chains (and contexts, if applicable) show up in the Propolis
logs.
  • Loading branch information
gjcolombo committed Oct 2, 2024
1 parent 5a71bed commit c325c58
Show file tree
Hide file tree
Showing 3 changed files with 222 additions and 128 deletions.
Loading

0 comments on commit c325c58

Please sign in to comment.