5
5
//! Types for representing the deployed software and configuration in the
6
6
//! database
7
7
8
- use crate :: inventory:: ZoneType ;
8
+ use crate :: inventory:: { SpMgsSlot , SpType , ZoneType } ;
9
9
use crate :: omicron_zone_config:: { self , OmicronZoneNic } ;
10
10
use crate :: typed_uuid:: DbTypedUuid ;
11
11
use crate :: {
12
- ArtifactHash , ByteCount , DbOximeterReadMode , Generation , MacAddr , Name ,
13
- SledState , SqlU8 , SqlU16 , SqlU32 , TufArtifact , impl_enum_type, ipv6,
12
+ ArtifactHash , ByteCount , DbArtifactVersion , DbOximeterReadMode , Generation ,
13
+ MacAddr , Name , SledState , SqlU8 , SqlU16 , SqlU32 , TufArtifact ,
14
+ impl_enum_type, ipv6,
14
15
} ;
15
16
use anyhow:: { Context , Result , anyhow, bail} ;
16
17
use chrono:: { DateTime , Utc } ;
@@ -21,10 +22,10 @@ use nexus_db_schema::schema::{
21
22
bp_clickhouse_keeper_zone_id_to_node_id,
22
23
bp_clickhouse_server_zone_id_to_node_id, bp_omicron_dataset,
23
24
bp_omicron_physical_disk, bp_omicron_zone, bp_omicron_zone_nic,
24
- bp_oximeter_read_policy, bp_sled_metadata, bp_target,
25
+ bp_oximeter_read_policy, bp_pending_mgs_update_sp, bp_sled_metadata,
26
+ bp_target,
25
27
} ;
26
28
use nexus_sled_agent_shared:: inventory:: OmicronZoneDataset ;
27
- use nexus_types:: deployment:: BlueprintDatasetDisposition ;
28
29
use nexus_types:: deployment:: BlueprintPhysicalDiskConfig ;
29
30
use nexus_types:: deployment:: BlueprintPhysicalDiskDisposition ;
30
31
use nexus_types:: deployment:: BlueprintTarget ;
@@ -33,14 +34,18 @@ use nexus_types::deployment::BlueprintZoneDisposition;
33
34
use nexus_types:: deployment:: BlueprintZoneType ;
34
35
use nexus_types:: deployment:: ClickhouseClusterConfig ;
35
36
use nexus_types:: deployment:: CockroachDbPreserveDowngrade ;
37
+ use nexus_types:: deployment:: PendingMgsUpdate ;
38
+ use nexus_types:: deployment:: PendingMgsUpdateDetails ;
36
39
use nexus_types:: deployment:: {
37
40
BlueprintDatasetConfig , BlueprintZoneImageVersion , OximeterReadMode ,
38
41
} ;
42
+ use nexus_types:: deployment:: { BlueprintDatasetDisposition , ExpectedVersion } ;
39
43
use nexus_types:: deployment:: { BlueprintZoneImageSource , blueprint_zone_type} ;
40
44
use nexus_types:: deployment:: {
41
45
OmicronZoneExternalFloatingAddr , OmicronZoneExternalFloatingIp ,
42
46
OmicronZoneExternalSnatIp ,
43
47
} ;
48
+ use nexus_types:: inventory:: BaseboardId ;
44
49
use omicron_common:: api:: internal:: shared:: NetworkInterface ;
45
50
use omicron_common:: disk:: DiskIdentity ;
46
51
use omicron_common:: zpool_name:: ZpoolName ;
@@ -50,6 +55,7 @@ use omicron_uuid_kinds::{
50
55
PhysicalDiskKind , SledKind , SledUuid , ZpoolKind , ZpoolUuid ,
51
56
} ;
52
57
use std:: net:: { IpAddr , SocketAddrV6 } ;
58
+ use std:: sync:: Arc ;
53
59
use uuid:: Uuid ;
54
60
55
61
/// See [`nexus_types::deployment::Blueprint`].
@@ -1245,3 +1251,40 @@ impl BpOximeterReadPolicy {
1245
1251
}
1246
1252
}
1247
1253
}
1254
+
1255
+ #[ derive( Queryable , Clone , Debug , Selectable , Insertable ) ]
1256
+ #[ diesel( table_name = bp_pending_mgs_update_sp) ]
1257
+ pub struct BpPendingMgsUpdateSp {
1258
+ pub blueprint_id : DbTypedUuid < BlueprintKind > ,
1259
+ pub hw_baseboard_id : Uuid ,
1260
+ pub sp_type : SpType ,
1261
+ pub sp_slot : SpMgsSlot ,
1262
+ pub artifact_sha256 : ArtifactHash ,
1263
+ pub artifact_version : DbArtifactVersion ,
1264
+ pub expected_active_version : DbArtifactVersion ,
1265
+ pub expected_inactive_version : Option < DbArtifactVersion > ,
1266
+ }
1267
+
1268
+ impl BpPendingMgsUpdateSp {
1269
+ pub fn into_generic (
1270
+ self ,
1271
+ baseboard_id : Arc < BaseboardId > ,
1272
+ ) -> PendingMgsUpdate {
1273
+ PendingMgsUpdate {
1274
+ baseboard_id,
1275
+ sp_type : self . sp_type . into ( ) ,
1276
+ slot_id : u32:: from ( * * self . sp_slot ) ,
1277
+ artifact_hash : self . artifact_sha256 . into ( ) ,
1278
+ artifact_version : ( * self . artifact_version ) . clone ( ) ,
1279
+ details : PendingMgsUpdateDetails :: Sp {
1280
+ expected_active_version : ( * self . expected_active_version )
1281
+ . clone ( ) ,
1282
+ expected_inactive_version : match self . expected_inactive_version
1283
+ {
1284
+ Some ( v) => ExpectedVersion :: Version ( ( * v) . clone ( ) ) ,
1285
+ None => ExpectedVersion :: NoValidVersion ,
1286
+ } ,
1287
+ } ,
1288
+ }
1289
+ }
1290
+ }
0 commit comments