From: Francesco Romani Date: Thu, 24 Nov 2016 15:09:41 +0000 (+0100) Subject: virt plugin: Properly reset the lists X-Git-Tag: collectd-5.8.0~290^2~1 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=0936a9ec3f007731f43c7c207a085baec88ab461;p=collectd.git 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 --- 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;