Fix libvirt plugin bug for newly created VMs
Once the instance cache file is built, we can never refresh the cache because we get a TypeError trying to build the dimensions and mis-diagnose the VM as a ghost VM. Simple fix is to move the update cache call above where we look for the instance name in the cache. Change-Id: Iddc229a4e0f150e838a82ace36bc1ba92be17a0e Closes-Bug: #1486688
This commit is contained in:
@ -168,6 +168,8 @@ class LibvirtCheck(AgentCheck):
|
||||
for inst in insp._get_connection().listAllDomains():
|
||||
# Verify that this instance exists in the cache. Add if necessary.
|
||||
inst_name = inst.name()
|
||||
if inst_name not in instance_cache:
|
||||
instance_cache = self._update_instance_cache()
|
||||
|
||||
# Build customer dimensions
|
||||
try:
|
||||
@ -196,8 +198,6 @@ class LibvirtCheck(AgentCheck):
|
||||
self.gauge('vm.host_alive_status', 2, dimensions=dims_operations,
|
||||
value_meta={'detail': detail})
|
||||
continue
|
||||
if inst_name not in instance_cache:
|
||||
instance_cache = self._update_instance_cache()
|
||||
if inst_name not in metric_cache:
|
||||
metric_cache[inst_name] = {}
|
||||
|
||||
|
Reference in New Issue
Block a user