@@ -8,6 +8,7 @@ use crate::blippy::SledKind;
88use nexus_sled_agent_shared:: inventory:: ZoneKind ;
99use nexus_types:: deployment:: BlueprintDatasetConfig ;
1010use nexus_types:: deployment:: BlueprintDatasetDisposition ;
11+ use nexus_types:: deployment:: BlueprintHostPhase2DesiredContents ;
1112use nexus_types:: deployment:: BlueprintPhysicalDiskDisposition ;
1213use nexus_types:: deployment:: BlueprintSledConfig ;
1314use nexus_types:: deployment:: BlueprintZoneConfig ;
@@ -21,6 +22,8 @@ use omicron_common::address::DnsSubnet;
2122use omicron_common:: address:: Ipv6Subnet ;
2223use omicron_common:: address:: SLED_PREFIX ;
2324use omicron_common:: disk:: DatasetKind ;
25+ use omicron_common:: disk:: M2Slot ;
26+ use omicron_uuid_kinds:: MupdateOverrideUuid ;
2427use omicron_uuid_kinds:: SledUuid ;
2528use omicron_uuid_kinds:: ZpoolUuid ;
2629use std:: collections:: BTreeMap ;
@@ -577,9 +580,21 @@ fn check_mupdate_override(blippy: &mut Blippy<'_>) {
577580 }
578581 }
579582
580- // TODO: The host phase 2 contents should be set to CurrentContents
581- // (waiting for
582- // https://github.com/oxidecomputer/omicron/issues/8542).
583+ // The host phase 2 contents should be set to CurrentContents.
584+ check_mupdate_override_host_phase_2_contents (
585+ blippy,
586+ sled_id,
587+ mupdate_override_id,
588+ M2Slot :: A ,
589+ & sled. host_phase_2 . slot_a ,
590+ ) ;
591+ check_mupdate_override_host_phase_2_contents (
592+ blippy,
593+ sled_id,
594+ mupdate_override_id,
595+ M2Slot :: B ,
596+ & sled. host_phase_2 . slot_b ,
597+ ) ;
583598
584599 // TODO: PendingMgsUpdates for this sled should be empty. Mapping
585600 // sled IDs to their MGS identifiers (baseboard ID) requires a map
@@ -589,6 +604,30 @@ fn check_mupdate_override(blippy: &mut Blippy<'_>) {
589604 }
590605}
591606
607+ fn check_mupdate_override_host_phase_2_contents (
608+ blippy : & mut Blippy < ' _ > ,
609+ sled_id : SledUuid ,
610+ mupdate_override_id : MupdateOverrideUuid ,
611+ slot : M2Slot ,
612+ contents : & BlueprintHostPhase2DesiredContents ,
613+ ) {
614+ match contents {
615+ BlueprintHostPhase2DesiredContents :: Artifact { version, hash } => {
616+ blippy. push_sled_note (
617+ sled_id,
618+ Severity :: Fatal ,
619+ SledKind :: MupdateOverrideWithHostPhase2Artifact {
620+ mupdate_override_id,
621+ slot,
622+ version : version. clone ( ) ,
623+ hash : * hash,
624+ } ,
625+ ) ;
626+ }
627+ BlueprintHostPhase2DesiredContents :: CurrentContents => { }
628+ }
629+ }
630+
592631#[ cfg( test) ]
593632mod tests {
594633 use super :: * ;
@@ -1637,7 +1676,7 @@ mod tests {
16371676 sled. remove_mupdate_override = Some ( mupdate_override_id) ;
16381677
16391678 // Find a zone and set it to use an artifact image source.
1640- let kind = {
1679+ let artifact_zone_kind = {
16411680 let mut zone = sled
16421681 . zones
16431682 . iter_mut ( )
@@ -1661,16 +1700,60 @@ mod tests {
16611700 }
16621701 } ;
16631702
1664- let expected_note = Note {
1665- severity : Severity :: Fatal ,
1666- kind : Kind :: Sled { sled_id, kind } ,
1703+ // Also set the host phase 2 contents.
1704+ let host_phase_2_a_kind = {
1705+ let version = BlueprintArtifactVersion :: Available {
1706+ version : ArtifactVersion :: new_const ( "123" ) ,
1707+ } ;
1708+ let hash = ArtifactHash ( [ 2u8 ; 32 ] ) ;
1709+ sled. host_phase_2 . slot_a =
1710+ BlueprintHostPhase2DesiredContents :: Artifact {
1711+ version : version. clone ( ) ,
1712+ hash,
1713+ } ;
1714+ SledKind :: MupdateOverrideWithHostPhase2Artifact {
1715+ mupdate_override_id,
1716+ slot : M2Slot :: A ,
1717+ version,
1718+ hash,
1719+ }
16671720 } ;
16681721
1722+ let host_phase_2_b_kind = {
1723+ let version = BlueprintArtifactVersion :: Unknown ;
1724+ let hash = ArtifactHash ( [ 3u8 ; 32 ] ) ;
1725+ sled. host_phase_2 . slot_b =
1726+ BlueprintHostPhase2DesiredContents :: Artifact {
1727+ version : version. clone ( ) ,
1728+ hash,
1729+ } ;
1730+ SledKind :: MupdateOverrideWithHostPhase2Artifact {
1731+ mupdate_override_id,
1732+ slot : M2Slot :: B ,
1733+ version,
1734+ hash,
1735+ }
1736+ } ;
1737+
1738+ let expected_notes = vec ! [
1739+ Note {
1740+ severity: Severity :: Fatal ,
1741+ kind: Kind :: Sled { sled_id, kind: artifact_zone_kind } ,
1742+ } ,
1743+ Note {
1744+ severity: Severity :: Fatal ,
1745+ kind: Kind :: Sled { sled_id, kind: host_phase_2_a_kind } ,
1746+ } ,
1747+ Note {
1748+ severity: Severity :: Fatal ,
1749+ kind: Kind :: Sled { sled_id, kind: host_phase_2_b_kind } ,
1750+ } ,
1751+ ] ;
1752+
16691753 let report =
16701754 Blippy :: new ( & blueprint) . into_report ( BlippyReportSortKey :: Kind ) ;
16711755 eprintln ! ( "{}" , report. display( ) ) ;
1672- assert_eq ! ( report. notes( ) . len( ) , 1 , "exactly one note expected" ) ;
1673- assert_eq ! ( report. notes( ) [ 0 ] , expected_note) ;
1756+ assert_eq ! ( report. notes( ) , & expected_notes) ;
16741757
16751758 logctx. cleanup_successful ( ) ;
16761759 }
0 commit comments