@@ -66,6 +66,7 @@ def main() -> None:
6666 firmware_update = args .firmware_update ,
6767 raid_configure = args .raid_configure ,
6868 external_cmdb_id = args .external_cmdb_id ,
69+ reset_idrac = args .reset_idrac ,
6970 )
7071
7172
@@ -75,6 +76,7 @@ def enroll(
7576 raid_configure : bool ,
7677 old_password : str | None ,
7778 external_cmdb_id : str | None = None ,
79+ reset_idrac : bool = False ,
7880) -> None :
7981 logger .info ("Starting enroll workflow for bmc_ip_address=%s" , ip_address )
8082
@@ -91,6 +93,13 @@ def enroll(
9193 external_cmdb_id = external_cmdb_id ,
9294 )
9395
96+ # Clear stale iDRAC jobs before virtual-media inspection, or optionally
97+ # reset the controller to a broader known-good state.
98+ if reset_idrac :
99+ ironic_node .reset_idrac_to_known_good_state (node )
100+ else :
101+ ironic_node .clear_pending_idrac_jobs (node )
102+
94103 # Out-of-band redfish inspection populates data including baremetal ports.
95104 #
96105 # Our hooks augment the ironic baremetal port with the BMC-reported
@@ -124,9 +133,6 @@ def enroll(
124133 )
125134 logger .info ("[node:%s] Selected PXE interface %s" , node .uuid , pxe_interface )
126135
127- # Clear the job queue - stale jobs can conflict with the ones we create:
128- ironic_node .clear_pending_idrac_jobs (node )
129-
130136 # This sets the boot device to use for all future HTTP boots:
131137 if update_dell_bios_settings (bmc , pxe_interface = pxe_interface ):
132138 logger .info ("%s performing second inspection write BIOS settings" , node .uuid )
@@ -225,6 +231,12 @@ def argument_parser():
225231 default = True ,
226232 help = "Configure RAID before inspection" ,
227233 )
234+ parser .add_argument (
235+ "--reset-idrac" ,
236+ type = parse_bool ,
237+ default = False ,
238+ help = "Reset iDRAC to known_good_state instead of clear_job_queue" ,
239+ )
228240 parser .add_argument (
229241 "--external-cmdb-id" ,
230242 required = False ,
0 commit comments