Fix for aggregate metrics

Change-Id: Ib4b94620b561586b76ef47c78d11548b0334a193
This commit is contained in:
Olivier Bourdon 2017-03-17 13:00:08 +01:00
parent ab344cbc52
commit 63e141c7fb
1 changed files with 3 additions and 3 deletions

View File

@ -57,7 +57,7 @@ class HypervisorStatsPlugin(openstack.CollectdPlugin):
for agg in aggregates_list:
nova_aggregates[agg['name']] = {
'id': agg['id'],
'hosts': agg['hosts'],
'hosts': [h.split('.')[0] for h in agg['hosts']],
'metrics': {'free_vcpus': 0},
}
nova_aggregates[agg['name']]['metrics'].update(
@ -85,7 +85,7 @@ class HypervisorStatsPlugin(openstack.CollectdPlugin):
total_stats[v] += m_val
for agg in nova_aggregates.keys():
agg_hosts = nova_aggregates[agg]['hosts']
if stats['hypervisor_hostname'] in agg_hosts:
if host in agg_hosts:
nova_aggregates[agg]['metrics'][v] += m_val
if 'cpu_ratio' in self.extra_config:
m_vcpus = stats.get('vcpus', 0)
@ -100,7 +100,7 @@ class HypervisorStatsPlugin(openstack.CollectdPlugin):
total_stats['free_vcpus'] += free
for agg in nova_aggregates.keys():
agg_hosts = nova_aggregates[agg]['hosts']
if stats['hypervisor_hostname'] in agg_hosts:
if host in agg_hosts:
free = ((int(self.extra_config['cpu_ratio'] *
m_vcpus)) -
m_vcpus_used)