From 1cb562acf69bf5648703964727736c5c7beb97a7 Mon Sep 17 00:00:00 2001 From: Alan Pevec Date: Aug 11 2009 22:34:15 +0000 Subject: - fix condrestart: on upgrade collectd is not restarted, bz# 516273 - collectd does not re-connect to libvirtd, bz# 480997 --- diff --git a/collectd-4.5.4-fix-condrestart.patch b/collectd-4.5.4-fix-condrestart.patch new file mode 100644 index 0000000..3982a16 --- /dev/null +++ b/collectd-4.5.4-fix-condrestart.patch @@ -0,0 +1,11 @@ +--- contrib/fedora/init.d-collectd.orig 2009-08-11 01:50:15.000000000 +0200 ++++ contrib/fedora/init.d-collectd 2009-08-11 01:51:10.000000000 +0200 +@@ -54,7 +54,7 @@ + start + ;; + condrestart) +- [ -f /var/lock/subsys/$prog ] && restart || : ++ [ -f /var/lock/subsys/$prog ] && stop && start || : + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}" diff --git a/collectd-4.5.4-libvirt-reconnect.patch b/collectd-4.5.4-libvirt-reconnect.patch new file mode 100644 index 0000000..a0de7ce --- /dev/null +++ b/collectd-4.5.4-libvirt-reconnect.patch @@ -0,0 +1,61 @@ +--- a/src/libvirt.c 2009-08-11 23:27:35.000000000 +0200 ++++ b/src/libvirt.c 2009-08-12 00:14:58.000000000 +0200 +@@ -49,6 +49,8 @@ + + /* Connection. */ + static virConnectPtr conn = 0; ++static char *conn_string = NULL; ++static int conn_count = 0; + + /* Seconds between list refreshes, 0 disables completely. */ + static int interval = 60; +@@ -153,14 +155,14 @@ + il_interface_devices = ignorelist_create (1); + + if (strcasecmp (key, "Connection") == 0) { +- if (conn != 0) { ++ if (conn_count++ != 0) { + ERROR ("Connection may only be given once in config file"); + return 1; + } +- conn = virConnectOpenReadOnly (value); +- if (!conn) { +- VIRT_ERROR (NULL, "connection failed"); +- return 1; ++ conn_string = strdup(value); ++ if (conn_string == NULL) { ++ ERROR ("libvirt plugin: Connection strdup failed."); ++ return -1; + } + return 0; + } +@@ -253,10 +255,11 @@ + 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 = virConnectOpenReadOnly (conn_string); ++ if (conn == NULL) { ++ ERROR ("libvirt plugin: Not connected."); ++ return -1; ++ } + } + + time (&t); +@@ -264,8 +267,12 @@ + /* 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; + } + diff --git a/collectd.spec b/collectd.spec index 1bac7ca..0ed4253 100644 --- a/collectd.spec +++ b/collectd.spec @@ -1,7 +1,7 @@ Summary: Statistics collection daemon for filling RRD files Name: collectd Version: 4.5.4 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2 Group: System Environment/Daemons URL: http://collectd.org/ @@ -10,6 +10,10 @@ Source: http://collectd.org/files/%{name}-%{version}.tar.bz2 Patch0: %{name}-4.5.1-include-collectd.d.patch # bug 468067 "pkg-config --libs OpenIPMIpthread" fails Patch1: %{name}-4.5.1-configure-OpenIPMI.patch +# bug 516273 on upgrade collectd is not restarted +Patch2: %{name}-%{version}-fix-condrestart.patch +# bug 480997 collectd does not re-connect to libvirtd +Patch3: %{name}-%{version}-libvirt-reconnect.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -151,6 +155,8 @@ This plugin collects information from virtualized guests. %setup -q %patch0 -p1 %patch1 -p0 +%patch2 -p0 +%patch3 -p1 sed -i.orig -e 's|-Werror||g' Makefile.in */Makefile.in @@ -407,6 +413,10 @@ fi %changelog +* Wed Aug 12 2009 Alan Pevec 4.5.4-2 +- fix condrestart: on upgrade collectd is not restarted, bz# 516273 +- collectd does not re-connect to libvirtd, bz# 480997 + * Tue Aug 11 2009 Alan Pevec 4.5.4-1 - New upstream version 4.5.4 http://collectd.org/news.shtml#news66