From 1093ca62643bc0e81d40866fb64fc11c9ee98585 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Wed, 15 Feb 2023 16:49:12 -0500 Subject: [PATCH] Disallow health less than 0 --- daemon-common/cluster.py | 3 +++ node-daemon/pvcnoded/objects/MonitoringInstance.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/daemon-common/cluster.py b/daemon-common/cluster.py index d5dd9ca5..8bf0aec1 100644 --- a/daemon-common/cluster.py +++ b/daemon-common/cluster.py @@ -155,6 +155,9 @@ def getClusterHealth(zkhandler, node_list, vm_list, ceph_osd_list): elif ceph_health_status == "HEALTH_WARN": cluster_health -= health_delta_map["ceph_warn"] + if cluster_health < 0: + cluster_health = 0 + return cluster_health, messages diff --git a/node-daemon/pvcnoded/objects/MonitoringInstance.py b/node-daemon/pvcnoded/objects/MonitoringInstance.py index 4ccc620c..81b0ccd4 100644 --- a/node-daemon/pvcnoded/objects/MonitoringInstance.py +++ b/node-daemon/pvcnoded/objects/MonitoringInstance.py @@ -366,6 +366,9 @@ class MonitoringInstance(object): if result is not None: total_health -= result.health_delta + if total_health < 0: + total_health = 0 + if total_health > 90: health_colour = self.logger.fmt_green elif total_health > 50: