Skip to content

Commit 9b1f7e3

Browse files
committed
(6/N) Add image to planning report for zones
1 parent 6d63038 commit 9b1f7e3

File tree

6 files changed

+66
-39
lines changed

6 files changed

+66
-39
lines changed

dev-tools/reconfigurator-cli/tests/output/cmds-expunge-newly-added-external-dns-stdout

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,7 @@ chicken switches:
10421042
add zones with mupdate override: false
10431043

10441044
* discretionary zones placed:
1045-
* 1 zone on sled 711ac7f8-d19e-4572-bdb9-e9b50f6e362a: external_dns
1045+
* external_dns zone on sled 711ac7f8-d19e-4572-bdb9-e9b50f6e362a from source install dataset
10461046
* zone updates waiting on discretionary zones
10471047

10481048

@@ -1738,7 +1738,7 @@ chicken switches:
17381738
add zones with mupdate override: false
17391739

17401740
* discretionary zones placed:
1741-
* 1 zone on sled 711ac7f8-d19e-4572-bdb9-e9b50f6e362a: external_dns
1741+
* external_dns zone on sled 711ac7f8-d19e-4572-bdb9-e9b50f6e362a from source install dataset
17421742
* zone updates waiting on discretionary zones
17431743

17441744

dev-tools/reconfigurator-cli/tests/output/cmds-expunge-newly-added-internal-dns-stdout

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ chicken switches:
10561056
add zones with mupdate override: false
10571057

10581058
* discretionary zones placed:
1059-
* 1 zone on sled 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c: internal_dns
1059+
* internal_dns zone on sled 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c from source install dataset
10601060
* zone updates waiting on discretionary zones
10611061

10621062

nexus/reconfigurator/planning/src/planner.rs

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,46 +1141,47 @@ impl<'a> Planner<'a> {
11411141
}
11421142
};
11431143

1144-
let image_source =
1144+
let image =
11451145
self.image_source_for_new_zone(kind.into(), mgs_updates)?;
1146+
let image_source = image.clone();
11461147
match kind {
11471148
DiscretionaryOmicronZone::BoundaryNtp => {
11481149
self.blueprint.sled_promote_internal_ntp_to_boundary_ntp(
1149-
sled_id,
1150-
image_source,
1150+
sled_id, image,
11511151
)?
11521152
}
1153-
DiscretionaryOmicronZone::Clickhouse => self
1154-
.blueprint
1155-
.sled_add_zone_clickhouse(sled_id, image_source)?,
1153+
DiscretionaryOmicronZone::Clickhouse => {
1154+
self.blueprint.sled_add_zone_clickhouse(sled_id, image)?
1155+
}
11561156
DiscretionaryOmicronZone::ClickhouseKeeper => self
11571157
.blueprint
1158-
.sled_add_zone_clickhouse_keeper(sled_id, image_source)?,
1158+
.sled_add_zone_clickhouse_keeper(sled_id, image)?,
11591159
DiscretionaryOmicronZone::ClickhouseServer => self
11601160
.blueprint
1161-
.sled_add_zone_clickhouse_server(sled_id, image_source)?,
1162-
DiscretionaryOmicronZone::CockroachDb => self
1163-
.blueprint
1164-
.sled_add_zone_cockroachdb(sled_id, image_source)?,
1161+
.sled_add_zone_clickhouse_server(sled_id, image)?,
1162+
DiscretionaryOmicronZone::CockroachDb => {
1163+
self.blueprint.sled_add_zone_cockroachdb(sled_id, image)?
1164+
}
11651165
DiscretionaryOmicronZone::CruciblePantry => self
11661166
.blueprint
1167-
.sled_add_zone_crucible_pantry(sled_id, image_source)?,
1168-
DiscretionaryOmicronZone::InternalDns => self
1169-
.blueprint
1170-
.sled_add_zone_internal_dns(sled_id, image_source)?,
1171-
DiscretionaryOmicronZone::ExternalDns => self
1172-
.blueprint
1173-
.sled_add_zone_external_dns(sled_id, image_source)?,
1167+
.sled_add_zone_crucible_pantry(sled_id, image)?,
1168+
DiscretionaryOmicronZone::InternalDns => {
1169+
self.blueprint.sled_add_zone_internal_dns(sled_id, image)?
1170+
}
1171+
DiscretionaryOmicronZone::ExternalDns => {
1172+
self.blueprint.sled_add_zone_external_dns(sled_id, image)?
1173+
}
11741174
DiscretionaryOmicronZone::Nexus => {
1175-
self.blueprint.sled_add_zone_nexus(sled_id, image_source)?
1175+
self.blueprint.sled_add_zone_nexus(sled_id, image)?
1176+
}
1177+
DiscretionaryOmicronZone::Oximeter => {
1178+
self.blueprint.sled_add_zone_oximeter(sled_id, image)?
11761179
}
1177-
DiscretionaryOmicronZone::Oximeter => self
1178-
.blueprint
1179-
.sled_add_zone_oximeter(sled_id, image_source)?,
11801180
};
11811181
report.discretionary_zone_placed(
11821182
sled_id,
11831183
ZoneKind::from(kind).report_str(),
1184+
&image_source,
11841185
);
11851186
}
11861187

nexus/reconfigurator/planning/tests/output/planner_decommissions_sleds_bp2.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,9 @@ chicken switches:
331331
add zones with mupdate override: false
332332

333333
* discretionary zones placed:
334-
* 2 zones on sled d67ce8f0-a691-4010-b414-420d82e80527: crucible_pantry, nexus
335-
* 2 zones on sled fefcf4cf-f7e7-46b3-b629-058526ce440e: clickhouse, internal_dns
334+
* crucible_pantry zone on sled d67ce8f0-a691-4010-b414-420d82e80527 from source install dataset
335+
* nexus zone on sled d67ce8f0-a691-4010-b414-420d82e80527 from source install dataset
336+
* clickhouse zone on sled fefcf4cf-f7e7-46b3-b629-058526ce440e from source install dataset
337+
* internal_dns zone on sled fefcf4cf-f7e7-46b3-b629-058526ce440e from source install dataset
336338
* zone updates waiting on discretionary zones
337339

nexus/reconfigurator/planning/tests/output/planner_nonprovisionable_bp2.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,11 @@ chicken switches:
519519
add zones with mupdate override: false
520520

521521
* discretionary zones placed:
522-
* 3 zones on sled 75bc286f-2b4b-482c-9431-59272af529da: nexus, nexus, nexus
523-
* 3 zones on sled affab35f-600a-4109-8ea0-34a067a4e0bc: nexus, nexus, nexus
522+
* nexus zone on sled 75bc286f-2b4b-482c-9431-59272af529da from source install dataset
523+
* nexus zone on sled 75bc286f-2b4b-482c-9431-59272af529da from source install dataset
524+
* nexus zone on sled 75bc286f-2b4b-482c-9431-59272af529da from source install dataset
525+
* nexus zone on sled affab35f-600a-4109-8ea0-34a067a4e0bc from source install dataset
526+
* nexus zone on sled affab35f-600a-4109-8ea0-34a067a4e0bc from source install dataset
527+
* nexus zone on sled affab35f-600a-4109-8ea0-34a067a4e0bc from source install dataset
524528
* zone updates waiting on discretionary zones
525529

nexus/types/src/deployment/planning_report.rs

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,14 @@ pub struct PlanningAddSufficientZonesExist {
526526
pub num_existing: usize,
527527
}
528528

529+
#[derive(
530+
Clone, Debug, Deserialize, Serialize, PartialEq, Eq, Diffable, JsonSchema,
531+
)]
532+
pub struct DiscretionaryZonePlacement {
533+
kind: String,
534+
source: String,
535+
}
536+
529537
#[derive(
530538
Clone, Debug, Deserialize, Serialize, PartialEq, Eq, Diffable, JsonSchema,
531539
)]
@@ -573,7 +581,8 @@ pub struct PlanningAddStepReport {
573581
/// Sled ID → kinds of discretionary zones placed there
574582
// TODO: make `sled_add_zone_*` methods return the added zone config
575583
// so that we can report it here.
576-
pub discretionary_zones_placed: BTreeMap<SledUuid, Vec<String>>,
584+
pub discretionary_zones_placed:
585+
BTreeMap<SledUuid, Vec<DiscretionaryZonePlacement>>,
577586
}
578587

579588
impl PlanningAddStepReport {
@@ -655,11 +664,22 @@ impl PlanningAddStepReport {
655664
&mut self,
656665
sled_id: SledUuid,
657666
zone_kind: &str,
667+
image_source: &BlueprintZoneImageSource,
658668
) {
659669
self.discretionary_zones_placed
660670
.entry(sled_id)
661-
.and_modify(|kinds| kinds.push(zone_kind.to_owned()))
662-
.or_insert_with(|| vec![zone_kind.to_owned()]);
671+
.and_modify(|kinds| {
672+
kinds.push(DiscretionaryZonePlacement {
673+
kind: zone_kind.to_owned(),
674+
source: image_source.to_string(),
675+
})
676+
})
677+
.or_insert_with(|| {
678+
vec![DiscretionaryZonePlacement {
679+
kind: zone_kind.to_owned(),
680+
source: image_source.to_string(),
681+
}]
682+
});
663683
}
664684
}
665685

@@ -770,13 +790,13 @@ impl fmt::Display for PlanningAddStepReport {
770790

771791
if !discretionary_zones_placed.is_empty() {
772792
writeln!(f, "* discretionary zones placed:")?;
773-
for (sled_id, kinds) in discretionary_zones_placed.iter() {
774-
let (n, s) = plural_vec(kinds);
775-
writeln!(
776-
f,
777-
" * {n} zone{s} on sled {sled_id}: {}",
778-
kinds.join(", ")
779-
)?;
793+
for (sled_id, placements) in discretionary_zones_placed.iter() {
794+
for DiscretionaryZonePlacement { kind, source } in placements {
795+
writeln!(
796+
f,
797+
" * {kind} zone on sled {sled_id} from source {source}",
798+
)?;
799+
}
780800
}
781801
}
782802

0 commit comments

Comments
 (0)