Skip to content

Commit 9ed8101

Browse files
committed
Added check to verify hypervisor error
Signed-off-by: KeerthanaAP <[email protected]>
1 parent b77856e commit 9ed8101

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
PROW_VIEW_URL = "https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs"
22
JOB_LINK_URL= "https://prow.ci.openshift.org/"
33
RELEASE_URL = "https://ppc64le.ocp.releases.ci.openshift.org/releasestream/4-stable-ppc64le/release/"
4+
HYPERVISOR_CONNECTION_ERROR = "failed to connect to the hypervisor"

monitor.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,23 @@ def check_if_gather_libvirt_dir_exists(spy_link,job_type):
364364
return "Request timed out"
365365
except requests.RequestException:
366366
return "Error while sending request to url"
367+
368+
#This is to check for hypervisor error
369+
def check_hypervisor_error(spy_link):
370+
build_log_url = constants.PROW_VIEW_URL + spy_link[8:] + '/build-log.txt'
371+
try:
372+
response = requests.get(build_log_url, verify=False, timeout=15)
373+
hypervisor_re = re.compile(constants.HYPERVISOR_CONNECTION_ERROR)
374+
hypervisor_re_match = hypervisor_re.search(response.text)
375+
if hypervisor_re_match is not None:
376+
return True
377+
else:
378+
return False
379+
except requests.Timeout:
380+
return "Request timed out"
381+
except requests.RequestException:
382+
return "Error while sending request to url"
383+
367384

368385
#This is a fix to check for sensitive information expose error.
369386
def check_if_sensitive_info_exposed(spy_link):
@@ -1222,6 +1239,10 @@ def get_brief_job_info(build_list,prow_ci_name,zone=None):
12221239
job_dict["Test result"] = str(e2e_fail_test_count) + " testcases failed"
12231240
else:
12241241
job_dict["Test result"] = "Failed to get Test summary"
1242+
else:
1243+
hypervisor_error_status = check_hypervisor_error(build)
1244+
if hypervisor_error_status:
1245+
job_dict["Test result"] = constants.HYPERVISOR_CONNECTION_ERROR
12251246
summary_list.append(job_dict)
12261247
return summary_list
12271248

@@ -1280,7 +1301,11 @@ def get_detailed_job_info(build_list,prow_ci_name,zone=None):
12801301
print("Lease Quota-", lease)
12811302
node_status = get_node_status(build)
12821303
print(node_status)
1283-
check_node_crash(build)
1304+
hypervisor_error_status = check_hypervisor_error(build)
1305+
if hypervisor_error_status:
1306+
print("Cluster Creation Failed."+constants.HYPERVISOR_CONNECTION_ERROR)
1307+
else :
1308+
check_node_crash(build)
12841309

12851310
if cluster_status == 'SUCCESS':
12861311
deploy_count += 1
@@ -1292,8 +1317,9 @@ def get_detailed_job_info(build_list,prow_ci_name,zone=None):
12921317

12931318
elif cluster_status == 'FAILURE':
12941319
print("Cluster Creation Failed")
1320+
12951321

1296-
elif cluster_status == 'ERROR':
1322+
elif cluster_status == 'ERROR' and not hypervisor_error_status :
12971323
print('Unable to get cluster status please check prowCI UI ')
12981324
else:
12991325
print(build_status)

0 commit comments

Comments
 (0)