bundles/vmhost: add option to exclude VM from monitoring
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2020-12-29 10:14:26 +01:00
parent ee0b8a569e
commit 914889da6c
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -4,7 +4,7 @@ from subprocess import check_output
from sys import exit
try:
result = check_output(['virsh', '--readonly', 'list', '--all']).decode('utf-8').split('\n')
result = check_output(['virsh', '--readonly', 'list', '--all']).decode('utf-8').splitlines()
except Exception as e:
# If something fails, this means libvirt is not responding. This is
# an error.
@ -22,6 +22,9 @@ for vm in result[2:]:
info = vm.split()
if info[1].startswith('EXCLUDE_FROM_MONITORING_'):
continue
if info[2] in {'crashed', 'dying'}:
crashed.add('{}: {}'.format(info[1], info[2]))
elif info[2] in {'running'}: