Browse Source

Fix for aggregate metrics

Change-Id: Ib4b94620b561586b76ef47c78d11548b0334a193
changes/71/446971/2
Olivier Bourdon 2 years ago
parent
commit
63e141c7fb

+ 3
- 3
deployment_scripts/puppet/modules/lma_collector/files/collectd/hypervisor_stats.py View File

@@ -57,7 +57,7 @@ class HypervisorStatsPlugin(openstack.CollectdPlugin):
57 57
             for agg in aggregates_list:
58 58
                 nova_aggregates[agg['name']] = {
59 59
                     'id': agg['id'],
60
-                    'hosts': agg['hosts'],
60
+                    'hosts': [h.split('.')[0] for h in agg['hosts']],
61 61
                     'metrics': {'free_vcpus': 0},
62 62
                 }
63 63
                 nova_aggregates[agg['name']]['metrics'].update(
@@ -85,7 +85,7 @@ class HypervisorStatsPlugin(openstack.CollectdPlugin):
85 85
                 total_stats[v] += m_val
86 86
                 for agg in nova_aggregates.keys():
87 87
                     agg_hosts = nova_aggregates[agg]['hosts']
88
-                    if stats['hypervisor_hostname'] in agg_hosts:
88
+                    if host in agg_hosts:
89 89
                         nova_aggregates[agg]['metrics'][v] += m_val
90 90
             if 'cpu_ratio' in self.extra_config:
91 91
                 m_vcpus = stats.get('vcpus', 0)
@@ -100,7 +100,7 @@ class HypervisorStatsPlugin(openstack.CollectdPlugin):
100 100
                 total_stats['free_vcpus'] += free
101 101
                 for agg in nova_aggregates.keys():
102 102
                     agg_hosts = nova_aggregates[agg]['hosts']
103
-                    if stats['hypervisor_hostname'] in agg_hosts:
103
+                    if host in agg_hosts:
104 104
                         free = ((int(self.extra_config['cpu_ratio'] *
105 105
                                      m_vcpus)) -
106 106
                                 m_vcpus_used)

Loading…
Cancel
Save