@@ -10,7 +10,7 @@ use crate::omicron_zone_config::{self, OmicronZoneNic};
10
10
use crate :: typed_uuid:: DbTypedUuid ;
11
11
use crate :: {
12
12
ArtifactHash , ByteCount , DbArtifactVersion , DbOximeterReadMode , Generation ,
13
- MacAddr , Name , SledState , SqlU8 , SqlU16 , SqlU32 , TufArtifact ,
13
+ HwM2Slot , MacAddr , Name , SledState , SqlU8 , SqlU16 , SqlU32 , TufArtifact ,
14
14
impl_enum_type, ipv6,
15
15
} ;
16
16
use anyhow:: { Context , Result , anyhow, bail} ;
@@ -22,12 +22,11 @@ use nexus_db_schema::schema::{
22
22
bp_clickhouse_keeper_zone_id_to_node_id,
23
23
bp_clickhouse_server_zone_id_to_node_id, bp_omicron_dataset,
24
24
bp_omicron_physical_disk, bp_omicron_zone, bp_omicron_zone_nic,
25
- bp_oximeter_read_policy, bp_pending_mgs_update_rot ,
26
- bp_pending_mgs_update_rot_bootloader , bp_pending_mgs_update_sp ,
27
- bp_sled_metadata, bp_target,
25
+ bp_oximeter_read_policy, bp_pending_mgs_update_host_phase_1 ,
26
+ bp_pending_mgs_update_rot , bp_pending_mgs_update_rot_bootloader ,
27
+ bp_pending_mgs_update_sp , bp_sled_metadata, bp_target,
28
28
} ;
29
29
use nexus_sled_agent_shared:: inventory:: OmicronZoneDataset ;
30
- use nexus_types:: deployment:: BlueprintHostPhase2DesiredContents ;
31
30
use nexus_types:: deployment:: BlueprintHostPhase2DesiredSlots ;
32
31
use nexus_types:: deployment:: BlueprintPhysicalDiskConfig ;
33
32
use nexus_types:: deployment:: BlueprintPhysicalDiskDisposition ;
@@ -44,6 +43,9 @@ use nexus_types::deployment::{
44
43
BlueprintArtifactVersion , BlueprintDatasetConfig , OximeterReadMode ,
45
44
} ;
46
45
use nexus_types:: deployment:: { BlueprintDatasetDisposition , ExpectedVersion } ;
46
+ use nexus_types:: deployment:: {
47
+ BlueprintHostPhase2DesiredContents , PendingMgsUpdateHostPhase1Details ,
48
+ } ;
47
49
use nexus_types:: deployment:: { BlueprintZoneImageSource , blueprint_zone_type} ;
48
50
use nexus_types:: deployment:: {
49
51
OmicronZoneExternalFloatingAddr , OmicronZoneExternalFloatingIp ,
@@ -1440,3 +1442,64 @@ impl BpPendingMgsUpdateComponent for BpPendingMgsUpdateRot {
1440
1442
}
1441
1443
}
1442
1444
}
1445
+
1446
+ #[ derive( Queryable , Clone , Debug , Selectable , Insertable ) ]
1447
+ #[ diesel( table_name = bp_pending_mgs_update_host_phase_1) ]
1448
+ pub struct BpPendingMgsUpdateHostPhase1 {
1449
+ pub blueprint_id : DbTypedUuid < BlueprintKind > ,
1450
+ pub hw_baseboard_id : Uuid ,
1451
+ pub sp_type : SpType ,
1452
+ pub sp_slot : SpMgsSlot ,
1453
+ pub artifact_sha256 : ArtifactHash ,
1454
+ pub artifact_version : DbArtifactVersion ,
1455
+ pub expected_active_phase_1_slot : HwM2Slot ,
1456
+ pub expected_boot_disk : HwM2Slot ,
1457
+ pub expected_active_phase_1_hash : ArtifactHash ,
1458
+ pub expected_active_phase_2_hash : ArtifactHash ,
1459
+ pub expected_inactive_phase_1_hash : ArtifactHash ,
1460
+ pub expected_inactive_phase_2_hash : ArtifactHash ,
1461
+ sled_agent_ip : ipv6:: Ipv6Addr ,
1462
+ sled_agent_port : SqlU16 ,
1463
+ }
1464
+
1465
+ impl BpPendingMgsUpdateComponent for BpPendingMgsUpdateHostPhase1 {
1466
+ fn hw_baseboard_id ( & self ) -> & Uuid {
1467
+ & self . hw_baseboard_id
1468
+ }
1469
+
1470
+ fn into_generic ( self , baseboard_id : Arc < BaseboardId > ) -> PendingMgsUpdate {
1471
+ PendingMgsUpdate {
1472
+ baseboard_id,
1473
+ sp_type : self . sp_type . into ( ) ,
1474
+ slot_id : * * self . sp_slot ,
1475
+ artifact_hash : self . artifact_sha256 . into ( ) ,
1476
+ artifact_version : ( * self . artifact_version ) . clone ( ) ,
1477
+ details : PendingMgsUpdateDetails :: HostPhase1 (
1478
+ PendingMgsUpdateHostPhase1Details {
1479
+ expected_active_phase_1_slot : self
1480
+ . expected_active_phase_1_slot
1481
+ . into ( ) ,
1482
+ expected_boot_disk : self . expected_boot_disk . into ( ) ,
1483
+ expected_active_phase_1_hash : self
1484
+ . expected_active_phase_1_hash
1485
+ . into ( ) ,
1486
+ expected_active_phase_2_hash : self
1487
+ . expected_active_phase_2_hash
1488
+ . into ( ) ,
1489
+ expected_inactive_phase_1_hash : self
1490
+ . expected_inactive_phase_1_hash
1491
+ . into ( ) ,
1492
+ expected_inactive_phase_2_hash : self
1493
+ . expected_inactive_phase_2_hash
1494
+ . into ( ) ,
1495
+ sled_agent_address : SocketAddrV6 :: new (
1496
+ self . sled_agent_ip . into ( ) ,
1497
+ * self . sled_agent_port ,
1498
+ 0 ,
1499
+ 0 ,
1500
+ ) ,
1501
+ } ,
1502
+ ) ,
1503
+ }
1504
+ }
1505
+ }
0 commit comments