@@ -365,6 +365,23 @@ def check_if_gather_libvirt_dir_exists(spy_link,job_type):
365365 return "Request timed out"
366366 except requests .RequestException :
367367 return "Error while sending request to url"
368+
369+ #This is to check for hypervisor error
370+ def check_hypervisor_error (spy_link ):
371+ build_log_url = constants .PROW_VIEW_URL + spy_link [8 :] + '/build-log.txt'
372+ try :
373+ response = requests .get (build_log_url , verify = False , timeout = 15 )
374+ hypervisor_re = re .compile (constants .HYPERVISOR_CONNECTION_ERROR )
375+ hypervisor_re_match = hypervisor_re .search (response .text )
376+ if hypervisor_re_match is not None :
377+ return True
378+ else :
379+ return False
380+ except requests .Timeout :
381+ return "Request timed out"
382+ except requests .RequestException :
383+ return "Error while sending request to url"
384+
368385
369386#This is a fix to check for sensitive information expose error.
370387def check_if_sensitive_info_exposed (spy_link ):
@@ -1223,6 +1240,10 @@ def get_brief_job_info(build_list,prow_ci_name,zone=None):
12231240 job_dict ["Test result" ] = str (e2e_fail_test_count ) + " testcases failed"
12241241 else :
12251242 job_dict ["Test result" ] = "Failed to get Test summary"
1243+ else :
1244+ hypervisor_error_status = check_hypervisor_error (build )
1245+ if hypervisor_error_status :
1246+ job_dict ["Test result" ] = constants .HYPERVISOR_CONNECTION_ERROR
12261247 summary_list .append (job_dict )
12271248 return summary_list
12281249
@@ -1281,7 +1302,11 @@ def get_detailed_job_info(build_list,prow_ci_name,zone=None):
12811302 print ("Lease Quota-" , lease )
12821303 node_status = get_node_status (build )
12831304 print (node_status )
1284- check_node_crash (build )
1305+ hypervisor_error_status = check_hypervisor_error (build )
1306+ if hypervisor_error_status :
1307+ print ("Cluster Creation Failed." + constants .HYPERVISOR_CONNECTION_ERROR )
1308+ else :
1309+ check_node_crash (build )
12851310
12861311 if cluster_status == 'SUCCESS' :
12871312 deploy_count += 1
@@ -1293,8 +1318,9 @@ def get_detailed_job_info(build_list,prow_ci_name,zone=None):
12931318
12941319 elif cluster_status == 'FAILURE' :
12951320 print ("Cluster Creation Failed" )
1321+
12961322
1297- elif cluster_status == 'ERROR' :
1323+ elif cluster_status == 'ERROR' and not hypervisor_error_status :
12981324 print ('Unable to get cluster status please check prowCI UI ' )
12991325 else :
13001326 print (build_status )
0 commit comments