From 48729136a7a01b07624b702f0b59af3c69e3fcca Mon Sep 17 00:00:00 2001 From: Johannes Grassler Date: Wed, 18 Oct 2017 17:36:30 +0200 Subject: [PATCH] libvirt check: use unqualified hostname Nova will always use an unqualified host name for an instance's compute node. If monasca-agent is configured to use a compute node's fully qualified host name for metrics and that gets used for looking up the instances running on that node, Nova will return zero results. This commit fixes this problem by always reducing the the host name to its first component. Change-Id: Ie29cb2dc305c8b2d4c551d1512e0e755f9e38cb6 Story: 2001251 Task: 5781 --- monasca_agent/collector/checks_d/libvirt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monasca_agent/collector/checks_d/libvirt.py b/monasca_agent/collector/checks_d/libvirt.py index 862c9b22..78aea08f 100644 --- a/monasca_agent/collector/checks_d/libvirt.py +++ b/monasca_agent/collector/checks_d/libvirt.py @@ -145,7 +145,7 @@ class LibvirtCheck(AgentCheck): client_version=ma_version.version_string) self._get_this_host_aggregate(nova_client) instances = nova_client.servers.list( - search_opts={'all_tenants': 1, 'host': self.hostname}) + search_opts={'all_tenants': 1, 'host': self.hostname.split('.')[0]}) # Lay the groundwork for fetching VM IPs and network namespaces if self.init_config.get('ping_check'): nu = neutron_client.Client(