Skip to content

Commit e02810b

Browse files
authored
Add cosmo support to reconfigurator (#9134)
1 parent 528764a commit e02810b

File tree

18 files changed

+679
-400
lines changed

18 files changed

+679
-400
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev-tools/reconfigurator-cli/tests/output/cmds-example-stdout

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,7 +1370,7 @@ done: <REDACTED_TIMESTAMP>
13701370
errors: 0
13711371

13721372
Sled serial0
1373-
part number: model0
1373+
part number: 913-0000019
13741374
power: A2
13751375
revision: 0
13761376
MGS slot: Sled 0
@@ -1395,7 +1395,7 @@ Sled serial0
13951395
RoT: slot B SHA3-256: slotBdigest1
13961396

13971397
Sled serial1
1398-
part number: model1
1398+
part number: 913-0000019
13991399
power: A2
14001400
revision: 0
14011401
MGS slot: Sled 1
@@ -1420,7 +1420,7 @@ Sled serial1
14201420
RoT: slot B SHA3-256: slotBdigest1
14211421

14221422
Sled serial2
1423-
part number: model2
1423+
part number: 913-0000019
14241424
power: A2
14251425
revision: 0
14261426
MGS slot: Sled 2

dev-tools/reconfigurator-cli/tests/output/cmds-missing-sled-blocks-zone-updates-stdout

Lines changed: 23 additions & 23 deletions
Large diffs are not rendered by default.

dev-tools/reconfigurator-cli/tests/output/cmds-mupdate-update-flow-stdout

Lines changed: 14 additions & 14 deletions
Large diffs are not rendered by default.

dev-tools/reconfigurator-cli/tests/output/cmds-nexus-generation-autobump-stdout

Lines changed: 39 additions & 39 deletions
Large diffs are not rendered by default.

dev-tools/reconfigurator-cli/tests/output/cmds-set-mgs-updates-stdout

Lines changed: 13 additions & 13 deletions
Large diffs are not rendered by default.

dev-tools/reconfigurator-cli/tests/output/cmds-target-release-stdout

Lines changed: 219 additions & 219 deletions
Large diffs are not rendered by default.

dev-tools/reconfigurator-cli/tests/output/cmds-unsafe-zone-mgs-stdout

Lines changed: 26 additions & 26 deletions
Large diffs are not rendered by default.

nexus/reconfigurator/planning/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ oxnet.workspace = true
3636
rand.workspace = true
3737
semver.workspace = true
3838
sled-agent-client.workspace = true
39+
sled-hardware-types.workspace = true
3940
slog.workspace = true
4041
slog-error-chain.workspace = true
4142
sp-sim.workspace = true

nexus/reconfigurator/planning/src/mgs_updates/host_phase_1.rs

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use omicron_common::api::external::TufArtifactMeta;
2222
use omicron_common::api::external::TufRepoDescription;
2323
use omicron_common::disk::M2Slot;
2424
use omicron_uuid_kinds::SledUuid;
25+
use sled_hardware_types::OxideSled;
2526
use slog::Logger;
2627
use slog::debug;
2728
use slog::error;
@@ -376,12 +377,23 @@ pub(super) fn try_make_update(
376377
);
377378
};
378379

380+
let Some(sled_type) = OxideSled::try_from_model(&baseboard_id.part_number)
381+
else {
382+
return Err(FailedHostOsUpdateReason::UnableToDetermineSledModel(
383+
baseboard_id.part_number.clone(),
384+
));
385+
};
386+
379387
let mut phase_1_artifacts = Vec::with_capacity(1);
380388
let mut phase_2_artifacts = Vec::with_capacity(1);
381389
for artifact in &current_artifacts.artifacts {
382-
// TODO-correctness we only support gimlet at the moment, need
383-
// to tell if this target is a gimlet or a comso
384-
if artifact.id.kind == ArtifactKind::GIMLET_HOST_PHASE_1 {
390+
if artifact.id.kind == ArtifactKind::COSMO_HOST_PHASE_1
391+
&& sled_type == OxideSled::Cosmo
392+
{
393+
phase_1_artifacts.push(artifact);
394+
} else if artifact.id.kind == ArtifactKind::GIMLET_HOST_PHASE_1
395+
&& sled_type == OxideSled::Gimlet
396+
{
385397
phase_1_artifacts.push(artifact);
386398
} else if artifact.id.kind == ArtifactKind::HOST_PHASE_2 {
387399
phase_2_artifacts.push(artifact);
@@ -476,7 +488,8 @@ mod tests {
476488
use crate::mgs_updates::ImpossibleUpdatePolicy;
477489
use crate::mgs_updates::MgsUpdatePlanner;
478490
use crate::mgs_updates::UpdateableBoard;
479-
use crate::mgs_updates::test_helpers::ARTIFACT_HASH_HOST_PHASE_1;
491+
use crate::mgs_updates::test_helpers::ARTIFACT_HASH_COSMO_HOST_PHASE_1;
492+
use crate::mgs_updates::test_helpers::ARTIFACT_HASH_GIMLET_HOST_PHASE_1;
480493
use crate::mgs_updates::test_helpers::ARTIFACT_HASH_HOST_PHASE_1_V1;
481494
use crate::mgs_updates::test_helpers::ARTIFACT_HASH_HOST_PHASE_1_V1_5;
482495
use crate::mgs_updates::test_helpers::ARTIFACT_HASH_HOST_PHASE_2;
@@ -560,7 +573,10 @@ mod tests {
560573
assert_eq!(first_update.baseboard_id.serial_number, "sled_0");
561574
assert_eq!(first_update.sp_type, SpType::Sled);
562575
assert_eq!(first_update.slot_id, 0);
563-
assert_eq!(first_update.artifact_hash, ARTIFACT_HASH_HOST_PHASE_1);
576+
assert_eq!(
577+
first_update.artifact_hash,
578+
ARTIFACT_HASH_GIMLET_HOST_PHASE_1
579+
);
564580
assert_eq!(first_update.artifact_version, ARTIFACT_VERSION_2);
565581
assert_eq!(planned.pending_host_phase_2_changes.len(), 1);
566582
let (phase2_id, phase2_slot, phase2_contents) =
@@ -658,7 +674,10 @@ mod tests {
658674
assert_eq!(first_update.baseboard_id.serial_number, "sled_1");
659675
assert_eq!(first_update.sp_type, SpType::Sled);
660676
assert_eq!(first_update.slot_id, 1);
661-
assert_eq!(first_update.artifact_hash, ARTIFACT_HASH_HOST_PHASE_1);
677+
assert_eq!(
678+
first_update.artifact_hash,
679+
ARTIFACT_HASH_COSMO_HOST_PHASE_1
680+
);
662681
assert_eq!(first_update.artifact_version, ARTIFACT_VERSION_2);
663682
assert_eq!(later_planned.pending_host_phase_2_changes.len(), 1);
664683
let (phase2_id, phase2_slot, phase2_contents) =
@@ -773,8 +792,8 @@ mod tests {
773792
// a new update reflecting that.
774793
let collection = test_boards
775794
.collection_builder()
776-
.host_phase_1_artifacts(
777-
ARTIFACT_HASH_HOST_PHASE_1,
795+
.gimlet_host_phase_1_artifacts(
796+
ARTIFACT_HASH_GIMLET_HOST_PHASE_1,
778797
ARTIFACT_HASH_HOST_PHASE_1_V1_5,
779798
)
780799
.host_active_exception(

0 commit comments

Comments
 (0)