From 24f7cc0144a9c57875b93dfcdd85ac7a2281039e Mon Sep 17 00:00:00 2001 From: John Gallagher Date: Mon, 29 Jul 2024 10:59:41 -0700 Subject: [PATCH] Add faux-mgs binary to the switch zone (#6164) Closes #6153 --- Cargo.lock | 52 +++++++++++++++--------------- Cargo.toml | 12 +++++-- package-manifest.toml | 17 ++++++++++ package/src/bin/omicron-package.rs | 13 ++++---- workspace-hack/Cargo.toml | 8 ++--- 5 files changed, 64 insertions(+), 38 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 41c3bef36f..75952fd71c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -504,7 +504,7 @@ version = "0.69.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cexpr", "clang-sys", "itertools 0.12.1", @@ -561,9 +561,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" dependencies = [ "serde", ] @@ -1410,7 +1410,7 @@ version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "crossterm_winapi", "futures-core", "libc", @@ -1817,7 +1817,7 @@ version = "2.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff236accb9a5069572099f0b350a92e9560e8e63a9b8d546162f4a5e03026bb2" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "byteorder", "chrono", "diesel_derives", @@ -2755,9 +2755,9 @@ dependencies = [ [[package]] name = "gateway-messages" version = "0.1.0" -source = "git+https://github.com/oxidecomputer/management-gateway-service?rev=c85a4ca043aaa389df12aac5348d8a3feda28762#c85a4ca043aaa389df12aac5348d8a3feda28762" +source = "git+https://github.com/oxidecomputer/management-gateway-service?rev=319e7b92db69792ab8efa4c68554ad0cf83adf93#319e7b92db69792ab8efa4c68554ad0cf83adf93" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "hubpack", "serde", "serde_repr", @@ -2771,7 +2771,7 @@ dependencies = [ [[package]] name = "gateway-sp-comms" version = "0.1.1" -source = "git+https://github.com/oxidecomputer/management-gateway-service?rev=c85a4ca043aaa389df12aac5348d8a3feda28762#c85a4ca043aaa389df12aac5348d8a3feda28762" +source = "git+https://github.com/oxidecomputer/management-gateway-service?rev=319e7b92db69792ab8efa4c68554ad0cf83adf93#319e7b92db69792ab8efa4c68554ad0cf83adf93" dependencies = [ "async-trait", "backoff", @@ -4146,7 +4146,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "libc", ] @@ -5124,7 +5124,7 @@ version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cfg-if", "libc", "memoffset", @@ -5136,7 +5136,7 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cfg-if", "cfg_aliases", "libc", @@ -6029,7 +6029,7 @@ dependencies = [ "bit-set", "bit-vec", "bitflags 1.3.2", - "bitflags 2.5.0", + "bitflags 2.6.0", "bstr 0.2.17", "bstr 1.9.1", "byteorder", @@ -6244,7 +6244,7 @@ version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cfg-if", "foreign-types 0.3.2", "libc", @@ -7418,7 +7418,7 @@ source = "git+https://github.com/oxidecomputer/propolis?rev=6dceb9ef69c217cb78a2 dependencies = [ "anyhow", "bhyve_api 0.0.0 (git+https://github.com/oxidecomputer/propolis?rev=6dceb9ef69c217cb78a2018bbedafbc19f6ec1af)", - "bitflags 2.5.0", + "bitflags 2.6.0", "bitstruct", "byteorder", "dladm", @@ -7551,7 +7551,7 @@ checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.5.0", + "bitflags 2.6.0", "lazy_static", "num-traits", "rand 0.8.5", @@ -7736,7 +7736,7 @@ version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d16546c5b5962abf8ce6e2881e722b4e0ae3b6f1a08a26ae3573c55853ca68d3" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cassowary", "compact_str", "crossterm", @@ -7849,7 +7849,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", ] [[package]] @@ -8091,7 +8091,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94" dependencies = [ "base64 0.21.7", - "bitflags 2.5.0", + "bitflags 2.6.0", "serde", "serde_derive", ] @@ -8177,7 +8177,7 @@ dependencies = [ "aes", "aes-gcm", "async-trait", - "bitflags 2.5.0", + "bitflags 2.6.0", "byteorder", "chacha20", "ctr", @@ -8312,7 +8312,7 @@ version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", @@ -8446,7 +8446,7 @@ version = "14.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7803e8936da37efd9b6d4478277f4b2b9bb5cdb37a113e8d63222e58da647e63" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cfg-if", "clipboard-win", "fd-lock", @@ -8614,7 +8614,7 @@ version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "core-foundation", "core-foundation-sys", "libc", @@ -9827,18 +9827,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.62" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2675633b1499176c2dff06b0856a27976a8f9d436737b4cf4f312d4d91d8bbb" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.62" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d20468752b09f49e909e55a5d338caa8bedf615594e9d80bc4c565d30faf798c" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 578c4de5a1..12bea694f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/package-manifest.toml b/package-manifest.toml index 098e15d3b8..ffe571121c 100644 --- a/package-manifest.toml +++ b/package-manifest.toml @@ -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. @@ -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", diff --git a/package/src/bin/omicron-package.rs b/package/src/bin/omicron-package.rs index 6db168c9f8..b2b8703015 100644 --- a/package/src/bin/omicron-package.rs +++ b/package/src/bin/omicron-package.rs @@ -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. @@ -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(); diff --git a/workspace-hack/Cargo.toml b/workspace-hack/Cargo.toml index dbb4a51c43..94b169e26c 100644 --- a/workspace-hack/Cargo.toml +++ b/workspace-hack/Cargo.toml @@ -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" } @@ -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"] } @@ -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" } @@ -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"] }