Skip to content

Commit

Permalink
ingest new Propolis VM creation API (#7211)
Browse files Browse the repository at this point in the history
Update Omicron to use the new Propolis VM creation API defined in
oxidecomputer/propolis#813 and oxidecomputer/propolis#816. This API
requires clients to pass instance specs to create new VMs and component
replacement lists to migrate existing VMs. Construct these in sled agent
for now; in the future this logic can move to Nexus and become part of a
robust virtual platform abstraction. For now the goal is just to keep
everything working for existing VMs while adapting to the new Propolis
API.

Slightly adjust the sled agent instance APIs so that Nexus specifies
disks and boot orderings using sled-agent-defined types and not
re-exported Propolis types.

Finally, adapt Nexus to the fact that Crucible's
`VolumeConstructionRequest` and `CrucibleOpts` types no longer appear in
Propolis's generated client (and so don't appear in sled agent's client
either). Instead, the `propolis-client` crate re-exports these types
directly from its `crucible-client-types` dependency. For the most part,
this involves updating `use` directives and storing `SocketAddr`s in
their natively typed form instead of converting them to and from
strings.

Tests: cargo nextest, plus ad hoc testing in a dev cluster as described
in the PR comments.
  • Loading branch information
gjcolombo authored Dec 20, 2024
1 parent 6672f1f commit c1281a9
Show file tree
Hide file tree
Showing 38 changed files with 799 additions and 695 deletions.
22 changes: 13 additions & 9 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -547,10 +547,10 @@ prettyplease = { version = "0.2.25", features = ["verbatim"] }
proc-macro2 = "1.0"
progenitor = "0.8.0"
progenitor-client = "0.8.0"
bhyve_api = { git = "https://github.com/oxidecomputer/propolis", rev = "220a6f367c18f2452dbc4fa9086f3fe73b961739" }
propolis_api_types = { git = "https://github.com/oxidecomputer/propolis", rev = "220a6f367c18f2452dbc4fa9086f3fe73b961739" }
propolis-client = { git = "https://github.com/oxidecomputer/propolis", rev = "220a6f367c18f2452dbc4fa9086f3fe73b961739" }
propolis-mock-server = { git = "https://github.com/oxidecomputer/propolis", rev = "220a6f367c18f2452dbc4fa9086f3fe73b961739" }
bhyve_api = { git = "https://github.com/oxidecomputer/propolis", rev = "d4529fd8247386b422b78e1203315d5baea5ea8b" }
propolis_api_types = { git = "https://github.com/oxidecomputer/propolis", rev = "d4529fd8247386b422b78e1203315d5baea5ea8b" }
propolis-client = { git = "https://github.com/oxidecomputer/propolis", rev = "d4529fd8247386b422b78e1203315d5baea5ea8b" }
propolis-mock-server = { git = "https://github.com/oxidecomputer/propolis", rev = "d4529fd8247386b422b78e1203315d5baea5ea8b" }
proptest = "1.5.0"
qorb = "0.2.1"
quote = "1.0"
Expand Down
1 change: 1 addition & 0 deletions clients/sled-agent-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ omicron-uuid-kinds.workspace = true
omicron-workspace-hack.workspace = true
oxnet.workspace = true
progenitor.workspace = true
propolis-client.workspace = true
regress.workspace = true
reqwest = { workspace = true, features = [ "json", "rustls-tls", "stream" ] }
schemars.workspace = true
Expand Down
2 changes: 2 additions & 0 deletions clients/sled-agent-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ use serde::Serialize;
use std::convert::TryFrom;
use uuid::Uuid;

pub use propolis_client::{CrucibleOpts, VolumeConstructionRequest};

progenitor::generate_api!(
spec = "../../openapi/sled-agent.json",
derives = [schemars::JsonSchema, PartialEq],
Expand Down
4 changes: 2 additions & 2 deletions dev-tools/ls-apis/tests/api_dependencies.out
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ Oximeter (client: oximeter-client)
consumed by: omicron-nexus (omicron/nexus) via 2 paths

Propolis (client: propolis-client)
consumed by: omicron-nexus (omicron/nexus) via 2 paths
consumed by: omicron-sled-agent (omicron/sled-agent) via 1 path
consumed by: omicron-nexus (omicron/nexus) via 3 paths
consumed by: omicron-sled-agent (omicron/sled-agent) via 2 paths

Crucible Repair (client: repair-client)
consumed by: crucible-downstairs (crucible/downstairs) via 1 path
Expand Down
2 changes: 1 addition & 1 deletion dev-tools/omdb/src/bin/omdb/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ use omicron_uuid_kinds::InstanceUuid;
use omicron_uuid_kinds::PhysicalDiskUuid;
use omicron_uuid_kinds::PropolisUuid;
use omicron_uuid_kinds::SledUuid;
use sled_agent_client::types::VolumeConstructionRequest;
use sled_agent_client::VolumeConstructionRequest;
use std::borrow::Cow;
use std::cmp::Ordering;
use std::collections::BTreeMap;
Expand Down
2 changes: 1 addition & 1 deletion nexus/db-queries/src/db/datastore/region_replacement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ mod test {

use crate::db::pub_test_utils::TestDatabase;
use omicron_test_utils::dev;
use sled_agent_client::types::VolumeConstructionRequest;
use sled_agent_client::VolumeConstructionRequest;

#[tokio::test]
async fn test_one_replacement_per_volume() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,7 @@ mod test {
use crate::db::pub_test_utils::TestDatabase;
use omicron_test_utils::dev;
use omicron_uuid_kinds::DatasetUuid;
use sled_agent_client::types::VolumeConstructionRequest;
use sled_agent_client::VolumeConstructionRequest;

#[tokio::test]
async fn test_one_replacement_per_volume() {
Expand Down
Loading

0 comments on commit c1281a9

Please sign in to comment.