From 9858dbf49f4118839d204de6e42b88b997270fdb Mon Sep 17 00:00:00 2001 From: Sean Klein Date: Fri, 21 Jun 2024 16:26:04 -0700 Subject: [PATCH] are we optional yet --- nexus/db-model/src/deployment.rs | 9 ++++++--- nexus/db-model/src/inventory.rs | 6 +++--- nexus/db-model/src/omicron_zone_config.rs | 14 ++++++++----- nexus/db-queries/src/db/datastore/rack.rs | 20 +++++++++---------- nexus/inventory/src/collector.rs | 2 +- .../reconfigurator/execution/src/datasets.rs | 2 +- nexus/reconfigurator/execution/src/dns.rs | 4 +++- .../execution/src/external_networking.rs | 12 +++++------ .../execution/src/omicron_zones.rs | 6 ++++-- .../planning/src/blueprint_builder/builder.rs | 8 ++++---- .../planning/src/blueprint_builder/zones.rs | 2 +- .../src/app/background/blueprint_execution.rs | 2 +- .../app/background/crdb_node_id_collector.rs | 4 ++-- nexus/test-utils/src/lib.rs | 12 +++++------ nexus/types/src/deployment.rs | 2 +- openapi/nexus-internal.json | 8 ++++++++ openapi/sled-agent.json | 2 +- sled-agent/src/rack_setup/plan/service.rs | 20 +++++++++---------- sled-agent/src/services.rs | 12 +++++------ 19 files changed, 83 insertions(+), 64 deletions(-) diff --git a/nexus/db-model/src/deployment.rs b/nexus/db-model/src/deployment.rs index f05e4c1bde..28c9d2448a 100644 --- a/nexus/db-model/src/deployment.rs +++ b/nexus/db-model/src/deployment.rs @@ -265,7 +265,7 @@ impl BpOmicronZone { sled_id, blueprint_zone.id.into_untyped_uuid(), blueprint_zone.underlay_address, - blueprint_zone.filesystem_pool.id(), + blueprint_zone.filesystem_pool.as_ref().map(|pool| pool.id()), &blueprint_zone.zone_type.clone().into(), external_ip_id, )?; @@ -274,7 +274,10 @@ impl BpOmicronZone { sled_id: zone.sled_id.into(), id: zone.id, underlay_address: zone.underlay_address, - filesystem_pool: blueprint_zone.filesystem_pool.id().into(), + filesystem_pool: blueprint_zone + .filesystem_pool + .as_ref() + .map(|pool| pool.id().into()), zone_type: zone.zone_type, primary_service_ip: zone.primary_service_ip, primary_service_port: zone.primary_service_port, @@ -305,7 +308,7 @@ impl BpOmicronZone { sled_id: self.sled_id.into(), id: self.id, underlay_address: self.underlay_address, - filesystem_pool: self.filesystem_pool.into(), + filesystem_pool: self.filesystem_pool.map(|id| id.into()), zone_type: self.zone_type, primary_service_ip: self.primary_service_ip, primary_service_port: self.primary_service_port, diff --git a/nexus/db-model/src/inventory.rs b/nexus/db-model/src/inventory.rs index 08576fe261..be38250f45 100644 --- a/nexus/db-model/src/inventory.rs +++ b/nexus/db-model/src/inventory.rs @@ -1041,7 +1041,7 @@ impl InvOmicronZone { sled_id, zone.id, zone.underlay_address, - zone.filesystem_pool.id(), + zone.filesystem_pool.as_ref().map(|pool| pool.id()), &zone.zone_type, external_ip_id, )?; @@ -1050,7 +1050,7 @@ impl InvOmicronZone { sled_id: zone.sled_id.into(), id: zone.id, underlay_address: zone.underlay_address, - filesystem_pool: zone.filesystem_pool.into(), + filesystem_pool: zone.filesystem_pool.map(|id| id.into()), zone_type: zone.zone_type, primary_service_ip: zone.primary_service_ip, primary_service_port: zone.primary_service_port, @@ -1079,7 +1079,7 @@ impl InvOmicronZone { sled_id: self.sled_id.into(), id: self.id, underlay_address: self.underlay_address, - filesystem_pool: self.filesystem_pool.into(), + filesystem_pool: self.filesystem_pool.map(|id| id.into()), zone_type: self.zone_type, primary_service_ip: self.primary_service_ip, primary_service_port: self.primary_service_port, diff --git a/nexus/db-model/src/omicron_zone_config.rs b/nexus/db-model/src/omicron_zone_config.rs index da40d2125f..a325e0d361 100644 --- a/nexus/db-model/src/omicron_zone_config.rs +++ b/nexus/db-model/src/omicron_zone_config.rs @@ -35,7 +35,7 @@ pub(crate) struct OmicronZone { pub(crate) sled_id: SledUuid, pub(crate) id: Uuid, pub(crate) underlay_address: ipv6::Ipv6Addr, - pub(crate) filesystem_pool: ZpoolUuid, + pub(crate) filesystem_pool: Option, pub(crate) zone_type: ZoneType, pub(crate) primary_service_ip: ipv6::Ipv6Addr, pub(crate) primary_service_port: SqlU16, @@ -62,7 +62,7 @@ impl OmicronZone { sled_id: SledUuid, zone_id: Uuid, zone_underlay_address: Ipv6Addr, - filesystem_pool: ZpoolUuid, + filesystem_pool: Option, zone_type: &nexus_types::inventory::OmicronZoneType, external_ip_id: Option, ) -> anyhow::Result { @@ -369,7 +369,9 @@ impl OmicronZone { disposition, id: OmicronZoneUuid::from_untyped_uuid(common.id), underlay_address: std::net::Ipv6Addr::from(common.underlay_address), - filesystem_pool: ZpoolName::new_external(common.filesystem_pool), + filesystem_pool: common + .filesystem_pool + .map(|id| ZpoolName::new_external(id)), zone_type, }) } @@ -473,7 +475,9 @@ impl OmicronZone { Ok(nexus_types::inventory::OmicronZoneConfig { id: common.id, underlay_address: std::net::Ipv6Addr::from(common.underlay_address), - filesystem_pool: ZpoolName::new_external(common.filesystem_pool), + filesystem_pool: common + .filesystem_pool + .map(|id| ZpoolName::new_external(id)), zone_type, }) } @@ -589,7 +593,7 @@ impl OmicronZone { struct ZoneConfigCommon { id: Uuid, underlay_address: ipv6::Ipv6Addr, - filesystem_pool: ZpoolUuid, + filesystem_pool: Option, zone_type: ZoneType, primary_service_address: SocketAddrV6, snat_ip: Option, diff --git a/nexus/db-queries/src/db/datastore/rack.rs b/nexus/db-queries/src/db/datastore/rack.rs index 1e382746cd..f1bde5b8c8 100644 --- a/nexus/db-queries/src/db/datastore/rack.rs +++ b/nexus/db-queries/src/db/datastore/rack.rs @@ -1376,7 +1376,7 @@ mod test { disposition: BlueprintZoneDisposition::InService, id: external_dns_id, underlay_address: Ipv6Addr::LOCALHOST, - filesystem_pool: dataset.pool_name.clone(), + filesystem_pool: Some(dataset.pool_name.clone()), zone_type: BlueprintZoneType::ExternalDns( blueprint_zone_type::ExternalDns { dataset, @@ -1405,7 +1405,7 @@ mod test { disposition: BlueprintZoneDisposition::InService, id: ntp1_id, underlay_address: Ipv6Addr::LOCALHOST, - filesystem_pool: random_zpool(), + filesystem_pool: Some(random_zpool()), zone_type: BlueprintZoneType::BoundaryNtp( blueprint_zone_type::BoundaryNtp { address: "[::1]:80".parse().unwrap(), @@ -1447,7 +1447,7 @@ mod test { disposition: BlueprintZoneDisposition::InService, id: nexus_id, underlay_address: Ipv6Addr::LOCALHOST, - filesystem_pool: random_zpool(), + filesystem_pool: Some(random_zpool()), zone_type: BlueprintZoneType::Nexus( blueprint_zone_type::Nexus { internal_address: "[::1]:80".parse().unwrap(), @@ -1479,7 +1479,7 @@ mod test { disposition: BlueprintZoneDisposition::InService, id: ntp2_id, underlay_address: Ipv6Addr::LOCALHOST, - filesystem_pool: random_zpool(), + filesystem_pool: Some(random_zpool()), zone_type: BlueprintZoneType::BoundaryNtp( blueprint_zone_type::BoundaryNtp { address: "[::1]:80".parse().unwrap(), @@ -1520,7 +1520,7 @@ mod test { disposition: BlueprintZoneDisposition::InService, id: ntp3_id, underlay_address: Ipv6Addr::LOCALHOST, - filesystem_pool: random_zpool(), + filesystem_pool: Some(random_zpool()), zone_type: BlueprintZoneType::InternalNtp( blueprint_zone_type::InternalNtp { address: "[::1]:80".parse().unwrap(), @@ -1703,7 +1703,7 @@ mod test { disposition: BlueprintZoneDisposition::InService, id: nexus_id1, underlay_address: Ipv6Addr::LOCALHOST, - filesystem_pool: random_zpool(), + filesystem_pool: Some(random_zpool()), zone_type: BlueprintZoneType::Nexus( blueprint_zone_type::Nexus { internal_address: "[::1]:80".parse().unwrap(), @@ -1735,7 +1735,7 @@ mod test { disposition: BlueprintZoneDisposition::InService, id: nexus_id2, underlay_address: Ipv6Addr::LOCALHOST, - filesystem_pool: random_zpool(), + filesystem_pool: Some(random_zpool()), zone_type: BlueprintZoneType::Nexus( blueprint_zone_type::Nexus { internal_address: "[::1]:80".parse().unwrap(), @@ -1976,7 +1976,7 @@ mod test { disposition: BlueprintZoneDisposition::InService, id: nexus_id, underlay_address: Ipv6Addr::LOCALHOST, - filesystem_pool: random_zpool(), + filesystem_pool: Some(random_zpool()), zone_type: BlueprintZoneType::Nexus( blueprint_zone_type::Nexus { internal_address: "[::1]:80".parse().unwrap(), @@ -2084,7 +2084,7 @@ mod test { disposition: BlueprintZoneDisposition::InService, id: external_dns_id, underlay_address: Ipv6Addr::LOCALHOST, - filesystem_pool: dataset.pool_name.clone(), + filesystem_pool: Some(dataset.pool_name.clone()), zone_type: BlueprintZoneType::ExternalDns( blueprint_zone_type::ExternalDns { dataset, @@ -2113,7 +2113,7 @@ mod test { disposition: BlueprintZoneDisposition::InService, id: nexus_id, underlay_address: Ipv6Addr::LOCALHOST, - filesystem_pool: random_zpool(), + filesystem_pool: Some(random_zpool()), zone_type: BlueprintZoneType::Nexus( blueprint_zone_type::Nexus { internal_address: "[::1]:80".parse().unwrap(), diff --git a/nexus/inventory/src/collector.rs b/nexus/inventory/src/collector.rs index 62f9dbf39f..87e9327dfa 100644 --- a/nexus/inventory/src/collector.rs +++ b/nexus/inventory/src/collector.rs @@ -572,7 +572,7 @@ mod test { sled_agent_client::types::OmicronZoneType::Oximeter { address: zone_address.to_string(), }, - filesystem_pool, + filesystem_pool: Some(filesystem_pool), }], }) .await diff --git a/nexus/reconfigurator/execution/src/datasets.rs b/nexus/reconfigurator/execution/src/datasets.rs index de0d4984e2..e007c2528e 100644 --- a/nexus/reconfigurator/execution/src/datasets.rs +++ b/nexus/reconfigurator/execution/src/datasets.rs @@ -278,7 +278,7 @@ mod tests { disposition: BlueprintZoneDisposition::InService, id: OmicronZoneUuid::new_v4(), underlay_address: "::1".parse().unwrap(), - filesystem_pool: ZpoolName::new_external(new_zpool_id), + filesystem_pool: Some(ZpoolName::new_external(new_zpool_id)), zone_type: BlueprintZoneType::Crucible( blueprint_zone_type::Crucible { address: "[::1]:0".parse().unwrap(), diff --git a/nexus/reconfigurator/execution/src/dns.rs b/nexus/reconfigurator/execution/src/dns.rs index 107fe0ac33..61bbcd72d5 100644 --- a/nexus/reconfigurator/execution/src/dns.rs +++ b/nexus/reconfigurator/execution/src/dns.rs @@ -623,7 +623,9 @@ mod test { disposition: BlueprintZoneDisposition::Quiesced, id: out_of_service_id, underlay_address: out_of_service_addr, - filesystem_pool: ZpoolName::new_external(ZpoolUuid::new_v4()), + filesystem_pool: Some(ZpoolName::new_external( + ZpoolUuid::new_v4(), + )), zone_type: BlueprintZoneType::Oximeter( blueprint_zone_type::Oximeter { address: SocketAddrV6::new( diff --git a/nexus/reconfigurator/execution/src/external_networking.rs b/nexus/reconfigurator/execution/src/external_networking.rs index 83c702fb65..b5b5ce51f0 100644 --- a/nexus/reconfigurator/execution/src/external_networking.rs +++ b/nexus/reconfigurator/execution/src/external_networking.rs @@ -592,9 +592,9 @@ mod tests { disposition: BlueprintZoneDisposition::InService, id: self.nexus_id, underlay_address: Ipv6Addr::LOCALHOST, - filesystem_pool: ZpoolName::new_external( + filesystem_pool: Some(ZpoolName::new_external( ZpoolUuid::new_v4(), - ), + )), zone_type: BlueprintZoneType::Nexus( blueprint_zone_type::Nexus { internal_address: "[::1]:0".parse().unwrap(), @@ -609,9 +609,9 @@ mod tests { disposition: BlueprintZoneDisposition::InService, id: self.dns_id, underlay_address: Ipv6Addr::LOCALHOST, - filesystem_pool: ZpoolName::new_external( + filesystem_pool: Some(ZpoolName::new_external( ZpoolUuid::new_v4(), - ), + )), zone_type: BlueprintZoneType::ExternalDns( blueprint_zone_type::ExternalDns { dataset: OmicronZoneDataset { @@ -629,9 +629,9 @@ mod tests { disposition: BlueprintZoneDisposition::InService, id: self.ntp_id, underlay_address: Ipv6Addr::LOCALHOST, - filesystem_pool: ZpoolName::new_external( + filesystem_pool: Some(ZpoolName::new_external( ZpoolUuid::new_v4(), - ), + )), zone_type: BlueprintZoneType::BoundaryNtp( blueprint_zone_type::BoundaryNtp { address: "[::1]:0".parse().unwrap(), diff --git a/nexus/reconfigurator/execution/src/omicron_zones.rs b/nexus/reconfigurator/execution/src/omicron_zones.rs index 401a2ef749..08d41928c9 100644 --- a/nexus/reconfigurator/execution/src/omicron_zones.rs +++ b/nexus/reconfigurator/execution/src/omicron_zones.rs @@ -192,7 +192,7 @@ mod test { disposition: BlueprintZoneDisposition::InService, id: OmicronZoneUuid::new_v4(), underlay_address: "::1".parse().unwrap(), - filesystem_pool: zpool.clone(), + filesystem_pool: Some(zpool.clone()), zone_type: BlueprintZoneType::InternalDns( blueprint_zone_type::InternalDns { dataset: OmicronZoneDataset { pool_name: zpool }, @@ -295,7 +295,9 @@ mod test { disposition, id: OmicronZoneUuid::new_v4(), underlay_address: "::1".parse().unwrap(), - filesystem_pool: ZpoolName::new_external(ZpoolUuid::new_v4()), + filesystem_pool: Some(ZpoolName::new_external( + ZpoolUuid::new_v4(), + )), zone_type: BlueprintZoneType::InternalNtp( blueprint_zone_type::InternalNtp { address: "[::1]:0".parse().unwrap(), diff --git a/nexus/reconfigurator/planning/src/blueprint_builder/builder.rs b/nexus/reconfigurator/planning/src/blueprint_builder/builder.rs index fef40acc07..05fa63b9d4 100644 --- a/nexus/reconfigurator/planning/src/blueprint_builder/builder.rs +++ b/nexus/reconfigurator/planning/src/blueprint_builder/builder.rs @@ -673,7 +673,7 @@ impl<'a> BlueprintBuilder<'a> { disposition: BlueprintZoneDisposition::InService, id: self.rng.zone_rng.next(), underlay_address: ip, - filesystem_pool, + filesystem_pool: Some(filesystem_pool), zone_type, }; @@ -729,7 +729,7 @@ impl<'a> BlueprintBuilder<'a> { disposition: BlueprintZoneDisposition::InService, id: self.rng.zone_rng.next(), underlay_address: ip, - filesystem_pool, + filesystem_pool: Some(filesystem_pool), zone_type, }; @@ -857,7 +857,7 @@ impl<'a> BlueprintBuilder<'a> { disposition: BlueprintZoneDisposition::InService, id: nexus_id, underlay_address: ip, - filesystem_pool, + filesystem_pool: Some(filesystem_pool), zone_type, }; self.sled_add_zone(sled_id, zone)?; @@ -914,7 +914,7 @@ impl<'a> BlueprintBuilder<'a> { disposition: BlueprintZoneDisposition::InService, id: zone_id, underlay_address: underlay_ip, - filesystem_pool, + filesystem_pool: Some(filesystem_pool), zone_type, }; self.sled_add_zone(sled_id, zone)?; diff --git a/nexus/reconfigurator/planning/src/blueprint_builder/zones.rs b/nexus/reconfigurator/planning/src/blueprint_builder/zones.rs index f5ad2efe97..eb65f948d7 100644 --- a/nexus/reconfigurator/planning/src/blueprint_builder/zones.rs +++ b/nexus/reconfigurator/planning/src/blueprint_builder/zones.rs @@ -290,7 +290,7 @@ mod tests { disposition: BlueprintZoneDisposition::InService, id: new_zone_id, underlay_address: Ipv6Addr::UNSPECIFIED, - filesystem_pool, + filesystem_pool: Some(filesystem_pool), zone_type: BlueprintZoneType::Oximeter( blueprint_zone_type::Oximeter { address: SocketAddrV6::new( diff --git a/nexus/src/app/background/blueprint_execution.rs b/nexus/src/app/background/blueprint_execution.rs index 7a56897f97..c7ee0ae43f 100644 --- a/nexus/src/app/background/blueprint_execution.rs +++ b/nexus/src/app/background/blueprint_execution.rs @@ -269,7 +269,7 @@ mod test { disposition, id: OmicronZoneUuid::new_v4(), underlay_address: "::1".parse().unwrap(), - filesystem_pool: ZpoolName::new_external(pool_id), + filesystem_pool: Some(ZpoolName::new_external(pool_id)), zone_type: BlueprintZoneType::InternalDns( blueprint_zone_type::InternalDns { dataset: OmicronZoneDataset { diff --git a/nexus/src/app/background/crdb_node_id_collector.rs b/nexus/src/app/background/crdb_node_id_collector.rs index eb9d4f3c3d..29ee04ade1 100644 --- a/nexus/src/app/background/crdb_node_id_collector.rs +++ b/nexus/src/app/background/crdb_node_id_collector.rs @@ -273,7 +273,7 @@ mod tests { disposition, id, underlay_address: *addr.ip(), - filesystem_pool: ZpoolName::new_external(zpool_id), + filesystem_pool: Some(ZpoolName::new_external(zpool_id)), zone_type: BlueprintZoneType::CockroachDb( blueprint_zone_type::CockroachDb { address: addr, @@ -316,7 +316,7 @@ mod tests { disposition: BlueprintZoneDisposition::InService, id: OmicronZoneUuid::new_v4(), underlay_address: "::1".parse().unwrap(), - filesystem_pool: ZpoolName::new_external(ZpoolUuid::new_v4()), + filesystem_pool: Some(ZpoolName::new_external(ZpoolUuid::new_v4())), zone_type: BlueprintZoneType::CruciblePantry( blueprint_zone_type::CruciblePantry { address: "[::1]:0".parse().unwrap(), diff --git a/nexus/test-utils/src/lib.rs b/nexus/test-utils/src/lib.rs index 3411eaa4e4..3d4f646bbe 100644 --- a/nexus/test-utils/src/lib.rs +++ b/nexus/test-utils/src/lib.rs @@ -422,7 +422,7 @@ impl<'a, N: NexusServer> ControlPlaneTestContextBuilder<'a, N> { disposition: BlueprintZoneDisposition::InService, id: OmicronZoneUuid::from_untyped_uuid(dataset_id), underlay_address: *address.ip(), - filesystem_pool: ZpoolName::new_external(zpool_id), + filesystem_pool: Some(ZpoolName::new_external(zpool_id)), zone_type: BlueprintZoneType::CockroachDb( blueprint_zone_type::CockroachDb { address, @@ -475,7 +475,7 @@ impl<'a, N: NexusServer> ControlPlaneTestContextBuilder<'a, N> { disposition: BlueprintZoneDisposition::InService, id: OmicronZoneUuid::from_untyped_uuid(dataset_id), underlay_address: *address.ip(), - filesystem_pool: ZpoolName::new_external(zpool_id), + filesystem_pool: Some(ZpoolName::new_external(zpool_id)), zone_type: BlueprintZoneType::Clickhouse( blueprint_zone_type::Clickhouse { address, @@ -664,7 +664,7 @@ impl<'a, N: NexusServer> ControlPlaneTestContextBuilder<'a, N> { disposition: BlueprintZoneDisposition::InService, id: nexus_id, underlay_address: *address.ip(), - filesystem_pool: ZpoolName::new_external(ZpoolUuid::new_v4()), + filesystem_pool: Some(ZpoolName::new_external(ZpoolUuid::new_v4())), zone_type: BlueprintZoneType::Nexus(blueprint_zone_type::Nexus { external_dns_servers: self .config @@ -986,7 +986,7 @@ impl<'a, N: NexusServer> ControlPlaneTestContextBuilder<'a, N> { disposition: BlueprintZoneDisposition::InService, id: zone_id, underlay_address: *address.ip(), - filesystem_pool: ZpoolName::new_external(ZpoolUuid::new_v4()), + filesystem_pool: Some(ZpoolName::new_external(ZpoolUuid::new_v4())), zone_type: BlueprintZoneType::CruciblePantry( blueprint_zone_type::CruciblePantry { address }, ), @@ -1028,7 +1028,7 @@ impl<'a, N: NexusServer> ControlPlaneTestContextBuilder<'a, N> { disposition: BlueprintZoneDisposition::InService, id: zone_id, underlay_address: *dropshot_address.ip(), - filesystem_pool: ZpoolName::new_external(zpool_id), + filesystem_pool: Some(ZpoolName::new_external(zpool_id)), zone_type: BlueprintZoneType::ExternalDns( blueprint_zone_type::ExternalDns { dataset: OmicronZoneDataset { pool_name }, @@ -1090,7 +1090,7 @@ impl<'a, N: NexusServer> ControlPlaneTestContextBuilder<'a, N> { disposition: BlueprintZoneDisposition::InService, id: zone_id, underlay_address: *http_address.ip(), - filesystem_pool: ZpoolName::new_external(zpool_id), + filesystem_pool: Some(ZpoolName::new_external(zpool_id)), zone_type: BlueprintZoneType::InternalDns( blueprint_zone_type::InternalDns { dataset: OmicronZoneDataset { pool_name }, diff --git a/nexus/types/src/deployment.rs b/nexus/types/src/deployment.rs index 822e819ff2..4f1984db7f 100644 --- a/nexus/types/src/deployment.rs +++ b/nexus/types/src/deployment.rs @@ -623,7 +623,7 @@ pub struct BlueprintZoneConfig { pub id: OmicronZoneUuid, pub underlay_address: Ipv6Addr, - pub filesystem_pool: ZpoolName, + pub filesystem_pool: Option, pub zone_type: BlueprintZoneType, } diff --git a/openapi/nexus-internal.json b/openapi/nexus-internal.json index c3cc3c059d..66ab49aaf9 100644 --- a/openapi/nexus-internal.json +++ b/openapi/nexus-internal.json @@ -1959,6 +1959,14 @@ } ] }, + "filesystem_pool": { + "nullable": true, + "allOf": [ + { + "$ref": "#/components/schemas/ZpoolName" + } + ] + }, "id": { "$ref": "#/components/schemas/TypedUuidForOmicronZoneKind" }, diff --git a/openapi/sled-agent.json b/openapi/sled-agent.json index e968b6dc8b..eb990507fd 100644 --- a/openapi/sled-agent.json +++ b/openapi/sled-agent.json @@ -3661,6 +3661,7 @@ "type": "object", "properties": { "filesystem_pool": { + "nullable": true, "description": "The pool on which we'll place this zone's filesystem.\n\nNote that this is transient -- the sled agent is permitted to destroy the zone's dataset on this pool each time the zone is initialized.", "allOf": [ { @@ -3681,7 +3682,6 @@ } }, "required": [ - "filesystem_pool", "id", "underlay_address", "zone_type" diff --git a/sled-agent/src/rack_setup/plan/service.rs b/sled-agent/src/rack_setup/plan/service.rs index 487bfcf0d5..dc077fb568 100644 --- a/sled-agent/src/rack_setup/plan/service.rs +++ b/sled-agent/src/rack_setup/plan/service.rs @@ -406,7 +406,7 @@ impl Plan { .unwrap(); let dataset_name = sled.alloc_dataset_from_u2s(DatasetKind::InternalDns)?; - let filesystem_pool = dataset_name.pool().clone(); + let filesystem_pool = Some(dataset_name.pool().clone()); sled.request.zones.push(OmicronZoneConfig { // TODO-cleanup use TypedUuid everywhere @@ -446,7 +446,7 @@ impl Plan { .unwrap(); let dataset_name = sled.alloc_dataset_from_u2s(DatasetKind::CockroachDb)?; - let filesystem_pool = dataset_name.pool().clone(); + let filesystem_pool = Some(dataset_name.pool().clone()); sled.request.zones.push(OmicronZoneConfig { // TODO-cleanup use TypedUuid everywhere id: id.into_untyped_uuid(), @@ -491,7 +491,7 @@ impl Plan { let dns_address = SocketAddr::new(external_ip, dns_port); let dataset_kind = DatasetKind::ExternalDns; let dataset_name = sled.alloc_dataset_from_u2s(dataset_kind)?; - let filesystem_pool = dataset_name.pool().clone(); + let filesystem_pool = Some(dataset_name.pool().clone()); sled.request.zones.push(OmicronZoneConfig { // TODO-cleanup use TypedUuid everywhere @@ -527,7 +527,7 @@ impl Plan { ) .unwrap(); let (nic, external_ip) = svc_port_builder.next_nexus(id)?; - let filesystem_pool = sled.alloc_zpool_from_u2s()?; + let filesystem_pool = Some(sled.alloc_zpool_from_u2s()?); sled.request.zones.push(OmicronZoneConfig { // TODO-cleanup use TypedUuid everywhere id: id.into_untyped_uuid(), @@ -572,7 +572,7 @@ impl Plan { omicron_common::address::OXIMETER_PORT, ) .unwrap(); - let filesystem_pool = sled.alloc_zpool_from_u2s()?; + let filesystem_pool = Some(sled.alloc_zpool_from_u2s()?); sled.request.zones.push(OmicronZoneConfig { // TODO-cleanup use TypedUuid everywhere id: id.into_untyped_uuid(), @@ -611,7 +611,7 @@ impl Plan { .unwrap(); let dataset_name = sled.alloc_dataset_from_u2s(DatasetKind::Clickhouse)?; - let filesystem_pool = dataset_name.pool().clone(); + let filesystem_pool = Some(dataset_name.pool().clone()); sled.request.zones.push(OmicronZoneConfig { // TODO-cleanup use TypedUuid everywhere id: id.into_untyped_uuid(), @@ -650,7 +650,7 @@ impl Plan { .unwrap(); let dataset_name = sled.alloc_dataset_from_u2s(DatasetKind::ClickhouseKeeper)?; - let filesystem_pool = dataset_name.pool().clone(); + let filesystem_pool = Some(dataset_name.pool().clone()); sled.request.zones.push(OmicronZoneConfig { // TODO-cleanup use TypedUuid everywhere id: id.into_untyped_uuid(), @@ -676,7 +676,7 @@ impl Plan { let address = sled.addr_alloc.next().expect("Not enough addrs"); let port = omicron_common::address::CRUCIBLE_PANTRY_PORT; let id = OmicronZoneUuid::new_v4(); - let filesystem_pool = sled.alloc_zpool_from_u2s()?; + let filesystem_pool = Some(sled.alloc_zpool_from_u2s()?); dns_builder .host_zone_with_one_backend( id, @@ -721,7 +721,7 @@ impl Plan { address, dataset: OmicronZoneDataset { pool_name: pool.clone() }, }, - filesystem_pool: pool.clone(), + filesystem_pool: Some(pool.clone()), }); } } @@ -734,7 +734,7 @@ impl Plan { let id = OmicronZoneUuid::new_v4(); let address = sled.addr_alloc.next().expect("Not enough addrs"); let ntp_address = SocketAddrV6::new(address, NTP_PORT, 0, 0); - let filesystem_pool = sled.alloc_zpool_from_u2s()?; + let filesystem_pool = Some(sled.alloc_zpool_from_u2s()?); let (zone_type, svcname) = if idx < BOUNDARY_NTP_COUNT { boundary_ntp_servers diff --git a/sled-agent/src/services.rs b/sled-agent/src/services.rs index d1b1324789..dcb0ddfbb3 100644 --- a/sled-agent/src/services.rs +++ b/sled-agent/src/services.rs @@ -3332,7 +3332,8 @@ impl ServiceManager { } } - let filesystem_pool = match (&zone.filesystem_pool, zone.dataset_name()) { + let filesystem_pool = match (&zone.filesystem_pool, zone.dataset_name()) + { // If a pool was explicitly requested, use it. (Some(pool), _) => pool.clone(), // NOTE: The following cases are for backwards compatibility. @@ -3340,11 +3341,10 @@ impl ServiceManager { // If no pool was selected, prefer to use the same pool as the // durable dataset. Otherwise, pick one randomly. (None, Some(dataset)) => dataset.pool().clone(), - (None, None) => { - all_u2_pools.choose(&mut rand::thread_rng()) - .ok_or_else(|| Error::U2NotFound)? - .clone() - } + (None, None) => all_u2_pools + .choose(&mut rand::thread_rng()) + .ok_or_else(|| Error::U2NotFound)? + .clone(), }; if !all_u2_pools.contains(&filesystem_pool) {