author | Francesco Romani <fromani@redhat.com> | |
Mon, 12 Dec 2016 11:03:43 +0000 (12:03 +0100) | ||
committer | Francesco Romani <fromani@redhat.com> | |
Mon, 12 Dec 2016 11:40:58 +0000 (12:40 +0100) | ||
commit | b2541eb463165a5973fedb5d51eab8288fcd7ebc | |
tree | 9a268509240b745a45cfd426fd67f7e8c9fe4ec8 | tree | snapshot |
parent | 7d8948f9d931d8acb3da197c5317a9f382657cd7 | commit | diff |
virt plugin: Open connection on init()
If we use more than one reader instance, we can spot errors like
this in the system logs:
Dec 12 09:59:24 $HOST collectd[19338]: reading number of
domains: invalid connection pointer in virConnectNumOfDomains
Dec 12 09:59:24 benji.rokugan.lan collectd[19338]: read-function of
plugin `virt-2' failed. Will suspend it for 20.000 seconds.
This causes unnecessary delay in the sampling of libvirt.
The reason for this is just one instance (always #0) takes care
of establishing the libvirt connection.
But this could be done safely in the plugin init callback: according
to doc, this function is called at least once before all the read
instances.
Signed-off-by: Francesco Romani <fromani@redhat.com>
If we use more than one reader instance, we can spot errors like
this in the system logs:
Dec 12 09:59:24 $HOST collectd[19338]: reading number of
domains: invalid connection pointer in virConnectNumOfDomains
Dec 12 09:59:24 benji.rokugan.lan collectd[19338]: read-function of
plugin `virt-2' failed. Will suspend it for 20.000 seconds.
This causes unnecessary delay in the sampling of libvirt.
The reason for this is just one instance (always #0) takes care
of establishing the libvirt connection.
But this could be done safely in the plugin init callback: according
to doc, this function is called at least once before all the read
instances.
Signed-off-by: Francesco Romani <fromani@redhat.com>
src/virt.c | diff | blob | history |