Make ceph_check to return OK when Ceph errors out in metrics pg above average

Change-Id: I8813d0dd8f79dbb21ac2dd396d1a3f15f0c846f5
This commit is contained in:
Marga Millet 2019-09-20 13:03:23 +00:00
parent 1f6c57d49f
commit 224ed6d861
1 changed files with 31 additions and 0 deletions

View File

@ -142,6 +142,34 @@ class operator_scenario(base.Scenario):
self.os_node_info_obj = openstack_node_info_reader(
cfg.CONF.operator_test.operator_setup_file)
def is_metric_pool(self, is_containerized, ceph_json):
if 'HEALTH_WARN' not in ceph_json['health']['status']:
return False
checks = ceph_json['health']['checks']
err = checks.get('MANY_OBJECTS_PER_PG', None)
if (not err or 'HEALTH_WARN' not in err.get('severity', None) or
('1 pools have many more objects per pg than average' not in
err['summary']['message'])):
return False
cmd = (r"ceph df")
if is_containerized:
ceph_container = get_container_name("cephmon")
cmd = ("'docker exec %s %s'" % (ceph_container, cmd))
cmd = "ansible -o all -u root -i 127.0.0.1, -a " + cmd + ' -u root'
ret = execute(cmd)
if ret['status']:
return False
for line in ret['output'].split('\\n'):
if 'metrics' not in line:
continue
try:
num_obj = int(line.split()[-1])
except ValueError:
return False
if num_obj > 1000:
return True
return False
@base.scenario(admin_only=False, operator=True)
def rabbitmq_check(self):
self.load()
@ -324,6 +352,9 @@ class operator_scenario(base.Scenario):
and 'mon health preluminous compat warning' in \
ceph_json['health']['summary'][0]['summary']:
overall_status = ceph_json['health']['status']
if ('HEALTH_WARN' in overall_status and
self.is_metric_pool(is_containerized, ceph_json)):
overall_status = 'HEALTH_OK'
else:
overall_status = ceph_json['health']['overall_status']
num_of_osd = ceph_json['osdmap']['osdmap']['num_osds']