Skip to content

Commit

Permalink
Supply real volume data to propolis
Browse files Browse the repository at this point in the history
Instance creation now can specify that existing disks be attached to
the instance (disk creation during instance creation is not yet
implemented).

There's a few important changes here.

Nexus will instruct the sled agent to send volume construction requests
when it ensures the instance, and therefore has to build these requests.
This is done in sdc_regions_ensure as regions are allocated.

sic_create_instance_record no longer returns the runtime of an instance,
but the instance's name.

Importantly, the instance creation saga now calls Nexus'
instance_set_runtime instead of duplicating the logic to call
instance_put. Nexus' instance_set_runtime will populate the
InstanceHardware with NICs and disks.

Nexus' disk_set_runtime now *optionally* calls the sled agent's
disk_put if the instance is running already, otherwise the disk will be
attached as part of the instance ensure by specifying volume requests.

request_body_max_bytes had to be increased to 1M because the volume
requests could be arbitrarily large (and eventually, the cloud init
bytes will add to the body size too).
  • Loading branch information
jmpesp committed Mar 18, 2022
1 parent c66d2f6 commit c833176
Show file tree
Hide file tree
Showing 22 changed files with 1,001 additions and 89 deletions.
232 changes: 230 additions & 2 deletions Cargo.lock

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

6 changes: 6 additions & 0 deletions common/src/api/external/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,12 @@ impl<T: ClientError> From<progenitor::progenitor_client::Error<T>> for Error {
}
}

impl From<serde_json::Error> for Error {
fn from(e: serde_json::Error) -> Self {
Error::internal_error(&e.to_string())
}
}

/// Like [`assert!`], except that instead of panicking, this function returns an
/// `Err(Error::InternalError)` with an appropriate message if the given
/// condition is not true.
Expand Down
4 changes: 4 additions & 0 deletions common/src/api/external/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,10 @@ impl Generation {
assert!(next_gen <= u64::try_from(i64::MAX).unwrap());
Generation(next_gen)
}

pub fn get(&self) -> u64 {
self.0
}
}

impl Display for Generation {
Expand Down
3 changes: 2 additions & 1 deletion nexus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ path = "../rpaths"
anyhow = "1.0"
async-bb8-diesel = { git = "https://github.com/oxidecomputer/async-bb8-diesel", rev = "c849b717be" }
async-trait = "0.1.51"
base64 = "0.13.0"
bb8 = "0.7.1"
cookie = "0.16"
crucible-agent-client = { git = "https://github.com/oxidecomputer/crucible", rev = "3e7e49eeb88fa8ad74375b0642aabd4224b1f2cb" }
crucible-agent-client = { git = "https://github.com/oxidecomputer/crucible", rev = "32e603bdc3b6e5eb6b880a2ddde7e05f043b5357" }
# Tracking pending 2.0 version.
diesel = { git = "https://github.com/diesel-rs/diesel", rev = "ce77c382", features = ["postgres", "r2d2", "chrono", "serde_json", "network-address", "uuid"] }
futures = "0.3.21"
Expand Down
Loading

0 comments on commit c833176

Please sign in to comment.