From be874d97579753f5a8b685256e5919d8b687f87a Mon Sep 17 00:00:00 2001 From: Sean Klein Date: Fri, 1 Sep 2023 17:28:50 -0700 Subject: [PATCH 1/3] Bump rust to 1.72.0, reduce debug level for faster incremental rebuild --- .github/buildomat/jobs/build-and-test-helios.sh | 2 +- .github/buildomat/jobs/build-and-test-linux.sh | 2 +- .github/buildomat/jobs/ci-tools.sh | 2 +- .github/buildomat/jobs/clippy.sh | 2 +- .github/buildomat/jobs/host-image.sh | 2 +- .github/buildomat/jobs/package.sh | 2 +- .github/buildomat/jobs/trampoline-image.sh | 2 +- Cargo.toml | 4 ++++ rust-toolchain.toml | 2 +- sled-agent/src/sim/storage.rs | 2 +- 10 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/buildomat/jobs/build-and-test-helios.sh b/.github/buildomat/jobs/build-and-test-helios.sh index 9ccd708154..c1a9bee581 100755 --- a/.github/buildomat/jobs/build-and-test-helios.sh +++ b/.github/buildomat/jobs/build-and-test-helios.sh @@ -3,7 +3,7 @@ #: name = "build-and-test (helios)" #: variety = "basic" #: target = "helios-2.0" -#: rust_toolchain = "1.70.0" +#: rust_toolchain = "1.72.0" #: output_rules = [ #: "/var/tmp/omicron_tmp/*", #: "!/var/tmp/omicron_tmp/crdb-base*", diff --git a/.github/buildomat/jobs/build-and-test-linux.sh b/.github/buildomat/jobs/build-and-test-linux.sh index ab0b2d65ef..50bdb22e56 100755 --- a/.github/buildomat/jobs/build-and-test-linux.sh +++ b/.github/buildomat/jobs/build-and-test-linux.sh @@ -3,7 +3,7 @@ #: name = "build-and-test (ubuntu-20.04)" #: variety = "basic" #: target = "ubuntu-20.04" -#: rust_toolchain = "1.70.0" +#: rust_toolchain = "1.72.0" #: output_rules = [ #: "/var/tmp/omicron_tmp/*", #: "!/var/tmp/omicron_tmp/crdb-base*", diff --git a/.github/buildomat/jobs/ci-tools.sh b/.github/buildomat/jobs/ci-tools.sh index d852a88821..b5d1d26f1a 100755 --- a/.github/buildomat/jobs/ci-tools.sh +++ b/.github/buildomat/jobs/ci-tools.sh @@ -3,7 +3,7 @@ #: name = "helios / CI tools" #: variety = "basic" #: target = "helios-2.0" -#: rust_toolchain = "1.70.0" +#: rust_toolchain = "1.72.0" #: output_rules = [ #: "=/work/end-to-end-tests/*.gz", #: "=/work/caboose-util.gz", diff --git a/.github/buildomat/jobs/clippy.sh b/.github/buildomat/jobs/clippy.sh index 84043895e2..184b4ccbe6 100755 --- a/.github/buildomat/jobs/clippy.sh +++ b/.github/buildomat/jobs/clippy.sh @@ -3,7 +3,7 @@ #: name = "clippy (helios)" #: variety = "basic" #: target = "helios-2.0" -#: rust_toolchain = "1.70.0" +#: rust_toolchain = "1.72.0" #: output_rules = [] # Run clippy on illumos (not just other systems) because a bunch of our code diff --git a/.github/buildomat/jobs/host-image.sh b/.github/buildomat/jobs/host-image.sh index 54a72899d6..0e2191ebc8 100755 --- a/.github/buildomat/jobs/host-image.sh +++ b/.github/buildomat/jobs/host-image.sh @@ -3,7 +3,7 @@ #: name = "helios / build OS image" #: variety = "basic" #: target = "helios-2.0" -#: rust_toolchain = "1.70.0" +#: rust_toolchain = "1.72.0" #: output_rules = [ #: "=/work/helios/image/output/os.tar.gz", #: ] diff --git a/.github/buildomat/jobs/package.sh b/.github/buildomat/jobs/package.sh index 77cc547b93..27656e0c1a 100755 --- a/.github/buildomat/jobs/package.sh +++ b/.github/buildomat/jobs/package.sh @@ -3,7 +3,7 @@ #: name = "helios / package" #: variety = "basic" #: target = "helios-2.0" -#: rust_toolchain = "1.70.0" +#: rust_toolchain = "1.72.0" #: output_rules = [ #: "=/work/version.txt", #: "=/work/package.tar.gz", diff --git a/.github/buildomat/jobs/trampoline-image.sh b/.github/buildomat/jobs/trampoline-image.sh index 512ca43cc7..794ebd96c1 100755 --- a/.github/buildomat/jobs/trampoline-image.sh +++ b/.github/buildomat/jobs/trampoline-image.sh @@ -3,7 +3,7 @@ #: name = "helios / build trampoline OS image" #: variety = "basic" #: target = "helios-2.0" -#: rust_toolchain = "1.70.0" +#: rust_toolchain = "1.72.0" #: output_rules = [ #: "=/work/helios/image/output/os.tar.gz", #: ] diff --git a/Cargo.toml b/Cargo.toml index 18744a0db1..b3abb3e6dd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -369,6 +369,10 @@ zone = { version = "0.2", default-features = false, features = ["async"] } [profile.dev] panic = "abort" +# See https://github.com/oxidecomputer/omicron/issues/4009 for some background context here. +# By reducing the debug level (though keeping enough to have meaningful +# backtraces), we reduce incremental build time and binary size significantly. +debug = "line-tables-only" # `bindgen` is used by `samael`'s build script; building it with optimizations # makes that build script run ~5x faster, more than offsetting the additional diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 71ebd07deb..77379db470 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -4,5 +4,5 @@ # # We choose a specific toolchain (rather than "stable") for repeatability. The # intent is to keep this up-to-date with recently-released stable Rust. -channel = "1.70.0" +channel = "1.72.0" profile = "default" diff --git a/sled-agent/src/sim/storage.rs b/sled-agent/src/sim/storage.rs index 789a598c54..2dd249d4f5 100644 --- a/sled-agent/src/sim/storage.rs +++ b/sled-agent/src/sim/storage.rs @@ -120,7 +120,7 @@ impl CrucibleDataInner { } let id = Uuid::from_str(&id.0).unwrap(); - if let Some(mut region) = self.regions.get_mut(&id) { + if let Some(region) = self.regions.get_mut(&id) { region.state = State::Destroyed; Ok(Some(region.clone())) } else { From 4e39536ad6f033512a658c6efe6950b2a81869d4 Mon Sep 17 00:00:00 2001 From: Sean Klein Date: Fri, 1 Sep 2023 17:44:05 -0700 Subject: [PATCH 2/3] fmt, clippy, only bump toolchain --- Cargo.toml | 4 ---- bootstore/src/schemes/v0/peer.rs | 4 ++-- bootstore/src/trust_quorum/rack_secret.rs | 4 ++-- .../tests/v0-fsm-proptest-rack-coordinator.rs | 5 +++-- gateway-test-utils/src/sim_state.rs | 4 +++- gateway/src/http_entrypoints.rs | 6 ++---- illumos-utils/src/running_zone.rs | 4 +++- installinator/src/mock_peers.rs | 4 ++++ nexus/db-queries/src/authz/actor.rs | 9 +++++--- nexus/db-queries/src/authz/api_resources.rs | 8 +++---- .../src/db/datastore/db_metadata.rs | 4 +++- nexus/test-utils/src/lib.rs | 6 ++++-- nexus/tests/integration_tests/authn_http.rs | 2 +- nexus/tests/integration_tests/vpc_subnets.rs | 9 ++++---- oximeter/db/src/model.rs | 8 +++---- oximeter/db/src/query.rs | 4 ++-- oximeter/oximeter/src/traits.rs | 4 ++-- sled-agent/src/bin/zone-bundle.rs | 5 ++++- sled-agent/src/http_entrypoints.rs | 9 ++++++-- sled-agent/src/instance_manager.rs | 4 +++- sled-agent/src/services.rs | 21 ++++++++++--------- sled-agent/src/storage_manager.rs | 8 +++++-- sled-agent/src/updates.rs | 3 ++- sled-agent/src/zone_bundle.rs | 14 ++++++------- sled-hardware/src/illumos/mod.rs | 15 +++++++++---- .../examples/update-engine-basic/display.rs | 3 ++- update-engine/src/engine.rs | 16 +++++++------- wicket/src/preflight.rs | 16 +++++++++----- wicket/src/runner.rs | 2 +- wicket/src/state/update.rs | 7 ++++++- wicketd/src/http_entrypoints.rs | 3 +-- wicketd/src/rss_config.rs | 7 ++++--- wicketd/src/update_tracker.rs | 8 ++++--- 33 files changed, 138 insertions(+), 92 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b3abb3e6dd..18744a0db1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -369,10 +369,6 @@ zone = { version = "0.2", default-features = false, features = ["async"] } [profile.dev] panic = "abort" -# See https://github.com/oxidecomputer/omicron/issues/4009 for some background context here. -# By reducing the debug level (though keeping enough to have meaningful -# backtraces), we reduce incremental build time and binary size significantly. -debug = "line-tables-only" # `bindgen` is used by `samael`'s build script; building it with optimizations # makes that build script run ~5x faster, more than offsetting the additional diff --git a/bootstore/src/schemes/v0/peer.rs b/bootstore/src/schemes/v0/peer.rs index 1988e800fe..230aaafcf8 100644 --- a/bootstore/src/schemes/v0/peer.rs +++ b/bootstore/src/schemes/v0/peer.rs @@ -762,8 +762,8 @@ impl Node { peer_id, } => { let Some(accepted_handle) = - self.accepted_connections.remove(&accepted_addr) else - { + self.accepted_connections.remove(&accepted_addr) + else { warn!( self.log, concat!( diff --git a/bootstore/src/trust_quorum/rack_secret.rs b/bootstore/src/trust_quorum/rack_secret.rs index de8f031a28..f2eb71fe02 100644 --- a/bootstore/src/trust_quorum/rack_secret.rs +++ b/bootstore/src/trust_quorum/rack_secret.rs @@ -67,7 +67,7 @@ impl Eq for RackSecret {} impl RackSecret { /// Create a secret based on Curve25519 pub fn new() -> RackSecret { - let mut rng = OsRng::default(); + let mut rng = OsRng; RackSecret { secret: Secret::new(Scalar::random(&mut rng)) } } @@ -78,7 +78,7 @@ impl RackSecret { threshold: u8, total_shares: u8, ) -> Result>>, vsss_rs::Error> { - let mut rng = OsRng::default(); + let mut rng = OsRng; Ok(Secret::new(shamir::split_secret::>( threshold as usize, total_shares as usize, diff --git a/bootstore/tests/v0-fsm-proptest-rack-coordinator.rs b/bootstore/tests/v0-fsm-proptest-rack-coordinator.rs index 577497aeb1..8bf149568a 100644 --- a/bootstore/tests/v0-fsm-proptest-rack-coordinator.rs +++ b/bootstore/tests/v0-fsm-proptest-rack-coordinator.rs @@ -218,8 +218,9 @@ impl TestState { for (i, envelope) in envelopes.into_iter().enumerate() { let Envelope { to, - msg: Msg::Req(Request { id, type_: RequestType::Init(pkg)}) - } = envelope else { + msg: Msg::Req(Request { id, type_: RequestType::Init(pkg) }), + } = envelope + else { panic!("Already verified the RequestType"); }; self.shares.insert(to.clone(), Share(pkg.common.share.clone())); diff --git a/gateway-test-utils/src/sim_state.rs b/gateway-test-utils/src/sim_state.rs index 143137291d..71802e0104 100644 --- a/gateway-test-utils/src/sim_state.rs +++ b/gateway-test-utils/src/sim_state.rs @@ -31,7 +31,9 @@ pub async fn current_simulator_state(simrack: &SimRack) -> Vec { let mut all_sps: Vec = Vec::new(); let mut slot = 0; for state in sim_state { - let Some(target_state) = state.target else { continue; }; + let Some(target_state) = state.target else { + continue; + }; let typ = match target_state.system_type { SystemType::Sidecar => SpType::Switch, SystemType::Gimlet => SpType::Sled, diff --git a/gateway/src/http_entrypoints.rs b/gateway/src/http_entrypoints.rs index c34388b5f7..6d19f4c56e 100644 --- a/gateway/src/http_entrypoints.rs +++ b/gateway/src/http_entrypoints.rs @@ -1174,10 +1174,8 @@ async fn sp_host_phase2_progress_get( // this SP most recently requested. We'll treat that as "no progress // information", since it almost certainly means our progress info on this // SP is very stale. - let Ok(total_size) = apictx - .host_phase2_provider - .total_size(progress.hash) - .await + let Ok(total_size) = + apictx.host_phase2_provider.total_size(progress.hash).await else { return Ok(HttpResponseOk(HostPhase2Progress::None)); }; diff --git a/illumos-utils/src/running_zone.rs b/illumos-utils/src/running_zone.rs index 0d4251832b..4e84658921 100644 --- a/illumos-utils/src/running_zone.rs +++ b/illumos-utils/src/running_zone.rs @@ -951,7 +951,9 @@ impl RunningZone { let binary = Utf8PathBuf::from(path); // Fetch any log files for this SMF service. - let Some((log_file, rotated_log_files)) = self.service_log_files(&service_name)? else { + let Some((log_file, rotated_log_files)) = + self.service_log_files(&service_name)? + else { error!( self.inner.log, "failed to find log files for existing service"; diff --git a/installinator/src/mock_peers.rs b/installinator/src/mock_peers.rs index 6f043d9a61..434276649f 100644 --- a/installinator/src/mock_peers.rs +++ b/installinator/src/mock_peers.rs @@ -2,6 +2,10 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. +// TODO: Remove when https://github.com/frozenlib/test-strategy/commit/c0ca38711757d2b51f74b28e80ef4c78275c284f +// is pulled into a new published version of "test_strategy" that we can use. +#![allow(clippy::arc_with_non_send_sync)] + use std::{ collections::BTreeMap, fmt, diff --git a/nexus/db-queries/src/authz/actor.rs b/nexus/db-queries/src/authz/actor.rs index 71257c1561..f1ce2695ac 100644 --- a/nexus/db-queries/src/authz/actor.rs +++ b/nexus/db-queries/src/authz/actor.rs @@ -72,9 +72,12 @@ impl AuthenticatedActor { /// this actor's Silo pub fn confers_fleet_role(&self, fleet_role_str: &str) -> Vec { let Ok(fleet_role) = FleetRole::from_database_string(fleet_role_str) - else { return vec![] }; - let Some(silo_policy) = self.silo_policy.as_ref() - else { return vec![] }; + else { + return vec![]; + }; + let Some(silo_policy) = self.silo_policy.as_ref() else { + return vec![]; + }; silo_policy .mapped_fleet_roles() .into_iter() diff --git a/nexus/db-queries/src/authz/api_resources.rs b/nexus/db-queries/src/authz/api_resources.rs index 9e590c7452..b344b077ba 100644 --- a/nexus/db-queries/src/authz/api_resources.rs +++ b/nexus/db-queries/src/authz/api_resources.rs @@ -229,10 +229,10 @@ impl ApiResourceWithRoles for Fleet { // If the actor is associated with a Silo, and if that Silo has a policy // that grants fleet-level roles, then we must look up the actor's // Silo-level roles when looking up their roles on the Fleet. - let Some(silo_id) = authn - .actor() - .and_then(|actor| actor.silo_id()) - else { return Ok(None); }; + let Some(silo_id) = authn.actor().and_then(|actor| actor.silo_id()) + else { + return Ok(None); + }; let silo_authn_policy = authn.silo_authn_policy().ok_or_else(|| { Error::internal_error(&format!( "actor had a Silo ({}) but no SiloAuthnPolicy", diff --git a/nexus/db-queries/src/db/datastore/db_metadata.rs b/nexus/db-queries/src/db/datastore/db_metadata.rs index 53c8b8cfbb..36bc8d7845 100644 --- a/nexus/db-queries/src/db/datastore/db_metadata.rs +++ b/nexus/db-queries/src/db/datastore/db_metadata.rs @@ -64,7 +64,9 @@ impl DataStore { }; let Some(config) = config else { - return Err("Not configured to automatically update schema".to_string()); + return Err( + "Not configured to automatically update schema".to_string() + ); }; if current_version > desired_version { diff --git a/nexus/test-utils/src/lib.rs b/nexus/test-utils/src/lib.rs index 0f303b6b7e..3b9bf86c2d 100644 --- a/nexus/test-utils/src/lib.rs +++ b/nexus/test-utils/src/lib.rs @@ -653,10 +653,12 @@ impl<'a, N: NexusServer> ControlPlaneTestContextBuilder<'a, N> { let dns = dns_server::TransientServer::new(&log).await.unwrap(); - let SocketAddr::V6(dns_address) = *dns.dns_server.local_address() else { + let SocketAddr::V6(dns_address) = *dns.dns_server.local_address() + else { panic!("Unsupported IPv4 DNS address"); }; - let SocketAddr::V6(dropshot_address) = dns.dropshot_server.local_addr() else { + let SocketAddr::V6(dropshot_address) = dns.dropshot_server.local_addr() + else { panic!("Unsupported IPv4 Dropshot address"); }; diff --git a/nexus/tests/integration_tests/authn_http.rs b/nexus/tests/integration_tests/authn_http.rs index 41fe4aa8a2..86cc73130e 100644 --- a/nexus/tests/integration_tests/authn_http.rs +++ b/nexus/tests/integration_tests/authn_http.rs @@ -48,7 +48,7 @@ async fn test_authn_spoof_allowed() { HashMap::new(), ) .await; - let tried_spoof = vec![SPOOF_SCHEME_NAME] + let tried_spoof = [SPOOF_SCHEME_NAME] .iter() .map(|s| s.to_string()) .collect::>(); diff --git a/nexus/tests/integration_tests/vpc_subnets.rs b/nexus/tests/integration_tests/vpc_subnets.rs index 0a9c60b75d..0ec7187e18 100644 --- a/nexus/tests/integration_tests/vpc_subnets.rs +++ b/nexus/tests/integration_tests/vpc_subnets.rs @@ -164,8 +164,7 @@ async fn test_vpc_subnets(cptestctx: &ControlPlaneTestContext) { let other_ipv4_block = Ipv4Net("172.31.0.0/16".parse().unwrap()); // Create the first two available IPv6 address ranges. */ let prefix = vpc.ipv6_prefix.network(); - let ipv6_block = - Some(Ipv6Net(ipnetwork::Ipv6Network::new(prefix, 64).unwrap())); + let ipv6_block = Ipv6Net(ipnetwork::Ipv6Network::new(prefix, 64).unwrap()); let mut segments = prefix.segments(); segments[3] = 1; let addr = std::net::Ipv6Addr::from(segments); @@ -177,7 +176,7 @@ async fn test_vpc_subnets(cptestctx: &ControlPlaneTestContext) { description: "it's below the net".to_string(), }, ipv4_block, - ipv6_block, + ipv6_block: Some(ipv6_block), }; let subnet: VpcSubnet = NexusRequest::objects_post(client, &subnets_url, &new_subnet) @@ -191,7 +190,7 @@ async fn test_vpc_subnets(cptestctx: &ControlPlaneTestContext) { assert_eq!(subnet.identity.description, "it's below the net"); assert_eq!(subnet.vpc_id, vpc.identity.id); assert_eq!(subnet.ipv4_block, ipv4_block); - assert_eq!(subnet.ipv6_block, ipv6_block.unwrap()); + assert_eq!(subnet.ipv6_block, ipv6_block); assert!(subnet.ipv6_block.is_vpc_subnet(&vpc.ipv6_prefix)); // get subnet, should be the same @@ -228,7 +227,7 @@ async fn test_vpc_subnets(cptestctx: &ControlPlaneTestContext) { description: "it's below the net".to_string(), }, ipv4_block, - ipv6_block, + ipv6_block: Some(ipv6_block), }; let expected_error = format!( "IP address range '{}' conflicts with an existing subnet", diff --git a/oximeter/db/src/model.rs b/oximeter/db/src/model.rs index 815d3f803a..ce38d5e229 100644 --- a/oximeter/db/src/model.rs +++ b/oximeter/db/src/model.rs @@ -91,8 +91,8 @@ impl From for Vec { fn from(list: DbFieldList) -> Self { list.names .into_iter() - .zip(list.types.into_iter()) - .zip(list.sources.into_iter()) + .zip(list.types) + .zip(list.sources) .map(|((name, ty), source)| FieldSchema { name, ty: ty.into(), @@ -599,9 +599,9 @@ where FieldSchema { name: name.to_string(), ty: value.field_type(), source } }; let target_field_schema = - target.field_names().iter().zip(target.field_values().into_iter()); + target.field_names().iter().zip(target.field_values()); let metric_field_schema = - metric.field_names().iter().zip(metric.field_values().into_iter()); + metric.field_names().iter().zip(metric.field_values()); let field_schema = target_field_schema .map(|(name, value)| { make_field_schema(name, value, FieldSource::Target) diff --git a/oximeter/db/src/query.rs b/oximeter/db/src/query.rs index a09e0287d1..524ead0da5 100644 --- a/oximeter/db/src/query.rs +++ b/oximeter/db/src/query.rs @@ -223,9 +223,9 @@ impl SelectQueryBuilder { let schema = crate::model::schema_for_parts(target, metric); let mut builder = Self::new(&schema); let target_fields = - target.field_names().iter().zip(target.field_values().into_iter()); + target.field_names().iter().zip(target.field_values()); let metric_fields = - metric.field_names().iter().zip(metric.field_values().into_iter()); + metric.field_names().iter().zip(metric.field_values()); for (name, value) in target_fields.chain(metric_fields) { builder = builder.filter(name, FieldCmp::Eq, value)?; } diff --git a/oximeter/oximeter/src/traits.rs b/oximeter/oximeter/src/traits.rs index c25a278b57..8cf0c5d350 100644 --- a/oximeter/oximeter/src/traits.rs +++ b/oximeter/oximeter/src/traits.rs @@ -77,7 +77,7 @@ pub trait Target { fn fields(&self) -> Vec { self.field_names() .iter() - .zip(self.field_values().into_iter()) + .zip(self.field_values()) .map(|(name, value)| Field { name: name.to_string(), value }) .collect() } @@ -153,7 +153,7 @@ pub trait Metric { fn fields(&self) -> Vec { self.field_names() .iter() - .zip(self.field_values().into_iter()) + .zip(self.field_values()) .map(|(name, value)| Field { name: name.to_string(), value }) .collect() } diff --git a/sled-agent/src/bin/zone-bundle.rs b/sled-agent/src/bin/zone-bundle.rs index b1116fdc10..d49e22d80a 100644 --- a/sled-agent/src/bin/zone-bundle.rs +++ b/sled-agent/src/bin/zone-bundle.rs @@ -484,7 +484,10 @@ async fn main() -> anyhow::Result<()> { let priority = match args.priority { None => None, Some(pri) => { - let Ok(arr): Result<[PriorityDimension; EXPECTED_DIMENSIONS], _> = pri.try_into() else { + let Ok(arr): Result< + [PriorityDimension; EXPECTED_DIMENSIONS], + _, + > = pri.try_into() else { bail!("must provide {EXPECTED_DIMENSIONS} priority dimensions"); }; Some(PriorityOrder::from(arr)) diff --git a/sled-agent/src/http_entrypoints.rs b/sled-agent/src/http_entrypoints.rs index e9e569d992..5fb6d7eaea 100644 --- a/sled-agent/src/http_entrypoints.rs +++ b/sled-agent/src/http_entrypoints.rs @@ -149,7 +149,8 @@ async fn zone_bundle_get( let zone_name = params.zone_name; let bundle_id = params.bundle_id; let sa = rqctx.context(); - let Some(path) = sa.get_zone_bundle_paths(&zone_name, &bundle_id) + let Some(path) = sa + .get_zone_bundle_paths(&zone_name, &bundle_id) .await .map_err(HttpError::from)? .into_iter() @@ -157,7 +158,11 @@ async fn zone_bundle_get( else { return Err(HttpError::for_not_found( None, - format!("No zone bundle for zone '{}' with ID '{}'", zone_name, bundle_id))); + format!( + "No zone bundle for zone '{}' with ID '{}'", + zone_name, bundle_id + ), + )); }; let f = tokio::fs::File::open(&path).await.map_err(|e| { HttpError::for_internal_error(format!( diff --git a/sled-agent/src/instance_manager.rs b/sled-agent/src/instance_manager.rs index 0b6d820c91..bdd29e4d1f 100644 --- a/sled-agent/src/instance_manager.rs +++ b/sled-agent/src/instance_manager.rs @@ -351,7 +351,9 @@ impl InstanceManager { .lock() .unwrap() .values() - .find(|(propolis_id, _instance)| name == propolis_zone_name(propolis_id)) + .find(|(propolis_id, _instance)| { + name == propolis_zone_name(propolis_id) + }) .cloned() else { return Err(BundleError::NoSuchZone { name: name.to_string() }); diff --git a/sled-agent/src/services.rs b/sled-agent/src/services.rs index cfa1cdb5ac..68c067a457 100644 --- a/sled-agent/src/services.rs +++ b/sled-agent/src/services.rs @@ -495,11 +495,9 @@ impl ServiceManager { info!(log, "Loading services from: {ledger_paths:?}"); let mut existing_zones = self.inner.zones.lock().await; - let Some(mut ledger) = Ledger::::new( - log, - ledger_paths, - ) - .await else { + let Some(mut ledger) = + Ledger::::new(log, ledger_paths).await + else { info!(log, "Loading services - No services detected"); return Ok(()); }; @@ -1617,8 +1615,8 @@ impl ServiceManager { // address for the switch zone. If we _don't_ have a // bootstrap address, someone has requested wicketd in a // non-switch zone; return an error. - let Some((_, bootstrap_address)) - = bootstrap_name_and_address + let Some((_, bootstrap_address)) = + bootstrap_name_and_address else { return Err(Error::BadServiceRequest { service: "wicketd".to_string(), @@ -1626,7 +1624,9 @@ impl ServiceManager { "missing bootstrap address: ", "wicketd can only be started in the ", "switch zone", - ).to_string() }); + ) + .to_string(), + }); }; smfh.setprop( "config/artifact-address", @@ -2772,8 +2772,9 @@ impl ServiceManager { filesystems, data_links, .. - } = &*sled_zone else { - return Ok(()) + } = &*sled_zone + else { + return Ok(()); }; // The switch zone must use the ramdisk in order to receive requests diff --git a/sled-agent/src/storage_manager.rs b/sled-agent/src/storage_manager.rs index a2d2b5f862..bd71371396 100644 --- a/sled-agent/src/storage_manager.rs +++ b/sled-agent/src/storage_manager.rs @@ -467,7 +467,9 @@ impl StorageWorker { async move { let underlay_guard = underlay.lock().await; let Some(underlay) = underlay_guard.as_ref() else { - return Err(backoff::BackoffError::transient(Error::UnderlayNotInitialized.to_string())); + return Err(backoff::BackoffError::transient( + Error::UnderlayNotInitialized.to_string(), + )); }; let sled_id = underlay.sled_id; let nexus_client = underlay.nexus_client.client().clone(); @@ -899,7 +901,9 @@ impl StorageWorker { async move { let underlay_guard = underlay.lock().await; let Some(underlay) = underlay_guard.as_ref() else { - return Err(backoff::BackoffError::transient(Error::UnderlayNotInitialized.to_string())); + return Err(backoff::BackoffError::transient( + Error::UnderlayNotInitialized.to_string(), + )); }; let sled_id = underlay.sled_id; let nexus_client = underlay.nexus_client.client().clone(); diff --git a/sled-agent/src/updates.rs b/sled-agent/src/updates.rs index 71ef95ef5f..6144fd9171 100644 --- a/sled-agent/src/updates.rs +++ b/sled-agent/src/updates.rs @@ -198,7 +198,8 @@ impl UpdateManager { let serde_json::Value::String(pkg) = &json["pkg"] else { return Err(version_malformed_err(path, "pkg")); }; - let serde_json::Value::String(version) = &json["version"] else { + let serde_json::Value::String(version) = &json["version"] + else { return Err(version_malformed_err(path, "version")); }; diff --git a/sled-agent/src/zone_bundle.rs b/sled-agent/src/zone_bundle.rs index 45995dbac1..2eeb8ebe7d 100644 --- a/sled-agent/src/zone_bundle.rs +++ b/sled-agent/src/zone_bundle.rs @@ -888,7 +888,8 @@ async fn find_archived_log_files( match rd.next_entry().await { Ok(None) => break, Ok(Some(entry)) => { - let Ok(path) = Utf8PathBuf::try_from(entry.path()) else { + let Ok(path) = Utf8PathBuf::try_from(entry.path()) + else { error!( log, "skipping possible archived log file with \ @@ -966,9 +967,9 @@ fn extract_zone_bundle_metadata_impl( .unwrap_or(false) }) else { - return Err(BundleError::from( - anyhow!("Zone bundle is missing metadata file") - )); + return Err(BundleError::from(anyhow!( + "Zone bundle is missing metadata file" + ))); }; // Extract its contents and parse as metadata. @@ -1340,10 +1341,7 @@ async fn disk_usage(path: &Utf8PathBuf) -> Result { let Some(line) = s.lines().next() else { return Err(err("no lines in du output")); }; - let Some(part) = line - .trim() - .split_ascii_whitespace() - .next() else { + let Some(part) = line.trim().split_ascii_whitespace().next() else { return Err(err("no disk usage size computed in output")); }; part.parse() diff --git a/sled-hardware/src/illumos/mod.rs b/sled-hardware/src/illumos/mod.rs index 2568bd833a..0364c98f14 100644 --- a/sled-hardware/src/illumos/mod.rs +++ b/sled-hardware/src/illumos/mod.rs @@ -118,8 +118,12 @@ impl HardwareSnapshot { let mut node_walker = device_info.walk_node(); // First, check the root node. If we aren't running on a Gimlet, bail. - let Some(root) = node_walker.next().transpose().map_err(Error::DevInfo)? else { - return Err(Error::DevInfo(anyhow::anyhow!("No nodes in device tree"))); + let Some(root) = + node_walker.next().transpose().map_err(Error::DevInfo)? + else { + return Err(Error::DevInfo(anyhow::anyhow!( + "No nodes in device tree" + ))); }; let root_node = root.node_name(); if root_node != GIMLET_ROOT_NODE_NAME { @@ -352,7 +356,10 @@ fn get_parent_node<'a>( expected_parent_driver_name: &'static str, ) -> Result, Error> { let Some(parent) = node.parent().map_err(Error::DevInfo)? else { - return Err(Error::DevInfo(anyhow::anyhow!("{} has no parent node", node.node_name()))); + return Err(Error::DevInfo(anyhow::anyhow!( + "{} has no parent node", + node.node_name() + ))); }; if parent.driver_name().as_deref() != Some(expected_parent_driver_name) { return Err(Error::DevInfo(anyhow::anyhow!( @@ -482,7 +489,7 @@ fn poll_blkdev_node( )?; let Some(variant) = slot_to_disk_variant(slot) else { warn!(log, "Slot# {slot} is not recognized as a disk: {devfs_path}"); - return Err(Error::UnrecognizedSlot { slot } ); + return Err(Error::UnrecognizedSlot { slot }); }; let disk = UnparsedDisk::new( diff --git a/update-engine/examples/update-engine-basic/display.rs b/update-engine/examples/update-engine-basic/display.rs index 38d8220223..e6b80e3637 100644 --- a/update-engine/examples/update-engine-basic/display.rs +++ b/update-engine/examples/update-engine-basic/display.rs @@ -85,7 +85,8 @@ impl MessageDisplayState { steps, components, first_step: _, - } = step_event.kind else { + } = step_event.kind + else { bail!("received invalid step event kind: {step_event:?}"); }; diff --git a/update-engine/src/engine.rs b/update-engine/src/engine.rs index 73374484b1..24f055858c 100644 --- a/update-engine/src/engine.rs +++ b/update-engine/src/engine.rs @@ -230,13 +230,15 @@ impl<'a, S: StepSpec + 'a> UpdateEngine<'a, S> { let Some((index, first_step)) = steps_iter.next() else { // There are no steps defined. - self.sender.send(Event::Step(StepEvent { - spec: S::schema_name(), - execution_id: self.execution_id, - event_index: (exec_cx.next_event_index)(), - total_elapsed: exec_cx.total_start.elapsed(), - kind: StepEventKind::NoStepsDefined, - })).await?; + self.sender + .send(Event::Step(StepEvent { + spec: S::schema_name(), + execution_id: self.execution_id, + event_index: (exec_cx.next_event_index)(), + total_elapsed: exec_cx.total_start.elapsed(), + kind: StepEventKind::NoStepsDefined, + })) + .await?; return Ok(CompletionContext::new()); }; diff --git a/wicket/src/preflight.rs b/wicket/src/preflight.rs index 1b98ae9a7d..ddbbf95c1a 100644 --- a/wicket/src/preflight.rs +++ b/wicket/src/preflight.rs @@ -114,8 +114,12 @@ async fn poll_uplink_status_until_complete(client: Client) -> Result<()> { // Display or tick the progress spinner for the in-progress step, if // there is one. - let Some(last_seen) = last_seen else { continue; }; - let Some(all_steps) = all_steps.as_ref() else { continue; }; + let Some(last_seen) = last_seen else { + continue; + }; + let Some(all_steps) = all_steps.as_ref() else { + continue; + }; // Are we done? if execution_failed @@ -124,9 +128,11 @@ async fn poll_uplink_status_until_complete(client: Client) -> Result<()> { return Ok(()); } - let Some(active_step) = all_steps.iter().find(|step| { - step.index == last_seen + 1 - }) else { continue; }; + let Some(active_step) = + all_steps.iter().find(|step| step.index == last_seen + 1) + else { + continue; + }; // Is this a new active step that needs a new progress bar? if progress_bar.is_none() { diff --git a/wicket/src/runner.rs b/wicket/src/runner.rs index 052680048f..21282e759d 100644 --- a/wicket/src/runner.rs +++ b/wicket/src/runner.rs @@ -171,7 +171,7 @@ impl RunnerCore { wicketd: Option<&WicketdHandle>, ) -> anyhow::Result<()> { let Some(action) = action else { - return Ok(()); + return Ok(()); }; match action { diff --git a/wicket/src/state/update.rs b/wicket/src/state/update.rs index c8ae0978ef..6536184217 100644 --- a/wicket/src/state/update.rs +++ b/wicket/src/state/update.rs @@ -110,7 +110,12 @@ impl RackUpdateState { sp_type: &sp_type, i: &i, }) else { - warn!(logger, "Invalid ComponentId in EventReport: {} {}", &sp_type, &i); + warn!( + logger, + "Invalid ComponentId in EventReport: {} {}", + &sp_type, + &i + ); continue; }; let item_state = self.items.get_mut(&id).unwrap(); diff --git a/wicketd/src/http_entrypoints.rs b/wicketd/src/http_entrypoints.rs index 2d980ecc29..14eeb15819 100644 --- a/wicketd/src/http_entrypoints.rs +++ b/wicketd/src/http_entrypoints.rs @@ -825,8 +825,7 @@ async fn post_start_update( let Some(sp_state) = sp_state else { return Err(HttpError::for_bad_request( None, - "cannot update target sled (no inventory state present)" - .into(), + "cannot update target sled (no inventory state present)".into(), )); }; diff --git a/wicketd/src/rss_config.rs b/wicketd/src/rss_config.rs index fa484d726b..55a9b456f0 100644 --- a/wicketd/src/rss_config.rs +++ b/wicketd/src/rss_config.rs @@ -153,12 +153,13 @@ impl CurrentRssConfig { if self.external_certificates.is_empty() { bail!("at least one certificate/key pair is required"); } - let Some(recovery_silo_password_hash) - = self.recovery_silo_password_hash.as_ref() + let Some(recovery_silo_password_hash) = + self.recovery_silo_password_hash.as_ref() else { bail!("recovery password not yet set"); }; - let Some(rack_network_config) = self.rack_network_config.as_ref() else { + let Some(rack_network_config) = self.rack_network_config.as_ref() + else { bail!("rack network config not set (have you uploaded a config?)"); }; let rack_network_config = diff --git a/wicketd/src/update_tracker.rs b/wicketd/src/update_tracker.rs index 6798f06908..bfa65f3b5f 100644 --- a/wicketd/src/update_tracker.rs +++ b/wicketd/src/update_tracker.rs @@ -667,9 +667,11 @@ impl UpdateDriver { let Some(sp_artifact) = sp_artifacts.get(&caboose.board) else { - return Err(UpdateTerminalError::MissingSpImageForBoard { - board: caboose.board, - }); + return Err( + UpdateTerminalError::MissingSpImageForBoard { + board: caboose.board, + }, + ); }; let sp_artifact = sp_artifact.clone(); From 9e61a46e0f3e5f6274f4a30df219c650bccd7c4c Mon Sep 17 00:00:00 2001 From: Sean Klein Date: Fri, 1 Sep 2023 18:39:28 -0700 Subject: [PATCH 3/3] fix ipv6 strings --- internal-dns/src/config.rs | 10 +++++----- internal-dns/tests/output/internal-dns-zone.txt | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/internal-dns/src/config.rs b/internal-dns/src/config.rs index 3fcbbb208e..e1b3129722 100644 --- a/internal-dns/src/config.rs +++ b/internal-dns/src/config.rs @@ -578,7 +578,7 @@ mod test { error.to_string(), "multiple definitions for sled \ 001de000-51ed-4000-8000-000000000001 (previously ::1, \ - now ::0.0.0.2)" + now ::2)" ); // Duplicate zone, with both the same IP and a different one. @@ -588,15 +588,15 @@ mod test { assert_eq!( error.to_string(), "multiple definitions for zone \ - 001de000-c04e-4000-8000-000000000001 (previously ::0.1.0.1, \ - now ::0.1.0.1)" + 001de000-c04e-4000-8000-000000000001 (previously ::1:1, \ + now ::1:1)" ); let error = builder.host_zone(zone1_uuid, ZONE2_IP).unwrap_err(); assert_eq!( error.to_string(), "multiple definitions for zone \ - 001de000-c04e-4000-8000-000000000001 (previously ::0.1.0.1, \ - now ::0.1.0.2)" + 001de000-c04e-4000-8000-000000000001 (previously ::1:1, \ + now ::1:2)" ); // Specify an undefined zone or sled. (This requires a second builder.) diff --git a/internal-dns/tests/output/internal-dns-zone.txt b/internal-dns/tests/output/internal-dns-zone.txt index 3e915a8c0e..e8c3f01b05 100644 --- a/internal-dns/tests/output/internal-dns-zone.txt +++ b/internal-dns/tests/output/internal-dns-zone.txt @@ -11,7 +11,7 @@ builder: "hosts_only" "001de000-51ed-4000-8000-000000000002.sled": [ { "type": "AAAA", - "data": "::0.0.0.2" + "data": "::2" } ] } @@ -20,13 +20,13 @@ builder: "zones_only" "001de000-c04e-4000-8000-000000000001.host": [ { "type": "AAAA", - "data": "::0.1.0.1" + "data": "::1:1" } ], "001de000-c04e-4000-8000-000000000002.host": [ { "type": "AAAA", - "data": "::0.1.0.2" + "data": "::1:2" } ] } @@ -41,31 +41,31 @@ builder: "non_trivial" "001de000-51ed-4000-8000-000000000002.sled": [ { "type": "AAAA", - "data": "::0.0.0.2" + "data": "::2" } ], "001de000-c04e-4000-8000-000000000001.host": [ { "type": "AAAA", - "data": "::0.1.0.1" + "data": "::1:1" } ], "001de000-c04e-4000-8000-000000000002.host": [ { "type": "AAAA", - "data": "::0.1.0.2" + "data": "::1:2" } ], "001de000-c04e-4000-8000-000000000003.host": [ { "type": "AAAA", - "data": "::0.1.0.3" + "data": "::1:3" } ], "001de000-c04e-4000-8000-000000000004.host": [ { "type": "AAAA", - "data": "::0.1.0.4" + "data": "::1:4" } ], "_nexus._tcp": [