Fix for aggregate metrics
Change-Id: I9e5feb30b29c750821e60778cbcb13fb0398996c
diff --git a/collectd/files/plugin/hypervisor_stats.py b/collectd/files/plugin/hypervisor_stats.py
index 84f735e..7c0d26d 100644
--- a/collectd/files/plugin/hypervisor_stats.py
+++ b/collectd/files/plugin/hypervisor_stats.py
@@ -60,7 +60,7 @@
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(
@@ -88,7 +88,7 @@
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)
@@ -103,7 +103,7 @@
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)