From: Sebastian Harl Date: Sun, 11 Oct 2009 17:20:22 +0000 (+0200) Subject: patches: Removed libvirt-reconnect.dpatch. X-Git-Tag: collectd-4.8.1-1~11 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5af4a6d8d77c9ec7c5c6a276ab9123dd43d43deb;p=pkg-collectd.git patches: Removed libvirt-reconnect.dpatch. This patch has been included upstream. --- diff --git a/debian/changelog b/debian/changelog index 378e5fd..d0c307a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -20,8 +20,9 @@ collectd (4.8.1-1) unstable; urgency=low - Removed bts541953-curl-followlocation.dpatch - included upstream. - Removed bts542859-df-fix-ignorelist.dpatch - included upstream. - Removed java-fix-jvm-start.dpatch - included upstream. + - Removed libvirt-reconnect.dpatch - included upstream. - -- Sebastian Harl Sun, 11 Oct 2009 19:18:29 +0200 + -- Sebastian Harl Sun, 11 Oct 2009 19:20:07 +0200 collectd (4.7.2-1) unstable; urgency=low diff --git a/debian/patches/00list b/debian/patches/00list index 680577a..1788169 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -1,6 +1,5 @@ rrd_filter_path.dpatch collection_conf_path.dpatch network-fix-cacheflush.dpatch -libvirt-reconnect.dpatch plugin-fix-unregister.dpatch diff --git a/debian/patches/libvirt-reconnect.dpatch b/debian/patches/libvirt-reconnect.dpatch deleted file mode 100755 index 2069276..0000000 --- a/debian/patches/libvirt-reconnect.dpatch +++ /dev/null @@ -1,86 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## libvirt-reconnect.dpatch by Alan Pevec and -## Florian Forster -## -## DP: libvirt plugin: Re-connect to libvirtd if connecting fails. -## DP: -## DP: https://bugzilla.redhat.com/show_bug.cgi?id=480997 - -@DPATCH@ - -diff a/src/libvirt.c b/src/libvirt.c ---- a/src/libvirt.c -+++ b/src/libvirt.c -@@ -24,6 +24,7 @@ - #include "plugin.h" - #include "configfile.h" - #include "utils_ignorelist.h" -+#include "utils_complain.h" - - #include - #include -@@ -49,6 +50,8 @@ static const char *config_keys[] = { - - /* Connection. */ - static virConnectPtr conn = 0; -+static char *conn_string = NULL; -+static c_complain_t conn_complain = C_COMPLAIN_INIT_STATIC; - - /* Seconds between list refreshes, 0 disables completely. */ - static int interval = 60; -@@ -153,15 +156,13 @@ lv_config (const char *key, const char *value) - il_interface_devices = ignorelist_create (1); - - if (strcasecmp (key, "Connection") == 0) { -- if (conn != 0) { -- ERROR ("Connection may only be given once in config file"); -- return 1; -- } -- conn = virConnectOpenReadOnly (value); -- if (!conn) { -- VIRT_ERROR (NULL, "connection failed"); -+ char *tmp = strdup (value); -+ if (tmp == NULL) { -+ ERROR ("libvirt plugin: Connection strdup failed."); - return 1; - } -+ sfree (conn_string); -+ conn_string = tmp; - return 0; - } - -@@ -253,19 +254,29 @@ lv_read (void) - int i; - - if (conn == NULL) { -- ERROR ("libvirt plugin: Not connected. Use Connection in " -- "config file to supply connection URI. For more information " -- "see "); -- return -1; -+ /* `conn_string == NULL' is acceptable. */ -+ conn = virConnectOpenReadOnly (conn_string); -+ if (conn == NULL) { -+ c_complain (LOG_ERR, &conn_complain, -+ "libvirt plugin: Unable to connect: " -+ "virConnectOpenReadOnly failed."); -+ return -1; -+ } - } -+ c_release (LOG_NOTICE, &conn_complain, -+ "libvirt plugin: Connection established."); - - time (&t); - - /* Need to refresh domain or device lists? */ - if ((last_refresh == (time_t) 0) || - ((interval > 0) && ((last_refresh + interval) <= t))) { -- if (refresh_lists () != 0) -+ if (refresh_lists () != 0) { -+ if (conn != NULL) -+ virConnectClose (conn); -+ conn = NULL; - return -1; -+ } - last_refresh = t; - } -