File tree 1 file changed +18
-0
lines changed
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -349,6 +349,22 @@ def boot_iso_with_redfish(self, iso_path: str) -> None:
349
349
self ._prepare_imc (extract_server (iso_path ))
350
350
logger .info ("restarting Redfish" )
351
351
self ._restart_redfish ()
352
+ self ._redfish_boot_retry (iso_path )
353
+
354
+ def _redfish_boot_retry (self , iso_path : str , max_retries = 10 ) -> None :
355
+ retries = 0
356
+ while True :
357
+ try :
358
+ self ._redfish_boot (iso_path )
359
+ break
360
+ except Exception as e :
361
+ logger .info (f"Encountered exception { e } when booting, retrying... (attempt={ retries } )" )
362
+ retries += 1
363
+ if retries >= max_retries :
364
+ logger .error_and_exit ("Redfish boot failed" )
365
+ time .sleep (5 )
366
+
367
+ def _redfish_boot (self , iso_path : str ) -> None :
352
368
# W/A delete iso before downloading it if partially downladed
353
369
# https://issues.redhat.com/browse/IIC-382
354
370
logger .info ("Checking if iso needs to be cleaned up" )
@@ -376,6 +392,8 @@ def _wait_iso_downloaded(self, iso_path: str) -> None:
376
392
rh .ssh_connect ("root" , password = "" , discover_auth = False )
377
393
loop_count = 0
378
394
while True :
395
+ if not rh .is_connected ():
396
+ raise RuntimeError (f"Connection to { rh .hostname } has been dropped, download failed" )
379
397
result = rh .run ("du -b /mnt/imc/acc-os.iso" ).out .split ()
380
398
if len (result ) == 0 :
381
399
continue
You can’t perform that action at this time.
0 commit comments