1- use crate :: { Assembly , REDFISH_ENDPOINT } ;
1+ use crate :: Assembly ;
22use reqwest:: StatusCode ;
33use std:: { collections:: HashMap , path:: Path , time:: Duration } ;
44use tokio:: fs:: File ;
@@ -8,8 +8,7 @@ use crate::model::boot::BootOverride;
88use crate :: model:: certificate:: Certificate ;
99use crate :: model:: component_integrity:: ComponentIntegrities ;
1010use crate :: model:: oem:: nvidia_dpu:: { HostPrivilegeLevel , NicMode } ;
11- use crate :: model:: power:: { Power , PowerSupplies , PowerSupply , Voltages } ;
12- use crate :: model:: sensor:: { GPUSensors , Sensor , Sensors } ;
11+ use crate :: model:: sensor:: GPUSensors ;
1312use crate :: model:: service_root:: RedfishVendor ;
1413use crate :: model:: task:: Task ;
1514use crate :: model:: update_service:: { ComponentType , TransferProtocolType , UpdateService } ;
@@ -26,8 +25,6 @@ use crate::{
2625} ;
2726use crate :: { EnabledDisabled , JobState , MachineSetupStatus , RoleId } ;
2827
29- const UEFI_PASSWORD_NAME : & str = "AdminPassword" ;
30-
3128pub struct Bmc {
3229 s : RedfishStandard ,
3330}
@@ -120,47 +117,9 @@ impl Redfish for Bmc {
120117 fn get_power_metrics < ' a > (
121118 & ' a self ,
122119 ) -> crate :: RedfishFuture < ' a , Result < crate :: Power , RedfishError > > {
123- Box :: pin ( async move {
124- let mut voltages = Vec :: new ( ) ;
125- let mut power_supplies = Vec :: new ( ) ;
126- // delta powershelf has a strange redfish tree. assemble this
127- let mut url = "Chassis/chassis/PowerSubsystem/PowerSupplies" . to_string ( ) ;
128- let ( _status_code, ps) : ( StatusCode , PowerSupplies ) = self . s . client . get ( & url) . await ?;
129- for supply in ps. members {
130- url = supply
131- . odata_id
132- . replace ( & format ! ( "/{REDFISH_ENDPOINT}/" ) , "" ) ;
133- let ( _status_code, power_supply) : ( StatusCode , PowerSupply ) =
134- self . s . client . get ( & url) . await ?;
135- power_supplies. push ( power_supply) ;
136- }
137-
138- url = "Chassis/chassis/Sensors" . to_string ( ) ;
139- let ( _status_code, sensors) : ( StatusCode , Sensors ) = self . s . client . get ( & url) . await ?;
140- for sensor in sensors. members {
141- // now all voltage sensors in all chassis
142- if !sensor. odata_id . contains ( "voltage" ) {
143- continue ;
144- }
145- url = sensor
146- . odata_id
147- . replace ( & format ! ( "/{REDFISH_ENDPOINT}/" ) , "" ) ;
148- let ( _status_code, t) : ( StatusCode , Sensor ) = self . s . client . get ( & url) . await ?;
149- let sensor: Voltages = Voltages :: from ( t) ;
150- voltages. push ( sensor) ;
151- }
152-
153- let power = Power {
154- odata : None ,
155- id : "Power" . to_string ( ) ,
156- name : "Power" . to_string ( ) ,
157- power_control : vec ! [ ] ,
158- power_supplies : Some ( power_supplies) ,
159- voltages : Some ( voltages) ,
160- redundancy : None ,
161- } ;
162- Ok ( power)
163- } )
120+ // Discover the chassis carrying the PowerSubsystem rather than
121+ // hard-coding the Delta-specific id.
122+ Box :: pin ( async move { self . s . get_power_metrics_from_chassis ( ) . await } )
164123 }
165124
166125 fn power < ' a > (
@@ -672,17 +631,17 @@ impl Redfish for Bmc {
672631 } )
673632 }
674633
675- // Set current_uefi_password to "" if there isn't one yet. By default there isn't a password.
676- /// Set new_uefi_password to "" to disable it .
634+ /// Delta power shelves have no UEFI/BIOS, so there is no UEFI password to
635+ /// manage .
677636 fn change_uefi_password < ' a > (
678637 & ' a self ,
679- current_uefi_password : & ' a str ,
680- new_uefi_password : & ' a str ,
638+ _current_uefi_password : & ' a str ,
639+ _new_uefi_password : & ' a str ,
681640 ) -> crate :: RedfishFuture < ' a , Result < Option < String > , RedfishError > > {
682641 Box :: pin ( async move {
683- self . s
684- . change_bios_password ( UEFI_PASSWORD_NAME , current_uefi_password , new_uefi_password )
685- . await
642+ Err ( RedfishError :: NotSupported (
643+ "Delta powershelf UEFI password unsupported" . to_string ( ) ,
644+ ) )
686645 } )
687646 }
688647
@@ -942,11 +901,12 @@ impl Redfish for Bmc {
942901 false
943902 }
944903
904+ /// Delta power shelves have no boot order, so there is nothing to set up.
945905 fn is_boot_order_setup < ' a > (
946906 & ' a self ,
947907 _mac_address : & ' a str ,
948908 ) -> crate :: RedfishFuture < ' a , Result < bool , RedfishError > > {
949- Box :: pin ( async move { Err ( RedfishError :: NotSupported ( "not supported" . to_string ( ) ) ) } )
909+ Box :: pin ( async move { Ok ( true ) } )
950910 }
951911
952912 fn get_component_integrities < ' a > (
0 commit comments