@@ -65,6 +65,7 @@ def main() -> None:
6565 firmware_update = args .firmware_update ,
6666 raid_configure = args .raid_configure ,
6767 external_cmdb_id = args .external_cmdb_id ,
68+ reset_idrac = args .reset_idrac ,
6869 )
6970
7071
@@ -74,6 +75,7 @@ def enroll(
7475 raid_configure : bool ,
7576 old_password : str | None ,
7677 external_cmdb_id : str | None = None ,
78+ reset_idrac : bool = False ,
7779) -> None :
7880 logger .info ("Starting enroll workflow for bmc_ip_address=%s" , ip_address )
7981
@@ -90,6 +92,13 @@ def enroll(
9092 external_cmdb_id = external_cmdb_id ,
9193 )
9294
95+ # Clear stale iDRAC jobs before virtual-media inspection, or optionally
96+ # reset the controller to a broader known-good state.
97+ if reset_idrac :
98+ ironic_node .reset_idrac_to_known_good_state (node )
99+ else :
100+ ironic_node .clear_pending_idrac_jobs (node )
101+
93102 # Out-of-band redfish inspection populates data including baremetal ports.
94103 #
95104 # Our hooks augment the ironic baremetal port with the BMC-reported
@@ -120,9 +129,6 @@ def enroll(
120129 )
121130 logger .info ("[node:%s] Selected PXE interface %s" , node .uuid , pxe_interface )
122131
123- # Clear the job queue - stale jobs can conflict with the ones we create:
124- ironic_node .clear_pending_idrac_jobs (node )
125-
126132 # This sets the boot device to use for all future HTTP boots:
127133 if update_dell_bios_settings (bmc , pxe_interface = pxe_interface ):
128134 logger .info ("%s performing second inspection write BIOS settings" , node .uuid )
@@ -278,6 +284,12 @@ def argument_parser():
278284 default = True ,
279285 help = "Configure RAID before inspection" ,
280286 )
287+ parser .add_argument (
288+ "--reset-idrac" ,
289+ type = parse_bool ,
290+ default = False ,
291+ help = "Reset iDRAC to known_good_state instead of clear_job_queue" ,
292+ )
281293 parser .add_argument (
282294 "--external-cmdb-id" ,
283295 required = False ,
0 commit comments