@@ -1321,6 +1321,28 @@ pub enum ReprovisionState {
13211321 BufferTime ,
13221322 VerifyFirmareVersions ,
13231323 WaitingForNetworkConfig ,
1324+ PrepareHostBootRepair ,
1325+ UnlockHostForBootRepair {
1326+ #[ serde( default ) ]
1327+ unlock_host_state : UnlockHostState ,
1328+ } ,
1329+ CheckHostBootConfig ,
1330+ CheckHostBootConfigAfterHostReboot ,
1331+ ConfigureHostBoot {
1332+ #[ serde( default ) ]
1333+ retry_count : u32 ,
1334+ } ,
1335+ WaitingForHostBiosJob {
1336+ bios_config_info : BiosConfigInfo ,
1337+ } ,
1338+ PollingHostBiosSetup {
1339+ #[ serde( default ) ]
1340+ retry_count : u32 ,
1341+ } ,
1342+ SetHostBootOrder {
1343+ set_boot_order_info : SetBootOrderInfo ,
1344+ } ,
1345+ LockHostAfterBootRepair ,
13241346 RebootHostBmc ,
13251347 RebootHost ,
13261348 NotUnderReprovision ,
@@ -1797,7 +1819,9 @@ pub enum UefiSetupState {
17971819/// `bios_job_id` is `Some` while polling a vendor BIOS job (e.g. Dell). `None` only during
17981820/// `HandleBiosJobFailure` recovery from stuck PollingBiosSetup; non-Dell hosts reboot in
17991821/// `configure_host_bios` and never enter job-polling substates.
1800- #[ derive( Debug , Clone , Serialize , Deserialize , Eq , PartialEq ) ]
1822+ ///
1823+ /// Derived ordering is used by enclosing reprovision states to report the least advanced DPU.
1824+ #[ derive( Debug , Clone , Serialize , Deserialize , Eq , PartialEq , PartialOrd , Ord ) ]
18011825#[ serde( rename_all = "lowercase" ) ]
18021826pub struct BiosConfigInfo {
18031827 #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
@@ -1808,7 +1832,8 @@ pub struct BiosConfigInfo {
18081832 pub retry_count : u32 ,
18091833}
18101834
1811- #[ derive( Debug , Clone , Serialize , Deserialize , Eq , PartialEq ) ]
1835+ /// Variant order follows BIOS job progression for derived reprovision-state comparisons.
1836+ #[ derive( Debug , Clone , Serialize , Deserialize , Eq , PartialEq , PartialOrd , Ord ) ]
18121837#[ serde( tag = "state" , rename_all = "lowercase" ) ]
18131838pub enum BiosConfigState {
18141839 WaitForBiosJobScheduled ,
@@ -1821,7 +1846,8 @@ pub enum BiosConfigState {
18211846 } ,
18221847}
18231848
1824- #[ derive( Debug , Clone , Serialize , Deserialize , Eq , PartialEq ) ]
1849+ /// Derived ordering is used by enclosing reprovision states to report the least advanced DPU.
1850+ #[ derive( Debug , Clone , Serialize , Deserialize , Eq , PartialEq , PartialOrd , Ord ) ]
18251851#[ serde( rename_all = "lowercase" ) ]
18261852pub struct SetBootOrderInfo {
18271853 #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
@@ -1832,7 +1858,8 @@ pub struct SetBootOrderInfo {
18321858 pub retry_count : u32 ,
18331859}
18341860
1835- #[ derive( Debug , Clone , Serialize , Deserialize , Eq , PartialEq ) ]
1861+ /// Variant order follows boot-order job progression for derived reprovision-state comparisons.
1862+ #[ derive( Debug , Clone , Serialize , Deserialize , Eq , PartialEq , PartialOrd , Ord ) ]
18361863#[ serde( tag = "state" , rename_all = "lowercase" ) ]
18371864pub enum SetBootOrderState {
18381865 SetBootOrder ,
@@ -2020,7 +2047,8 @@ pub enum HostPlatformConfigurationState {
20202047 LockHost ,
20212048}
20222049
2023- #[ derive( Debug , Clone , Serialize , Deserialize , Eq , PartialEq , Default ) ]
2050+ /// Variant order follows unlock progression for derived reprovision-state comparisons.
2051+ #[ derive( Debug , Clone , Serialize , Deserialize , Eq , PartialEq , PartialOrd , Ord , Default ) ]
20242052#[ serde( tag = "state" , rename_all = "lowercase" ) ]
20252053pub enum UnlockHostState {
20262054 #[ default]
@@ -2705,7 +2733,8 @@ impl<'r> FromRow<'r, PgRow> for MachineInterfaceSnapshot {
27052733
27062734// TODO: reconcile with site_explorer::PowerState. They are almost
27072735// identical but here we have Reset enum item.
2708- #[ derive( Debug , Serialize , Deserialize , Clone , Copy , PartialEq , Eq ) ]
2736+ /// Variant order is a deterministic tie-breaker inside derived recovery-state comparisons.
2737+ #[ derive( Debug , Serialize , Deserialize , Clone , Copy , PartialEq , Eq , PartialOrd , Ord ) ]
27092738pub enum PowerState {
27102739 Off ,
27112740 On ,
@@ -2972,6 +3001,10 @@ mod tests {
29723001 // variant; the parsed value (PartialEq) is the whole assertion.
29733002 #[ test]
29743003 fn test_json_deserialize_managed_host_states ( ) {
3004+ let machine_id =
3005+ MachineId :: from_str ( "fm100ds7blqjsadm2uuh3qqbf1h7k8pmf47um6v9uckrg7l03po8mhqgvng" )
3006+ . unwrap ( ) ;
3007+
29753008 scenarios ! (
29763009 run = |s| serde_json:: from_str:: <ManagedHostState >( s) . map_err( drop) ;
29773010 "assigned booting with discovery image, default retry" {
@@ -2990,6 +3023,30 @@ mod tests {
29903023 } ) ,
29913024 }
29923025
3026+ "dpu reprovision host boot configure state" {
3027+ r#"{"state":"dpureprovision","dpu_states":{"states":{"fm100ds7blqjsadm2uuh3qqbf1h7k8pmf47um6v9uckrg7l03po8mhqgvng":{"configurehostboot":{"retry_count":2}}}}}"# => Yields ( ManagedHostState :: DPUReprovision {
3028+ dpu_states: DpuReprovisionStates {
3029+ states: HashMap :: from( [ (
3030+ machine_id,
3031+ ReprovisionState :: ConfigureHostBoot { retry_count: 2 } ,
3032+ ) ] ) ,
3033+ } ,
3034+ } ) ,
3035+ }
3036+
3037+ "dpu reprovision host boot unlock default state" {
3038+ r#"{"state":"dpureprovision","dpu_states":{"states":{"fm100ds7blqjsadm2uuh3qqbf1h7k8pmf47um6v9uckrg7l03po8mhqgvng":{"unlockhostforbootrepair":{}}}}}"# => Yields ( ManagedHostState :: DPUReprovision {
3039+ dpu_states: DpuReprovisionStates {
3040+ states: HashMap :: from( [ (
3041+ machine_id,
3042+ ReprovisionState :: UnlockHostForBootRepair {
3043+ unlock_host_state: UnlockHostState :: DisableLockdown ,
3044+ } ,
3045+ ) ] ) ,
3046+ } ,
3047+ } ) ,
3048+ }
3049+
29933050 "host init polling bios setup, default retry" {
29943051 r#"{"state":"hostinit","machine_state":{"state":"pollingbiossetup"}}"# => Yields ( ManagedHostState :: HostInit {
29953052 machine_state: MachineState :: PollingBiosSetup { retry_count: 0 } ,
0 commit comments