Skip to content

Commit c073f52

Browse files
committed
(6/N) Add image to planning report for zones
1 parent f5aa67c commit c073f52

File tree

7 files changed

+82
-40
lines changed

7 files changed

+82
-40
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
@@ -846,7 +846,7 @@ chicken switches:
846846
add zones with mupdate override: false
847847

848848
* discretionary zones placed:
849-
* 1 zone on sled 711ac7f8-d19e-4572-bdb9-e9b50f6e362a: external_dns
849+
* external_dns zone on sled 711ac7f8-d19e-4572-bdb9-e9b50f6e362a from source install dataset
850850
* zone updates waiting on discretionary zones
851851

852852

@@ -1346,7 +1346,7 @@ chicken switches:
13461346
add zones with mupdate override: false
13471347

13481348
* discretionary zones placed:
1349-
* 1 zone on sled 711ac7f8-d19e-4572-bdb9-e9b50f6e362a: external_dns
1349+
* external_dns zone on sled 711ac7f8-d19e-4572-bdb9-e9b50f6e362a from source install dataset
13501350
* zone updates waiting on discretionary zones
13511351

13521352

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
@@ -654,7 +654,7 @@ chicken switches:
654654
add zones with mupdate override: false
655655

656656
* discretionary zones placed:
657-
* 1 zone on sled 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c: internal_dns
657+
* internal_dns zone on sled 2b8f0cb3-0295-4b3c-bc58-4fe88b57112c from source install dataset
658658
* zone updates waiting on discretionary zones
659659

660660

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
@@ -528,6 +528,14 @@ pub struct PlanningAddSufficientZonesExist {
528528
pub num_existing: usize,
529529
}
530530

531+
#[derive(
532+
Clone, Debug, Deserialize, Serialize, PartialEq, Eq, Diffable, JsonSchema,
533+
)]
534+
pub struct DiscretionaryZonePlacement {
535+
kind: String,
536+
source: String,
537+
}
538+
531539
#[derive(
532540
Clone, Debug, Deserialize, Serialize, PartialEq, Eq, Diffable, JsonSchema,
533541
)]
@@ -580,7 +588,8 @@ pub struct PlanningAddStepReport {
580588
/// Sled ID → kinds of discretionary zones placed there
581589
// TODO: make `sled_add_zone_*` methods return the added zone config
582590
// so that we can report it here.
583-
pub discretionary_zones_placed: BTreeMap<SledUuid, Vec<String>>,
591+
pub discretionary_zones_placed:
592+
BTreeMap<SledUuid, Vec<DiscretionaryZonePlacement>>,
584593
}
585594

586595
impl PlanningAddStepReport {
@@ -663,11 +672,22 @@ impl PlanningAddStepReport {
663672
&mut self,
664673
sled_id: SledUuid,
665674
zone_kind: &str,
675+
image_source: &BlueprintZoneImageSource,
666676
) {
667677
self.discretionary_zones_placed
668678
.entry(sled_id)
669-
.and_modify(|kinds| kinds.push(zone_kind.to_owned()))
670-
.or_insert_with(|| vec![zone_kind.to_owned()]);
679+
.and_modify(|kinds| {
680+
kinds.push(DiscretionaryZonePlacement {
681+
kind: zone_kind.to_owned(),
682+
source: image_source.to_string(),
683+
})
684+
})
685+
.or_insert_with(|| {
686+
vec![DiscretionaryZonePlacement {
687+
kind: zone_kind.to_owned(),
688+
source: image_source.to_string(),
689+
}]
690+
});
671691
}
672692
}
673693

@@ -788,13 +808,13 @@ impl fmt::Display for PlanningAddStepReport {
788808

789809
if !discretionary_zones_placed.is_empty() {
790810
writeln!(f, "* discretionary zones placed:")?;
791-
for (sled_id, kinds) in discretionary_zones_placed.iter() {
792-
let (n, s) = plural_vec(kinds);
793-
writeln!(
794-
f,
795-
" * {n} zone{s} on sled {sled_id}: {}",
796-
kinds.join(", ")
797-
)?;
811+
for (sled_id, placements) in discretionary_zones_placed.iter() {
812+
for DiscretionaryZonePlacement { kind, source } in placements {
813+
writeln!(
814+
f,
815+
" * {kind} zone on sled {sled_id} from source {source}",
816+
)?;
817+
}
798818
}
799819
}
800820

openapi/nexus-internal.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4219,6 +4219,21 @@
42194219
"saga_id"
42204220
]
42214221
},
4222+
"DiscretionaryZonePlacement": {
4223+
"type": "object",
4224+
"properties": {
4225+
"kind": {
4226+
"type": "string"
4227+
},
4228+
"source": {
4229+
"type": "string"
4230+
}
4231+
},
4232+
"required": [
4233+
"kind",
4234+
"source"
4235+
]
4236+
},
42224237
"DiskIdentity": {
42234238
"description": "Uniquely identifies a disk.",
42244239
"type": "object",
@@ -6756,7 +6771,7 @@
67566771
"additionalProperties": {
67576772
"type": "array",
67586773
"items": {
6759-
"type": "string"
6774+
"$ref": "#/components/schemas/DiscretionaryZonePlacement"
67606775
}
67616776
}
67626777
},

0 commit comments

Comments
 (0)