From b5927f27beb497273cc33282930a70a40563f109 Mon Sep 17 00:00:00 2001 From: Arjen Annes Date: Thu, 2 Jul 2020 14:04:06 +0200 Subject: [PATCH 1/2] CIS-4563: ignoring disabled hosts with vms if migrating --- src/sonny/monitor.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sonny/monitor.py b/src/sonny/monitor.py index 5023c9b..1a9ffeb 100644 --- a/src/sonny/monitor.py +++ b/src/sonny/monitor.py @@ -312,6 +312,8 @@ def get_suspicious_hypervisors(self): f'ignoring {hv_name} (disabled and 0 running vms)') continue elif hv['status'] == 'disabled' and hv['running_vms'] > 0: + if 'sonny' in hv['service_details']['disabled_reason']: + continue r_vms = hv['running_vms'] _logger.warning( f'{hv_name} is disabled and running {r_vms} instances!') From a9c5772f2d29de087ca255ac095bad77766aaaaa Mon Sep 17 00:00:00 2001 From: Arjen Annes Date: Thu, 2 Jul 2020 16:56:10 +0200 Subject: [PATCH 2/2] maintenance? -> no warning --- src/sonny/monitor.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/sonny/monitor.py b/src/sonny/monitor.py index 1a9ffeb..612dd5a 100644 --- a/src/sonny/monitor.py +++ b/src/sonny/monitor.py @@ -305,15 +305,16 @@ def get_suspicious_hypervisors(self): if hv['state'] == 'down' and \ hv['service_details']['disabled_reason'] and \ 'sonny' in hv['service_details']['disabled_reason']: - _logger.debug(f'{hv_name} is down but alredy handled') + _logger.debug(f'{hv_name} is down but already handled') + continue + elif hv['status'] == 'disabled' and 'maintenance' in hv['service_details']['disabled_reason'].lower(): + _logger.debug(f'{hv_name} is in maintenance') continue elif hv['status'] == 'disabled' and hv['running_vms'] == 0: _logger.debug( f'ignoring {hv_name} (disabled and 0 running vms)') continue elif hv['status'] == 'disabled' and hv['running_vms'] > 0: - if 'sonny' in hv['service_details']['disabled_reason']: - continue r_vms = hv['running_vms'] _logger.warning( f'{hv_name} is disabled and running {r_vms} instances!')