Skip to content

Commit

Permalink
Add faux-mgs binary to the switch zone (#6164)
Browse files Browse the repository at this point in the history
Closes #6153
  • Loading branch information
jgallagher authored Jul 29, 2024
1 parent 1bb75f2 commit 24f7cc0
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 38 deletions.
52 changes: 26 additions & 26 deletions Cargo.lock

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

12 changes: 10 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,16 @@ fs-err = "2.11.0"
futures = "0.3.30"
gateway-api = { path = "gateway-api" }
gateway-client = { path = "clients/gateway-client" }
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "c85a4ca043aaa389df12aac5348d8a3feda28762", default-features = false, features = ["std"] }
gateway-sp-comms = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "c85a4ca043aaa389df12aac5348d8a3feda28762" }
# If you're updating the pinned revision of these MGS dependencies, you should
# also update the git commit revision for the `omicron-faux-mgs` package in
# `package-manifest.toml`. Failure to do so won't cause incorrect behavior, but
# does mean the `faux-mgs` shipped with the switch zone would be out of date
# relative to the MGS proper shipped in that same switch zone. (Generally this
# is "fine", because SP/MGS communication maintains forwards and backwards
# compatibility, but will mean that faux-mgs might be missing new
# functionality.)
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "319e7b92db69792ab8efa4c68554ad0cf83adf93", default-features = false, features = ["std"] }
gateway-sp-comms = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "319e7b92db69792ab8efa4c68554ad0cf83adf93" }
gateway-test-utils = { path = "gateway-test-utils" }
gateway-types = { path = "gateway-types" }
gethostname = "0.4.3"
Expand Down
17 changes: 17 additions & 0 deletions package-manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,22 @@ output.type = "zone"

# Packages not built within Omicron, but which must be imported.

[package.omicron-faux-mgs]
# This package bundles a `faux-mgs` binary into `/usr/bin` in the switch zone,
# allowing `pilot sp ...` to work without needing to manually scp a `faux-mgs`
# binary in during support operations. (On rare occasions a support operator may
# still need to do that to get a more recent faux-mgs.)
service_name = "faux_mgs"
only_for_targets.image = "standard"
source.type = "prebuilt"
source.repo = "management-gateway-service"
# In general, this commit should match the pinned revision of `gateway-sp-comms`
# in `Cargo.toml`.
source.commit = "319e7b92db69792ab8efa4c68554ad0cf83adf93"
source.sha256 = "f4cbc480c8cfc2605c13b319291e69cbf8c213bb9c625ff79d339f90a7124358"
output.type = "zone"
output.intermediate_only = true

# Refer to
# https://github.com/oxidecomputer/crucible/blob/main/package/README.md
# for instructions on building this manually.
Expand Down Expand Up @@ -728,6 +744,7 @@ only_for_targets.switch = "asic"
only_for_targets.image = "standard"
source.type = "composite"
source.packages = [
"omicron-faux-mgs.tar.gz",
"omicron-gateway-asic.tar.gz",
"dendrite-asic.tar.gz",
"lldp.tar.gz",
Expand Down
13 changes: 7 additions & 6 deletions package/src/bin/omicron-package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,14 +430,15 @@ async fn download_prebuilt(
}

let digest = context.finish();
if digest.as_ref() != expected_digest {
bail!(
"Digest mismatch downloading {package_name}: Saw {}, expected {}",
if digest.as_ref() == expected_digest {
Ok(())
} else {
Err(anyhow!("Failed validating download of {url}").context(format!(
"Digest mismatch on {package_name}: Saw {}, expected {}",
hex::encode(digest.as_ref()),
hex::encode(expected_digest)
);
)))
}
Ok(())
}

// Ensures a package exists, either by creating it or downloading it.
Expand Down Expand Up @@ -484,7 +485,7 @@ async fn ensure_package(
let msg = format!("Failed to download prebuilt ({attempts_left} attempts remaining)");
progress.set_error_message(msg.into());
if attempts_left == 0 {
bail!("Failed to download package: {err}");
return Err(err);
}
tokio::time::sleep(config.retry_duration).await;
progress.reset();
Expand Down
8 changes: 4 additions & 4 deletions workspace-hack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ base16ct = { version = "0.2.0", default-features = false, features = ["alloc"] }
bit-set = { version = "0.5.3" }
bit-vec = { version = "0.6.3" }
bitflags-dff4ba8e3ae991db = { package = "bitflags", version = "1.3.2" }
bitflags-f595c2ba2a3f28df = { package = "bitflags", version = "2.5.0", default-features = false, features = ["serde", "std"] }
bitflags-f595c2ba2a3f28df = { package = "bitflags", version = "2.6.0", default-features = false, features = ["serde", "std"] }
bstr-6f8ce4dd05d13bba = { package = "bstr", version = "0.2.17" }
bstr-dff4ba8e3ae991db = { package = "bstr", version = "1.9.1" }
byteorder = { version = "1.5.0" }
Expand Down Expand Up @@ -54,7 +54,7 @@ futures-io = { version = "0.3.30", default-features = false, features = ["std"]
futures-sink = { version = "0.3.30" }
futures-task = { version = "0.3.30", default-features = false, features = ["std"] }
futures-util = { version = "0.3.30", features = ["channel", "io", "sink"] }
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "c85a4ca043aaa389df12aac5348d8a3feda28762", features = ["std"] }
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "319e7b92db69792ab8efa4c68554ad0cf83adf93", features = ["std"] }
generic-array = { version = "0.14.7", default-features = false, features = ["more_lengths", "zeroize"] }
getrandom = { version = "0.2.14", default-features = false, features = ["js", "rdrand", "std"] }
group = { version = "0.13.0", default-features = false, features = ["alloc"] }
Expand Down Expand Up @@ -129,7 +129,7 @@ base16ct = { version = "0.2.0", default-features = false, features = ["alloc"] }
bit-set = { version = "0.5.3" }
bit-vec = { version = "0.6.3" }
bitflags-dff4ba8e3ae991db = { package = "bitflags", version = "1.3.2" }
bitflags-f595c2ba2a3f28df = { package = "bitflags", version = "2.5.0", default-features = false, features = ["serde", "std"] }
bitflags-f595c2ba2a3f28df = { package = "bitflags", version = "2.6.0", default-features = false, features = ["serde", "std"] }
bstr-6f8ce4dd05d13bba = { package = "bstr", version = "0.2.17" }
bstr-dff4ba8e3ae991db = { package = "bstr", version = "1.9.1" }
byteorder = { version = "1.5.0" }
Expand Down Expand Up @@ -159,7 +159,7 @@ futures-io = { version = "0.3.30", default-features = false, features = ["std"]
futures-sink = { version = "0.3.30" }
futures-task = { version = "0.3.30", default-features = false, features = ["std"] }
futures-util = { version = "0.3.30", features = ["channel", "io", "sink"] }
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "c85a4ca043aaa389df12aac5348d8a3feda28762", features = ["std"] }
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "319e7b92db69792ab8efa4c68554ad0cf83adf93", features = ["std"] }
generic-array = { version = "0.14.7", default-features = false, features = ["more_lengths", "zeroize"] }
getrandom = { version = "0.2.14", default-features = false, features = ["js", "rdrand", "std"] }
group = { version = "0.13.0", default-features = false, features = ["alloc"] }
Expand Down

0 comments on commit 24f7cc0

Please sign in to comment.