From 0936a9ec3f007731f43c7c207a085baec88ab461 Mon Sep 17 00:00:00 2001 From: Francesco Romani Date: Thu, 24 Nov 2016 16:09:41 +0100 Subject: [PATCH] virt plugin: Properly reset the lists If all the libvirt domains are shutdown between two refresh cycles, the code failed to clean the lists. Thus, the last detected libvirt domains are kept forever, leading to failures in the data collection. This leads to messages like Nov 24 15:34:57 benji.rokugan.lan collectd[15083]: libvirt: QEMU Driver error : Domain not found: no domain with matching uuid 'bc324fee-5707-4ac6-a650-6037562d4632' (nano_C010) In the logs. This bug was also present in collectd 5.6.1. Signed-off-by: Francesco Romani --- src/virt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/virt.c b/src/virt.c index 7cb90b77..6afd2390 100644 --- a/src/virt.c +++ b/src/virt.c @@ -836,6 +836,8 @@ static int refresh_lists(struct lv_read_instance *inst) { return -1; } + lv_clean_read_state(state); + if (n > 0) { int *domids; @@ -853,8 +855,6 @@ static int refresh_lists(struct lv_read_instance *inst) { return -1; } - lv_clean_read_state(state); - /* Fetch each domain and add it to the list, unless ignore. */ for (int i = 0; i < n; ++i) { virDomainPtr dom = NULL; -- 2.11.0