bundles/vmhost: add option to exclude VM from monitoring
All checks were successful
bundlewrap/pipeline/head This commit looks good
All checks were successful
bundlewrap/pipeline/head This commit looks good
This commit is contained in:
parent
ee0b8a569e
commit
914889da6c
1 changed files with 4 additions and 1 deletions
|
@ -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'}:
|
||||
|
|
Loading…
Reference in a new issue