Skip to content

Commit

Permalink
are we optional yet
Browse files Browse the repository at this point in the history
  • Loading branch information
smklein committed Jun 21, 2024
1 parent a96fc81 commit 9858dbf
Show file tree
Hide file tree
Showing 19 changed files with 83 additions and 64 deletions.
9 changes: 6 additions & 3 deletions nexus/db-model/src/deployment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)?;
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions nexus/db-model/src/inventory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)?;
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
14 changes: 9 additions & 5 deletions nexus/db-model/src/omicron_zone_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ZpoolUuid>,
pub(crate) zone_type: ZoneType,
pub(crate) primary_service_ip: ipv6::Ipv6Addr,
pub(crate) primary_service_port: SqlU16,
Expand All @@ -62,7 +62,7 @@ impl OmicronZone {
sled_id: SledUuid,
zone_id: Uuid,
zone_underlay_address: Ipv6Addr,
filesystem_pool: ZpoolUuid,
filesystem_pool: Option<ZpoolUuid>,
zone_type: &nexus_types::inventory::OmicronZoneType,
external_ip_id: Option<ExternalIpUuid>,
) -> anyhow::Result<Self> {
Expand Down Expand Up @@ -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,
})
}
Expand Down Expand Up @@ -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,
})
}
Expand Down Expand Up @@ -589,7 +593,7 @@ impl OmicronZone {
struct ZoneConfigCommon {
id: Uuid,
underlay_address: ipv6::Ipv6Addr,
filesystem_pool: ZpoolUuid,
filesystem_pool: Option<ZpoolUuid>,
zone_type: ZoneType,
primary_service_address: SocketAddrV6,
snat_ip: Option<IpNetwork>,
Expand Down
20 changes: 10 additions & 10 deletions nexus/db-queries/src/db/datastore/rack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion nexus/inventory/src/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion nexus/reconfigurator/execution/src/datasets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
4 changes: 3 additions & 1 deletion nexus/reconfigurator/execution/src/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
12 changes: 6 additions & 6 deletions nexus/reconfigurator/execution/src/external_networking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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 {
Expand All @@ -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(),
Expand Down
6 changes: 4 additions & 2 deletions nexus/reconfigurator/execution/src/omicron_zones.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down Expand Up @@ -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,
};

Expand Down Expand Up @@ -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)?;
Expand Down Expand Up @@ -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)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion nexus/src/app/background/blueprint_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions nexus/src/app/background/crdb_node_id_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(),
Expand Down
Loading

0 comments on commit 9858dbf

Please sign in to comment.