Fix in pacemaker monitoring

Pacemaker monitoring was reporting resource failures as part of
the total resource count for each individual resource. This patch
fixes the issue.

Change-Id: Idb4f39030d6423dc891301ac2b0facb30e01ed6a
This commit is contained in:
Sanjay Chari 2021-10-20 13:50:52 +05:30
parent 6bf1577638
commit 9a00692cfa

View File

@ -72,32 +72,46 @@ def read_func():
elif "resource_total_count" in component:
resource = component.split("_")[0]
val = 0
for line in latest_output:
# Flag to make sure that failures are not counted
# in resource total count.
is_failures_total = False
for line in latest_output[-1::-1]:
if "Failed" in line:
is_failures_total = True
if (resource == "haproxy" or resource == "galera"
or resource == "rabbitmq" or resource == "redis"):
if resource+"-bundle-" in line and "Guest" not in line:
if resource+"-bundle-" in line and "Guest" not in line and not is_failures_total:
val += 1
if resource == "ovn":
if "ovn-dbs-bundle-" in line and "Guest" not in line:
if "ovn-dbs-bundle-" in line and "Guest" not in line and not is_failures_total:
val += 1
if resource == "cinder":
if "openstack-cinder-volume-" in line and "Guest" not in line:
if "openstack-cinder-volume-" in line and "Guest" not in line and not is_failures_total:
val += 1
if is_failures_total and "Daemon Status" in line:
is_failures_total = False
elif "resource_master_count" in component:
resource = component.split("_")[0]
val = 0
for line in latest_output:
# Flag to make sure that failures are not counted
# in resource master count
is_failures_master = False
for line in latest_output[-1::-1]:
if "Failed" in line:
is_failures_master = True
if (resource == "haproxy" or resource == "galera"
or resource == "rabbitmq" or resource == "redis"):
if resource+"-bundle-" in line and "Master" in line:
if resource+"-bundle-" in line and "Master" in line and not is_failures_master:
val += 1
if resource == "ovn":
if "ovn-dbs-bundle-" in line and "Master" in line:
if "ovn-dbs-bundle-" in line and "Master" in line and not is_failures_master:
val += 1
if resource == "cinder":
if "openstack-cinder-volume-" in line and "Master" in line:
if "openstack-cinder-volume-" in line and "Master" in line and not is_failures_master:
val += 1
if is_failures_master and "Daemon Status" in line:
is_failures_master = False
if "daemon_status" in component:
daemon = component.split("_")[0]