From c047888de1273805e309098befa15f38d712df2c Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 15 Oct 2009 17:29:08 +0000 Subject: [PATCH 01/71] - New upstream based on git ea2f772d. - Update the configuration file based on upstream changes to how virsh has to be run. - vhostmd should run non-root as user 'vhostmd'. - Allow libvirt URI to be configured. --- ...ther-changes-to-avoid-using-xenstore.patch | 61 ------------------- sources | 2 +- vhostmd.conf | 12 ++-- vhostmd.init | 6 ++ vhostmd.spec | 31 ++++++---- vhostmd.sysconfig | 6 ++ 6 files changed, 38 insertions(+), 80 deletions(-) delete mode 100644 0001-Further-changes-to-avoid-using-xenstore.patch diff --git a/0001-Further-changes-to-avoid-using-xenstore.patch b/0001-Further-changes-to-avoid-using-xenstore.patch deleted file mode 100644 index 1425ba6..0000000 --- a/0001-Further-changes-to-avoid-using-xenstore.patch +++ /dev/null @@ -1,61 +0,0 @@ -From c0cbeed281739194adfb9c43d01197a4f84d8d95 Mon Sep 17 00:00:00 2001 -From: Richard Jones -Date: Tue, 13 Oct 2009 11:18:49 +0100 -Subject: [PATCH] Further changes to avoid using xenstore. - -We missed two more places where libxenstore is used. This commit -changes the Makefiles to not link to xenstore when --without-xenstore -is given. ---- - test/Makefile.am | 10 ++++++++-- - vm-dump-metrics/Makefile.am | 5 ++++- - 2 files changed, 12 insertions(+), 3 deletions(-) - -diff --git a/test/Makefile.am b/test/Makefile.am -index 42e6a59..fd2cd60 100644 ---- a/test/Makefile.am -+++ b/test/Makefile.am -@@ -5,7 +5,10 @@ INCLUDES = \ - noinst_PROGRAMS = test_static test_dyn - - test_static_SOURCES = main.c --test_static_LDADD = ../libmetrics/libmetrics.la $(LIBXML_LIBS) -lxenstore -+test_static_LDADD = ../libmetrics/libmetrics.la $(LIBXML_LIBS) -+if WITH_XENSTORE -+test_static_LDADD += -lxenstore -+endif - - test_static_DEPENDENCIES = \ - ../libmetrics/libmetrics.h \ -@@ -13,7 +16,10 @@ test_static_DEPENDENCIES = \ - - test_dyn_SOURCES = main.c - test_dyn_CFLAGS = -DUSE_DL_OPEN --test_dyn_LDADD = ../libmetrics/libmetrics.la $(LIBXML_LIBS) -lxenstore -+test_dyn_LDADD = ../libmetrics/libmetrics.la $(LIBXML_LIBS) -+if WITH_XENSTORE -+test_dyn_LDADD += -lxenstore -+endif - - test_dyn_DEPENDENCIES = \ - ../libmetrics/libmetrics.h \ -diff --git a/vm-dump-metrics/Makefile.am b/vm-dump-metrics/Makefile.am -index c29a4cd..0cde35d 100644 ---- a/vm-dump-metrics/Makefile.am -+++ b/vm-dump-metrics/Makefile.am -@@ -8,8 +8,11 @@ endif - - sbin_PROGRAMS = vm-dump-metrics - vm_dump_metrics_SOURCES = main.c --vm_dump_metrics_LDADD = ../libmetrics/libmetrics.la $(LIBXML_LIBS) -lxenstore -+vm_dump_metrics_LDADD = ../libmetrics/libmetrics.la $(LIBXML_LIBS) - vm_dump_metrics_LDFLAGS = -static -+if WITH_XENSTORE -+vm_dump_metrics_LDADD += -lxenstore -+endif - - vm_dump_metrics_DEPENDENCIES = \ - ../libmetrics/libmetrics.h \ --- -1.6.2.5 - diff --git a/sources b/sources index af60bb7..6b5ed6e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -3e96ae064b7accaea68160d48379c92f vhostmd-0.4.tar.bz2 +e241097003a7a8eb1898fcc152581596 vhostmd-0.4.tar.bz2 diff --git a/vhostmd.conf b/vhostmd.conf index e649ba3..9c937c9 100644 --- a/vhostmd.conf +++ b/vhostmd.conf @@ -43,19 +43,19 @@ within the vm element. VirtualizationProductInfo - virsh version | grep API | gawk -F': ' '{print $2}' + virsh -r CONNECT version | grep API | gawk -F': ' '{print $2}' TotalPhyCPUs - virsh nodeinfo | grep 'CPU(s):' | gawk -F': +' '{print $2}' + virsh -r CONNECT nodeinfo | grep 'CPU(s):' | gawk -F': +' '{print $2}' NumCPUs - virsh nodeinfo | grep 'CPU(s):' | gawk -F': +' '{print $2}' + virsh -r CONNECT nodeinfo | grep 'CPU(s):' | gawk -F': +' '{print $2}' TotalPhyMem - virsh nodeinfo | grep 'Memory size:' | gawk -F' +' '{print $3}' + virsh -r CONNECT nodeinfo | grep 'Memory size:' | gawk -F' +' '{print $3}' UsedMem @@ -81,12 +81,12 @@ within the vm element. TotalCPUTime - virsh dominfo NAME | sed 's/: */:/' | \ + virsh -r CONNECT dominfo NAME | sed 's/: */:/' | \ gawk -F: '/CPU time/ {print $2;}' diff --git a/vhostmd.init b/vhostmd.init index 5555592..a64d9f5 100644 --- a/vhostmd.init +++ b/vhostmd.init @@ -30,6 +30,12 @@ fi if [ -n "$VHOSTMD_CONFIG" ]; then ARGS="$ARGS --config $VHOSTMD_CONFIG" fi +if [ -n "$VHOSTMD_USER" ]; then + ARGS="$ARGS --user $VHOSTMD_USER" +fi +if [ -n "$VHOSTMD_URI" ]; then + ARGS="$ARGS --connect $VHOSTMD_URI" +fi lockfile=/var/lock/subsys/$prog diff --git a/vhostmd.spec b/vhostmd.spec index 7aa201e..797bd94 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -8,7 +8,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 0.4 -Release: 0.1.git326f0012172%{?dist} +Release: 0.2.gitea2f772d%{?dist} License: GPLv2+ Group: System Environment/Daemons BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -16,24 +16,18 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root URL: http://gitorious.org/vhostmd # Upstream tarball hosting is screwed at the moment. This release is -# a pre-release of 0.4, based on git 326f00121729760c0236ef1b56b905f85470c740 -# with 'make dist' done by the packager. +# a pre-release of 0.4, based on the git commit names in the Release +# tag above, with 'make dist' done by the packager. Source0: vhostmd-%{version}.tar.bz2 Source1: vhostmd.init Source2: vhostmd.sysconfig Source3: vhostmd.conf -# Fix --without-xenstore option. Patch posted upstream on 2009-10-13. -Patch0: 0001-Further-changes-to-avoid-using-xenstore.patch - BuildRequires: chrpath BuildRequires: pkgconfig BuildRequires: libxml2-devel BuildRequires: libvirt-devel -# Used when we are patching autotools configuration. -BuildRequires: automake, autoconf, libtool - %if %{have_xen} BuildRequires: xen-devel %endif @@ -42,6 +36,7 @@ Requires(post): chkconfig Requires(preun): chkconfig Requires(preun): initscripts Requires(postun): initscripts +Requires(pre): shadow-utils %description @@ -74,9 +69,6 @@ Header and libraries necessary for metrics gathering development %prep %setup -q -%patch0 -p1 -./autogen.sh - %build %configure \ @@ -144,6 +136,14 @@ fi %postun -n vm-dump-metrics -p /sbin/ldconfig +%pre +getent group vhostmd >/dev/null || groupadd -r vhostmd +getent passwd vhostmd >/dev/null || \ +useradd -r -g vhostmd -d %{_datadir}/vhostmd -s /sbin/nologin \ +-c "Virtual Host Metrics Daemon" vhostmd +exit 0 + + %files %defattr(-,root,root,-) %doc AUTHORS ChangeLog COPYING README @@ -183,6 +183,13 @@ fi %changelog +* Thu Oct 15 2009 Richard W.M. Jones - 0.4-0.2.gitea2f772d +- New upstream based on git ea2f772d. +- Update the configuration file based on upstream changes to how virsh + has to be run. +- vhostmd should run non-root as user 'vhostmd'. +- Allow libvirt URI to be configured. + * Tue Oct 13 2009 Richard W.M. Jones - 0.4-0.1.git326f0012172 - Move to pre-release of 0.4, self-built tarball. - Disable xenstore on non-x86 platforms. diff --git a/vhostmd.sysconfig b/vhostmd.sysconfig index 8422c3e..47bbd9a 100644 --- a/vhostmd.sysconfig +++ b/vhostmd.sysconfig @@ -3,3 +3,9 @@ # Override the default configuration file path. #VHOSTMD_CONFIG=/path/to/vhostmd.conf + +# Set the user that the daemon runs as after dropping root privs. +VHOSTMD_USER=vhostmd + +# Set the libvirt URI. +VHOSTMD_URI=qemu:///system From 38499bf7521949328f9cfad64dc36c7c1a9e445e Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 16 Oct 2009 16:10:40 +0000 Subject: [PATCH 02/71] - New upstream based on git e9db007b. - Fix segfault in vm-dump-metrics (RHBZ#529348). - On error, vm-dump-metrics now exits with status code 1. --- sources | 2 +- vhostmd.spec | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/sources b/sources index 6b5ed6e..29cbdd2 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -e241097003a7a8eb1898fcc152581596 vhostmd-0.4.tar.bz2 +139650528c154da52a65adedfb8e83cf vhostmd-0.4.tar.bz2 diff --git a/vhostmd.spec b/vhostmd.spec index 797bd94..e54a65f 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -8,7 +8,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 0.4 -Release: 0.2.gitea2f772d%{?dist} +Release: 0.5.gite9db007b%{?dist} License: GPLv2+ Group: System Environment/Daemons BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -183,6 +183,11 @@ exit 0 %changelog +* Fri Oct 16 2009 Richard W.M. Jones - 0.4-0.5.gite9db007b +- New upstream based on git e9db007b. +- Fix segfault in vm-dump-metrics (RHBZ#529348). +- On error, vm-dump-metrics now exits with status code 1. + * Thu Oct 15 2009 Richard W.M. Jones - 0.4-0.2.gitea2f772d - New upstream based on git ea2f772d. - Update the configuration file based on upstream changes to how virsh From b1baa925b05c2ca26f88c5ef12eac8ba0628eb49 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 2 Nov 2009 11:03:49 +0000 Subject: [PATCH 03/71] Some changes to the default configuration file suggested by SAP to make it more CIM standards compliant. --- vhostmd.conf | 85 +++++++++++++++++++++++++++++++++++++++++++--------- vhostmd.spec | 6 +++- 2 files changed, 76 insertions(+), 15 deletions(-) diff --git a/vhostmd.conf b/vhostmd.conf index 9c937c9..d7b73ec 100644 --- a/vhostmd.conf +++ b/vhostmd.conf @@ -39,55 +39,112 @@ within the vm element. VirtualizationVendor - echo Fedora + rpm -qi libvirt| grep Vendor: |awk '{print substr($0, index($0,$5)) }' + - VirtualizationProductInfo + VirtProductInfo virsh -r CONNECT version | grep API | gawk -F': ' '{print $2}' + + + HostSystemInfo + hostname -s + + - TotalPhyCPUs + NumberOfPhysicalCPUsUtilized virsh -r CONNECT nodeinfo | grep 'CPU(s):' | gawk -F': +' '{print $2}' - - NumCPUs - virsh -r CONNECT nodeinfo | grep 'CPU(s):' | gawk -F': +' '{print $2}' + + + MemoryAllocatedToVirtualServers + virsh -r CONNECT nodeinfo | grep 'Memory size:' | gawk -F' +' '{ printf "%d\n" $3/1024 }' + + + + FreePhysicalMemory + + free|egrep -i '^[[:space:]]*(Mem:)' \ + |awk 'BEGIN { sum = 0; } + { sum += $4; } + END { printf "%10d\n", sum/1024; }' + - TotalPhyMem - virsh -r CONNECT nodeinfo | grep 'Memory size:' | gawk -F' +' '{print $3}' + UsedPhysicalMemory + + free|egrep -i '^[[:space:]]*(Mem:)' \ + |awk 'BEGIN { sum = 0; } + { sum += $3; } + END { printf "%10d\n", sum/1024; }' + + - UsedMem - free | grep '^Mem:' | gawk '{print $3}' + FreeVirtualMemory + + free|egrep -i '^[[:space:]]*(Mem:|Swap:)' \ + |awk 'BEGIN { sum = 0; } + { sum += $4; } + END { printf "%10d\n", sum/1024; }' + + - FreeMem - free | grep '^Mem:' | gawk '{print $4}' + UsedVirtualMemory + + free|egrep -i '^[[:space:]]*(Mem:|Swap:)' \ + |awk 'BEGIN { sum = 0; } + { sum += $3; } + END { printf "%10d\n", sum/1024; }' + PagedInMemory echo "$((`vmstat -s | gawk '/pages paged in/ {print $1}'` / 1024))" + + PagedOutMemory echo "$((`vmstat -s | gawk '/pages paged out/ {print $1}'` / 1024))" PageRates pagerate.pl + + TotalCPUTime virsh -r CONNECT dominfo NAME | sed 's/: */:/' | \ gawk -F: '/CPU time/ {print $2;}' + + NumberOfAssignedPhysicalCPUs + virsh -r CONNECT dominfo NAME | grep 'CPU(s):' | gawk -F': +' '{print $2}' + + + + PhysicalMemoryAllocatedToVirtualSystem + virsh -r CONNECT dominfo NAME | grep 'Max memory:' | gawk -F' +' '{printf "%d\n", $3/1024}' + + + + + diff --git a/vhostmd.spec b/vhostmd.spec index e54a65f..1b253da 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -8,7 +8,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 0.4 -Release: 0.5.gite9db007b%{?dist} +Release: 0.6.gite9db007b%{?dist} License: GPLv2+ Group: System Environment/Daemons BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -183,6 +183,10 @@ exit 0 %changelog +* Mon Nov 2 2009 Richard W.M. Jones - 0.4-0.6.gite9db007b +- Some changes to the default configuration file suggested by SAP to + make it more CIM standards compliant. + * Fri Oct 16 2009 Richard W.M. Jones - 0.4-0.5.gite9db007b - New upstream based on git e9db007b. - Fix segfault in vm-dump-metrics (RHBZ#529348). From 53c268e4a2671d911d9ba105b6778aa8fbcac518 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 10 Nov 2009 16:16:01 +0000 Subject: [PATCH 04/71] - vm-dump-metrics-devel package should require version and release of base package. --- vhostmd.spec | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vhostmd.spec b/vhostmd.spec index 1b253da..c3548b9 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -8,7 +8,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 0.4 -Release: 0.6.gite9db007b%{?dist} +Release: 0.7.gite9db007b%{?dist} License: GPLv2+ Group: System Environment/Daemons BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -58,7 +58,7 @@ or a file. %package -n vm-dump-metrics-devel Summary: Virtualization host metrics dump development Group: Development/Libraries -Requires: vm-dump-metrics = %{version} +Requires: vm-dump-metrics = %{version}-%{release} Requires: pkgconfig @@ -183,6 +183,10 @@ exit 0 %changelog +* Tue Nov 10 2009 Richard W.M. Jones - 0.4-0.7.gite9db007b +- vm-dump-metrics-devel package should require version and release of + base package. + * Mon Nov 2 2009 Richard W.M. Jones - 0.4-0.6.gite9db007b - Some changes to the default configuration file suggested by SAP to make it more CIM standards compliant. From b6d5045b2f84bcd2b0694f00c5ddcaa9b85042c3 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 11 Nov 2009 14:03:52 +0000 Subject: [PATCH 05/71] Use fixed UID:GID 112:112 (RHBZ#534109). --- vhostmd.spec | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/vhostmd.spec b/vhostmd.spec index c3548b9..c862823 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -8,7 +8,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 0.4 -Release: 0.7.gite9db007b%{?dist} +Release: 0.8.gite9db007b%{?dist} License: GPLv2+ Group: System Environment/Daemons BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -137,9 +137,10 @@ fi %pre -getent group vhostmd >/dev/null || groupadd -r vhostmd +# UID:GID 112:112 reserved, see RHBZ#534109. +getent group vhostmd >/dev/null || groupadd -g 112 -r vhostmd getent passwd vhostmd >/dev/null || \ -useradd -r -g vhostmd -d %{_datadir}/vhostmd -s /sbin/nologin \ +useradd -u 112 -r -g vhostmd -d %{_datadir}/vhostmd -s /sbin/nologin \ -c "Virtual Host Metrics Daemon" vhostmd exit 0 @@ -183,6 +184,9 @@ exit 0 %changelog +* Wed Nov 11 2009 Richard W.M. Jones - 0.4-0.8.gite9db007b +- Use fixed UID:GID 112:112 (RHBZ#534109). + * Tue Nov 10 2009 Richard W.M. Jones - 0.4-0.7.gite9db007b - vm-dump-metrics-devel package should require version and release of base package. From 65ca3e012299aa4f7ba5d4450b2e65b8de8e9286 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 17 Nov 2009 11:16:24 +0000 Subject: [PATCH 06/71] - Add a timestamp to the metrics. - Fix a typo in MemoryAllocatedToVirtualServers metric (https://bugzilla.redhat.com/show_bug.cgi?id=532070#c7) - %{_sysconfdir}/sysconfig/vhostmd: Use libvirt default URI (https://bugzilla.redhat.com/show_bug.cgi?id=537828) - %{_sysconfdir}/init.d/vhostmd: If using libvirt's default URI, then pass the root URI to vhostmd (the default URI changes in some circumstances when vhostmd switches to the non-root user). --- vhostmd.conf | 6 +++++- vhostmd.init | 3 +++ vhostmd.spec | 12 +++++++++++- vhostmd.sysconfig | 5 ++++- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/vhostmd.conf b/vhostmd.conf index d7b73ec..271e821 100644 --- a/vhostmd.conf +++ b/vhostmd.conf @@ -37,6 +37,10 @@ within the vm element. HostName hostname + + Time + date +%s + VirtualizationVendor rpm -qi libvirt| grep Vendor: |awk '{print substr($0, index($0,$5)) }' @@ -59,7 +63,7 @@ within the vm element. MemoryAllocatedToVirtualServers - virsh -r CONNECT nodeinfo | grep 'Memory size:' | gawk -F' +' '{ printf "%d\n" $3/1024 }' + virsh -r CONNECT nodeinfo | grep 'Memory size:' | gawk -F' +' '{ printf "%d\n", $3/1024 }' diff --git a/vhostmd.init b/vhostmd.init index a64d9f5..ca3c587 100644 --- a/vhostmd.init +++ b/vhostmd.init @@ -35,6 +35,9 @@ if [ -n "$VHOSTMD_USER" ]; then fi if [ -n "$VHOSTMD_URI" ]; then ARGS="$ARGS --connect $VHOSTMD_URI" +elif virsh uri >/dev/null 2>&1; then + default_uri=$(virsh uri) + ARGS="$ARGS --connect '$default_uri'" fi lockfile=/var/lock/subsys/$prog diff --git a/vhostmd.spec b/vhostmd.spec index c862823..33583f4 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -8,7 +8,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 0.4 -Release: 0.8.gite9db007b%{?dist} +Release: 0.9.gite9db007b%{?dist} License: GPLv2+ Group: System Environment/Daemons BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -184,6 +184,16 @@ exit 0 %changelog +* Tue Nov 17 2009 Richard W.M. Jones - 0.4-0.9.gite9db007b +- Add a timestamp to the metrics. +- Fix a typo in MemoryAllocatedToVirtualServers metric + (https://bugzilla.redhat.com/show_bug.cgi?id=532070#c7) +- %{_sysconfdir}/sysconfig/vhostmd: Use libvirt default URI + (https://bugzilla.redhat.com/show_bug.cgi?id=537828) +- %{_sysconfdir}/init.d/vhostmd: If using libvirt's default URI, then pass + the root URI to vhostmd (the default URI changes in some circumstances + when vhostmd switches to the non-root user). + * Wed Nov 11 2009 Richard W.M. Jones - 0.4-0.8.gite9db007b - Use fixed UID:GID 112:112 (RHBZ#534109). diff --git a/vhostmd.sysconfig b/vhostmd.sysconfig index 47bbd9a..f3d97c3 100644 --- a/vhostmd.sysconfig +++ b/vhostmd.sysconfig @@ -8,4 +8,7 @@ VHOSTMD_USER=vhostmd # Set the libvirt URI. -VHOSTMD_URI=qemu:///system +# Uncomment one of these to force KVM or Xen, otherwise libvirt +# will try to choose a suitable default. +#VHOSTMD_URI=qemu:///system +#VHOSTMD_URI=xen:/// From 808bf31791e7a82a309a2ff0f74f7a40992e6704 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Wed, 25 Nov 2009 22:43:21 +0000 Subject: [PATCH 07/71] Fix typo that causes a failure to update the common directory. (releng #2781) --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 60aa6a2..ab78374 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ # Makefile for source rpm: vhostmd -# $Id$ +# $Id: Makefile,v 1.1 2009/10/13 16:24:01 kevin Exp $ NAME := vhostmd SPECFILE = $(firstword $(wildcard *.spec)) define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done +for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done endef MAKEFILE_COMMON := $(shell $(find-makefile-common)) From e401e7577b032cb17745774f4e7d94e53fb07dac Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 9 Dec 2009 15:33:09 +0000 Subject: [PATCH 08/71] vhostmd didn't chdir (/) when daemonizing. Fixed in this 0.4 release. --- sources | 2 +- vhostmd.spec | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sources b/sources index 29cbdd2..d78177b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -139650528c154da52a65adedfb8e83cf vhostmd-0.4.tar.bz2 +83ae93a53002b09c21654566790261a6 vhostmd-0.4.tar.bz2 diff --git a/vhostmd.spec b/vhostmd.spec index 33583f4..4a92a81 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -8,7 +8,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 0.4 -Release: 0.9.gite9db007b%{?dist} +Release: 1%{?dist} License: GPLv2+ Group: System Environment/Daemons BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -16,8 +16,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root URL: http://gitorious.org/vhostmd # Upstream tarball hosting is screwed at the moment. This release is -# a pre-release of 0.4, based on the git commit names in the Release -# tag above, with 'make dist' done by the packager. +# of the 0.4 branch, with 'make dist' done by the packager. Source0: vhostmd-%{version}.tar.bz2 Source1: vhostmd.init Source2: vhostmd.sysconfig @@ -184,6 +183,9 @@ exit 0 %changelog +* Wed Dec 9 2009 Richard W.M. Jones - 0.4-1 +- vhostmd didn't chdir ("/") when daemonizing. Fixed in this 0.4 release. + * Tue Nov 17 2009 Richard W.M. Jones - 0.4-0.9.gite9db007b - Add a timestamp to the metrics. - Fix a typo in MemoryAllocatedToVirtualServers metric From dd2e205248bf6480527de083742863a289be527d Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 10 Dec 2009 17:27:55 +0000 Subject: [PATCH 09/71] Fix the PagedOutMemory and PagedInMemory stats to report MB instead of pages (fixes supplied by Joachim Schneider). --- vhostmd.conf | 96 +++++++++++++++++++++++++++++++++++++--------------- vhostmd.spec | 6 +++- 2 files changed, 74 insertions(+), 28 deletions(-) diff --git a/vhostmd.conf b/vhostmd.conf index 271e821..8afd303 100644 --- a/vhostmd.conf +++ b/vhostmd.conf @@ -43,12 +43,18 @@ within the vm element. VirtualizationVendor - rpm -qi libvirt| grep Vendor: |awk '{print substr($0, index($0,$5)) }' + + rpm -qi libvirt| grep Vendor: \ + | gawk '{print substr($0, index($0,$5)) }' + VirtProductInfo - virsh -r CONNECT version | grep API | gawk -F': ' '{print $2}' + + virsh -r CONNECT version | grep API \ + | gawk -F': ' '{print $2}' + @@ -58,61 +64,84 @@ within the vm element. NumberOfPhysicalCPUsUtilized - virsh -r CONNECT nodeinfo | grep 'CPU(s):' | gawk -F': +' '{print $2}' + + virsh -r CONNECT nodeinfo | grep 'CPU(s):' \ + | gawk -F': +' '{print $2}' + MemoryAllocatedToVirtualServers - virsh -r CONNECT nodeinfo | grep 'Memory size:' | gawk -F' +' '{ printf "%d\n", $3/1024 }' + + virsh -r CONNECT nodeinfo | grep 'Memory size:' \ + | gawk -F' +' '{ printf "%d\n", $3/1024 }' + FreePhysicalMemory - free|egrep -i '^[[:space:]]*(Mem:)' \ - |awk 'BEGIN { sum = 0; } + free|egrep -i '^[[:space:]]*(Mem:)' \ + | gawk 'BEGIN { sum = 0; } { sum += $4; } - END { printf "%10d\n", sum/1024; }' + END { printf "%d\n", sum/1024; }' UsedPhysicalMemory - free|egrep -i '^[[:space:]]*(Mem:)' \ - |awk 'BEGIN { sum = 0; } + free|egrep -i '^[[:space:]]*(Mem:)' \ + | gawk 'BEGIN { sum = 0; } { sum += $3; } - END { printf "%10d\n", sum/1024; }' + END { printf "%d\n", sum/1024; }' FreeVirtualMemory - free|egrep -i '^[[:space:]]*(Mem:|Swap:)' \ - |awk 'BEGIN { sum = 0; } + free|egrep -i '^[[:space:]]*(Mem:|Swap:)' \ + | gawk 'BEGIN { sum = 0; } { sum += $4; } - END { printf "%10d\n", sum/1024; }' + END { printf "%d\n", sum/1024; }' UsedVirtualMemory - free|egrep -i '^[[:space:]]*(Mem:|Swap:)' \ - |awk 'BEGIN { sum = 0; } + free|egrep -i '^[[:space:]]*(Mem:|Swap:)' \ + | gawk 'BEGIN { sum = 0; } { sum += $3; } - END { printf "%10d\n", sum/1024; }' + END { printf "%d\n", sum/1024; }' PagedInMemory - echo "$((`vmstat -s | gawk '/pages paged in/ {print $1}'` / 1024))" + + vmstat -s | gawk 'BEGIN { + cmd = "getconf PAGESIZE"; + cmd | getline pagesize; + close(cmd); + } + /pages swapped in/ { + printf "%d\n", $1 / 1024 * pagesize / 1024; + }' + - PagedOutMemory - echo "$((`vmstat -s | gawk '/pages paged out/ {print $1}'` / 1024))" + + vmstat -s | gawk 'BEGIN { + cmd = "getconf PAGESIZE"; + cmd | getline pagesize; + close(cmd); + } + /pages swapped out/ { + printf "%d\n", $1 / 1024 * pagesize / 1024; + }' + PageRates @@ -123,32 +152,45 @@ within the vm element. TotalCPUTime - virsh -r CONNECT dominfo NAME | sed 's/: */:/' | \ - gawk -F: '/CPU time/ {print $2;}' + + virsh -r CONNECT dominfo NAME | sed 's/: */:/' \ + | gawk -F: '/CPU time/ {print $2;}' + NumberOfAssignedPhysicalCPUs - virsh -r CONNECT dominfo NAME | grep 'CPU(s):' | gawk -F': +' '{print $2}' + + virsh -r CONNECT dominfo NAME | grep 'CPU(s):' \ + | gawk -F': +' '{print $2}' + PhysicalMemoryAllocatedToVirtualSystem - virsh -r CONNECT dominfo NAME | grep 'Max memory:' | gawk -F' +' '{printf "%d\n", $3/1024}' + + virsh -r CONNECT dominfo NAME | grep 'Max memory:' \ + | gawk -F' +' '{printf "%d\n", $3/1024}' + diff --git a/vhostmd.spec b/vhostmd.spec index 4a92a81..d67c77f 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -8,7 +8,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 0.4 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ Group: System Environment/Daemons BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -183,6 +183,10 @@ exit 0 %changelog +* Thu Dec 10 2009 Richard W.M. Jones - 0.4-2 +- Fix the PagedOutMemory and PagedInMemory stats to report MB instead + of pages (fixes supplied by Joachim Schneider). + * Wed Dec 9 2009 Richard W.M. Jones - 0.4-1 - vhostmd didn't chdir ("/") when daemonizing. Fixed in this 0.4 release. From e0228ab3992a3120b05f483db907de4312e378e1 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 16 Feb 2010 15:44:29 +0000 Subject: [PATCH 10/71] Add a patch to link tests explicitly with -ldl (RHBZ#565096). --- vhostmd-0.4-link-with-dl.patch | 21 +++++++++++++++++++++ vhostmd.spec | 8 +++++++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 vhostmd-0.4-link-with-dl.patch diff --git a/vhostmd-0.4-link-with-dl.patch b/vhostmd-0.4-link-with-dl.patch new file mode 100644 index 0000000..dc478d2 --- /dev/null +++ b/vhostmd-0.4-link-with-dl.patch @@ -0,0 +1,21 @@ +diff -ur vhostmd-0.4.orig/test/Makefile.am vhostmd-0.4.dso/test/Makefile.am +--- vhostmd-0.4.orig/test/Makefile.am 2009-10-13 11:17:39.000000000 +0100 ++++ vhostmd-0.4.dso/test/Makefile.am 2010-02-16 15:42:10.102603034 +0000 +@@ -5,7 +5,7 @@ + noinst_PROGRAMS = test_static test_dyn + + test_static_SOURCES = main.c +-test_static_LDADD = ../libmetrics/libmetrics.la $(LIBXML_LIBS) ++test_static_LDADD = ../libmetrics/libmetrics.la $(LIBXML_LIBS) -ldl + if WITH_XENSTORE + test_static_LDADD += -lxenstore + endif +@@ -16,7 +16,7 @@ + + test_dyn_SOURCES = main.c + test_dyn_CFLAGS = -DUSE_DL_OPEN +-test_dyn_LDADD = ../libmetrics/libmetrics.la $(LIBXML_LIBS) ++test_dyn_LDADD = ../libmetrics/libmetrics.la $(LIBXML_LIBS) -ldl + if WITH_XENSTORE + test_dyn_LDADD += -lxenstore + endif diff --git a/vhostmd.spec b/vhostmd.spec index d67c77f..8f93f22 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -8,7 +8,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 0.4 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ Group: System Environment/Daemons BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -22,6 +22,9 @@ Source1: vhostmd.init Source2: vhostmd.sysconfig Source3: vhostmd.conf +# RHBZ#565096. +Patch0: vhostmd-0.4-link-with-dl.patch + BuildRequires: chrpath BuildRequires: pkgconfig BuildRequires: libxml2-devel @@ -183,6 +186,9 @@ exit 0 %changelog +* Tue Feb 16 2010 Richard W.M. Jones - 0.4-3 +- Add a patch to link tests explicitly with -ldl (RHBZ#565096). + * Thu Dec 10 2009 Richard W.M. Jones - 0.4-2 - Fix the PagedOutMemory and PagedInMemory stats to report MB instead of pages (fixes supplied by Joachim Schneider). From e894ca29dc405394ba82d32d79c6ff9e6dd7839d Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 16 Feb 2010 15:49:35 +0000 Subject: [PATCH 11/71] Remember to actually apply the patch. --- vhostmd.spec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vhostmd.spec b/vhostmd.spec index 8f93f22..bd2b1c1 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -8,7 +8,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 0.4 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2+ Group: System Environment/Daemons BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -71,6 +71,8 @@ Header and libraries necessary for metrics gathering development %prep %setup -q +%patch0 -p1 + %build %configure \ @@ -186,7 +188,7 @@ exit 0 %changelog -* Tue Feb 16 2010 Richard W.M. Jones - 0.4-3 +* Tue Feb 16 2010 Richard W.M. Jones - 0.4-4 - Add a patch to link tests explicitly with -ldl (RHBZ#565096). * Thu Dec 10 2009 Richard W.M. Jones - 0.4-2 From 8791133062974f04e05c6b5e8bf2bdcc5f76a0a8 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 16 Feb 2010 15:57:28 +0000 Subject: [PATCH 12/71] Rerun autoreconf. --- vhostmd.spec | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vhostmd.spec b/vhostmd.spec index bd2b1c1..fc48e1f 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -8,7 +8,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 0.4 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv2+ Group: System Environment/Daemons BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -25,6 +25,9 @@ Source3: vhostmd.conf # RHBZ#565096. Patch0: vhostmd-0.4-link-with-dl.patch +# Required for patch0 only. +BuildRequires: autoconf, automake, libtool + BuildRequires: chrpath BuildRequires: pkgconfig BuildRequires: libxml2-devel @@ -72,6 +75,7 @@ Header and libraries necessary for metrics gathering development %setup -q %patch0 -p1 +autoreconf %build @@ -188,7 +192,7 @@ exit 0 %changelog -* Tue Feb 16 2010 Richard W.M. Jones - 0.4-4 +* Tue Feb 16 2010 Richard W.M. Jones - 0.4-5 - Add a patch to link tests explicitly with -ldl (RHBZ#565096). * Thu Dec 10 2009 Richard W.M. Jones - 0.4-2 From 685be0dbbdf2815a723ff638f754117e7dc0bc34 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 27 Apr 2010 10:39:00 +0000 Subject: [PATCH 13/71] Updated vhostmd.conf file which enables TotalCPUTime metric. --- vhostmd.conf | 23 +++++++++++++++++++---- vhostmd.spec | 5 ++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/vhostmd.conf b/vhostmd.conf index 8afd303..d1b6da0 100644 --- a/vhostmd.conf +++ b/vhostmd.conf @@ -150,13 +150,28 @@ within the vm element. - + TotalCPUTime diff --git a/vhostmd.spec b/vhostmd.spec index fc48e1f..8712240 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -8,7 +8,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 0.4 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv2+ Group: System Environment/Daemons BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -192,6 +192,9 @@ exit 0 %changelog +* Tue Apr 27 2010 Richard W.M. Jones - 0.4-6 +- Updated vhostmd.conf file which enables TotalCPUTime metric. + * Tue Feb 16 2010 Richard W.M. Jones - 0.4-5 - Add a patch to link tests explicitly with -ldl (RHBZ#565096). From 12791203b769a7d2634cc90bc380c2723b033278 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 6 Jul 2010 16:39:42 +0000 Subject: [PATCH 14/71] Updated vhostmd.conf from Dr. Joachim Schneider at SAP. --- vhostmd.conf | 322 ++++++++++++++++++++++++++++++++++++++++++--------- vhostmd.spec | 5 +- 2 files changed, 273 insertions(+), 54 deletions(-) diff --git a/vhostmd.conf b/vhostmd.conf index d1b6da0..21c0f22 100644 --- a/vhostmd.conf +++ b/vhostmd.conf @@ -19,6 +19,59 @@ within the vm element. --> + + + + + + + + @@ -45,15 +98,40 @@ within the vm element. VirtualizationVendor rpm -qi libvirt| grep Vendor: \ - | gawk '{print substr($0, index($0,$5)) }' + | awk '{ print substr($0, index($0, $5)); }' | sort -u VirtProductInfo - virsh -r CONNECT version | grep API \ - | gawk -F': ' '{print $2}' + virsh -r CONNECT version \ + |awk -F ':' ' + function mkvarnam(s) { # UPPER_CASE_UNDERSCORE + sub("(^[[:space:]]+|[[:space:]]+$)", "", s); # trim + gsub("[[:space:]]+", "_", s); s = toupper(s); + return s; + } + function filt_phys(s, sep, num, unit) { # 42.0 KM + sub("(^[[:space:]]+|[[:space:]]+$)", "", s); # trim + if ( s ~ /^[0-9]*\.?[0-9]+[[:space:]]*[[:alpha:]]+$/ ) + { + num = s; unit = s; + sub("[[:space:]]*[[:alpha:]]+$", "", num); + sub("^[0-9]*[.]?[0-9]+[[:space:]]*", "", unit); + return num sep toupper(unit); + } + else + { + return s; + } + } + /:/ { + d1 = substr($0, 1, index($0, ":") - 1); + rest = substr($0, index($0, ":") + 1); + printf("%s:%s\n", mkvarnam(d1), filt_phys(rest, ":")); + }' \ + | awk -F: '$1 == "USING_API" { print $2; }' @@ -61,20 +139,56 @@ within the vm element. HostSystemInfo hostname -s - + - NumberOfPhysicalCPUsUtilized + NumberOfPhysicalCPUs + + + + + + - virsh -r CONNECT nodeinfo | grep 'CPU(s):' \ - | gawk -F': +' '{print $2}' + virsh -r CONNECT nodeinfo \ + |awk -F ':' ' + function mkvarnam(s) { # UPPER_CASE_UNDERSCORE + sub("(^[[:space:]]+|[[:space:]]+$)", "", s); # trim + gsub("[[:space:]]+", "_", s); s = toupper(s); + return s; + } + function filt_phys(s, sep, num, unit) { # 42.0 KM + sub("(^[[:space:]]+|[[:space:]]+$)", "", s); # trim + if ( s ~ /^[0-9]*\.?[0-9]+[[:space:]]*[[:alpha:]]+$/ ) + { + num = s; unit = s; + sub("[[:space:]]*[[:alpha:]]+$", "", num); + sub("^[0-9]*[.]?[0-9]+[[:space:]]*", "", unit); + return num sep toupper(unit); + } + else + { + return s; + } + } + /:/ { + d1 = substr($0, 1, index($0, ":") - 1); + rest = substr($0, index($0, ":") + 1); + printf("%s:%s\n", mkvarnam(d1), filt_phys(rest, ":")); + }' \ + | awk -F: '$1 == "CPU(S)" { print $2; }' MemoryAllocatedToVirtualServers + + + - virsh -r CONNECT nodeinfo | grep 'Memory size:' \ - | gawk -F' +' '{ printf "%d\n", $3/1024 }' + free|egrep -i '^[[:space:]]*(Mem:)' \ + | awk 'BEGIN { sum = 0; } + { sum += $3; } + END { printf "%d\n", sum/1024; }' @@ -82,26 +196,17 @@ within the vm element. FreePhysicalMemory free|egrep -i '^[[:space:]]*(Mem:)' \ - | gawk 'BEGIN { sum = 0; } + | awk 'BEGIN { sum = 0; } { sum += $4; } END { printf "%d\n", sum/1024; }' - - UsedPhysicalMemory - - free|egrep -i '^[[:space:]]*(Mem:)' \ - | gawk 'BEGIN { sum = 0; } - { sum += $3; } - END { printf "%d\n", sum/1024; }' - - FreeVirtualMemory free|egrep -i '^[[:space:]]*(Mem:|Swap:)' \ - | gawk 'BEGIN { sum = 0; } + | awk 'BEGIN { sum = 0; } { sum += $4; } END { printf "%d\n", sum/1024; }' @@ -111,15 +216,16 @@ within the vm element. UsedVirtualMemory free|egrep -i '^[[:space:]]*(Mem:|Swap:)' \ - | gawk 'BEGIN { sum = 0; } + | awk 'BEGIN { sum = 0; } { sum += $3; } END { printf "%d\n", sum/1024; }' + PagedInMemory - vmstat -s | gawk 'BEGIN { + vmstat -s | awk 'BEGIN { cmd = "getconf PAGESIZE"; cmd | getline pagesize; close(cmd); @@ -133,7 +239,7 @@ within the vm element. PagedOutMemory - vmstat -s | gawk 'BEGIN { + vmstat -s | awk 'BEGIN { cmd = "getconf PAGESIZE"; cmd | getline pagesize; close(cmd); @@ -143,31 +249,40 @@ within the vm element. }' - - PageRates - pagerate.pl - - - - + TotalCPUTime - gawk 'BEGIN { - getline < "/proc/uptime"; - idle_sec = $2; - while ( 0 <= (getline < "/proc/stat") ) + awk ' + function user_hz( hz) + { + cmd = "getconf CLK_TCK"; + cmd | getline; + hz = $1; + close(cmd); + + return hz; + } + + BEGIN { + USER_HZ = user_hz(); + TotalCPUTime = 0; + + while ( 0 < ( getline < "/proc/stat" ) ) { if ( "cpu" == $1 ) { - USER_HZ = $5/idle_sec; - #printf "USER_HZ = %f\n", USER_HZ | "cat 1>&2" - TotalCPUTime = ($2 + $3 + $4)/USER_HZ; - printf "%f\n", TotalCPUTime; + TotalCPUTime = $2 + $3 + $4; break; } } + close("/proc/stat"); + + #printf "USER_HZ = %d\n", USER_HZ | "cat 1>&2"; + TotalCPUTime /= USER_HZ; + printf "%f\n", TotalCPUTime; + #close("cat 1>&2"); }' @@ -176,33 +291,134 @@ within the vm element. TotalCPUTime - virsh -r CONNECT dominfo NAME | sed 's/: */:/' \ - | gawk -F: '/CPU time/ {print $2;}' + virsh -r CONNECT dominfo NAME \ + |awk -F ':' ' + function mkvarnam(s) { # UPPER_CASE_UNDERSCORE + sub("(^[[:space:]]+|[[:space:]]+$)", "", s); # trim + gsub("[[:space:]]+", "_", s); s = toupper(s); + return s; + } + function filt_phys(s, sep, num, unit) { # 42.0 KM + sub("(^[[:space:]]+|[[:space:]]+$)", "", s); # trim + if ( s ~ /^[0-9]*\.?[0-9]+[[:space:]]*[[:alpha:]]+$/ ) + { + num = s; unit = s; + sub("[[:space:]]*[[:alpha:]]+$", "", num); + sub("^[0-9]*[.]?[0-9]+[[:space:]]*", "", unit); + return num sep toupper(unit); + } + else + { + return s; + } + } + /:/ { + d1 = substr($0, 1, index($0, ":") - 1); + rest = substr($0, index($0, ":") + 1); + printf("%s:%s\n", mkvarnam(d1), filt_phys(rest, ":")); + }' \ + | awk -F: '$1 == "CPU_TIME" { print $2; }' + - NumberOfAssignedPhysicalCPUs + ResourceProcessorLimit - virsh -r CONNECT dominfo NAME | grep 'CPU(s):' \ - | gawk -F': +' '{print $2}' + virsh -r CONNECT dominfo NAME \ + |awk -F ':' ' + function mkvarnam(s) { # UPPER_CASE_UNDERSCORE + sub("(^[[:space:]]+|[[:space:]]+$)", "", s); # trim + gsub("[[:space:]]+", "_", s); s = toupper(s); + return s; + } + function filt_phys(s, sep, num, unit) { # 42.0 KM + sub("(^[[:space:]]+|[[:space:]]+$)", "", s); # trim + if ( s ~ /^[0-9]*\.?[0-9]+[[:space:]]*[[:alpha:]]+$/ ) + { + num = s; unit = s; + sub("[[:space:]]*[[:alpha:]]+$", "", num); + sub("^[0-9]*[.]?[0-9]+[[:space:]]*", "", unit); + return num sep toupper(unit); + } + else + { + return s; + } + } + /:/ { + d1 = substr($0, 1, index($0, ":") - 1); + rest = substr($0, index($0, ":") + 1); + printf("%s:%s\n", mkvarnam(d1), filt_phys(rest, ":")); + }' \ + | awk -F: '$1 == "CPU(S)" { print $2; }' + + + + + ResourceMemoryLimit + + virsh -r CONNECT dominfo NAME \ + |awk -F ':' ' + function mkvarnam(s) { # UPPER_CASE_UNDERSCORE + sub("(^[[:space:]]+|[[:space:]]+$)", "", s); # trim + gsub("[[:space:]]+", "_", s); s = toupper(s); + return s; + } + function filt_phys(s, sep, num, unit) { # 42.0 KM + sub("(^[[:space:]]+|[[:space:]]+$)", "", s); # trim + if ( s ~ /^[0-9]*\.?[0-9]+[[:space:]]*[[:alpha:]]+$/ ) + { + num = s; unit = s; + sub("[[:space:]]*[[:alpha:]]+$", "", num); + sub("^[0-9]*[.]?[0-9]+[[:space:]]*", "", unit); + return num sep toupper(unit); + } + else + { + return s; + } + } + /:/ { + d1 = substr($0, 1, index($0, ":") - 1); + rest = substr($0, index($0, ":") + 1); + printf("%s:%s\n", mkvarnam(d1), filt_phys(rest, ":")); + }' \ + | awk -F: '$1 == "MAX_MEMORY" { print int($2/1024); }' PhysicalMemoryAllocatedToVirtualSystem - virsh -r CONNECT dominfo NAME | grep 'Max memory:' \ - | gawk -F' +' '{printf "%d\n", $3/1024}' + virsh -r CONNECT dominfo NAME \ + |awk -F ':' ' + function mkvarnam(s) { # UPPER_CASE_UNDERSCORE + sub("(^[[:space:]]+|[[:space:]]+$)", "", s); # trim + gsub("[[:space:]]+", "_", s); s = toupper(s); + return s; + } + function filt_phys(s, sep, num, unit) { # 42.0 KM + sub("(^[[:space:]]+|[[:space:]]+$)", "", s); # trim + if ( s ~ /^[0-9]*\.?[0-9]+[[:space:]]*[[:alpha:]]+$/ ) + { + num = s; unit = s; + sub("[[:space:]]*[[:alpha:]]+$", "", num); + sub("^[0-9]*[.]?[0-9]+[[:space:]]*", "", unit); + return num sep toupper(unit); + } + else + { + return s; + } + } + /:/ { + d1 = substr($0, 1, index($0, ":") - 1); + rest = substr($0, index($0, ":") + 1); + printf("%s:%s\n", mkvarnam(d1), filt_phys(rest, ":")); + }' \ + | awk -F: '$1 == "USED_MEMORY" { print int($2/1024); }' - - + + +@@ -28,52 +34,75 @@ within the vm element. + 256 + + 5 +- /usr/bin:/usr/sbin:/usr/share/vhostmd/scripts ++ /usr/sbin:/sbin:/usr/bin:/bin:/usr/share/vhostmd/scripts + vbd + + + + + HostName +- virsh CONNECT hostname | tr -d '[:space:]' ++ ++ virsh CONNECT hostname | tr -d '[:space:]' ++ + + + VirtualizationVendor +- /bin/rpm -q --info xen | grep Vendor: | \ +- awk '{print substr($0, index($0,$5)) }' ++ ++ [ -f /proc/xen/privcmd ] && RPM="xen" || RPM="libvirt"; \ ++ rpm -q --queryformat "%{VENDOR}\n" $RPM | sort -u | sed -e 's/<.*//' -e 's/ *$//' ++ + + + VirtualizationProductInfo +- xm info | gawk '/^xen_(major|minor|extra)/ {print $3}' | \ +- tr -d . | tr '[:space:]' . ++ ++ [ -f /proc/xen/privcmd ] && xl info | \ ++ awk '/^xen_(major|minor|extra)/ {print $3}' | sed -e 'N;s/\n/./' -e 'N;s/\n//' || \ ++ rpm -q --queryformat "%{VERSION}-%{RELEASE}\n" libvirt | sort -u ++ + + + TotalPhyCPUs +- xm info | gawk '/^nr_cpus/ {print $3}' ++ ++ virsh nodeinfo | awk '/^CPU\(s\)/ {print $2}' ++ + + + NumCPUs +- xm info | gawk '/^nr_cpus/ {print $3}' ++ ++ virsh nodeinfo | awk '/^CPU\(s\)/ {print $2}' ++ + + + TotalPhyMem +- xm info | gawk '/^total_memory/ {print $3}' ++ ++ echo $((`virsh nodeinfo | awk '/^Memory/ {print $3}'` / 1024)) ++ + + + UsedMem +- echo "$((`xentop -b -i 1 | gawk '/Domain-0/ {print $5}'` / 1024))" ++ ++ [ -f /proc/xen/privcmd ] && echo "$((`xentop -b -i 1 | awk '/Domain-0/ {print $5}'` / 1024))" || \ ++ free | egrep -i '^[[:space:]]*(.*buffers/cache:)' | awk '{ printf "%d\n", $3/1024; }' ++ + + + FreeMem +- xm info | gawk '/^max_free_memory/ {print $3}' ++ ++ [ -f /proc/xen/privcmd ] && xl info | awk '/^free_memory/ {print $3}' || \ ++ free | egrep -i '^[[:space:]]*(.*buffers/cache:)' | awk '{ printf "%d\n", $4/1024; }' ++ + + + PagedInMemory +- echo "$((`vmstat -s | gawk '/pages paged in/ {print $1}'` / 1024))" ++ ++ vmstat -s | awk '/pages paged in/ {printf "%d\n", $1 / 1024 * $(getconf PAGESIZE) / 1024;}' ++ + + + PagedOutMemory +- echo "$((`vmstat -s | gawk '/pages paged out/ {print $1}'` / 1024))" ++ ++ vmstat -s | awk '/pages paged out/ {printf "%d\n", $1 / 1024 * $(getconf PAGESIZE) / 1024;}' ++ + + + PageRates +@@ -83,13 +112,45 @@ within the vm element. + + + TotalCPUTime +- virsh CONNECT dominfo 0 | sed 's/: */:/' | \ +- gawk -F: '/CPU time/ {print $2;}' ++ ++ [ -f /proc/xen/privcmd ] && xl list | awk '/^Domain-0/ {print $6}' || \ ++ awk ' ++ function user_hz( hz) ++ { ++ cmd = "getconf CLK_TCK"; ++ cmd | getline; ++ hz = $1; ++ close(cmd); ++ ++ return hz; ++ } ++ ++ BEGIN { ++ USER_HZ = user_hz(); ++ TotalCPUTime = 0; ++ ++ while ( 0 < ( getline < "/proc/stat" ) ) ++ { ++ if ( "cpu" == $1 ) ++ { ++ TotalCPUTime = $2 + $3 + $4; ++ ++ break; ++ } ++ } ++ close("/proc/stat"); ++ ++ TotalCPUTime /= USER_HZ; ++ printf "%f\n", TotalCPUTime; ++ }' ++ + + + TotalCPUTime +- virsh CONNECT dominfo NAME | sed 's/: */:/' | \ +- gawk -F: '/CPU time/ {print $2;}' ++ ++ virsh CONNECT dominfo NAME | sed 's/: */:/' | \ ++ awk -F: '/CPU time/ {print $2;}' | sed 's/s//' ++ + + + +-- +2.19.0.rc0 + diff --git a/vhostmd.spec b/vhostmd.spec index 0e97ef2..cbcc927 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -17,9 +17,23 @@ Source3: vhostmd.conf # These commits have been added upstream since vhostmd 0.5 was # released. -Patch1: 0001-Security-Set-supplemental-groups-correctly-when-drop.patch -Patch2: 0002-libmetrics-Return-error-indication-up-through-get_me.patch -Patch3: 0003-Make-Xen-Libraries-really-optional.patch +Patch0001: 0001-Security-Set-supplemental-groups-correctly-when-drop.patch +Patch0002: 0002-libmetrics-Return-error-indication-up-through-get_me.patch +Patch0003: 0003-Make-Xen-Libraries-really-optional.patch +Patch0004: 0004-Add-contact-info-to-README.patch +Patch0005: 0005-Fix-name-and-location-of-the-vhostmd.conf-file.patch +Patch0006: 0006-fix-typo-in-vhostmd.init-virutalization.patch +Patch0007: 0007-Modernize-build-files.patch +Patch0008: 0008-Add-systemd-service-file.patch +Patch0009: 0009-Remove-xenctrl-support.patch +Patch0010: 0010-Remove-support-for-libxenstat.patch +Patch0011: 0011-Fix-compilation-with-xenstore.patch +Patch0012: 0012-Fix-typo-in-systemd-service-file.patch +Patch0013: 0013-Fix-help-option.patch +Patch0014: 0014-Add-SIGPIPE-handler-and-reconnect.patch +Patch0015: 0015-fix-deallocation-in-vu_vm_free.patch +Patch0016: 0016-configure-fix-logic-in-init-script-check.patch +Patch0017: 0017-conf-Improve-example-configuration-file.patch BuildRequires: gcc BuildRequires: chrpath @@ -27,17 +41,15 @@ BuildRequires: perl-generators BuildRequires: pkgconfig BuildRequires: libxml2-devel BuildRequires: libvirt-devel +BuildRequires: autoconf, automake, libtool +BuildRequires: git +%{?systemd_requires} +BuildRequires: systemd %if %{have_xen} BuildRequires: xen-devel %endif -Requires(post): chkconfig -Requires(preun): chkconfig -Requires(preun): initscripts -Requires(postun): initscripts -Requires(pre): shadow-utils - %description vhostmd provides a "metrics communication channel" between a host and @@ -65,18 +77,16 @@ Header and libraries necessary for metrics gathering development %prep -%setup -q - -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 +%autosetup -S git %build +autoreconf -i %configure \ %if %{have_xen} == 0 --without-xenstore \ %endif + --with-init-script=systemd \ --enable-shared --disable-static make %{_smp_mflags} @@ -86,12 +96,6 @@ rm -rf $RPM_BUILD_ROOT make DESTDIR=$RPM_BUILD_ROOT install -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/init.d -install -m 0755 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/%{name} - -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig -install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name} - #rm $RPM_BUILD_ROOT%{_libdir}/libmetrics.a rm $RPM_BUILD_ROOT%{_libdir}/libmetrics.la @@ -115,24 +119,6 @@ rm $RPM_BUILD_ROOT%{_datadir}/vhostmd/scripts/pagerate.pl %endif - -%post -/sbin/chkconfig --add vhostmd - - -%preun -if [ $1 = 0 ] ; then - /sbin/service vhostmd stop >/dev/null 2>&1 - /sbin/chkconfig --del vhostmd -fi - - -%postun -if [ "$1" -ge "1" ] ; then - /sbin/service vhostmd condrestart >/dev/null 2>&1 || : -fi - - %pre # UID:GID 112:112 reserved, see RHBZ#534109. getent group vhostmd >/dev/null || groupadd -g 112 -r vhostmd @@ -142,6 +128,18 @@ useradd -u 112 -r -g vhostmd -d %{_datadir}/vhostmd -s /sbin/nologin \ exit 0 +%post +%systemd_post vhostmd.service + + +%preun +%systemd_preun vhostmd.service + + +%postun +%systemd_postun_with_restart vhostmd.service + + %files %doc AUTHORS ChangeLog COPYING README %doc mdisk.xml metric.dtd vhostmd.dtd vhostmd.xml @@ -151,8 +149,8 @@ exit 0 %dir %{_sysconfdir}/vhostmd %config(noreplace) %{_sysconfdir}/vhostmd/vhostmd.conf %config %{_sysconfdir}/vhostmd/vhostmd.dtd -%{_sysconfdir}/init.d/%{name} -%config(noreplace) %{_sysconfdir}/sysconfig/%{name} + +%{_unitdir}/vhostmd.service %dir %{_datadir}/vhostmd %dir %{_datadir}/vhostmd/scripts @@ -179,6 +177,10 @@ exit 0 %changelog +* Tue Oct 16 2018 Richard W.M. Jones - 0.5-19 +- Include all upstream patches since 0.5. +- Enable systemd init scripts (RHBZ#1592400). + * Sat Jul 14 2018 Fedora Release Engineering - 0.5-18 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild From ac5642f6748146e93e6fbc657801d0a8b8f2f6b7 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 18 Jan 2019 10:55:53 +0000 Subject: [PATCH 44/71] Upstream version 1.0. --- .gitignore | 1 + ...plemental-groups-correctly-when-drop.patch | 40 --- ...n-error-indication-up-through-get_me.patch | 29 -- 0003-Make-Xen-Libraries-really-optional.patch | 51 --- 0004-Add-contact-info-to-README.patch | 34 -- ...nd-location-of-the-vhostmd.conf-file.patch | 41 --- ...-typo-in-vhostmd.init-virutalization.patch | 25 -- 0007-Modernize-build-files.patch | 61 ---- 0008-Add-systemd-service-file.patch | 128 ------- 0009-Remove-xenctrl-support.patch | 311 ------------------ 0010-Remove-support-for-libxenstat.patch | 222 ------------- 0011-Fix-compilation-with-xenstore.patch | 58 ---- 0012-Fix-typo-in-systemd-service-file.patch | 24 -- 0013-Fix-help-option.patch | 70 ---- 0014-Add-SIGPIPE-handler-and-reconnect.patch | 110 ------- 0015-fix-deallocation-in-vu_vm_free.patch | 40 --- ...igure-fix-logic-in-init-script-check.patch | 39 --- ...f-Improve-example-configuration-file.patch | 175 ---------- sources | 2 +- vhostmd.init | 118 ------- vhostmd.spec | 46 +-- vhostmd.sysconfig | 14 - 22 files changed, 18 insertions(+), 1621 deletions(-) delete mode 100644 0001-Security-Set-supplemental-groups-correctly-when-drop.patch delete mode 100644 0002-libmetrics-Return-error-indication-up-through-get_me.patch delete mode 100644 0003-Make-Xen-Libraries-really-optional.patch delete mode 100644 0004-Add-contact-info-to-README.patch delete mode 100644 0005-Fix-name-and-location-of-the-vhostmd.conf-file.patch delete mode 100644 0006-fix-typo-in-vhostmd.init-virutalization.patch delete mode 100644 0007-Modernize-build-files.patch delete mode 100644 0008-Add-systemd-service-file.patch delete mode 100644 0009-Remove-xenctrl-support.patch delete mode 100644 0010-Remove-support-for-libxenstat.patch delete mode 100644 0011-Fix-compilation-with-xenstore.patch delete mode 100644 0012-Fix-typo-in-systemd-service-file.patch delete mode 100644 0013-Fix-help-option.patch delete mode 100644 0014-Add-SIGPIPE-handler-and-reconnect.patch delete mode 100644 0015-fix-deallocation-in-vu_vm_free.patch delete mode 100644 0016-configure-fix-logic-in-init-script-check.patch delete mode 100644 0017-conf-Improve-example-configuration-file.patch delete mode 100644 vhostmd.init delete mode 100644 vhostmd.sysconfig diff --git a/.gitignore b/.gitignore index ecfd37c..55af9f4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ vhostmd-0.4.tar.bz2 /vhostmd-0.5.tar.bz2 +/vhostmd-1.0.tar.gz diff --git a/0001-Security-Set-supplemental-groups-correctly-when-drop.patch b/0001-Security-Set-supplemental-groups-correctly-when-drop.patch deleted file mode 100644 index 25ec0c0..0000000 --- a/0001-Security-Set-supplemental-groups-correctly-when-drop.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 8684995d87e08fadd44e1814e810c770a1f60273 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Mon, 5 Mar 2012 14:48:08 +0000 -Subject: [PATCH 01/17] Security: Set supplemental groups correctly when - dropping privileges. - -https://bugzilla.redhat.com/show_bug.cgi?id=741289 - -(Thanks to Steve Grubb for finding the bug and suggesting a fix) ---- - vhostmd/vhostmd.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/vhostmd/vhostmd.c b/vhostmd/vhostmd.c -index 21763af..90ba76d 100644 ---- a/vhostmd/vhostmd.c -+++ b/vhostmd/vhostmd.c -@@ -34,6 +34,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -1115,6 +1116,11 @@ int main(int argc, char *argv[]) - goto out; - } - -+ if (initgroups (user, pw->pw_gid) == -1) { -+ vu_log (VHOSTMD_ERR, "initgroups: %m"); -+ goto out; -+ } -+ - if (setuid (pw->pw_uid) == -1) { - vu_log (VHOSTMD_ERR, "setuid: %d: %m", pw->pw_uid); - goto out; --- -2.19.0.rc0 - diff --git a/0002-libmetrics-Return-error-indication-up-through-get_me.patch b/0002-libmetrics-Return-error-indication-up-through-get_me.patch deleted file mode 100644 index e5844b1..0000000 --- a/0002-libmetrics-Return-error-indication-up-through-get_me.patch +++ /dev/null @@ -1,29 +0,0 @@ -From efba4feaef25ea7efc9e35cfa6e92b69784aa88f Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Thu, 10 May 2012 10:14:50 +0100 -Subject: [PATCH 02/17] libmetrics: Return error indication up through - get_metric. - -If private function 'get_mdef' returns an error, then the error is not -propagated back to the user because it gets lost in 'get_metric'. Fix -this by initializing 'ret' correctly. ---- - libmetrics/libmetrics.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libmetrics/libmetrics.c b/libmetrics/libmetrics.c -index d049458..6d5c26f 100644 ---- a/libmetrics/libmetrics.c -+++ b/libmetrics/libmetrics.c -@@ -571,7 +571,7 @@ int get_metric(const char *metric_name, metric **mdef, metric_context context) - metric *lmdef; - uint32_t sum; - int extra_len = 0; -- int ret = 0; -+ int ret = -1; - - *mdef = NULL; - --- -2.19.0.rc0 - diff --git a/0003-Make-Xen-Libraries-really-optional.patch b/0003-Make-Xen-Libraries-really-optional.patch deleted file mode 100644 index ba06222..0000000 --- a/0003-Make-Xen-Libraries-really-optional.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 8fd4d847277bb9a7e53f8bb3f3f935004d8e5cc4 Mon Sep 17 00:00:00 2001 -From: Eduardo Otubo -Date: Thu, 2 Aug 2012 19:42:00 -0300 -Subject: [PATCH 03/17] Make Xen Libraries really optional - -The default behavior in the configure script was to make with_xenstore -set to 'true', which caused the compilation to break in my case because -I don't have xen libraries, therefore, xs.h - -Now the default behavior is set according to its existence or not. Same -thing for xenstat and xenctrl. - -Signed-off-by: Eduardo Otubo ---- - configure.ac | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/configure.ac b/configure.ac -index ee9c446..fb4309b 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -48,7 +48,7 @@ AC_ARG_ENABLE([libxenstat], - ;; - no) libxenstat=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-libxenstat) ;; -- esac],[libxenstat=false]) -+ esac],[AC_CHECK_HEADER(xenstat.h, libxenstat=true, libxenstat=false)]) - AM_CONDITIONAL(LIBXENSTAT, test x$libxenstat = xtrue) - - # Configure argument to support using xenctrl library for vm enumeration -@@ -60,7 +60,7 @@ AC_ARG_ENABLE([xenctrl], - ;; - no) xenctrl=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-xenctrl) ;; -- esac],[xenctrl=false]) -+ esac],[AC_CHECK_HEADER(xenctrl.h, xenctrl=true, xenctrl=false,)]) - AM_CONDITIONAL(XENCTRL, test x$xenctrl = xtrue) - - libvirt=false -@@ -79,7 +79,7 @@ AC_ARG_WITH([xenstore], - yes) with_xenstore=true;; - no) with_xenstore=false;; - *) AC_MSG_ERROR(bad value ${withval} for --with-xenstore) ;; -- esac],[with_xenstore=true]) -+ esac],[AC_CHECK_HEADER(xs.h, with_xenstore=true)]) - AM_CONDITIONAL(WITH_XENSTORE, test x$with_xenstore = xtrue) - - AC_OUTPUT(vhostmd/Makefile --- -2.19.0.rc0 - diff --git a/0004-Add-contact-info-to-README.patch b/0004-Add-contact-info-to-README.patch deleted file mode 100644 index de38803..0000000 --- a/0004-Add-contact-info-to-README.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 7a2936ec4e6bd5a47ef8ac4f4b889c70b8a78e9b Mon Sep 17 00:00:00 2001 -From: Jim Fehlig -Date: Wed, 9 Mar 2016 18:40:56 -0700 -Subject: [PATCH 04/17] Add contact info to README - -Extended README with contact info (virt-tools-list) for -comments, suggestions, and patches. ---- - README | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/README b/README -index 2755e4f..788ffe4 100644 ---- a/README -+++ b/README -@@ -15,6 +15,15 @@ surfaced read-only to virtual machines using tools provided by the host's - virtualization platform. - - -+Contact -+------- -+ -+All comments / suggestions / patches should be directed to the -+virt-tools-list mailing list: -+ -+ http://www.redhat.com/mailman/listinfo/virt-tools-list -+ -+ - Usage - ----- - --- -2.19.0.rc0 - diff --git a/0005-Fix-name-and-location-of-the-vhostmd.conf-file.patch b/0005-Fix-name-and-location-of-the-vhostmd.conf-file.patch deleted file mode 100644 index bb4999e..0000000 --- a/0005-Fix-name-and-location-of-the-vhostmd.conf-file.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 972ac212abcf0eacd7039b3a5987bd9ae2083607 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Wed, 22 Feb 2017 11:39:59 +0000 -Subject: [PATCH 05/17] Fix name and location of the vhostmd.conf file. - -Thanks: Xianghua Chen -Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1359593 ---- - README | 2 +- - docs/man/vhostmd.8 | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/README b/README -index 788ffe4..cb23226 100644 ---- a/README -+++ b/README -@@ -32,7 +32,7 @@ vhostmd [options] - Options: - -v | --verbose Verbose messages - -d | --no-daemonize Process will not daemonize -- -f | --config Configuration file (/etc/vhostmd.xml default) -+ -f | --config Configuration file (/etc/vhostmd/vhostmd.conf default) - -p | --pid-file PID file (/var/run/vhostmd.pid default) - - -diff --git a/docs/man/vhostmd.8 b/docs/man/vhostmd.8 -index dfcb301..2c73adc 100644 ---- a/docs/man/vhostmd.8 -+++ b/docs/man/vhostmd.8 -@@ -32,7 +32,7 @@ Drop root privileges and run as the named non-root user. - Specify an alternate path for vhostmd to record its process-id in. Normally /var/run/vhostmd.pid - .TP - .B \-f, --config --Specify a different configuration file. Normally /etc/vhostmd.xml -+Specify a different configuration file. Normally /etc/vhostmd/vhostmd.conf - .SH CONFIG FILE - At startup, vhostmd reads - .I /etc/vhostmd/vhostmd.conf, --- -2.19.0.rc0 - diff --git a/0006-fix-typo-in-vhostmd.init-virutalization.patch b/0006-fix-typo-in-vhostmd.init-virutalization.patch deleted file mode 100644 index cdba1dc..0000000 --- a/0006-fix-typo-in-vhostmd.init-virutalization.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 3e4df5dd16c59a804373564602aa045b0599aa82 Mon Sep 17 00:00:00 2001 -From: Johannes Kastl -Date: Sun, 6 May 2018 16:23:05 +0200 -Subject: [PATCH 06/17] fix typo in vhostmd.init: virutalization - ---- - vhostmd.init | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/vhostmd.init b/vhostmd.init -index 71f9ab8..23d7874 100644 ---- a/vhostmd.init -+++ b/vhostmd.init -@@ -11,7 +11,7 @@ - # Required-Stop: $remote_fs $null - # Should-Stop: $null - # Default-Stop: 0 1 2 4 6 --# Short-Description: daemon for collecting virutalization host metrics -+# Short-Description: daemon for collecting virtualization host metrics - # Description: This is a daemon for collecting virtualization host - # metrics and writing them to a file-backed disk. - ### END INIT INFO --- -2.19.0.rc0 - diff --git a/0007-Modernize-build-files.patch b/0007-Modernize-build-files.patch deleted file mode 100644 index 408f0f6..0000000 --- a/0007-Modernize-build-files.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 498bace866c16842d677a00b1df8ab62e0724d55 Mon Sep 17 00:00:00 2001 -From: Jim Fehlig -Date: Thu, 27 Apr 2017 09:36:28 -0600 -Subject: [PATCH 07/17] Modernize build files - -Some of the constructs used in the configure script and Makefiles -are a bit outdated, e.g. use of '$(mkinstalldirs)' instead of -'$(MKDIR_P)'. Change these old constructs to their modern counterparts. - -Signed-off-by: Jim Fehlig ---- - Makefile.am | 15 +++++++-------- - configure.ac | 2 +- - 2 files changed, 8 insertions(+), 9 deletions(-) - -diff --git a/Makefile.am b/Makefile.am -index e11963a..8234d98 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -8,11 +8,10 @@ EXTRA_DIST = $(doc_DATA) vhostmd.init vhostmd.spec autogen.sh - AUTOMAKE_OPTIONS=dist-bzip2 - - install-data-local: -- $(mkinstalldirs) $(DESTDIR)/etc/vhostmd -- $(mkinstalldirs) $(DESTDIR)/etc/init.d -- $(mkinstalldirs) $(DESTDIR)/usr/sbin -- -@INSTALL@ -m 0644 $(srcdir)/vhostmd.xml $(DESTDIR)/etc/vhostmd/vhostmd.conf -- -@INSTALL@ -m 0644 $(srcdir)/vhostmd.dtd $(DESTDIR)/etc/vhostmd -- -@INSTALL@ -m 0644 $(srcdir)/metric.dtd $(DESTDIR)/etc/vhostmd -- -@INSTALL@ -m 0755 $(srcdir)/vhostmd.init $(DESTDIR)/etc/init.d/vhostmd -- -+ $(MKDIR_P) $(DESTDIR)/etc/vhostmd -+ $(MKDIR_P) $(DESTDIR)/etc/init.d -+ $(MKDIR_P) $(DESTDIR)/usr/sbin -+ $(INSTALL_DATA) $(srcdir)/vhostmd.xml $(DESTDIR)/etc/vhostmd/vhostmd.conf -+ $(INSTALL_DATA) $(srcdir)/vhostmd.dtd $(DESTDIR)/etc/vhostmd -+ $(INSTALL_DATA) $(srcdir)/metric.dtd $(DESTDIR)/etc/vhostmd -+ $(INSTALL_SCRIPT) $(srcdir)/vhostmd.init $(DESTDIR)/etc/init.d/vhostmd -diff --git a/configure.ac b/configure.ac -index fb4309b..27c8488 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -4,6 +4,7 @@ AC_CONFIG_SRCDIR(vhostmd/vhostmd.c) - AC_CONFIG_HEADERS([config.h]) - - AC_GNU_SOURCE -+AM_INIT_AUTOMAKE - - AC_PROG_LIBTOOL - -@@ -21,7 +22,6 @@ AC_SUBST(topdir) - - AC_CONFIG_FILES([Makefile]) - --AM_INIT_AUTOMAKE - - # Checks for programs. - AM_PROG_CC_C_O --- -2.19.0.rc0 - diff --git a/0008-Add-systemd-service-file.patch b/0008-Add-systemd-service-file.patch deleted file mode 100644 index b92eadc..0000000 --- a/0008-Add-systemd-service-file.patch +++ /dev/null @@ -1,128 +0,0 @@ -From d12766463a9de3b8490e6a552db83bf7d4853896 Mon Sep 17 00:00:00 2001 -From: Jim Fehlig -Date: Thu, 27 Apr 2017 09:52:02 -0600 -Subject: [PATCH 08/17] Add systemd service file - -vhostmd is long overdue for a systemd service file. Add one, and -while at it support specifying the type of init system in the -configure script. - -Signed-off-by: Jim Fehlig ---- - Makefile.am | 36 +++++++++++++++++++++++++++++++++--- - configure.ac | 24 +++++++++++++++++++++++- - vhostmd.service | 14 ++++++++++++++ - 3 files changed, 70 insertions(+), 4 deletions(-) - create mode 100644 vhostmd.service - -diff --git a/Makefile.am b/Makefile.am -index 8234d98..4f8af15 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -7,11 +7,41 @@ EXTRA_DIST = $(doc_DATA) vhostmd.init vhostmd.spec autogen.sh - - AUTOMAKE_OPTIONS=dist-bzip2 - --install-data-local: -+install-data-local: install-init-systemv install-init-systemd - $(MKDIR_P) $(DESTDIR)/etc/vhostmd -- $(MKDIR_P) $(DESTDIR)/etc/init.d -- $(MKDIR_P) $(DESTDIR)/usr/sbin - $(INSTALL_DATA) $(srcdir)/vhostmd.xml $(DESTDIR)/etc/vhostmd/vhostmd.conf - $(INSTALL_DATA) $(srcdir)/vhostmd.dtd $(DESTDIR)/etc/vhostmd - $(INSTALL_DATA) $(srcdir)/metric.dtd $(DESTDIR)/etc/vhostmd -+ -+uninstall-local: uninstall-init-systemv uninstall-init-systemd -+ rm -f $(DESTDIR)/etc/vhostmd/vhostmd.conf -+ rm -f $(DESTDIR)/etc/vhostmd/vhostmd.dtd -+ rm -f $(DESTDIR)/etc/vhostmd/metric.dtd -+ rmdir $(DESTDIR)/etc/vhostmd || : -+ -+if INIT_SCRIPT_SYSTEMV -+install-init-systemv: $(srcdir)/vhostmd.init -+ $(MKDIR_P) $(DESTDIR)$(sysconfdir)/init.d - $(INSTALL_SCRIPT) $(srcdir)/vhostmd.init $(DESTDIR)/etc/init.d/vhostmd -+ -+uninstall-init-systemv: -+ rm -f $(DESTDIR)$(sysconfdir)/init.d/vhostmd -+ rmdir $(DESTDIR)$(sysconfdir)/init.d || : -+else ! INIT_SCRIPT_SYSTEMV -+install-init-systemv: -+uninstall-init-systemv: -+endif ! INIT_SCRIPT_SYSTEMV -+ -+if INIT_SCRIPT_SYSTEMD -+SYSTEMD_UNIT_DIR = $(prefix)/lib/systemd/system -+install-init-systemd: $(srcdir)/vhostmd.service -+ $(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR) -+ $(INSTALL_DATA) $(srcdir)/vhostmd.service $(DESTDIR)$(SYSTEMD_UNIT_DIR)/vhostmd.service -+ -+uninstall-init-systemd: -+ rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/vhostmd.service -+ rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) || : -+else ! INIT_SCRIPT_SYSTEMD -+install-init-systemd: -+uninstall-init-systemd: -+endif ! INIT_SCRIPT_SYSTEMD -diff --git a/configure.ac b/configure.ac -index 27c8488..b0a07c7 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1,4 +1,4 @@ --AC_INIT(Virtual Host Metrics Daemon, 0.5, jfehlig@novell.com, vhostmd) -+AC_INIT(Virtual Host Metrics Daemon, 0.5, jfehlig@suse.com, vhostmd) - - AC_CONFIG_SRCDIR(vhostmd/vhostmd.c) - AC_CONFIG_HEADERS([config.h]) -@@ -82,6 +82,28 @@ AC_ARG_WITH([xenstore], - esac],[AC_CHECK_HEADER(xs.h, with_xenstore=true)]) - AM_CONDITIONAL(WITH_XENSTORE, test x$with_xenstore = xtrue) - -+# Configure argument to support type of init system -+AC_ARG_WITH([init_script], -+ [AS_HELP_STRING([--with-init-script], -+ [Type of init script to install: systemv, systemd, check @<:@default=check@:>@])], -+ [], -+ [with_init_script=check]) -+init_systemv=no -+init_systemd=no -+if test "$with_init_script" = check && type systemctl >/dev/null 2>&1; then -+ init_systemd=yes -+else -+ init_systemv=yes -+fi -+case "${with_init_script}" in -+ systemv) init_systemv=yes;; -+ systemd) init_systemd=yes;; -+ check) ;; -+ *) AC_MSG_ERROR([Unknown initscript type $with_init_script]);; -+esac -+AM_CONDITIONAL([INIT_SCRIPT_SYSTEMV], test "$init_systemv" = "yes") -+AM_CONDITIONAL([INIT_SCRIPT_SYSTEMD], test "$init_systemd" = "yes") -+ - AC_OUTPUT(vhostmd/Makefile - include/Makefile - libmetrics/Makefile -diff --git a/vhostmd.service b/vhostmd.service -new file mode 100644 -index 0000000..9d50523 ---- /dev/null -+++ b/vhostmd.service -@@ -0,0 +1,14 @@ -+[Unit] -+Description=Daemon for collecting virutalization host metrics -+After=libvirtd.service -+Documentation=man:vhostmd(8) -+ -+[Service] -+Type=forking -+ExecStart=/usr/sbin/vhostmd -+ExecReload=/bin/kill -HUP $MAINPID -+KillMode=process -+Restart=on-failure -+ -+[Install] -+WantedBy=multi-user.target --- -2.19.0.rc0 - diff --git a/0009-Remove-xenctrl-support.patch b/0009-Remove-xenctrl-support.patch deleted file mode 100644 index 0bf32a4..0000000 --- a/0009-Remove-xenctrl-support.patch +++ /dev/null @@ -1,311 +0,0 @@ -From 3dd984f7299d1364d6e7a902776e1fcfd83d6370 Mon Sep 17 00:00:00 2001 -From: Jim Fehlig -Date: Wed, 6 Jun 2018 14:40:33 -0600 -Subject: [PATCH 09/17] Remove xenctrl support - -The xenctrl interface has changed over the years, causing -the associated code in vhostmd to no longer compile. Instead -of trying to get this low-level xen interface working again, -simply remove it from vhostmd. libvirt or custom "actions" -should be used to gather metrics. - -Signed-off-by: Jim Fehlig ---- - configure.ac | 21 +----- - include/util.h | 2 - - vhostmd/Makefile.am | 17 +---- - vhostmd/metric.c | 5 -- - vhostmd/vhostmd.c | 4 -- - vhostmd/xenctrl-util.c | 148 ----------------------------------------- - 6 files changed, 4 insertions(+), 193 deletions(-) - delete mode 100644 vhostmd/xenctrl-util.c - -diff --git a/configure.ac b/configure.ac -index b0a07c7..2e88bfd 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -51,26 +51,7 @@ AC_ARG_ENABLE([libxenstat], - esac],[AC_CHECK_HEADER(xenstat.h, libxenstat=true, libxenstat=false)]) - AM_CONDITIONAL(LIBXENSTAT, test x$libxenstat = xtrue) - --# Configure argument to support using xenctrl library for vm enumeration --AC_ARG_ENABLE([xenctrl], --[ --enable-xenctrl use xenctrl specific vm enumeration instead of libvirt], -- [case "${enableval}" in -- yes) xenctrl=true -- CFLAGS="$CFLAGS -DXENCTRL" -- ;; -- no) xenctrl=false ;; -- *) AC_MSG_ERROR(bad value ${enableval} for --enable-xenctrl) ;; -- esac],[AC_CHECK_HEADER(xenctrl.h, xenctrl=true, xenctrl=false,)]) --AM_CONDITIONAL(XENCTRL, test x$xenctrl = xtrue) -- --libvirt=false --AM_CONDITIONAL(LIBVIRT, test x$libvirt = xtrue) --# Default to libvirt for vm enumeration if no other enabled --if test "x$xenctrl" = "xfalse"; then -- libvirt=true -- PKG_CHECK_MODULES([LIBVIRT], [libvirt]) -- AM_CONDITIONAL(LIBVIRT, test x$libvirt = xtrue) --fi -+PKG_CHECK_MODULES([LIBVIRT], [libvirt]) - - # Configure argument to support using xenstore - AC_ARG_WITH([xenstore], -diff --git a/include/util.h b/include/util.h -index 6045665..3a21e09 100644 ---- a/include/util.h -+++ b/include/util.h -@@ -53,12 +53,10 @@ typedef struct _vu_vm - } vu_vm; - - --#ifndef XENCTRL - /* The libvirt URI to connect to (-c argument on the command line). If - * not set, this will be NULL. - */ - extern const char *libvirt_uri; --#endif - - /* - * Init logging interface. If running as daemon messages -diff --git a/vhostmd/Makefile.am b/vhostmd/Makefile.am -index 3801882..659a0ce 100644 ---- a/vhostmd/Makefile.am -+++ b/vhostmd/Makefile.am -@@ -3,26 +3,15 @@ INCLUDES = \ - -I../include - - sbin_PROGRAMS = vhostmd --vhostmd_SOURCES = vhostmd.c util.c metric.c --vhostmd_CFLAGS = $(LIBXML_CFLAGS) --vhostmd_LDADD = -lm $(LIBXML_LIBS) -+vhostmd_SOURCES = vhostmd.c util.c metric.c virt-util.c -+vhostmd_CFLAGS = $(LIBXML_CFLAGS) $(LIBVIRT_CFLAGS) -+vhostmd_LDADD = -lm $(LIBXML_LIBS) $(LIBVIRT_LIBS) - - if WITH_XENSTORE - vhostmd_SOURCES += xenstore-update.c - vhostmd_LDADD += -lxenstore - endif - --if XENCTRL --vhostmd_SOURCES += xenctrl-util.c --vhostmd_LDADD += -lxenctrl -lxenstore --endif -- --if LIBVIRT --vhostmd_SOURCES += virt-util.c --vhostmd_LDADD += $(LIBVIRT_LIBS) --vhostmd_CFLAGS += $(LIBVIRT_CFLAGS) --endif -- - if LIBXENSTAT - vhostmd_SOURCES += xen-metrics.c - vhostmd_LDADD += ../xenstat/libxenstat/src/libxenstat.a -diff --git a/vhostmd/metric.c b/vhostmd/metric.c -index 3fdf4f6..84b1678 100644 ---- a/vhostmd/metric.c -+++ b/vhostmd/metric.c -@@ -71,10 +71,6 @@ static int metric_action_subst(metric *m, char **action) - return -1; - } - --#ifdef XENCTRL -- temp = replace (temp, "CONNECT", ""); -- if (temp == NULL) return -1; --#else /* LIBVIRT used instead */ - if (libvirt_uri) { - temp = replace (temp, "CONNECT", "--connect '%s'", libvirt_uri); - if (temp == NULL) return -1; -@@ -82,7 +78,6 @@ static int metric_action_subst(metric *m, char **action) - temp = replace (temp, "CONNECT", ""); - if (temp == NULL) return -1; - } --#endif - - if (m->ctx == METRIC_CONTEXT_VM) { - temp = replace (temp, "NAME", "%s", m->vm->name); -diff --git a/vhostmd/vhostmd.c b/vhostmd/vhostmd.c -index 90ba76d..e2e91f6 100644 ---- a/vhostmd/vhostmd.c -+++ b/vhostmd/vhostmd.c -@@ -979,9 +979,7 @@ int main(int argc, char *argv[]) - { "config", required_argument, NULL, 'f'}, - { "pid-file", required_argument, NULL, 'p'}, - { "user", required_argument, NULL, 'u'}, --#ifndef XENCTRL - { "connect", required_argument, NULL, 'c'}, --#endif - { "help", no_argument, NULL, '?' }, - {0, 0, 0, 0} - }; -@@ -1014,11 +1012,9 @@ int main(int argc, char *argv[]) - case 'u': - user = optarg; - break; --#ifndef XENCTRL - case 'c': - libvirt_uri = optarg; - break; --#endif - case '?': - usage(argv[0]); - return 2; -diff --git a/vhostmd/xenctrl-util.c b/vhostmd/xenctrl-util.c -deleted file mode 100644 -index 7c78ca4..0000000 ---- a/vhostmd/xenctrl-util.c -+++ /dev/null -@@ -1,148 +0,0 @@ --/* -- * Copyright (C) 2009 Novell, Inc. -- * -- * This library is free software; you can redistribute it and/or -- * modify it under the terms of the GNU Lesser General Public -- * License as published by the Free Software Foundation; either -- * version 2.1 of the License, or (at your option) any later version. -- * -- * This library is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- * Lesser General Public License for more details. -- * -- * You should have received a copy of the GNU Lesser General Public -- * License along with this library; if not, write to the Free Software -- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- * -- * Author: Pat Campbell -- * -- * Preliminary, this could be done better -- */ -- --#include -- --#include --#include --#include --#include -- --#include "util.h" -- --#define MAX_DOMS 1024 --static int xc_handle = -1; --static xc_dominfo_t info[MAX_DOMS]; -- --int vu_num_vms(void) --{ -- uint32_t first_dom = 0; -- int max_doms = MAX_DOMS, nr_doms = 0; -- -- if (xc_handle == -1) -- xc_handle = xc_interface_open(); -- -- if (xc_handle == -1) -- return -1; -- -- nr_doms = xc_domain_getinfo(xc_handle, first_dom, max_doms, info); -- -- return(nr_doms); --} -- --int vu_get_vms(int *ids, int max_ids) --{ -- uint32_t first_dom = 0; -- int max_doms = MAX_DOMS, nr_doms = 0, i; -- -- if (xc_handle == -1) -- xc_handle = xc_interface_open(); -- -- if (xc_handle == -1) -- return -1; -- -- nr_doms = xc_domain_getinfo(xc_handle, first_dom, max_doms, info); -- if (nr_doms < 0) { -- goto out; -- } -- -- if (max_ids < nr_doms) -- nr_doms = max_ids; -- for (i = 0; i < nr_doms; i++) -- ids[i] = (int)info[i].domid; -- --out: -- return nr_doms; --} -- --vu_vm *vu_get_vm(int id) --{ -- vu_vm *vm = NULL; -- char *path = NULL, *buf = NULL; -- char *name = NULL; -- char *uuid = NULL; -- struct xs_handle *xsh = NULL; -- unsigned len; -- char *cp; -- -- vm = calloc(1, sizeof(vu_vm)); -- if (vm == NULL) -- return NULL; -- -- vm->id = id; -- -- xsh = xs_daemon_open(); -- if (xsh == NULL) -- goto error; -- -- path = xs_get_domain_path(xsh, id); -- if (path == NULL) { -- goto error; -- } -- -- asprintf(&buf, "%s/vm", path); -- uuid = xs_read(xsh, XBT_NULL, buf, &len); -- if (uuid == NULL) { -- goto error; -- } -- cp = strrchr(uuid, '/'); -- memmove(uuid, cp+1, strlen(cp)); -- vm->uuid = strdup(uuid); -- free(buf); -- -- asprintf(&buf, "%s/name", path); -- name = xs_read(xsh, XBT_NULL, buf, &len); -- if (name) -- vm->name = strdup(name); -- -- goto out; -- --error: -- if (vm) free(vm); -- vm = NULL; -- --out: -- if (buf) free(buf); -- if (path) free(path); -- if (name) free(name); -- if (uuid) free(uuid); -- if (xsh) xs_daemon_close(xsh); -- -- return vm; --} -- --void vu_vm_free(vu_vm *vm) --{ -- if (vm) { -- free(vm->name); -- free(vm->uuid); -- free(vm); -- } --} -- --void vu_vm_connect_close() --{ -- if (xc_handle != -1) -- xc_interface_close(xc_handle); -- xc_handle = -1; --} -- --- -2.19.0.rc0 - diff --git a/0010-Remove-support-for-libxenstat.patch b/0010-Remove-support-for-libxenstat.patch deleted file mode 100644 index db52f25..0000000 --- a/0010-Remove-support-for-libxenstat.patch +++ /dev/null @@ -1,222 +0,0 @@ -From 1586cf7722d8ca45e4e4fff67be1ae0567e6d4b8 Mon Sep 17 00:00:00 2001 -From: Jim Fehlig -Date: Wed, 6 Jun 2018 14:52:29 -0600 -Subject: [PATCH 10/17] Remove support for libxenstat - -Old, crufty code that no longer compiles and should be -removed from the sources. libvirt or custom "actions" -should be used to gather metrics. - -Signed-off-by: Jim Fehlig ---- - configure.ac | 12 ----- - include/metric.h | 4 -- - vhostmd/Makefile.am | 5 -- - vhostmd/vhostmd.c | 6 --- - vhostmd/xen-metrics.c | 123 ------------------------------------------ - 5 files changed, 150 deletions(-) - delete mode 100644 vhostmd/xen-metrics.c - -diff --git a/configure.ac b/configure.ac -index 2e88bfd..830c47f 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -39,18 +39,6 @@ AC_ARG_ENABLE([debug], - CFLAGS="$CFLAGS $DEBUG_CFLAGS" - ]) - --# Add a configure argument to support using xen library, libxenstat --AC_ARG_ENABLE([libxenstat], --[ --enable-libxenstat enable libxenstat usage], -- [case "${enableval}" in -- yes) libxenstat=true -- CFLAGS="$CFLAGS -DLIBXENSTAT" -- ;; -- no) libxenstat=false ;; -- *) AC_MSG_ERROR(bad value ${enableval} for --enable-libxenstat) ;; -- esac],[AC_CHECK_HEADER(xenstat.h, libxenstat=true, libxenstat=false)]) --AM_CONDITIONAL(LIBXENSTAT, test x$libxenstat = xtrue) -- - PKG_CHECK_MODULES([LIBVIRT], [libvirt]) - - # Configure argument to support using xenstore -diff --git a/include/metric.h b/include/metric.h -index 6c8432e..cc82366 100644 ---- a/include/metric.h -+++ b/include/metric.h -@@ -71,10 +71,6 @@ int metric_value_get(metric *def); - - int metric_xml(metric *m, vu_buffer *buf); - --#ifdef LIBXENSTAT --int xen_metrics(metric **user_metrics); --#endif -- - #ifdef WITH_XENSTORE - int metrics_xenstore_update(char *buffer, int *ids, int num_vms); - #endif -diff --git a/vhostmd/Makefile.am b/vhostmd/Makefile.am -index 659a0ce..3585970 100644 ---- a/vhostmd/Makefile.am -+++ b/vhostmd/Makefile.am -@@ -12,11 +12,6 @@ vhostmd_SOURCES += xenstore-update.c - vhostmd_LDADD += -lxenstore - endif - --if LIBXENSTAT --vhostmd_SOURCES += xen-metrics.c --vhostmd_LDADD += ../xenstat/libxenstat/src/libxenstat.a --endif -- - valgrind: - $(MAKE) CHECKER='valgrind --quiet --leak-check=full --suppressions=$(srcdir)/.valgrind.supp' tests - -diff --git a/vhostmd/vhostmd.c b/vhostmd/vhostmd.c -index e2e91f6..7f04705 100644 ---- a/vhostmd/vhostmd.c -+++ b/vhostmd/vhostmd.c -@@ -1077,12 +1077,6 @@ int main(int argc, char *argv[]) - goto out; - } - --#ifdef LIBXENSTAT -- if (xen_metrics(&metrics)) { -- vu_log(VHOSTMD_ERR, "Unable to load xen specific metrics, ignoring"); -- } --#endif -- - if ((mdisk_fd = metrics_disk_create()) < 0) { - vu_log(VHOSTMD_ERR, "Failed to create metrics disk %s", mdisk_path); - goto out; -diff --git a/vhostmd/xen-metrics.c b/vhostmd/xen-metrics.c -deleted file mode 100644 -index 94f7dea..0000000 ---- a/vhostmd/xen-metrics.c -+++ /dev/null -@@ -1,123 +0,0 @@ --/* -- * Copyright (C) 2008 Novell, Inc. -- * -- * This library is free software; you can redistribute it and/or -- * modify it under the terms of the GNU Lesser General Public -- * License as published by the Free Software Foundation; either -- * version 2.1 of the License, or (at your option) any later version. -- * -- * This library is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- * Lesser General Public License for more details. -- * -- * You should have received a copy of the GNU Lesser General Public -- * License along with this library; if not, write to the Free Software -- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- * -- * Author: Pat Campbell -- */ -- --#include -- --#include --#include --#include --#include --#include -- --#include "util.h" --#include "metric.h" -- --#include "xenstat.h" -- --static xenstat_handle *xhandle = NULL; --static xenstat_node *cur_node = NULL; -- --int node_tot_mem(void *vp) { -- metric *m = vp; -- -- cur_node = xenstat_get_node(xhandle, XENSTAT_ALL); -- if (cur_node == NULL) { -- vu_log(VHOSTMD_WARN, "Failed to retrieve statistics from libxenstat\n"); -- return -1; -- } -- m->value.r32 = xenstat_node_tot_mem(cur_node); -- xenstat_free_node(cur_node); -- return 0; --} -- --int func_str_test(void *vp) { -- metric *m = vp; -- int len = 0; -- char value[] = "func_str_test"; -- -- if (m->value.str) { -- len = strlen(m->value.str); -- m->value.str[0] = '\0'; -- if (strlen(value) > len) -- m->value.str = realloc(m->value.str, strlen(value) + 1); -- } -- else -- m->value.str = calloc(1, strlen(value) + 1); -- if (m->value.str == NULL) -- goto out; -- sprintf(m->value.str, "%s", value); --out: -- return 0; --} -- -- --metric m[] = { -- { "test", -- NULL, -- M_STRING, -- METRIC_CONTEXT_HOST, -- func_str_test, -- 0, -- NULL -- }, -- { "node_tot_mem", -- NULL, -- M_REAL32, -- METRIC_CONTEXT_HOST, -- node_tot_mem, -- 0, -- NULL -- }, -- { "pages paged out", -- "vmstat -s |grep \"pages paged out\" | awk '{print $1}'", -- M_UINT32, -- METRIC_CONTEXT_HOST, -- NULL, -- 0, -- NULL -- } --}; -- -- --int xen_metrics(metric **user_metrics) { -- int i; -- metric *mdef; -- metric *metrics = *user_metrics; -- -- xhandle = xenstat_init(); -- if (xhandle == NULL) { -- vu_log(VHOSTMD_WARN, "Failed to initialize xenstat library\n"); -- return -1; -- } -- -- for (i = 0; i < sizeof(m)/sizeof(metric); i++) { -- mdef = calloc(sizeof(metric), 1); -- if (mdef) { -- memcpy(mdef,&m[i], sizeof(metric)); -- mdef->next = metrics; -- metrics = mdef; -- } -- else { -- vu_log(VHOSTMD_WARN, "Unable to allocate metric node, ignoring ..."); -- } -- } -- *user_metrics = metrics; -- return 0; --} --- -2.19.0.rc0 - diff --git a/0011-Fix-compilation-with-xenstore.patch b/0011-Fix-compilation-with-xenstore.patch deleted file mode 100644 index 7b80f99..0000000 --- a/0011-Fix-compilation-with-xenstore.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 66967ef343c40d91918384540f9868b43c90c433 Mon Sep 17 00:00:00 2001 -From: Jim Fehlig -Date: Wed, 6 Jun 2018 14:58:00 -0600 -Subject: [PATCH 11/17] Fix compilation with xenstore - -The xenstore transport is worth keeping, so update it to -work with "modern" Xen. By modern I mean something like 4.4 -or newer. - -Signed-off-by: Jim Fehlig ---- - configure.ac | 2 +- - libmetrics/libmetrics.c | 2 +- - vhostmd/xenstore-update.c | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 830c47f..c6b660e 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -48,7 +48,7 @@ AC_ARG_WITH([xenstore], - yes) with_xenstore=true;; - no) with_xenstore=false;; - *) AC_MSG_ERROR(bad value ${withval} for --with-xenstore) ;; -- esac],[AC_CHECK_HEADER(xs.h, with_xenstore=true)]) -+ esac],[AC_CHECK_HEADER(xenstore.h, with_xenstore=true)]) - AM_CONDITIONAL(WITH_XENSTORE, test x$with_xenstore = xtrue) - - # Configure argument to support type of init system -diff --git a/libmetrics/libmetrics.c b/libmetrics/libmetrics.c -index 6d5c26f..81f4d1a 100644 ---- a/libmetrics/libmetrics.c -+++ b/libmetrics/libmetrics.c -@@ -31,7 +31,7 @@ - #include - #include - #ifdef WITH_XENSTORE --#include -+#include - #endif - - #include "libmetrics.h" -diff --git a/vhostmd/xenstore-update.c b/vhostmd/xenstore-update.c -index f157f60..20fbde1 100644 ---- a/vhostmd/xenstore-update.c -+++ b/vhostmd/xenstore-update.c -@@ -28,7 +28,7 @@ - #include - #include - #include --#include -+#include - - #include "util.h" - #include "metric.h" --- -2.19.0.rc0 - diff --git a/0012-Fix-typo-in-systemd-service-file.patch b/0012-Fix-typo-in-systemd-service-file.patch deleted file mode 100644 index 02be16f..0000000 --- a/0012-Fix-typo-in-systemd-service-file.patch +++ /dev/null @@ -1,24 +0,0 @@ -From b015f73b742db6285d8201e87387a7217e89dbfd Mon Sep 17 00:00:00 2001 -From: Jim Fehlig -Date: Mon, 11 Jun 2018 15:25:58 -0600 -Subject: [PATCH 12/17] Fix typo in systemd service file - -Signed-off-by: Jim Fehlig ---- - vhostmd.service | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/vhostmd.service b/vhostmd.service -index 9d50523..576dabd 100644 ---- a/vhostmd.service -+++ b/vhostmd.service -@@ -1,5 +1,5 @@ - [Unit] --Description=Daemon for collecting virutalization host metrics -+Description=Daemon for collecting virtualization host metrics - After=libvirtd.service - Documentation=man:vhostmd(8) - --- -2.19.0.rc0 - diff --git a/0013-Fix-help-option.patch b/0013-Fix-help-option.patch deleted file mode 100644 index 4513273..0000000 --- a/0013-Fix-help-option.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 302e49730f862a10b3b5b58905d803d27853f7d6 Mon Sep 17 00:00:00 2001 -From: Jim Fehlig -Date: Wed, 20 Jun 2018 16:39:20 -0600 -Subject: [PATCH 13/17] Fix help option - -Fix the short option for help, add help to the help output, and -add help to the vhostmd man page. - -Signed-off-by: Jim Fehlig ---- - docs/man/vhostmd.8 | 3 +++ - vhostmd/vhostmd.c | 7 ++++--- - 2 files changed, 7 insertions(+), 3 deletions(-) - -diff --git a/docs/man/vhostmd.8 b/docs/man/vhostmd.8 -index 2c73adc..ed82432 100644 ---- a/docs/man/vhostmd.8 -+++ b/docs/man/vhostmd.8 -@@ -13,6 +13,9 @@ provides a "metrics communication channel" between a host and its hosted virtual - vhostmd will periodically write metrics to a disk. The metrics to write, how often, and where to write them are all adjustable via the /etc/vhostmd/vhostmd.conf configuration file. The disk can then be surfaced read-only to virtual machines using tools provided by the host's virtualization platform. - .SH OPTIONS - .TP -+.B \-h, --help -+Display help and exit -+.TP - .B \-v, --verbose - Verbose messages - .TP -diff --git a/vhostmd/vhostmd.c b/vhostmd/vhostmd.c -index 7f04705..8576609 100644 ---- a/vhostmd/vhostmd.c -+++ b/vhostmd/vhostmd.c -@@ -950,6 +950,7 @@ static void usage(const char *argv0) - %s [options]\n\ - \n\ - Options:\n\ -+ -h | --help Display program help.\n\ - -v | --verbose Verbose messages.\n\ - -c | --connect Set the libvirt URI.\n\ - -d | --no-daemonize Process will not daemonize - useful for debugging.\n\ -@@ -980,7 +981,7 @@ int main(int argc, char *argv[]) - { "pid-file", required_argument, NULL, 'p'}, - { "user", required_argument, NULL, 'u'}, - { "connect", required_argument, NULL, 'c'}, -- { "help", no_argument, NULL, '?' }, -+ { "help", no_argument, NULL, 'h' }, - {0, 0, 0, 0} - }; - -@@ -988,7 +989,7 @@ int main(int argc, char *argv[]) - int optidx = 0; - int c; - -- c = getopt_long(argc, argv, "c:df:p:u:v", opts, &optidx); -+ c = getopt_long(argc, argv, "c:df:p:u:vh", opts, &optidx); - - if (c == -1) - break; -@@ -1015,7 +1016,7 @@ int main(int argc, char *argv[]) - case 'c': - libvirt_uri = optarg; - break; -- case '?': -+ case 'h': - usage(argv[0]); - return 2; - default: --- -2.19.0.rc0 - diff --git a/0014-Add-SIGPIPE-handler-and-reconnect.patch b/0014-Add-SIGPIPE-handler-and-reconnect.patch deleted file mode 100644 index f2c707a..0000000 --- a/0014-Add-SIGPIPE-handler-and-reconnect.patch +++ /dev/null @@ -1,110 +0,0 @@ -From c7646e329ca61a038777f58042539611ac42b007 Mon Sep 17 00:00:00 2001 -From: Michael Trapp -Date: Thu, 21 Jun 2018 15:03:50 +0200 -Subject: [PATCH 14/17] Add SIGPIPE handler and reconnect - -vhostmd has no signal handler for SIGPIPE and a restart of libvirtd results in -a stopped vhostmd. The root cause seems to be a UDS socket between vhostmd and -libvirtd which is closed by a libvirtd restart. -In addition to the signal handler the connection to libvirtd has to be opened -again otherwise vhostmd can't read any data from libvirtd and doesn't update -the metrics. ---- - vhostmd/vhostmd.c | 2 ++ - vhostmd/virt-util.c | 43 ++++++++++++++++++++++++++++++++++++------- - 2 files changed, 38 insertions(+), 7 deletions(-) - -diff --git a/vhostmd/vhostmd.c b/vhostmd/vhostmd.c -index 8576609..dc80345 100644 ---- a/vhostmd/vhostmd.c -+++ b/vhostmd/vhostmd.c -@@ -117,6 +117,7 @@ static void sig_handler(int sig, siginfo_t *siginfo ATTRIBUTE_UNUSED, - case SIGQUIT: - down = 1; - break; -+ case SIGPIPE: - default: - break; - } -@@ -1054,6 +1055,7 @@ int main(int argc, char *argv[]) - sigaction(SIGINT, &sig_action, NULL); - sigaction(SIGQUIT, &sig_action, NULL); - sigaction(SIGTERM, &sig_action, NULL); -+ sigaction(SIGPIPE, &sig_action, NULL); - - xmlInitParser(); - -diff --git a/vhostmd/virt-util.c b/vhostmd/virt-util.c -index 1c31305..587146f 100644 ---- a/vhostmd/virt-util.c -+++ b/vhostmd/virt-util.c -@@ -26,21 +26,48 @@ - - #include "util.h" - -+enum { -+ CLOSED = 0, -+ ESTABLISHED -+} connection = CLOSED; -+ - static virConnectPtr conn = NULL; - - const char *libvirt_uri = NULL; - -+void -+conn_close_cb(virConnectPtr c, -+ int reason ATTRIBUTE_UNUSED, -+ void *p ATTRIBUTE_UNUSED) -+{ -+ if (c == conn) -+ connection = CLOSED; -+} -+ - static int --do_connect (void) -+do_connect(void) - { -+ if (connection == ESTABLISHED) -+ return 0; -+ -+ if (conn != NULL) -+ virConnectClose(conn); -+ -+ conn = virConnectOpenReadOnly(libvirt_uri); - if (conn == NULL) { -- conn = virConnectOpenReadOnly (libvirt_uri); -- if (conn == NULL) { -- vu_log (VHOSTMD_ERR, "Unable to open libvirt connection to %s", -- libvirt_uri ? libvirt_uri : "default hypervisor"); -- return -1; -- } -+ vu_log(VHOSTMD_ERR, "Unable to open libvirt connection to %s", -+ libvirt_uri ? libvirt_uri : "default hypervisor"); -+ return -1; - } -+ -+ if (virConnectRegisterCloseCallback(conn, conn_close_cb, NULL, NULL)) { -+ vu_log(VHOSTMD_ERR, "Unable to register callback 'virConnectCloseFunc'"); -+ virConnectClose(conn); -+ conn = NULL; -+ return -1; -+ } -+ -+ connection = ESTABLISHED; - return 0; - } - -@@ -107,8 +134,10 @@ void vu_vm_free(vu_vm *vm) - void vu_vm_connect_close() - { - if (conn) { -+ virConnectUnregisterCloseCallback(conn, conn_close_cb); - virConnectClose(conn); - conn = NULL; - } -+ connection = CLOSED; - } - --- -2.19.0.rc0 - diff --git a/0015-fix-deallocation-in-vu_vm_free.patch b/0015-fix-deallocation-in-vu_vm_free.patch deleted file mode 100644 index 975882d..0000000 --- a/0015-fix-deallocation-in-vu_vm_free.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 03dc99825ad3d53cfcc7d8c2b8288b1549f261d6 Mon Sep 17 00:00:00 2001 -From: Michael Trapp -Date: Thu, 21 Jun 2018 15:19:26 +0200 -Subject: [PATCH 15/17] fix deallocation in vu_vm_free - -Callers of vu_vm_free may pass a partially constructed vu_vm -object. Check if members of the object have been allocated -before deallocating them. ---- - vhostmd/virt-util.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/vhostmd/virt-util.c b/vhostmd/virt-util.c -index 587146f..a94cccd 100644 ---- a/vhostmd/virt-util.c -+++ b/vhostmd/virt-util.c -@@ -118,15 +118,17 @@ vu_vm *vu_get_vm(int id) - - error: - virDomainFree(dom); -- free(vm); -+ vu_vm_free(vm); - return NULL; - } - - void vu_vm_free(vu_vm *vm) - { - if (vm) { -- free(vm->name); -- free(vm->uuid); -+ if (vm->name) -+ free(vm->name); -+ if (vm->uuid) -+ free(vm->uuid); - free(vm); - } - } --- -2.19.0.rc0 - diff --git a/0016-configure-fix-logic-in-init-script-check.patch b/0016-configure-fix-logic-in-init-script-check.patch deleted file mode 100644 index 0d4f324..0000000 --- a/0016-configure-fix-logic-in-init-script-check.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 6439d22cea451e54b58bb9d6e8072cc6c58694be Mon Sep 17 00:00:00 2001 -From: Jim Fehlig -Date: Mon, 11 Jun 2018 20:35:50 -0600 -Subject: [PATCH 16/17] configure: fix logic in init script check - -The logic introduced in commit d1276646to check for init script type is -a bit flawed. If the init script type is specified, init_systemv is -always set to 'yes', even when '--with-init-script=systemd'. Split the -logic to only check for init script type when '--with-init-script=check'. - -Signed-off-by: Jim Fehlig ---- - configure.ac | 10 ++++++---- - 1 file changed, 6 insertions(+), 4 deletions(-) - -diff --git a/configure.ac b/configure.ac -index c6b660e..9414440 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -59,10 +59,12 @@ AC_ARG_WITH([init_script], - [with_init_script=check]) - init_systemv=no - init_systemd=no --if test "$with_init_script" = check && type systemctl >/dev/null 2>&1; then -- init_systemd=yes --else -- init_systemv=yes -+if test "$with_init_script" = check; then -+ if type systemctl >/dev/null 2>&1; then -+ init_systemd=yes -+ else -+ init_systemv=yes -+ fi - fi - case "${with_init_script}" in - systemv) init_systemv=yes;; --- -2.19.0.rc0 - diff --git a/0017-conf-Improve-example-configuration-file.patch b/0017-conf-Improve-example-configuration-file.patch deleted file mode 100644 index 7926fe6..0000000 --- a/0017-conf-Improve-example-configuration-file.patch +++ /dev/null @@ -1,175 +0,0 @@ -From d1a230d6d3ca4ded376f6522688d379bac347fbe Mon Sep 17 00:00:00 2001 -From: Jim Fehlig -Date: Wed, 20 Jun 2018 15:39:45 -0600 -Subject: [PATCH 17/17] conf: Improve example configuration file - -Although the upstream vhostmd config file serves primarily as an -example, it should at least work and not unconditionally call -commands that no longer exist. - -While at it, improve the comments describing the element. - -Signed-off-by: Jim Fehlig ---- - vhostmd.xml | 95 +++++++++++++++++++++++++++++++++++++++++++---------- - 1 file changed, 78 insertions(+), 17 deletions(-) - -diff --git a/vhostmd.xml b/vhostmd.xml -index 6f56b58..9b048df 100644 ---- a/vhostmd.xml -+++ b/vhostmd.xml -@@ -18,6 +18,12 @@ A metric's value is set to the output produced by executing its action. - the vm currently under inspection is substituted for NAME. Only useful - within the vm element. - -+NOTE - 'action' must be a valid shell builtin, script or external -+command found in the path specified by the global element. -+When chaining commands, '&', '<' and '>' are reserved characters, -+therefore '&', '<' and '>' must be used instead. For example, -+the logical && operator must be replaced with "&&". -+ - --> - - -@@ -28,52 +34,75 @@ within the vm element. - 256 - - 5 -- /usr/bin:/usr/sbin:/usr/share/vhostmd/scripts -+ /usr/sbin:/sbin:/usr/bin:/bin:/usr/share/vhostmd/scripts - vbd - - - - - HostName -- virsh CONNECT hostname | tr -d '[:space:]' -+ -+ virsh CONNECT hostname | tr -d '[:space:]' -+ - - - VirtualizationVendor -- /bin/rpm -q --info xen | grep Vendor: | \ -- awk '{print substr($0, index($0,$5)) }' -+ -+ [ -f /proc/xen/privcmd ] && RPM="xen" || RPM="libvirt"; \ -+ rpm -q --queryformat "%{VENDOR}\n" $RPM | sort -u | sed -e 's/<.*//' -e 's/ *$//' -+ - - - VirtualizationProductInfo -- xm info | gawk '/^xen_(major|minor|extra)/ {print $3}' | \ -- tr -d . | tr '[:space:]' . -+ -+ [ -f /proc/xen/privcmd ] && xl info | \ -+ awk '/^xen_(major|minor|extra)/ {print $3}' | sed -e 'N;s/\n/./' -e 'N;s/\n//' || \ -+ rpm -q --queryformat "%{VERSION}-%{RELEASE}\n" libvirt | sort -u -+ - - - TotalPhyCPUs -- xm info | gawk '/^nr_cpus/ {print $3}' -+ -+ virsh nodeinfo | awk '/^CPU\(s\)/ {print $2}' -+ - - - NumCPUs -- xm info | gawk '/^nr_cpus/ {print $3}' -+ -+ virsh nodeinfo | awk '/^CPU\(s\)/ {print $2}' -+ - - - TotalPhyMem -- xm info | gawk '/^total_memory/ {print $3}' -+ -+ echo $((`virsh nodeinfo | awk '/^Memory/ {print $3}'` / 1024)) -+ - - - UsedMem -- echo "$((`xentop -b -i 1 | gawk '/Domain-0/ {print $5}'` / 1024))" -+ -+ [ -f /proc/xen/privcmd ] && echo "$((`xentop -b -i 1 | awk '/Domain-0/ {print $5}'` / 1024))" || \ -+ free | egrep -i '^[[:space:]]*(.*buffers/cache:)' | awk '{ printf "%d\n", $3/1024; }' -+ - - - FreeMem -- xm info | gawk '/^max_free_memory/ {print $3}' -+ -+ [ -f /proc/xen/privcmd ] && xl info | awk '/^free_memory/ {print $3}' || \ -+ free | egrep -i '^[[:space:]]*(.*buffers/cache:)' | awk '{ printf "%d\n", $4/1024; }' -+ - - - PagedInMemory -- echo "$((`vmstat -s | gawk '/pages paged in/ {print $1}'` / 1024))" -+ -+ vmstat -s | awk '/pages paged in/ {printf "%d\n", $1 / 1024 * $(getconf PAGESIZE) / 1024;}' -+ - - - PagedOutMemory -- echo "$((`vmstat -s | gawk '/pages paged out/ {print $1}'` / 1024))" -+ -+ vmstat -s | awk '/pages paged out/ {printf "%d\n", $1 / 1024 * $(getconf PAGESIZE) / 1024;}' -+ - - - PageRates -@@ -83,13 +112,45 @@ within the vm element. - - - TotalCPUTime -- virsh CONNECT dominfo 0 | sed 's/: */:/' | \ -- gawk -F: '/CPU time/ {print $2;}' -+ -+ [ -f /proc/xen/privcmd ] && xl list | awk '/^Domain-0/ {print $6}' || \ -+ awk ' -+ function user_hz( hz) -+ { -+ cmd = "getconf CLK_TCK"; -+ cmd | getline; -+ hz = $1; -+ close(cmd); -+ -+ return hz; -+ } -+ -+ BEGIN { -+ USER_HZ = user_hz(); -+ TotalCPUTime = 0; -+ -+ while ( 0 < ( getline < "/proc/stat" ) ) -+ { -+ if ( "cpu" == $1 ) -+ { -+ TotalCPUTime = $2 + $3 + $4; -+ -+ break; -+ } -+ } -+ close("/proc/stat"); -+ -+ TotalCPUTime /= USER_HZ; -+ printf "%f\n", TotalCPUTime; -+ }' -+ - - - TotalCPUTime -- virsh CONNECT dominfo NAME | sed 's/: */:/' | \ -- gawk -F: '/CPU time/ {print $2;}' -+ -+ virsh CONNECT dominfo NAME | sed 's/: */:/' | \ -+ awk -F: '/CPU time/ {print $2;}' | sed 's/s//' -+ - - - --- -2.19.0.rc0 - diff --git a/sources b/sources index 825b401..a5cb2ed 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -db5e80d9a6606ea2394479ef99d30eb8 vhostmd-0.5.tar.bz2 +SHA512 (vhostmd-1.0.tar.gz) = 0479f2b4cebd2d3aa603516b4c6db03ba4f998ab5c25965cc26b1b64ff9a33ac5d6e5a973361931a11b641500fc21b187881756726e92d96a924f47efac2e7cf diff --git a/vhostmd.init b/vhostmd.init deleted file mode 100644 index ca3c587..0000000 --- a/vhostmd.init +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/sh -# -# vhostmd: Virtualization host metrics daemon -# -# chkconfig: - 98 02 -# description: This daemon allows access to host information from guests. - -### BEGIN INIT INFO -# Provides: vhostmd -# Required-Start: libvirtd -# Required-Stop: libvirtd -# Default-Stop: -# Short-Description: Virtualization host metrics daemon -# Description: This daemon allows access to host information from guests. -### END INIT INFO - -# Source function library. -. /etc/rc.d/init.d/functions - -exec=/usr/sbin/vhostmd -prog=vhostmd -config=/etc/vhostmd/vhostmd.conf - -[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog - -ARGS= -if [ -n "$VHOSTMD_VERBOSE" ]; then - ARGS="$ARGS --verbose" -fi -if [ -n "$VHOSTMD_CONFIG" ]; then - ARGS="$ARGS --config $VHOSTMD_CONFIG" -fi -if [ -n "$VHOSTMD_USER" ]; then - ARGS="$ARGS --user $VHOSTMD_USER" -fi -if [ -n "$VHOSTMD_URI" ]; then - ARGS="$ARGS --connect $VHOSTMD_URI" -elif virsh uri >/dev/null 2>&1; then - default_uri=$(virsh uri) - ARGS="$ARGS --connect '$default_uri'" -fi - -lockfile=/var/lock/subsys/$prog - -start() { - [ -x $exec ] || exit 5 - [ -f $config ] || exit 6 - echo -n $"Starting $prog: " - daemon $exec $ARGS - retval=$? - echo - [ $retval -eq 0 ] && touch $lockfile - return $retval -} - -stop() { - echo -n $"Stopping $prog: " - killproc $prog - rm -f /var/run/$prog.pid - retval=$? - echo - [ $retval -eq 0 ] && rm -f $lockfile - return $retval -} - -restart() { - stop - start -} - -reload() { - restart -} - -force_reload() { - restart -} - -rh_status() { - status $prog -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - - -case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart) - $1 - ;; - reload) - rh_status_q || exit 7 - $1 - ;; - force-reload) - force_reload - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - restart - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" - exit 2 -esac -exit $? diff --git a/vhostmd.spec b/vhostmd.spec index cbcc927..d56c37a 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -2,38 +2,14 @@ Summary: Virtualization host metrics daemon Name: vhostmd -Version: 0.5 -Release: 18%{?dist} +Version: 1.0 +Release: 1%{?dist} License: GPLv2+ URL: http://gitorious.org/vhostmd -# Upstream tarball hosting is screwed at the moment. This release is -# of the 0.5 branch, with 'make dist' done by the packager. -Source0: vhostmd-%{version}.tar.bz2 -Source1: vhostmd.init -Source2: vhostmd.sysconfig -Source3: vhostmd.conf - -# These commits have been added upstream since vhostmd 0.5 was -# released. -Patch0001: 0001-Security-Set-supplemental-groups-correctly-when-drop.patch -Patch0002: 0002-libmetrics-Return-error-indication-up-through-get_me.patch -Patch0003: 0003-Make-Xen-Libraries-really-optional.patch -Patch0004: 0004-Add-contact-info-to-README.patch -Patch0005: 0005-Fix-name-and-location-of-the-vhostmd.conf-file.patch -Patch0006: 0006-fix-typo-in-vhostmd.init-virutalization.patch -Patch0007: 0007-Modernize-build-files.patch -Patch0008: 0008-Add-systemd-service-file.patch -Patch0009: 0009-Remove-xenctrl-support.patch -Patch0010: 0010-Remove-support-for-libxenstat.patch -Patch0011: 0011-Fix-compilation-with-xenstore.patch -Patch0012: 0012-Fix-typo-in-systemd-service-file.patch -Patch0013: 0013-Fix-help-option.patch -Patch0014: 0014-Add-SIGPIPE-handler-and-reconnect.patch -Patch0015: 0015-fix-deallocation-in-vu_vm_free.patch -Patch0016: 0016-configure-fix-logic-in-init-script-check.patch -Patch0017: 0017-conf-Improve-example-configuration-file.patch +Source0: https://github.com/vhostmd/vhostmd/archive/v%{version}/%{name}-%{version}.tar.gz +Source1: vhostmd.conf BuildRequires: gcc BuildRequires: chrpath @@ -96,8 +72,8 @@ rm -rf $RPM_BUILD_ROOT make DESTDIR=$RPM_BUILD_ROOT install -#rm $RPM_BUILD_ROOT%{_libdir}/libmetrics.a rm $RPM_BUILD_ROOT%{_libdir}/libmetrics.la +rm $RPM_BUILD_ROOT%{_libdir}/libserialclient.la chrpath --delete $RPM_BUILD_ROOT%{_sbindir}/vm-dump-metrics @@ -111,7 +87,7 @@ rm $RPM_BUILD_ROOT%{_sysconfdir}/vhostmd/metric.dtd # for anyone else. Replace it with one which is better for libvirt # users. rm $RPM_BUILD_ROOT%{_sysconfdir}/vhostmd/vhostmd.conf -cp %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/vhostmd/vhostmd.conf +cp %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/vhostmd/vhostmd.conf %if 0%{?rhel} # Remove Perl script (https://bugzilla.redhat.com/show_bug.cgi?id=749875) @@ -166,17 +142,27 @@ exit 0 %{_sbindir}/vm-dump-metrics %{_libdir}/libmetrics.so.0 %{_libdir}/libmetrics.so.0.0.0 +%{_libdir}/libserialclient.so.0 +%{_libdir}/libserialclient.so.0.0.0 %{_mandir}/man1/vm-dump-metrics.1.gz %files -n vm-dump-metrics-devel %doc README %{_libdir}/libmetrics.so +%{_libdir}/libserialclient.so %dir %{_includedir}/vhostmd %{_includedir}/vhostmd/libmetrics.h %changelog +* Fri Jan 18 2019 Richard W.M. Jones - 1.0-1 +- Upstream version 1.0. +- Remove patches, since all included 1.0. +- Fix Source0 URL, hosted on github. +- Remove old Source1 and Source2, not used. +- Add new serial client library. + * Tue Oct 16 2018 Richard W.M. Jones - 0.5-19 - Include all upstream patches since 0.5. - Enable systemd init scripts (RHBZ#1592400). diff --git a/vhostmd.sysconfig b/vhostmd.sysconfig deleted file mode 100644 index 2579454..0000000 --- a/vhostmd.sysconfig +++ /dev/null @@ -1,14 +0,0 @@ -# Uncomment the following line to print verbose messages. -#VHOSTMD_VERBOSE=1 - -# Override the default configuration file path. -#VHOSTMD_CONFIG=/path/to/vhostmd.conf - -# Set the user that the daemon runs as after dropping root privs. -VHOSTMD_USER=vhostmd - -# Set the libvirt URI. -# Choose between KVM and Xen here. If both are commented out then -# the libvirt default URI will be used. -VHOSTMD_URI=qemu:///system -#VHOSTMD_URI=xen:/// From bd3e0883add0643094ded0c86ae939f4db797536 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 18 Jan 2019 11:03:11 +0000 Subject: [PATCH 45/71] Remove libserialclient. --- 0001-Remove-libserialclient.patch | 422 ++++++++++++++++++ ...-NULL-string-to-library-log-function.patch | 27 ++ vhostmd.spec | 15 +- 3 files changed, 457 insertions(+), 7 deletions(-) create mode 100644 0001-Remove-libserialclient.patch create mode 100644 0002-Don-t-pass-NULL-string-to-library-log-function.patch diff --git a/0001-Remove-libserialclient.patch b/0001-Remove-libserialclient.patch new file mode 100644 index 0000000..b52e2c2 --- /dev/null +++ b/0001-Remove-libserialclient.patch @@ -0,0 +1,422 @@ +From 89ba5ba4bad7267615d2ae77a40abb5de249fb94 Mon Sep 17 00:00:00 2001 +From: Michael Trapp +Date: Fri, 7 Dec 2018 19:12:22 +0100 +Subject: [PATCH 1/2] Remove libserialclient + +There is no need to keep the dump_virtio code in a separate library. +Revert libserialclient changes and move the code to libmetrics. +--- + libmetrics/Makefile.am | 18 +--- + libmetrics/libmetrics.c | 131 ++++++++++++++++++++++++++ + libmetrics/libmetrics.h | 4 - + libmetrics/libserialclient.c | 172 ----------------------------------- + libmetrics/libserialclient.h | 30 ------ + 5 files changed, 133 insertions(+), 222 deletions(-) + delete mode 100644 libmetrics/libserialclient.c + delete mode 100644 libmetrics/libserialclient.h + +diff --git a/libmetrics/Makefile.am b/libmetrics/Makefile.am +index 468f08f..254b2c8 100644 +--- a/libmetrics/Makefile.am ++++ b/libmetrics/Makefile.am +@@ -6,7 +6,7 @@ if WITH_XENSTORE + AM_CFLAGS += -DWITH_XENSTORE + endif + +-lib_LTLIBRARIES=libmetrics.la libserialclient.la ++lib_LTLIBRARIES=libmetrics.la + + libmetricsincdir=$(includedir)/vhostmd + libmetricsinc_HEADERS = libmetrics.h +@@ -15,21 +15,7 @@ libmetrics_la_SOURCES = \ + libmetrics.c \ + vm_metrics.c \ + host_metrics.c \ +- libserialclient.c \ + libmetrics.h + + libmetrics_la_DEPENDENCIES = \ +- libmetrics.h \ +- libserialclient.h +- +- +-libserialclientincdir= +-libserialclientinc_HEADERS = libserialclient.h +- +-libserialclient_la_SOURCES = \ +- libserialclient.c \ +- libserialclient.h +- +-libserialclient_la_DEPENDENCIES = \ +- libserialclient.h +- ++ libmetrics.h +diff --git a/libmetrics/libmetrics.c b/libmetrics/libmetrics.c +index bc3ba1d..0a5e3ee 100644 +--- a/libmetrics/libmetrics.c ++++ b/libmetrics/libmetrics.c +@@ -775,3 +775,134 @@ out: + } + #endif + ++/* ++ * dump metrics from virtio serial port to buffer ++ */ ++static char *get_virtio_metrics(void) ++{ ++ const char request[] = "GET /metrics/XML\n\n", end_token[] = "\n\n"; ++ const char dev[] = "/dev/virtio-ports/org.github.vhostmd.1"; ++ ++ char *response = NULL; ++ int fd = -1; ++ size_t pos; ++ size_t buf_size = (1 << 16); ++ const size_t req_len = (size_t) strlen(request); ++ const time_t start_time = time(NULL); ++ ++ response = calloc(1UL, buf_size); ++ if (response == NULL) ++ goto error; ++ ++ fd = open(dev, O_RDWR | O_NONBLOCK); ++ ++ if (fd < 0) { ++ libmsg("Error, unable to export metrics: open(%s) %s\n", ++ dev, strerror(errno)); ++ goto error; ++ } ++ ++ pos = 0; ++ while (pos < req_len) { ++ ssize_t len = write(fd, &request[pos], req_len - pos); ++ if (len > 0) ++ pos += (size_t) len; ++ else { ++ if (errno == EAGAIN) ++ usleep(10000); ++ else ++ goto error; ++ } ++ } ++ ++ pos = 0; ++ do { ++ ssize_t len = read(fd, &response[pos], buf_size - pos - 1); ++ if (len > 0) { ++ pos += (size_t) len; ++ response[pos] = 0; ++ ++ if ((pos + 1) >= buf_size) { ++ buf_size = buf_size << 1; /* increase response buffer */ ++ if (buf_size > (1 << 24)) /* max 16MB */ ++ goto error; ++ ++ response = realloc(response, buf_size); ++ if (response == NULL) ++ goto error; ++ ++ memset(&response[pos], 0, buf_size - pos); ++ } ++ } else { ++ if (errno == EAGAIN) { ++ usleep(10000); ++ if (time(NULL) > (start_time + 30)) { ++ libmsg("Error, unable to read metrics" ++ " - timeout after 30s\n"); ++ goto error; ++ } ++ } else ++ goto error; ++ } ++ } while ((pos < (size_t) strlen(end_token) || ++ strcmp(end_token, &response[pos - (size_t) strlen(end_token)]) != 0) && ++ pos < buf_size); ++ ++ if (fd >= 0) ++ close(fd); ++ ++ return response; ++ ++ error: ++ if (fd >= 0) ++ close(fd); ++ if (response) ++ free(response); ++ ++ return NULL; ++} ++ ++/* ++ * dump metrics from virtio serial port to xml formatted file ++ */ ++int dump_virtio_metrics(const char *dest_file) ++{ ++ FILE *fp = stdout; ++ char *response = NULL; ++ size_t len; ++ ++ response = get_virtio_metrics(); ++ if (response == NULL) ++ goto error; ++ ++ len = strlen(response); ++ ++ if (dest_file) { ++ fp = fopen(dest_file, "w"); ++ if (fp == NULL) { ++ libmsg("Error, unable to dump metrics: fopen(%s) %s\n", ++ dest_file, strerror(errno)); ++ goto error; ++ } ++ } ++ ++ if (fwrite(response, 1UL, len, fp) != len) { ++ libmsg("Error, unable to export metrics to file:%s %s\n", ++ dest_file ? dest_file : "stdout", strerror(errno)); ++ goto error; ++ } ++ ++ if (response) ++ free(response); ++ ++ return 0; ++ ++ error: ++ if (dest_file && fp) ++ fclose(fp); ++ ++ if (response) ++ free(response); ++ ++ return -1; ++} +diff --git a/libmetrics/libmetrics.h b/libmetrics/libmetrics.h +index 1908de8..c4873ff 100644 +--- a/libmetrics/libmetrics.h ++++ b/libmetrics/libmetrics.h +@@ -102,8 +102,4 @@ int dump_xenstore_metrics(const char *dest_file); + + /* dump metrics from virtio serial port to xml formatted file */ + int dump_virtio_metrics(const char *dest_file); +- +-/* dump metrics from virtio serial port to buffer */ +-const char *get_virtio_metrics(const char *dev_name); +- + #endif +diff --git a/libmetrics/libserialclient.c b/libmetrics/libserialclient.c +deleted file mode 100644 +index d3a4af5..0000000 +--- a/libmetrics/libserialclient.c ++++ /dev/null +@@ -1,172 +0,0 @@ +-/* +- * Copyright (C) 2018 SAP SE +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2.1 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- * +- * Author: Michael Trapp +- */ +- +-#include +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include "libserialclient.h" +- +- +-/* +- * dump metrics from virtio serial port to xml formatted file +- */ +-int dump_virtio_metrics(const char *dest_file) +-{ +- FILE *fp = stdout; +- char *response; +- size_t len; +- +- response = get_virtio_metrics(NULL); +- if (response == NULL) +- goto error; +- +- len = strlen(response); +- +- if (dest_file) { +- fp = fopen(dest_file, "w"); +- if (fp == NULL) { +- fprintf(stderr, +- "LIB_SERIALCLIENT: Error, unable to dump metrics: fopen(%s) %s\n", +- dest_file, strerror(errno)); +- goto error; +- } +- } +- +- if (fwrite(response, 1UL, len, fp) != len) { +- fprintf(stderr, +- "LIB_SERIALCLIENT: Error, unable to export metrics to file:%s - error:%s\n", +- dest_file ? dest_file : "STDOUT", strerror(errno)); +- goto error; +- } +- +- if (response) +- free(response); +- +- return 0; +- +- error: +- if (dest_file && fp) +- fclose(fp); +- +- if (response) +- free(response); +- +- return -1; +-} +- +-/* +- * dump metrics from virtio serial port to buffer +- */ +-char *get_virtio_metrics(const char *dev_name) +-{ +- const char request[] = "GET /metrics/XML\n\n", end_token[] = "\n\n"; +- const char *dev; +- char *response = NULL; +- int fd = -1; +- size_t pos; +- size_t buf_size = (1 << 16); +- const size_t req_len = (size_t) strlen(request); +- const time_t start_time = time(NULL); +- +- if (dev_name) +- dev = dev_name; +- else +- dev = "/dev/virtio-ports/org.github.vhostmd.1"; +- +- response = calloc(1UL, buf_size); +- if (response == NULL) +- goto error; +- +- fd = open(dev, O_RDWR | O_NONBLOCK); +- +- if (fd < 0) { +- fprintf(stderr, +- "LIB_SERIALCLIENT: Error, unable to dump metrics: open(%s) %s\n", +- dev, strerror(errno)); +- goto error; +- } +- +- pos = 0; +- while (pos < req_len) { +- ssize_t len = write(fd, &request[pos], req_len - pos); +- if (len > 0) +- pos += (size_t) len; +- else { +- if (errno == EAGAIN) +- usleep(10000); +- else +- goto error; +- } +- } +- +- pos = 0; +- do { +- ssize_t len = read(fd, &response[pos], buf_size - pos - 1); +- if (len > 0) { +- pos += (size_t) len; +- response[pos] = 0; +- +- if ((pos + 1) >= buf_size) { +- buf_size = buf_size << 1; /* increase response buffer */ +- if (buf_size > (1 << 24)) /* max 16MB */ +- goto error; +- +- response = realloc(response, buf_size); +- if (response == NULL) +- goto error; +- +- memset(&response[pos], 0, buf_size - pos); +- } +- } else { +- if (errno == EAGAIN) { +- usleep(10000); +- if (time(NULL) > (start_time + 30)) { +- fprintf(stderr, +- "LIB_SERIALCLIENT: Error, unable to read metrics" +- " - timeout after 30s\n"); +- goto error; +- } +- } else +- goto error; +- } +- } while ((pos < (size_t) strlen(end_token) || +- strcmp(end_token, &response[pos - (size_t) strlen(end_token)]) != 0) && +- pos < buf_size); +- +- if (fd >= 0) +- close(fd); +- +- return response; +- +- error: +- if (fd >= 0) +- close(fd); +- if (response) +- free(response); +- +- return NULL; +-} +diff --git a/libmetrics/libserialclient.h b/libmetrics/libserialclient.h +deleted file mode 100644 +index 887c6a5..0000000 +--- a/libmetrics/libserialclient.h ++++ /dev/null +@@ -1,30 +0,0 @@ +-/* +- * Copyright (C) 2018 SAP SE +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2.1 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- * +- * Author: Michael Trapp +- */ +- +-#ifndef __LIBSERIALCLIENT_H__ +-#define __LIBSERIALCLIENT_H__ +- +-/* dump metrics from virtio serial port to xml formatted file */ +-int dump_virtio_metrics(const char *dest_file); +- +-/* dump metrics from virtio serial port to buffer */ +-char *get_virtio_metrics(const char *dev_name); +- +-#endif +-- +2.20.1 + diff --git a/0002-Don-t-pass-NULL-string-to-library-log-function.patch b/0002-Don-t-pass-NULL-string-to-library-log-function.patch new file mode 100644 index 0000000..0379a61 --- /dev/null +++ b/0002-Don-t-pass-NULL-string-to-library-log-function.patch @@ -0,0 +1,27 @@ +From 57698b6b2c05e2288b72ae36afa93a2e555c72fd Mon Sep 17 00:00:00 2001 +From: Michael Trapp +Date: Fri, 7 Dec 2018 19:12:40 +0100 +Subject: [PATCH 2/2] Don't pass NULL string to library log function + +--- + libmetrics/libmetrics.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libmetrics/libmetrics.c b/libmetrics/libmetrics.c +index 0a5e3ee..36c7f5f 100644 +--- a/libmetrics/libmetrics.c ++++ b/libmetrics/libmetrics.c +@@ -681,8 +681,8 @@ int dump_metrics(const char *dest_file) + } + + if (fwrite(mdisk->buffer, 1, mdisk->length, fp) != mdisk->length) { +- libmsg("Error, unable to export metrics to file:%s - error:%s\n", +- dest_file, strerror(errno)); ++ libmsg("Error, unable to export metrics to file:%s - error:%s\n", ++ dest_file ? dest_file : "stdout", strerror(errno)); + } + if (dest_file) + fclose(fp); +-- +2.20.1 + diff --git a/vhostmd.spec b/vhostmd.spec index d56c37a..79b2262 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -3,7 +3,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 1.0 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ URL: http://gitorious.org/vhostmd @@ -11,6 +11,11 @@ URL: http://gitorious.org/vhostmd Source0: https://github.com/vhostmd/vhostmd/archive/v%{version}/%{name}-%{version}.tar.gz Source1: vhostmd.conf +# Upstream patches since 1.0 was released. Note the first patch +# removes the libserialclient API (present, temporarily, in 1.0). +Patch0001: 0001-Remove-libserialclient.patch +Patch0002: 0002-Don-t-pass-NULL-string-to-library-log-function.patch + BuildRequires: gcc BuildRequires: chrpath BuildRequires: perl-generators @@ -73,7 +78,6 @@ rm -rf $RPM_BUILD_ROOT make DESTDIR=$RPM_BUILD_ROOT install rm $RPM_BUILD_ROOT%{_libdir}/libmetrics.la -rm $RPM_BUILD_ROOT%{_libdir}/libserialclient.la chrpath --delete $RPM_BUILD_ROOT%{_sbindir}/vm-dump-metrics @@ -142,26 +146,23 @@ exit 0 %{_sbindir}/vm-dump-metrics %{_libdir}/libmetrics.so.0 %{_libdir}/libmetrics.so.0.0.0 -%{_libdir}/libserialclient.so.0 -%{_libdir}/libserialclient.so.0.0.0 %{_mandir}/man1/vm-dump-metrics.1.gz %files -n vm-dump-metrics-devel %doc README %{_libdir}/libmetrics.so -%{_libdir}/libserialclient.so %dir %{_includedir}/vhostmd %{_includedir}/vhostmd/libmetrics.h %changelog -* Fri Jan 18 2019 Richard W.M. Jones - 1.0-1 +* Fri Jan 18 2019 Richard W.M. Jones - 1.0-2 - Upstream version 1.0. - Remove patches, since all included 1.0. +- Add patches since 1.0. - Fix Source0 URL, hosted on github. - Remove old Source1 and Source2, not used. -- Add new serial client library. * Tue Oct 16 2018 Richard W.M. Jones - 0.5-19 - Include all upstream patches since 0.5. From 105c3803e0bfeb56f0b4954078311f8facf1075e Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sun, 3 Feb 2019 11:14:56 +0000 Subject: [PATCH 46/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- vhostmd.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vhostmd.spec b/vhostmd.spec index 79b2262..fcca007 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -3,7 +3,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 1.0 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ URL: http://gitorious.org/vhostmd @@ -157,6 +157,9 @@ exit 0 %changelog +* Sun Feb 03 2019 Fedora Release Engineering - 1.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + * Fri Jan 18 2019 Richard W.M. Jones - 1.0-2 - Upstream version 1.0. - Remove patches, since all included 1.0. From e5a043ff978c06ce7817f81f010b25dfba4f8ca4 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 27 Jul 2019 02:56:57 +0000 Subject: [PATCH 47/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- vhostmd.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vhostmd.spec b/vhostmd.spec index fcca007..201bf32 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -3,7 +3,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 1.0 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2+ URL: http://gitorious.org/vhostmd @@ -157,6 +157,9 @@ exit 0 %changelog +* Sat Jul 27 2019 Fedora Release Engineering - 1.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + * Sun Feb 03 2019 Fedora Release Engineering - 1.0-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild From 8e296f6839c2805a75a4eaadc8f21cd72f364a8e Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 29 Aug 2019 09:07:01 +0100 Subject: [PATCH 48/71] Upstream version 1.1. Remove patches, since all included 1.1. --- .gitignore | 1 + 0001-Remove-libserialclient.patch | 422 ------------------ ...-NULL-string-to-library-log-function.patch | 27 -- sources | 2 +- vhostmd.spec | 13 +- 5 files changed, 8 insertions(+), 457 deletions(-) delete mode 100644 0001-Remove-libserialclient.patch delete mode 100644 0002-Don-t-pass-NULL-string-to-library-log-function.patch diff --git a/.gitignore b/.gitignore index 55af9f4..0583968 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ vhostmd-0.4.tar.bz2 /vhostmd-0.5.tar.bz2 /vhostmd-1.0.tar.gz +/vhostmd-1.1.tar.gz diff --git a/0001-Remove-libserialclient.patch b/0001-Remove-libserialclient.patch deleted file mode 100644 index b52e2c2..0000000 --- a/0001-Remove-libserialclient.patch +++ /dev/null @@ -1,422 +0,0 @@ -From 89ba5ba4bad7267615d2ae77a40abb5de249fb94 Mon Sep 17 00:00:00 2001 -From: Michael Trapp -Date: Fri, 7 Dec 2018 19:12:22 +0100 -Subject: [PATCH 1/2] Remove libserialclient - -There is no need to keep the dump_virtio code in a separate library. -Revert libserialclient changes and move the code to libmetrics. ---- - libmetrics/Makefile.am | 18 +--- - libmetrics/libmetrics.c | 131 ++++++++++++++++++++++++++ - libmetrics/libmetrics.h | 4 - - libmetrics/libserialclient.c | 172 ----------------------------------- - libmetrics/libserialclient.h | 30 ------ - 5 files changed, 133 insertions(+), 222 deletions(-) - delete mode 100644 libmetrics/libserialclient.c - delete mode 100644 libmetrics/libserialclient.h - -diff --git a/libmetrics/Makefile.am b/libmetrics/Makefile.am -index 468f08f..254b2c8 100644 ---- a/libmetrics/Makefile.am -+++ b/libmetrics/Makefile.am -@@ -6,7 +6,7 @@ if WITH_XENSTORE - AM_CFLAGS += -DWITH_XENSTORE - endif - --lib_LTLIBRARIES=libmetrics.la libserialclient.la -+lib_LTLIBRARIES=libmetrics.la - - libmetricsincdir=$(includedir)/vhostmd - libmetricsinc_HEADERS = libmetrics.h -@@ -15,21 +15,7 @@ libmetrics_la_SOURCES = \ - libmetrics.c \ - vm_metrics.c \ - host_metrics.c \ -- libserialclient.c \ - libmetrics.h - - libmetrics_la_DEPENDENCIES = \ -- libmetrics.h \ -- libserialclient.h -- -- --libserialclientincdir= --libserialclientinc_HEADERS = libserialclient.h -- --libserialclient_la_SOURCES = \ -- libserialclient.c \ -- libserialclient.h -- --libserialclient_la_DEPENDENCIES = \ -- libserialclient.h -- -+ libmetrics.h -diff --git a/libmetrics/libmetrics.c b/libmetrics/libmetrics.c -index bc3ba1d..0a5e3ee 100644 ---- a/libmetrics/libmetrics.c -+++ b/libmetrics/libmetrics.c -@@ -775,3 +775,134 @@ out: - } - #endif - -+/* -+ * dump metrics from virtio serial port to buffer -+ */ -+static char *get_virtio_metrics(void) -+{ -+ const char request[] = "GET /metrics/XML\n\n", end_token[] = "\n\n"; -+ const char dev[] = "/dev/virtio-ports/org.github.vhostmd.1"; -+ -+ char *response = NULL; -+ int fd = -1; -+ size_t pos; -+ size_t buf_size = (1 << 16); -+ const size_t req_len = (size_t) strlen(request); -+ const time_t start_time = time(NULL); -+ -+ response = calloc(1UL, buf_size); -+ if (response == NULL) -+ goto error; -+ -+ fd = open(dev, O_RDWR | O_NONBLOCK); -+ -+ if (fd < 0) { -+ libmsg("Error, unable to export metrics: open(%s) %s\n", -+ dev, strerror(errno)); -+ goto error; -+ } -+ -+ pos = 0; -+ while (pos < req_len) { -+ ssize_t len = write(fd, &request[pos], req_len - pos); -+ if (len > 0) -+ pos += (size_t) len; -+ else { -+ if (errno == EAGAIN) -+ usleep(10000); -+ else -+ goto error; -+ } -+ } -+ -+ pos = 0; -+ do { -+ ssize_t len = read(fd, &response[pos], buf_size - pos - 1); -+ if (len > 0) { -+ pos += (size_t) len; -+ response[pos] = 0; -+ -+ if ((pos + 1) >= buf_size) { -+ buf_size = buf_size << 1; /* increase response buffer */ -+ if (buf_size > (1 << 24)) /* max 16MB */ -+ goto error; -+ -+ response = realloc(response, buf_size); -+ if (response == NULL) -+ goto error; -+ -+ memset(&response[pos], 0, buf_size - pos); -+ } -+ } else { -+ if (errno == EAGAIN) { -+ usleep(10000); -+ if (time(NULL) > (start_time + 30)) { -+ libmsg("Error, unable to read metrics" -+ " - timeout after 30s\n"); -+ goto error; -+ } -+ } else -+ goto error; -+ } -+ } while ((pos < (size_t) strlen(end_token) || -+ strcmp(end_token, &response[pos - (size_t) strlen(end_token)]) != 0) && -+ pos < buf_size); -+ -+ if (fd >= 0) -+ close(fd); -+ -+ return response; -+ -+ error: -+ if (fd >= 0) -+ close(fd); -+ if (response) -+ free(response); -+ -+ return NULL; -+} -+ -+/* -+ * dump metrics from virtio serial port to xml formatted file -+ */ -+int dump_virtio_metrics(const char *dest_file) -+{ -+ FILE *fp = stdout; -+ char *response = NULL; -+ size_t len; -+ -+ response = get_virtio_metrics(); -+ if (response == NULL) -+ goto error; -+ -+ len = strlen(response); -+ -+ if (dest_file) { -+ fp = fopen(dest_file, "w"); -+ if (fp == NULL) { -+ libmsg("Error, unable to dump metrics: fopen(%s) %s\n", -+ dest_file, strerror(errno)); -+ goto error; -+ } -+ } -+ -+ if (fwrite(response, 1UL, len, fp) != len) { -+ libmsg("Error, unable to export metrics to file:%s %s\n", -+ dest_file ? dest_file : "stdout", strerror(errno)); -+ goto error; -+ } -+ -+ if (response) -+ free(response); -+ -+ return 0; -+ -+ error: -+ if (dest_file && fp) -+ fclose(fp); -+ -+ if (response) -+ free(response); -+ -+ return -1; -+} -diff --git a/libmetrics/libmetrics.h b/libmetrics/libmetrics.h -index 1908de8..c4873ff 100644 ---- a/libmetrics/libmetrics.h -+++ b/libmetrics/libmetrics.h -@@ -102,8 +102,4 @@ int dump_xenstore_metrics(const char *dest_file); - - /* dump metrics from virtio serial port to xml formatted file */ - int dump_virtio_metrics(const char *dest_file); -- --/* dump metrics from virtio serial port to buffer */ --const char *get_virtio_metrics(const char *dev_name); -- - #endif -diff --git a/libmetrics/libserialclient.c b/libmetrics/libserialclient.c -deleted file mode 100644 -index d3a4af5..0000000 ---- a/libmetrics/libserialclient.c -+++ /dev/null -@@ -1,172 +0,0 @@ --/* -- * Copyright (C) 2018 SAP SE -- * -- * This library is free software; you can redistribute it and/or -- * modify it under the terms of the GNU Lesser General Public -- * License as published by the Free Software Foundation; either -- * version 2.1 of the License, or (at your option) any later version. -- * -- * This library is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- * Lesser General Public License for more details. -- * -- * You should have received a copy of the GNU Lesser General Public -- * License along with this library; if not, write to the Free Software -- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- * -- * Author: Michael Trapp -- */ -- --#include -- --#include --#include --#include --#include --#include --#include --#include -- --#include "libserialclient.h" -- -- --/* -- * dump metrics from virtio serial port to xml formatted file -- */ --int dump_virtio_metrics(const char *dest_file) --{ -- FILE *fp = stdout; -- char *response; -- size_t len; -- -- response = get_virtio_metrics(NULL); -- if (response == NULL) -- goto error; -- -- len = strlen(response); -- -- if (dest_file) { -- fp = fopen(dest_file, "w"); -- if (fp == NULL) { -- fprintf(stderr, -- "LIB_SERIALCLIENT: Error, unable to dump metrics: fopen(%s) %s\n", -- dest_file, strerror(errno)); -- goto error; -- } -- } -- -- if (fwrite(response, 1UL, len, fp) != len) { -- fprintf(stderr, -- "LIB_SERIALCLIENT: Error, unable to export metrics to file:%s - error:%s\n", -- dest_file ? dest_file : "STDOUT", strerror(errno)); -- goto error; -- } -- -- if (response) -- free(response); -- -- return 0; -- -- error: -- if (dest_file && fp) -- fclose(fp); -- -- if (response) -- free(response); -- -- return -1; --} -- --/* -- * dump metrics from virtio serial port to buffer -- */ --char *get_virtio_metrics(const char *dev_name) --{ -- const char request[] = "GET /metrics/XML\n\n", end_token[] = "\n\n"; -- const char *dev; -- char *response = NULL; -- int fd = -1; -- size_t pos; -- size_t buf_size = (1 << 16); -- const size_t req_len = (size_t) strlen(request); -- const time_t start_time = time(NULL); -- -- if (dev_name) -- dev = dev_name; -- else -- dev = "/dev/virtio-ports/org.github.vhostmd.1"; -- -- response = calloc(1UL, buf_size); -- if (response == NULL) -- goto error; -- -- fd = open(dev, O_RDWR | O_NONBLOCK); -- -- if (fd < 0) { -- fprintf(stderr, -- "LIB_SERIALCLIENT: Error, unable to dump metrics: open(%s) %s\n", -- dev, strerror(errno)); -- goto error; -- } -- -- pos = 0; -- while (pos < req_len) { -- ssize_t len = write(fd, &request[pos], req_len - pos); -- if (len > 0) -- pos += (size_t) len; -- else { -- if (errno == EAGAIN) -- usleep(10000); -- else -- goto error; -- } -- } -- -- pos = 0; -- do { -- ssize_t len = read(fd, &response[pos], buf_size - pos - 1); -- if (len > 0) { -- pos += (size_t) len; -- response[pos] = 0; -- -- if ((pos + 1) >= buf_size) { -- buf_size = buf_size << 1; /* increase response buffer */ -- if (buf_size > (1 << 24)) /* max 16MB */ -- goto error; -- -- response = realloc(response, buf_size); -- if (response == NULL) -- goto error; -- -- memset(&response[pos], 0, buf_size - pos); -- } -- } else { -- if (errno == EAGAIN) { -- usleep(10000); -- if (time(NULL) > (start_time + 30)) { -- fprintf(stderr, -- "LIB_SERIALCLIENT: Error, unable to read metrics" -- " - timeout after 30s\n"); -- goto error; -- } -- } else -- goto error; -- } -- } while ((pos < (size_t) strlen(end_token) || -- strcmp(end_token, &response[pos - (size_t) strlen(end_token)]) != 0) && -- pos < buf_size); -- -- if (fd >= 0) -- close(fd); -- -- return response; -- -- error: -- if (fd >= 0) -- close(fd); -- if (response) -- free(response); -- -- return NULL; --} -diff --git a/libmetrics/libserialclient.h b/libmetrics/libserialclient.h -deleted file mode 100644 -index 887c6a5..0000000 ---- a/libmetrics/libserialclient.h -+++ /dev/null -@@ -1,30 +0,0 @@ --/* -- * Copyright (C) 2018 SAP SE -- * -- * This library is free software; you can redistribute it and/or -- * modify it under the terms of the GNU Lesser General Public -- * License as published by the Free Software Foundation; either -- * version 2.1 of the License, or (at your option) any later version. -- * -- * This library is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- * Lesser General Public License for more details. -- * -- * You should have received a copy of the GNU Lesser General Public -- * License along with this library; if not, write to the Free Software -- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- * -- * Author: Michael Trapp -- */ -- --#ifndef __LIBSERIALCLIENT_H__ --#define __LIBSERIALCLIENT_H__ -- --/* dump metrics from virtio serial port to xml formatted file */ --int dump_virtio_metrics(const char *dest_file); -- --/* dump metrics from virtio serial port to buffer */ --char *get_virtio_metrics(const char *dev_name); -- --#endif --- -2.20.1 - diff --git a/0002-Don-t-pass-NULL-string-to-library-log-function.patch b/0002-Don-t-pass-NULL-string-to-library-log-function.patch deleted file mode 100644 index 0379a61..0000000 --- a/0002-Don-t-pass-NULL-string-to-library-log-function.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 57698b6b2c05e2288b72ae36afa93a2e555c72fd Mon Sep 17 00:00:00 2001 -From: Michael Trapp -Date: Fri, 7 Dec 2018 19:12:40 +0100 -Subject: [PATCH 2/2] Don't pass NULL string to library log function - ---- - libmetrics/libmetrics.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/libmetrics/libmetrics.c b/libmetrics/libmetrics.c -index 0a5e3ee..36c7f5f 100644 ---- a/libmetrics/libmetrics.c -+++ b/libmetrics/libmetrics.c -@@ -681,8 +681,8 @@ int dump_metrics(const char *dest_file) - } - - if (fwrite(mdisk->buffer, 1, mdisk->length, fp) != mdisk->length) { -- libmsg("Error, unable to export metrics to file:%s - error:%s\n", -- dest_file, strerror(errno)); -+ libmsg("Error, unable to export metrics to file:%s - error:%s\n", -+ dest_file ? dest_file : "stdout", strerror(errno)); - } - if (dest_file) - fclose(fp); --- -2.20.1 - diff --git a/sources b/sources index a5cb2ed..0c0aaef 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (vhostmd-1.0.tar.gz) = 0479f2b4cebd2d3aa603516b4c6db03ba4f998ab5c25965cc26b1b64ff9a33ac5d6e5a973361931a11b641500fc21b187881756726e92d96a924f47efac2e7cf +SHA512 (vhostmd-1.1.tar.gz) = 9fad55c96c504b59345fb670d9ae9b83c892d82f05784253c8826436a1a75419bb73d6be48a8f8d956f89c77ab4f54a85200e92078c22c8f156954ca8f434d49 diff --git a/vhostmd.spec b/vhostmd.spec index 201bf32..84d1e0f 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -2,8 +2,8 @@ Summary: Virtualization host metrics daemon Name: vhostmd -Version: 1.0 -Release: 4%{?dist} +Version: 1.1 +Release: 1%{?dist} License: GPLv2+ URL: http://gitorious.org/vhostmd @@ -11,11 +11,6 @@ URL: http://gitorious.org/vhostmd Source0: https://github.com/vhostmd/vhostmd/archive/v%{version}/%{name}-%{version}.tar.gz Source1: vhostmd.conf -# Upstream patches since 1.0 was released. Note the first patch -# removes the libserialclient API (present, temporarily, in 1.0). -Patch0001: 0001-Remove-libserialclient.patch -Patch0002: 0002-Don-t-pass-NULL-string-to-library-log-function.patch - BuildRequires: gcc BuildRequires: chrpath BuildRequires: perl-generators @@ -157,6 +152,10 @@ exit 0 %changelog +* Thu Aug 29 2019 Richard W.M. Jones - 1.1-1 +- Upstream version 1.1. +- Remove patches, since all included 1.1. + * Sat Jul 27 2019 Fedora Release Engineering - 1.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild From fea444b84f65496640a81f61ba7409c5ada8f28c Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 31 Jan 2020 03:06:40 +0000 Subject: [PATCH 49/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- vhostmd.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vhostmd.spec b/vhostmd.spec index 84d1e0f..8269322 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -3,7 +3,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 1.1 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ URL: http://gitorious.org/vhostmd @@ -152,6 +152,9 @@ exit 0 %changelog +* Fri Jan 31 2020 Fedora Release Engineering - 1.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + * Thu Aug 29 2019 Richard W.M. Jones - 1.1-1 - Upstream version 1.1. - Remove patches, since all included 1.1. From e422a2a3a0f594aabccab78394c045e9efb543d5 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 29 Jul 2020 13:40:50 +0000 Subject: [PATCH 50/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- vhostmd.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vhostmd.spec b/vhostmd.spec index 8269322..adfdbcc 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -3,7 +3,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 1.1 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ URL: http://gitorious.org/vhostmd @@ -152,6 +152,9 @@ exit 0 %changelog +* Wed Jul 29 2020 Fedora Release Engineering - 1.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + * Fri Jan 31 2020 Fedora Release Engineering - 1.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild From 4dd9235786ee92b2e860a0158c368eb5380cd992 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Sat, 9 Jan 2021 00:41:31 +0000 Subject: [PATCH 51/71] Add BuildRequires: make https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot --- vhostmd.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/vhostmd.spec b/vhostmd.spec index adfdbcc..453de70 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -11,6 +11,7 @@ URL: http://gitorious.org/vhostmd Source0: https://github.com/vhostmd/vhostmd/archive/v%{version}/%{name}-%{version}.tar.gz Source1: vhostmd.conf +BuildRequires: make BuildRequires: gcc BuildRequires: chrpath BuildRequires: perl-generators From 5d6e8f685ce26e9f6d6e554396ff7eca4a4e6268 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 27 Jan 2021 23:02:15 +0000 Subject: [PATCH 52/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- vhostmd.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vhostmd.spec b/vhostmd.spec index 453de70..13b5f13 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -3,7 +3,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 1.1 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2+ URL: http://gitorious.org/vhostmd @@ -153,6 +153,9 @@ exit 0 %changelog +* Wed Jan 27 2021 Fedora Release Engineering - 1.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + * Wed Jul 29 2020 Fedora Release Engineering - 1.1-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild From 6f8231b1f9d4339bbf511014d70c2b95b66567ab Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 4 Feb 2021 08:59:31 +0000 Subject: [PATCH 53/71] Increase release so > RHEL 8 (RHBZ#1924966). Unify spec files between RHEL and Fedora. --- ...ax-virtio-requirement-in-config-file.patch | 42 +++++++++++++++++++ vhostmd.spec | 18 +++++++- 2 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 0001-Relax-virtio-requirement-in-config-file.patch diff --git a/0001-Relax-virtio-requirement-in-config-file.patch b/0001-Relax-virtio-requirement-in-config-file.patch new file mode 100644 index 0000000..5f49e4c --- /dev/null +++ b/0001-Relax-virtio-requirement-in-config-file.patch @@ -0,0 +1,42 @@ +From 83cc269f6892852be94467cea771b3ad1da8a369 Mon Sep 17 00:00:00 2001 +From: Jim Fehlig +Date: Tue, 8 Oct 2019 20:56:18 -0600 +Subject: [PATCH] Relax virtio requirement in config file + +When the virtio transport was introduced the schema was changed to +require a transport in vhostmd.conf. When updating existing +deployments without a virtio transport specified in vhostmd.conf, +vhostmd fails to start + +/usr/sbin/vhostmd -d +/etc/vhostmd/vhostmd.conf:41: element globals: validity error : Element +globals content does not follow the DTD, expecting (disk , virtio , +update_period , path , transport+), got (disk update_period path transport ) +validate_config_file(): Failed to validate :/etc/vhostmd/vhostmd.conf +Config file: /etc/vhostmd/vhostmd.conf, fails DTD validation + +Relax the requirement for virtio transport in the schema. With the +introduction of multiple transports perhaps the others shoud be optional +as well, but requiring virtio is clearly a regression. + +Signed-off-by: Jim Fehlig +--- + vhostmd.dtd | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/vhostmd.dtd b/vhostmd.dtd +index db417fd..888270e 100644 +--- a/vhostmd.dtd ++++ b/vhostmd.dtd +@@ -9,7 +9,7 @@ Virtual Host Metrics Daemon (vhostmd). Configuration file DTD + --> + + +- ++ + + + +-- +2.24.1 + diff --git a/vhostmd.spec b/vhostmd.spec index 13b5f13..6603a65 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -3,14 +3,19 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 1.1 -Release: 4%{?dist} +Release: 6%{?dist} License: GPLv2+ -URL: http://gitorious.org/vhostmd +URL: https://github.com/vhostmd/vhostmd Source0: https://github.com/vhostmd/vhostmd/archive/v%{version}/%{name}-%{version}.tar.gz Source1: vhostmd.conf +# Prevents updates from previous versions with the old config file +# from breaking (RHBZ#1782897). +# https://github.com/vhostmd/vhostmd/commit/83cc269f6892852be94467cea771b3ad1da8a369 +Patch1: 0001-Relax-virtio-requirement-in-config-file.patch + BuildRequires: make BuildRequires: gcc BuildRequires: chrpath @@ -27,6 +32,11 @@ BuildRequires: systemd BuildRequires: xen-devel %endif +# This is hopefully temporary, but required to run vhostmd.xml as +# currently written. For more information see: +# https://bugzilla.redhat.com/show_bug.cgi?id=1897130 +Requires: libvirt + %description vhostmd provides a "metrics communication channel" between a host and @@ -153,6 +163,10 @@ exit 0 %changelog +* Thu Feb 04 2021 Richard W.M. Jones - 1.1-6 +- Increase release so > RHEL 8 (RHBZ#1924966). +- Unify spec files between RHEL and Fedora. + * Wed Jan 27 2021 Fedora Release Engineering - 1.1-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild From 24499ef94d58ab33840e102b3c33a4908148c888 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 9 Feb 2021 10:16:49 +0000 Subject: [PATCH 54/71] Unify vhostmd.conf with RHEL 8.4 (RHBZ#1924966). --- vhostmd.conf | 8 ++++++-- vhostmd.spec | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) mode change 100644 => 100755 vhostmd.conf diff --git a/vhostmd.conf b/vhostmd.conf old mode 100644 new mode 100755 index 21c0f22..955dd2f --- a/vhostmd.conf +++ b/vhostmd.conf @@ -80,10 +80,15 @@ way. 256 + + 1024 + 15 + 60 /bin:/sbin:/usr/bin:/usr/sbin:/usr/share/vhostmd/scripts vbd + virtio @@ -97,8 +102,7 @@ way. VirtualizationVendor - rpm -qi libvirt| grep Vendor: \ - | awk '{ print substr($0, index($0, $5)); }' | sort -u + rpm -q --queryformat "%{VENDOR}\n" libvirt | sort -u diff --git a/vhostmd.spec b/vhostmd.spec index 6603a65..db5ba81 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -3,7 +3,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 1.1 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv2+ URL: https://github.com/vhostmd/vhostmd @@ -163,6 +163,9 @@ exit 0 %changelog +* Tue Feb 09 2021 Richard W.M. Jones - 1.1-7 +- Unify vhostmd.conf with RHEL 8.4 (RHBZ#1924966). + * Thu Feb 04 2021 Richard W.M. Jones - 1.1-6 - Increase release so > RHEL 8 (RHBZ#1924966). - Unify spec files between RHEL and Fedora. From 7ff113517860dbebeed5f948cd1da626f945cf7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 2 Mar 2021 16:12:03 +0100 Subject: [PATCH 55/71] Rebuilt for updated systemd-rpm-macros See https://pagure.io/fesco/issue/2583. --- vhostmd.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vhostmd.spec b/vhostmd.spec index db5ba81..bdd5719 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -3,7 +3,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 1.1 -Release: 7%{?dist} +Release: 8%{?dist} License: GPLv2+ URL: https://github.com/vhostmd/vhostmd @@ -163,6 +163,10 @@ exit 0 %changelog +* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek - 1.1-8 +- Rebuilt for updated systemd-rpm-macros + See https://pagure.io/fesco/issue/2583. + * Tue Feb 09 2021 Richard W.M. Jones - 1.1-7 - Unify vhostmd.conf with RHEL 8.4 (RHBZ#1924966). From 325e0045bc526a256b8b72b7d309b2cb79a49f9d Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 23 Jun 2021 10:56:24 +0100 Subject: [PATCH 56/71] Add gating tests (for RHEL) --- gating.yaml | 7 +++++++ tests/basic-test.sh | 6 ++++++ tests/tests.yml | 11 +++++++++++ 3 files changed, 24 insertions(+) create mode 100644 gating.yaml create mode 100755 tests/basic-test.sh create mode 100644 tests/tests.yml diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..1bef654 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,7 @@ +--- !Policy +product_versions: + - rhel-* +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} + - !PassingTestCaseRule {test_case_name: manual.sst_virtualization.vhostmd.manual-test} diff --git a/tests/basic-test.sh b/tests/basic-test.sh new file mode 100755 index 0000000..962990e --- /dev/null +++ b/tests/basic-test.sh @@ -0,0 +1,6 @@ +#!/bin/bash - +set -e +set -x + +# Setting up vhostmd is basically impossible, so: +LANG=C vm-dump-metrics |& grep "Unable to read metrics disk" diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..a93bdf6 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,11 @@ +- hosts: localhost + roles: + - role: standard-test-basic + tags: + - classic + required_packages: + - vm-dump-metrics-devel + tests: + - simple: + dir: . + run: ./basic-test.sh From eb279043d1e6251fee1fec15d4f7cac8772b1a7d Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 23 Jul 2021 20:26:12 +0000 Subject: [PATCH 57/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- vhostmd.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vhostmd.spec b/vhostmd.spec index bdd5719..d5d1490 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -3,7 +3,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 1.1 -Release: 8%{?dist} +Release: 9%{?dist} License: GPLv2+ URL: https://github.com/vhostmd/vhostmd @@ -163,6 +163,9 @@ exit 0 %changelog +* Fri Jul 23 2021 Fedora Release Engineering - 1.1-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + * Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek - 1.1-8 - Rebuilt for updated systemd-rpm-macros See https://pagure.io/fesco/issue/2583. From 308a9d2918c7d1baa7eacb95784c88e4ee036008 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 29 Jul 2021 11:21:33 +0100 Subject: [PATCH 58/71] Miscellaneous upstream fixes. --- ...ax-virtio-requirement-in-config-file.patch | 4 +- ...bmetrics-Set-pointer-NULL-after-free.patch | 58 ++++++++ ...ialize-local-variable-ret-to-failure.patch | 125 ++++++++++++++++++ ...trics-Check-return-value-of-asprintf.patch | 67 ++++++++++ ...Remove-unsafe-XML_PARSE_NOENT-option.patch | 41 ++++++ ...e-libmetrics-mutex-is-unlocked-in-er.patch | 53 ++++++++ ...libmetrics-Fix-potential-memory-leak.patch | 49 +++++++ ...roper-conversion-specifier-when-call.patch | 40 ++++++ ...s-Fix-potential-leak-of-FILE-pointer.patch | 75 +++++++++++ 0010-util-Add-missing-call-to-va_end.patch | 55 ++++++++ 0011-util-Fix-potential-memory-leak.patch | 40 ++++++ 0012-util-Check-return-value-of-strstr.patch | 38 ++++++ 0013-Check-return-value-of-asprintf.patch | 48 +++++++ ...-Fix-memory-leak-in-parse_transports.patch | 36 +++++ ...Remove-unsafe-XML_PARSE_NOENT-option.patch | 36 +++++ ...Check-return-value-of-file-functions.patch | 94 +++++++++++++ ...r-valide-file-handle-before-calling-.patch | 38 ++++++ ...ostmd-Fix-memory-leak-in-vhostmd_run.patch | 46 +++++++ ...-virtio-Fix-strncpy-length-parameter.patch | 36 +++++ vhostmd.spec | 25 +++- 20 files changed, 1000 insertions(+), 4 deletions(-) create mode 100644 0002-libmetrics-Set-pointer-NULL-after-free.patch create mode 100644 0003-libmetrics-Initialize-local-variable-ret-to-failure.patch create mode 100644 0004-libmetrics-Check-return-value-of-asprintf.patch create mode 100644 0005-libmetrics-Remove-unsafe-XML_PARSE_NOENT-option.patch create mode 100644 0006-libmetrics-Ensure-libmetrics-mutex-is-unlocked-in-er.patch create mode 100644 0007-libmetrics-Fix-potential-memory-leak.patch create mode 100644 0008-libmetrics-Use-proper-conversion-specifier-when-call.patch create mode 100644 0009-libmetrics-Fix-potential-leak-of-FILE-pointer.patch create mode 100644 0010-util-Add-missing-call-to-va_end.patch create mode 100644 0011-util-Fix-potential-memory-leak.patch create mode 100644 0012-util-Check-return-value-of-strstr.patch create mode 100644 0013-Check-return-value-of-asprintf.patch create mode 100644 0014-vhostmd-Fix-memory-leak-in-parse_transports.patch create mode 100644 0015-vhostmd-Remove-unsafe-XML_PARSE_NOENT-option.patch create mode 100644 0016-vhostmd-Check-return-value-of-file-functions.patch create mode 100644 0017-vhostmd-Check-for-valide-file-handle-before-calling-.patch create mode 100644 0018-vhostmd-Fix-memory-leak-in-vhostmd_run.patch create mode 100644 0019-virtio-Fix-strncpy-length-parameter.patch diff --git a/0001-Relax-virtio-requirement-in-config-file.patch b/0001-Relax-virtio-requirement-in-config-file.patch index 5f49e4c..f14d062 100644 --- a/0001-Relax-virtio-requirement-in-config-file.patch +++ b/0001-Relax-virtio-requirement-in-config-file.patch @@ -1,7 +1,7 @@ From 83cc269f6892852be94467cea771b3ad1da8a369 Mon Sep 17 00:00:00 2001 From: Jim Fehlig Date: Tue, 8 Oct 2019 20:56:18 -0600 -Subject: [PATCH] Relax virtio requirement in config file +Subject: [PATCH 01/19] Relax virtio requirement in config file When the virtio transport was introduced the schema was changed to require a transport in vhostmd.conf. When updating existing @@ -38,5 +38,5 @@ index db417fd..888270e 100644 -- -2.24.1 +2.32.0 diff --git a/0002-libmetrics-Set-pointer-NULL-after-free.patch b/0002-libmetrics-Set-pointer-NULL-after-free.patch new file mode 100644 index 0000000..5a1297a --- /dev/null +++ b/0002-libmetrics-Set-pointer-NULL-after-free.patch @@ -0,0 +1,58 @@ +From 06e73264b2338d20aa6e3f17b9820be3768439bf Mon Sep 17 00:00:00 2001 +From: Jim Fehlig +Date: Mon, 6 Jan 2020 16:14:18 -0700 +Subject: [PATCH 02/19] libmetrics: Set pointer NULL after free + +From a coverity scan + +vhostmd-1.1/libmetrics/libmetrics.c:185:10: warning: Attempt to free released memory + free(mdisk->buffer); + +Some error conditions will call mdisk_content_free(), which could result +in a double-free when the entire mdisk is freed and mdisk_content_free() +is called again. Protect agains these potential double-frees by setting +the mdisk contents NULL after freeing them. + +Signed-off-by: Jim Fehlig +--- + libmetrics/libmetrics.c | 24 ++++++++++++++++-------- + 1 file changed, 16 insertions(+), 8 deletions(-) + +diff --git a/libmetrics/libmetrics.c b/libmetrics/libmetrics.c +index 6c80681..a5582e7 100644 +--- a/libmetrics/libmetrics.c ++++ b/libmetrics/libmetrics.c +@@ -177,14 +177,22 @@ static metric_disk * mdisk_alloc() + static void mdisk_content_free() + { + if (mdisk) { +- if (mdisk->doc) +- xmlFreeDoc(mdisk->doc); +- if (mdisk->pctxt) +- xmlFreeParserCtxt(mdisk->pctxt); +- if (mdisk->buffer) +- free(mdisk->buffer); +- if (mdisk->disk_name) +- free(mdisk->disk_name); ++ if (mdisk->doc) { ++ xmlFreeDoc(mdisk->doc); ++ mdisk->doc = NULL; ++ } ++ if (mdisk->pctxt) { ++ xmlFreeParserCtxt(mdisk->pctxt); ++ mdisk->pctxt = NULL; ++ } ++ if (mdisk->buffer) { ++ free(mdisk->buffer); ++ mdisk->buffer = NULL; ++ } ++ if (mdisk->disk_name) { ++ free(mdisk->disk_name); ++ mdisk->disk_name = NULL; ++ } + } + } + +-- +2.32.0 + diff --git a/0003-libmetrics-Initialize-local-variable-ret-to-failure.patch b/0003-libmetrics-Initialize-local-variable-ret-to-failure.patch new file mode 100644 index 0000000..290ead0 --- /dev/null +++ b/0003-libmetrics-Initialize-local-variable-ret-to-failure.patch @@ -0,0 +1,125 @@ +From 9db959c9e3f83cb2a4fc07534462e769990d9631 Mon Sep 17 00:00:00 2001 +From: Jim Fehlig +Date: Mon, 6 Jan 2020 16:33:24 -0700 +Subject: [PATCH 03/19] libmetrics: Initialize local variable 'ret' to failure + +The get_mdef() and dump_xenstore_metrics() functions have local variables +named 'ret' that are initialized to zero, meaning success. In failure paths +'ret' is set to -1 before jumping to the 'out' label. Invert this logic by +initializing 'ret' to -1 and only setting it to success after the function +bodies have successfully executed. + +Signed-off-by: Jim Fehlig +--- + libmetrics/libmetrics.c | 16 ++++------------ + 1 file changed, 4 insertions(+), 12 deletions(-) + +diff --git a/libmetrics/libmetrics.c b/libmetrics/libmetrics.c +index a5582e7..49b38ea 100644 +--- a/libmetrics/libmetrics.c ++++ b/libmetrics/libmetrics.c +@@ -228,7 +228,7 @@ static int get_mdef(metric_disk *mdisk, private_metric *pmdef) + xmlNodePtr node; + char *str; + char *xpath; +- int ret = 0; ++ int ret = -1; + + ctxt = xmlXPathNewContext(mdisk->doc); + if (!ctxt) { +@@ -242,19 +242,16 @@ static int get_mdef(metric_disk *mdisk, private_metric *pmdef) + if ((obj == NULL) || (obj->type != XPATH_NODESET)) { + libmsg("%s(): No metrics found that matches %s in context:%s or malformed definition\n", + __func__, pmdef->name, pmdef->context); +- ret = -1; + goto out; + } + if (xmlXPathNodeSetGetLength(obj->nodesetval) != 1) { + libmsg("%s(): No metrics found that matches %s in context:%s or malformed definition\n", + __func__, pmdef->name, pmdef->context); +- ret = -1; + goto out; + } + node = obj->nodesetval->nodeTab[0]; + if ((str = (char *)xmlGetProp(node, BAD_CAST "type")) == NULL) { + libmsg("%s(): Metric type not specified\n", __func__); +- ret = -1; + goto out; + } + metric_type_from_str((char *)str, &(pmdef->type)); +@@ -267,7 +264,6 @@ static int get_mdef(metric_disk *mdisk, private_metric *pmdef) + free(xpath); + if ((obj == NULL) || (obj->type != XPATH_NODESET)) { + libmsg("%s(): No metrics value found!\n", __func__); +- ret = -1; + goto out; + } + +@@ -276,6 +272,7 @@ static int get_mdef(metric_disk *mdisk, private_metric *pmdef) + str = (char *)xmlNodeListGetString(mdisk->doc, node, 1); + pmdef->value = strdup(str); + free(str); ++ ret = 0; + + out: + if (obj) +@@ -707,7 +704,7 @@ int dump_xenstore_metrics(const char *dest_file) + char *buf = NULL, *path = NULL, *metrics = NULL; + struct xs_handle *xsh = NULL; + unsigned int len; +- int ret = 0; ++ int ret = -1; + xmlParserCtxtPtr pctxt = NULL; + xmlDocPtr doc = NULL; + int domid; +@@ -726,35 +723,30 @@ int dump_xenstore_metrics(const char *dest_file) + + if ((domid = get_dom_id()) == -1) { + libmsg("Unable to derive domID.\n" ); +- ret = -1; + goto out; + } + + xsh = xs_domain_open(); + if (xsh == NULL) { + libmsg("xs_domain_open() error. errno: %d.\n", errno); +- ret = -1; + goto out; + } + + path = xs_get_domain_path(xsh, domid); + if (path == NULL) { + libmsg("xs_get_domain_path() error. domid %d.\n", 0); +- ret = -1; + goto out; + } + asprintf(&buf, "%s/metrics", path); + metrics = xs_read(xsh, XBT_NULL, buf, &len); + if (metrics == NULL) { + libmsg("xs_read(): uuid get error. %s.\n", buf); +- ret = -1; + goto out; + } + + pctxt = xmlNewParserCtxt(); + if (!pctxt || !pctxt->sax) { + libmsg("%s(): failed to create parser \n", __func__); +- ret = -1; + goto out; + } + +@@ -764,10 +756,10 @@ int dump_xenstore_metrics(const char *dest_file) + XML_PARSE_NOWARNING); + if (!doc) { + libmsg("%s(): libxml failed to xenstore metrics attribute\n", __func__); +- ret = -1; + goto out; + } + xmlDocFormatDump(fp, doc, 1); ++ ret = 0; + + out: + if (fp && fp != stdout) +-- +2.32.0 + diff --git a/0004-libmetrics-Check-return-value-of-asprintf.patch b/0004-libmetrics-Check-return-value-of-asprintf.patch new file mode 100644 index 0000000..967b012 --- /dev/null +++ b/0004-libmetrics-Check-return-value-of-asprintf.patch @@ -0,0 +1,67 @@ +From f659ec774221532cc5452a07418e2ab1385f162c Mon Sep 17 00:00:00 2001 +From: Jim Fehlig +Date: Mon, 6 Jan 2020 16:43:21 -0700 +Subject: [PATCH 04/19] libmetrics: Check return value of asprintf + +Exmaple from coverity scan + +vhostmd-1.1/libmetrics/libmetrics.c: scope_hint: In function 'get_mdef' +vhostmd-1.1/libmetrics/libmetrics.c:231:4: warning: ignoring return value of 'asprintf', declared with attribute warn_unused_result [-Wunused-result] + asprintf(&xpath, "//metrics/metric[name='%s'][@context='%s']", pmdef->name, pmdef->context); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Signed-off-by: Jim Fehlig +--- + libmetrics/libmetrics.c | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +diff --git a/libmetrics/libmetrics.c b/libmetrics/libmetrics.c +index 49b38ea..4b2369a 100644 +--- a/libmetrics/libmetrics.c ++++ b/libmetrics/libmetrics.c +@@ -236,7 +236,9 @@ static int get_mdef(metric_disk *mdisk, private_metric *pmdef) + } + + /* Get the matching metric node type */ +- asprintf(&xpath, "//metrics/metric[name='%s'][@context='%s']", pmdef->name, pmdef->context); ++ if (asprintf(&xpath, "//metrics/metric[name='%s'][@context='%s']", pmdef->name, pmdef->context) < 0) ++ goto out; ++ + obj = xmlXPathEval(BAD_CAST xpath, ctxt); + free(xpath); + if ((obj == NULL) || (obj->type != XPATH_NODESET)) { +@@ -259,7 +261,9 @@ static int get_mdef(metric_disk *mdisk, private_metric *pmdef) + xmlXPathFreeObject(obj); + + /* Get the matching metric node value */ +- asprintf(&xpath, "//metrics/metric[name='%s'][@context='%s']/value/text()", pmdef->name, pmdef->context); ++ if (asprintf(&xpath, "//metrics/metric[name='%s'][@context='%s']/value/text()", pmdef->name, pmdef->context) < 0) ++ goto out; ++ + obj = xmlXPathEval( BAD_CAST xpath, ctxt); /* worked but no nodes */ + free(xpath); + if ((obj == NULL) || (obj->type != XPATH_NODESET)) { +@@ -349,7 +353,8 @@ retry: + strcmp(entry->d_name, "..") == 0) + continue; + +- asprintf(&path, "/dev/%s", entry->d_name); ++ if (asprintf(&path, "/dev/%s", entry->d_name) < 0) ++ goto error; + #else + path = strdup("/dev/shm/vhostmd0"); + #endif +@@ -737,7 +742,9 @@ int dump_xenstore_metrics(const char *dest_file) + libmsg("xs_get_domain_path() error. domid %d.\n", 0); + goto out; + } +- asprintf(&buf, "%s/metrics", path); ++ if (asprintf(&buf, "%s/metrics", path) , 0) ++ goto out; ++ + metrics = xs_read(xsh, XBT_NULL, buf, &len); + if (metrics == NULL) { + libmsg("xs_read(): uuid get error. %s.\n", buf); +-- +2.32.0 + diff --git a/0005-libmetrics-Remove-unsafe-XML_PARSE_NOENT-option.patch b/0005-libmetrics-Remove-unsafe-XML_PARSE_NOENT-option.patch new file mode 100644 index 0000000..8b64921 --- /dev/null +++ b/0005-libmetrics-Remove-unsafe-XML_PARSE_NOENT-option.patch @@ -0,0 +1,41 @@ +From 3d4f3acdfc9f937bea946bb1c7dfad1f3516a6ce Mon Sep 17 00:00:00 2001 +From: Jim Fehlig +Date: Mon, 6 Jan 2020 17:42:39 -0700 +Subject: [PATCH 05/19] libmetrics: Remove unsafe XML_PARSE_NOENT option + +From coverity scan + +Error: UNSAFE_XML_PARSE_CONFIG: +vhostmd-1.1/libmetrics/libmetrics.c:412: unsafe_xml_parse_config: XML parse option should not have flag "XML_PARSE_NOENT" set, which is vulnerable to XML external entity attack. + 410| mdisk->doc = xmlCtxtReadMemory(mdisk->pctxt, mdisk->buffer, + 411| mdisk->length, "mdisk.xml", NULL, + 412|-> XML_PARSE_NOENT | XML_PARSE_NONET | + 413| XML_PARSE_NOWARNING); + 414| if (!mdisk->doc) { + +It should be safe to remove the option. + +Signed-off-by: Jim Fehlig +--- + libmetrics/libmetrics.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/libmetrics/libmetrics.c b/libmetrics/libmetrics.c +index 4b2369a..2819f80 100644 +--- a/libmetrics/libmetrics.c ++++ b/libmetrics/libmetrics.c +@@ -418,9 +418,8 @@ retry: + } + + mdisk->doc = xmlCtxtReadMemory(mdisk->pctxt, mdisk->buffer, +- mdisk->length, "mdisk.xml", NULL, +- XML_PARSE_NOENT | XML_PARSE_NONET | +- XML_PARSE_NOWARNING); ++ mdisk->length, "mdisk.xml", NULL, ++ XML_PARSE_NONET | XML_PARSE_NOWARNING); + if (!mdisk->doc) { + libmsg("%s(): libxml failed to parse mdisk.xml buffer\n", __func__); + goto error; +-- +2.32.0 + diff --git a/0006-libmetrics-Ensure-libmetrics-mutex-is-unlocked-in-er.patch b/0006-libmetrics-Ensure-libmetrics-mutex-is-unlocked-in-er.patch new file mode 100644 index 0000000..f23d4af --- /dev/null +++ b/0006-libmetrics-Ensure-libmetrics-mutex-is-unlocked-in-er.patch @@ -0,0 +1,53 @@ +From 855326a8c9ec1a599354f743fb5391a2766a2a9c Mon Sep 17 00:00:00 2001 +From: Jim Fehlig +Date: Mon, 6 Jan 2020 17:47:10 -0700 +Subject: [PATCH 06/19] libmetrics: Ensure libmetrics mutex is unlocked in + error paths + +From coverity scan + +vhostmd-1.1/libmetrics/libmetrics.c:595: missing_unlock: Returning without unlocking "libmetrics_mutex". + 593| if (mdisk_alloc() == NULL) { + 594| errno = ENOMEM; + 595|-> return -1; + 596| } + 597| read_mdisk(mdisk); + +Signed-off-by: Jim Fehlig +--- + libmetrics/libmetrics.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/libmetrics/libmetrics.c b/libmetrics/libmetrics.c +index 2819f80..756645c 100644 +--- a/libmetrics/libmetrics.c ++++ b/libmetrics/libmetrics.c +@@ -601,7 +601,7 @@ int get_metric(const char *metric_name, metric **mdef, metric_context context) + mdisk_free(); + if (mdisk_alloc() == NULL) { + errno = ENOMEM; +- return -1; ++ goto out; + } + read_mdisk(mdisk); + } +@@ -620,7 +620,7 @@ int get_metric(const char *metric_name, metric **mdef, metric_context context) + + if ((lmdef = metric_alloc_padded(extra_len)) == NULL) { + errno = ENOMEM; +- return -1; ++ goto out; + } + + lmdef->type = pmdef.type; +@@ -635,6 +635,7 @@ int get_metric(const char *metric_name, metric **mdef, metric_context context) + if (pmdef.context) + free(pmdef.context); + ++out: + /* unlock library data */ + pthread_mutex_unlock(&libmetrics_mutex); + return ret; +-- +2.32.0 + diff --git a/0007-libmetrics-Fix-potential-memory-leak.patch b/0007-libmetrics-Fix-potential-memory-leak.patch new file mode 100644 index 0000000..4f20b0b --- /dev/null +++ b/0007-libmetrics-Fix-potential-memory-leak.patch @@ -0,0 +1,49 @@ +From 2cbce5fcb652226bf159f9cd9649f5869d76f6b7 Mon Sep 17 00:00:00 2001 +From: Jim Fehlig +Date: Mon, 6 Jan 2020 18:40:33 -0700 +Subject: [PATCH 07/19] libmetrics: Fix potential memory leak + +From coverity scan + +vhostmd-1.1/libmetrics/libmetrics.c:613:18: warning: Potential leak of memory pointed to by 'pmdef.context' + errno = ENOMEM; + +Signed-off-by: Jim Fehlig +--- + libmetrics/libmetrics.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/libmetrics/libmetrics.c b/libmetrics/libmetrics.c +index 756645c..6817df9 100644 +--- a/libmetrics/libmetrics.c ++++ b/libmetrics/libmetrics.c +@@ -586,7 +586,8 @@ int get_metric(const char *metric_name, metric **mdef, metric_context context) + int ret = -1; + + *mdef = NULL; +- ++ memset(&pmdef, 0, sizeof(private_metric)); ++ + if (mdisk == NULL) { + errno = ENODEV; + return -1; +@@ -628,6 +629,8 @@ int get_metric(const char *metric_name, metric **mdef, metric_context context) + *mdef = lmdef; + ret = 0; + } ++ ++out: + if (pmdef.name) + free(pmdef.name); + if (pmdef.value) +@@ -635,7 +638,6 @@ int get_metric(const char *metric_name, metric **mdef, metric_context context) + if (pmdef.context) + free(pmdef.context); + +-out: + /* unlock library data */ + pthread_mutex_unlock(&libmetrics_mutex); + return ret; +-- +2.32.0 + diff --git a/0008-libmetrics-Use-proper-conversion-specifier-when-call.patch b/0008-libmetrics-Use-proper-conversion-specifier-when-call.patch new file mode 100644 index 0000000..5200180 --- /dev/null +++ b/0008-libmetrics-Use-proper-conversion-specifier-when-call.patch @@ -0,0 +1,40 @@ +From bc5da0b99699bbeb653b86398a7112bc0885c31e Mon Sep 17 00:00:00 2001 +From: Jim Fehlig +Date: Mon, 6 Jan 2020 18:51:40 -0700 +Subject: [PATCH 08/19] libmetrics: Use proper conversion specifier when + calling log function + +From coverity scan + +vhostmd-1.1/libmetrics/libmetrics.c:817: invalid_type: Argument "5L" to format specifier "%u" was expected to have type "unsigned int" but has type "long". + +Signed-off-by: Jim Fehlig +--- + libmetrics/libmetrics.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libmetrics/libmetrics.c b/libmetrics/libmetrics.c +index 6817df9..0f4cf70 100644 +--- a/libmetrics/libmetrics.c ++++ b/libmetrics/libmetrics.c +@@ -823,7 +823,7 @@ static char *get_virtio_metrics(void) + usleep(10000); + if (time(NULL) > end_time) { + libmsg("%s(): Unable to send metrics request" +- " - timeout after %us\n", __func__, timeout); ++ " - timeout after %lis\n", __func__, timeout); + goto error; + } + } +@@ -856,7 +856,7 @@ static char *get_virtio_metrics(void) + usleep(10000); + if (time(NULL) > end_time) { + libmsg("%s(): Unable to read metrics" +- " - timeout after %us\n", __func__, timeout); ++ " - timeout after %lis\n", __func__, timeout); + goto error; + } + } else +-- +2.32.0 + diff --git a/0009-libmetrics-Fix-potential-leak-of-FILE-pointer.patch b/0009-libmetrics-Fix-potential-leak-of-FILE-pointer.patch new file mode 100644 index 0000000..8206fd2 --- /dev/null +++ b/0009-libmetrics-Fix-potential-leak-of-FILE-pointer.patch @@ -0,0 +1,75 @@ +From cba4dddebc56886034038f907085da3c6b50baab Mon Sep 17 00:00:00 2001 +From: Jim Fehlig +Date: Mon, 6 Jan 2020 18:59:18 -0700 +Subject: [PATCH 09/19] libmetrics: Fix potential leak of FILE pointer + +From coverity scan + +vhostmd-1.1/libmetrics/libmetrics.c:892: alloc_fn: Storage is returned from allocation function "fopen". +vhostmd-1.1/libmetrics/libmetrics.c:892: var_assign: Assigning: "fp" = storage returned from "fopen(dest_file, "w")". +vhostmd-1.1/libmetrics/libmetrics.c:900: noescape: Resource "fp" is not freed or pointed-to in "fwrite". +vhostmd-1.1/libmetrics/libmetrics.c:909: leaked_storage: Variable "fp" going out of scope leaks the storage it points to. + 907| free(response); + 908| + 909|-> return 0; + 910| + 911| error: + +Signed-off-by: Jim Fehlig +--- + libmetrics/libmetrics.c | 16 +++++++--------- + 1 file changed, 7 insertions(+), 9 deletions(-) + +diff --git a/libmetrics/libmetrics.c b/libmetrics/libmetrics.c +index 0f4cf70..8819074 100644 +--- a/libmetrics/libmetrics.c ++++ b/libmetrics/libmetrics.c +@@ -890,10 +890,11 @@ int dump_virtio_metrics(const char *dest_file) + FILE *fp = stdout; + char *response = NULL; + size_t len; ++ int ret = -1; + + response = get_virtio_metrics(); + if (response == NULL) +- goto error; ++ return -1; + + len = strlen(response); + +@@ -902,27 +903,24 @@ int dump_virtio_metrics(const char *dest_file) + if (fp == NULL) { + libmsg("%s(), unable to dump metrics: fopen(%s) %s\n", + __func__, dest_file, strerror(errno)); +- goto error; ++ goto out; + } + } + + if (fwrite(response, 1UL, len, fp) != len) { + libmsg("%s(), unable to export metrics to file:%s %s\n", + __func__, dest_file ? dest_file : "stdout", strerror(errno)); +- goto error; ++ goto out; + } + +- if (response) +- free(response); ++ ret = 0; + +- return 0; +- +- error: ++out: + if (dest_file && fp) + fclose(fp); + + if (response) + free(response); + +- return -1; ++ return ret; + } +-- +2.32.0 + diff --git a/0010-util-Add-missing-call-to-va_end.patch b/0010-util-Add-missing-call-to-va_end.patch new file mode 100644 index 0000000..dfe25fd --- /dev/null +++ b/0010-util-Add-missing-call-to-va_end.patch @@ -0,0 +1,55 @@ +From 69fcc2075d7cb1f16eb7d27ae3559fa3c77f5514 Mon Sep 17 00:00:00 2001 +From: Jim Fehlig +Date: Tue, 7 Jan 2020 11:36:56 -0700 +Subject: [PATCH 10/19] util: Add missing call to va_end + +From coverity scan + +Error: VARARGS (CWE-237): +vhostmd-1.1/vhostmd/util.c:209: va_init: Initializing va_list "argptr". +vhostmd-1.1/vhostmd/util.c:218: missing_va_end: va_end was not called for "argptr". + 216| grow_size = (count > 1000) ? count : 1000; + 217| if (buffer_grow(buf, grow_size) < 0) + 218|-> return; + 219| + 220| size = buf->size - buf->use - 1; + +Error: VARARGS (CWE-237): +vhostmd-1.1/vhostmd/util.c:209: va_init: Initializing va_list "argptr". +vhostmd-1.1/vhostmd/util.c:226: missing_va_end: va_end was not called for "argptr". + 224| buf->use += count; + 225| buf->content[buf->use] = '\0'; + 226|-> } + 227| + 228| /* + +Signed-off-by: Jim Fehlig +--- + vhostmd/util.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/vhostmd/util.c b/vhostmd/util.c +index 5747f16..1f9545b 100644 +--- a/vhostmd/util.c ++++ b/vhostmd/util.c +@@ -214,13 +214,16 @@ void vu_buffer_vsprintf(vu_buffer *buf, const char *format, ...) + va_end(locarg); + + grow_size = (count > 1000) ? count : 1000; +- if (buffer_grow(buf, grow_size) < 0) ++ if (buffer_grow(buf, grow_size) < 0) { ++ va_end(argptr); + return; ++ } + + size = buf->size - buf->use - 1; + va_copy(locarg, argptr); + } + va_end(locarg); ++ va_end(argptr); + buf->use += count; + buf->content[buf->use] = '\0'; + } +-- +2.32.0 + diff --git a/0011-util-Fix-potential-memory-leak.patch b/0011-util-Fix-potential-memory-leak.patch new file mode 100644 index 0000000..418b678 --- /dev/null +++ b/0011-util-Fix-potential-memory-leak.patch @@ -0,0 +1,40 @@ +From b39f7cc778903e9cda8aa46d170b9efe80efda89 Mon Sep 17 00:00:00 2001 +From: Jim Fehlig +Date: Tue, 7 Jan 2020 11:41:11 -0700 +Subject: [PATCH 11/19] util: Fix potential memory leak + +From coverity scan + +vhostmd-1.1/vhostmd/util.c:415:14: warning: Potential leak of memory pointed to by 'cp' + return(NULL); + +Signed-off-by: Jim Fehlig +--- + vhostmd/util.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/vhostmd/util.c b/vhostmd/util.c +index 1f9545b..599c5c7 100644 +--- a/vhostmd/util.c ++++ b/vhostmd/util.c +@@ -415,7 +415,7 @@ char *vu_str_replace(const char *haystack, const char *origstr, const char *news + + dest = malloc(strlen(haystack) - (origlen * cnt) + (newlen * cnt) + 1); + if (dest == NULL) { +- return(NULL); ++ goto out; + } + *dest = '\0'; + +@@ -428,6 +428,8 @@ char *vu_str_replace(const char *haystack, const char *origstr, const char *news + cp = p + origlen; + } + strcat(dest, cp); ++ ++out: + free(tempstr); + + return dest; +-- +2.32.0 + diff --git a/0012-util-Check-return-value-of-strstr.patch b/0012-util-Check-return-value-of-strstr.patch new file mode 100644 index 0000000..0f4219a --- /dev/null +++ b/0012-util-Check-return-value-of-strstr.patch @@ -0,0 +1,38 @@ +From 4350fcf7a5c4cb7d803db1a0df2b757230b90e25 Mon Sep 17 00:00:00 2001 +From: Jim Fehlig +Date: Tue, 7 Jan 2020 11:47:33 -0700 +Subject: [PATCH 12/19] util: Check return value of strstr + +From coverity scan + +vhostmd-1.1/vhostmd/util.c:421: returned_null: "strstr" returns "NULL" (checked 6 out of 7 times). + +Signed-off-by: Jim Fehlig +--- + vhostmd/util.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/vhostmd/util.c b/vhostmd/util.c +index 599c5c7..317dbc6 100644 +--- a/vhostmd/util.c ++++ b/vhostmd/util.c +@@ -422,10 +422,12 @@ char *vu_str_replace(const char *haystack, const char *origstr, const char *news + cp = tempstr; + for (i=0; i +Date: Tue, 7 Jan 2020 11:52:23 -0700 +Subject: [PATCH 13/19] Check return value of asprintf + +Example from coverity scan + +vhostmd-1.1/vhostmd/util.c: scope_hint: In function 'vu_append_string' +vhostmd-1.1/vhostmd/util.c:484:7: warning: ignoring return value of 'asprintf', declared with attribute warn_unused_result [-Wunused-result] + asprintf(&cp, "%s,%s", *dest, str); + +Signed-off-by: Jim Fehlig +--- + vhostmd/util.c | 3 ++- + vhostmd/vhostmd.c | 3 ++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/vhostmd/util.c b/vhostmd/util.c +index 317dbc6..d7ce3fc 100644 +--- a/vhostmd/util.c ++++ b/vhostmd/util.c +@@ -488,7 +488,8 @@ int vu_append_string(char **dest, xmlChar * str) + char *cp; + + if (*dest) { +- asprintf(&cp, "%s,%s", *dest, str); ++ if (asprintf(&cp, "%s,%s", *dest, str) < 0) ++ return -1; + free(*dest); + *dest = cp; + } +diff --git a/vhostmd/vhostmd.c b/vhostmd/vhostmd.c +index 7e29e6f..7374ec9 100644 +--- a/vhostmd/vhostmd.c ++++ b/vhostmd/vhostmd.c +@@ -259,7 +259,8 @@ static int parse_group_metric(xmlDocPtr xml ATTRIBUTE_UNUSED, + vu_log(VHOSTMD_WARN, "parse_group_metric: node path not found"); + return -1; + } +- asprintf(&cp, "%s/variable", path); ++ if (asprintf(&cp, "%s/variable", path) < 0) ++ goto error; + + obj = xmlXPathEval( BAD_CAST cp, ctxt); + if ((obj == NULL) || (obj->type != XPATH_NODESET)) { +-- +2.32.0 + diff --git a/0014-vhostmd-Fix-memory-leak-in-parse_transports.patch b/0014-vhostmd-Fix-memory-leak-in-parse_transports.patch new file mode 100644 index 0000000..3b838e5 --- /dev/null +++ b/0014-vhostmd-Fix-memory-leak-in-parse_transports.patch @@ -0,0 +1,36 @@ +From 71a94a18c470ebbd870253b8aedbb7b3b24a274b Mon Sep 17 00:00:00 2001 +From: Jim Fehlig +Date: Tue, 14 Jan 2020 15:08:54 -0700 +Subject: [PATCH 14/19] vhostmd: Fix memory leak in parse_transports + +From coverity scan + +vhostmd-1.1/vhostmd/vhostmd.c:455: alloc_fn: Storage is returned from allocation function "xmlXPathEval". +vhostmd-1.1/vhostmd/vhostmd.c:455: var_assign: Assigning: "obj" = storage returned from "xmlXPathEval((xmlChar *)"//vhostmd/globals/transport", ctxt)". +vhostmd-1.1/vhostmd/vhostmd.c:474: leaked_storage: Variable "obj" going out of scope leaks the storage it points to. + 472| #else + 473| vu_log (VHOSTMD_ERR, "No support for xenstore transport in this vhostmd"); + 474|-> return -1; + 475| #endif + 476| } + +Signed-off-by: Jim Fehlig +--- + vhostmd/vhostmd.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/vhostmd/vhostmd.c b/vhostmd/vhostmd.c +index 7374ec9..3d1d53e 100644 +--- a/vhostmd/vhostmd.c ++++ b/vhostmd/vhostmd.c +@@ -472,6 +472,7 @@ static int parse_transports(xmlDocPtr xml, + transports |= XENSTORE; + #else + vu_log (VHOSTMD_ERR, "No support for xenstore transport in this vhostmd"); ++ xmlXPathFreeObject(obj); + return -1; + #endif + } +-- +2.32.0 + diff --git a/0015-vhostmd-Remove-unsafe-XML_PARSE_NOENT-option.patch b/0015-vhostmd-Remove-unsafe-XML_PARSE_NOENT-option.patch new file mode 100644 index 0000000..9872d7d --- /dev/null +++ b/0015-vhostmd-Remove-unsafe-XML_PARSE_NOENT-option.patch @@ -0,0 +1,36 @@ +From d9eeede678521776d327784d0307de6c98920bb8 Mon Sep 17 00:00:00 2001 +From: Jim Fehlig +Date: Tue, 14 Jan 2020 15:12:28 -0700 +Subject: [PATCH 15/19] vhostmd: Remove unsafe XML_PARSE_NOENT option + +From coverity scan + +vhostmd-1.1/vhostmd/vhostmd.c:553: unsafe_xml_parse_config: XML parse option should not have flag "XML_PARSE_NOENT" set, which is vulnerable to XML external entty attack. + 551| + 552| xml = xmlCtxtReadFile(pctxt, filename, NULL, + 553|-> XML_PARSE_NOENT | XML_PARSE_NONET | + 554| XML_PARSE_NOWARNING); + 555| if (!xml) { + +Signed-off-by: Jim Fehlig +--- + vhostmd/vhostmd.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/vhostmd/vhostmd.c b/vhostmd/vhostmd.c +index 3d1d53e..4d04989 100644 +--- a/vhostmd/vhostmd.c ++++ b/vhostmd/vhostmd.c +@@ -552,8 +552,7 @@ static int parse_config_file(const char *filename) + goto out; + + xml = xmlCtxtReadFile(pctxt, filename, NULL, +- XML_PARSE_NOENT | XML_PARSE_NONET | +- XML_PARSE_NOWARNING); ++ XML_PARSE_NONET | XML_PARSE_NOWARNING); + if (!xml) { + vu_log(VHOSTMD_ERR, "libxml failed to parse config file %s", + filename); +-- +2.32.0 + diff --git a/0016-vhostmd-Check-return-value-of-file-functions.patch b/0016-vhostmd-Check-return-value-of-file-functions.patch new file mode 100644 index 0000000..2597209 --- /dev/null +++ b/0016-vhostmd-Check-return-value-of-file-functions.patch @@ -0,0 +1,94 @@ +From 4f7b23e19c88c92d834d5f975c846b47eaa03c79 Mon Sep 17 00:00:00 2001 +From: Jim Fehlig +Date: Tue, 14 Jan 2020 15:33:39 -0700 +Subject: [PATCH 16/19] vhostmd: Check return value of file functions + +Check return value of ftruncate, lseek, and write functions as +reported by coverity. Example from coverity scan + +vhostmd-1.1/vhostmd/vhostmd.c: scope_hint: In function 'metrics_disk_create' +vhostmd-1.1/vhostmd/vhostmd.c:821:4: warning: ignoring return value of 'ftruncate', declared with attribute warn_unused_result [-Wunused-result] + ftruncate(fd, mdisk_size); + ^~~~~~~~~~~~~~~~~~~~~~~~~ + 819| + 820| /* truncate to a possible new size */ + 821|-> ftruncate(fd, mdisk_size); + 822| + 823| /* zero fill metrics data */ + +Signed-off-by: Jim Fehlig +--- + vhostmd/vhostmd.c | 33 +++++++++++++++++++++++++-------- + 1 file changed, 25 insertions(+), 8 deletions(-) + +diff --git a/vhostmd/vhostmd.c b/vhostmd/vhostmd.c +index 4d04989..1600a87 100644 +--- a/vhostmd/vhostmd.c ++++ b/vhostmd/vhostmd.c +@@ -675,8 +675,12 @@ static int metrics_disk_busy(int fd, int busy) + { + md_header.busy = (uint32_t)(htonl(busy)); + +- lseek(fd, offsetof(mdisk_header, busy), SEEK_SET); +- write(fd, &(md_header.busy), sizeof(uint32_t)); ++ if (lseek(fd, offsetof(mdisk_header, busy), SEEK_SET) == -1) ++ return -1; ++ ++ if (write(fd, &(md_header.busy), sizeof(uint32_t)) == -1) ++ return -1; ++ + return 0; + } + +@@ -724,6 +728,8 @@ error: + + static int metrics_disk_update(int fd, vu_buffer *buf) + { ++ int ret = -1; ++ + if (buf->use > MDISK_SIZE) { + vu_log(VHOSTMD_ERR, "Metrics data is larger than metrics disk"); + return -1; +@@ -731,11 +737,17 @@ static int metrics_disk_update(int fd, vu_buffer *buf) + + metrics_disk_busy(fd, 1); + metrics_disk_header_update(fd, buf); +- lseek(fd, MDISK_HEADER_SIZE, SEEK_SET); +- write(fd, buf->content, buf->use); ++ if (lseek(fd, MDISK_HEADER_SIZE, SEEK_SET) == -1) ++ goto out; ++ ++ if (write(fd, buf->content, buf->use) == -1) ++ goto out; ++ ++ ret = 0; ++ ++out: + metrics_disk_busy(fd, 0); +- +- return 0; ++ return ret; + } + + static int metrics_free() +@@ -819,10 +831,15 @@ static int metrics_disk_create(void) + } + + /* truncate to a possible new size */ +- ftruncate(fd, mdisk_size); ++ if (ftruncate(fd, mdisk_size) == -1){ ++ vu_log(VHOSTMD_ERR, "Failed to truncate metrics disk: %s", ++ strerror(errno)); ++ goto error; ++ } + + /* zero fill metrics data */ +- lseek(fd, MDISK_HEADER_SIZE, SEEK_SET); ++ if (lseek(fd, MDISK_HEADER_SIZE, SEEK_SET) == -1) ++ goto error; + for (i = 0; i < size / MDISK_SIZE_MIN; i++) + if (write(fd, buf, MDISK_SIZE_MIN) != MDISK_SIZE_MIN) { + vu_log(VHOSTMD_ERR, "Error creating disk of requested " +-- +2.32.0 + diff --git a/0017-vhostmd-Check-for-valide-file-handle-before-calling-.patch b/0017-vhostmd-Check-for-valide-file-handle-before-calling-.patch new file mode 100644 index 0000000..5222522 --- /dev/null +++ b/0017-vhostmd-Check-for-valide-file-handle-before-calling-.patch @@ -0,0 +1,38 @@ +From d86c51d98ce8b891f3948f8aa54fc9634e6a8c67 Mon Sep 17 00:00:00 2001 +From: Jim Fehlig +Date: Tue, 14 Jan 2020 16:04:09 -0700 +Subject: [PATCH 17/19] vhostmd: Check for valide file handle before calling + close + +From coverity scan + +vhostmd-1.1/vhostmd/vhostmd.c:778: var_tested_neg: Assigning: "fd" = a negative value. +vhostmd-1.1/vhostmd/vhostmd.c:845: negative_returns: "fd" is passed to a parameter that cannot be negative. + 843| free(dir); + 844| free(buf); + 845|-> close(fd); + 846| return -1; + 847| } + +Signed-off-by: Jim Fehlig +--- + vhostmd/vhostmd.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/vhostmd/vhostmd.c b/vhostmd/vhostmd.c +index 1600a87..1395bc5 100644 +--- a/vhostmd/vhostmd.c ++++ b/vhostmd/vhostmd.c +@@ -860,7 +860,8 @@ static int metrics_disk_create(void) + error: + free(dir); + free(buf); +- close(fd); ++ if (fd != -1) ++ close(fd); + return -1; + } + +-- +2.32.0 + diff --git a/0018-vhostmd-Fix-memory-leak-in-vhostmd_run.patch b/0018-vhostmd-Fix-memory-leak-in-vhostmd_run.patch new file mode 100644 index 0000000..1480307 --- /dev/null +++ b/0018-vhostmd-Fix-memory-leak-in-vhostmd_run.patch @@ -0,0 +1,46 @@ +From ff6959fd9203c667f6b4c95fa812621cc91dc42e Mon Sep 17 00:00:00 2001 +From: Jim Fehlig +Date: Tue, 14 Jan 2020 16:08:42 -0700 +Subject: [PATCH 18/19] vhostmd: Fix memory leak in vhostmd_run + +Example from coverity scan + +vhostmd-1.1/vhostmd/vhostmd.c:940: alloc_arg: "vu_buffer_create" allocates memory that is stored into "buf". +vhostmd-1.1/vhostmd/vhostmd.c:959: leaked_storage: Variable "buf" going out of scope leaks the storage it points to. + 957| vu_log(VHOSTMD_ERR, "Failed to start virtio thread '%s'\n", + 958| strerror(rc)); + 959|-> return -1; + 960| } + 961| } + +Signed-off-by: Jim Fehlig +--- + vhostmd/vhostmd.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/vhostmd/vhostmd.c b/vhostmd/vhostmd.c +index 1395bc5..6f3709b 100644 +--- a/vhostmd/vhostmd.c ++++ b/vhostmd/vhostmd.c +@@ -967,14 +967,17 @@ static int vhostmd_run(int diskfd) + if (virtio_expiration_time < (update_period * 3)) + virtio_expiration_time = update_period * 3; + +- if (virtio_init(virtio_max_channels, virtio_expiration_time)) ++ if (virtio_init(virtio_max_channels, virtio_expiration_time)) { ++ vu_buffer_delete(buf); + return -1; ++ } + + rc = pthread_create(&virtio_tid, NULL, virtio_run, NULL); + + if (rc != 0) { + vu_log(VHOSTMD_ERR, "Failed to start virtio thread '%s'\n", + strerror(rc)); ++ vu_buffer_delete(buf); + return -1; + } + } +-- +2.32.0 + diff --git a/0019-virtio-Fix-strncpy-length-parameter.patch b/0019-virtio-Fix-strncpy-length-parameter.patch new file mode 100644 index 0000000..97c6a57 --- /dev/null +++ b/0019-virtio-Fix-strncpy-length-parameter.patch @@ -0,0 +1,36 @@ +From 99995e4ba138f43b277620bd43a096c72f354548 Mon Sep 17 00:00:00 2001 +From: Jim Fehlig +Date: Tue, 14 Jan 2020 16:22:48 -0700 +Subject: [PATCH 19/19] virtio: Fix strncpy length parameter + +Leave an extra byte for null-terminator in call to strncpy. From +coverity scan + +vhostmd-1.1/vhostmd/virtio.c:194: buffer_size_warning: Calling "strncpy" with a maximum size argument of 108 bytes on destination array "address.sun_path" of size 108 bytes might leave the destination string unterminated. + 192| address.sun_family = AF_LOCAL; + 193| + 194|-> strncpy(address.sun_path, c->uds_name, SUN_PATH_LEN); + 195| + 196| if ((c->fd = socket(AF_LOCAL, SOCK_STREAM, 0)) == -1) + +Signed-off-by: Jim Fehlig +--- + vhostmd/virtio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/vhostmd/virtio.c b/vhostmd/virtio.c +index f227b45..a6c2515 100644 +--- a/vhostmd/virtio.c ++++ b/vhostmd/virtio.c +@@ -191,7 +191,7 @@ static int vio_channel_open(channel_t * c) + bzero(&address, sizeof(address)); + address.sun_family = AF_LOCAL; + +- strncpy(address.sun_path, c->uds_name, SUN_PATH_LEN); ++ strncpy(address.sun_path, c->uds_name, SUN_PATH_LEN - 1); + + if ((c->fd = socket(AF_LOCAL, SOCK_STREAM, 0)) == -1) + goto error; +-- +2.32.0 + diff --git a/vhostmd.spec b/vhostmd.spec index d5d1490..c6d58ef 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -3,7 +3,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 1.1 -Release: 9%{?dist} +Release: 10%{?dist} License: GPLv2+ URL: https://github.com/vhostmd/vhostmd @@ -14,7 +14,25 @@ Source1: vhostmd.conf # Prevents updates from previous versions with the old config file # from breaking (RHBZ#1782897). # https://github.com/vhostmd/vhostmd/commit/83cc269f6892852be94467cea771b3ad1da8a369 -Patch1: 0001-Relax-virtio-requirement-in-config-file.patch +Patch0001: 0001-Relax-virtio-requirement-in-config-file.patch +Patch0002: 0002-libmetrics-Set-pointer-NULL-after-free.patch +Patch0003: 0003-libmetrics-Initialize-local-variable-ret-to-failure.patch +Patch0004: 0004-libmetrics-Check-return-value-of-asprintf.patch +Patch0005: 0005-libmetrics-Remove-unsafe-XML_PARSE_NOENT-option.patch +Patch0006: 0006-libmetrics-Ensure-libmetrics-mutex-is-unlocked-in-er.patch +Patch0007: 0007-libmetrics-Fix-potential-memory-leak.patch +Patch0008: 0008-libmetrics-Use-proper-conversion-specifier-when-call.patch +Patch0009: 0009-libmetrics-Fix-potential-leak-of-FILE-pointer.patch +Patch0010: 0010-util-Add-missing-call-to-va_end.patch +Patch0011: 0011-util-Fix-potential-memory-leak.patch +Patch0012: 0012-util-Check-return-value-of-strstr.patch +Patch0013: 0013-Check-return-value-of-asprintf.patch +Patch0014: 0014-vhostmd-Fix-memory-leak-in-parse_transports.patch +Patch0015: 0015-vhostmd-Remove-unsafe-XML_PARSE_NOENT-option.patch +Patch0016: 0016-vhostmd-Check-return-value-of-file-functions.patch +Patch0017: 0017-vhostmd-Check-for-valide-file-handle-before-calling-.patch +Patch0018: 0018-vhostmd-Fix-memory-leak-in-vhostmd_run.patch +Patch0019: 0019-virtio-Fix-strncpy-length-parameter.patch BuildRequires: make BuildRequires: gcc @@ -163,6 +181,9 @@ exit 0 %changelog +* Thu Jul 29 2021 Richard W.M. Jones - 1.1-10 +- Miscellaneous upstream fixes. + * Fri Jul 23 2021 Fedora Release Engineering - 1.1-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild From 2d75effb58b1889b9ef8c3bbc1e17317fcdd858b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 22 Jan 2022 03:56:19 +0000 Subject: [PATCH 59/71] - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- vhostmd.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vhostmd.spec b/vhostmd.spec index c6d58ef..a80967a 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -3,7 +3,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 1.1 -Release: 10%{?dist} +Release: 11%{?dist} License: GPLv2+ URL: https://github.com/vhostmd/vhostmd @@ -181,6 +181,9 @@ exit 0 %changelog +* Sat Jan 22 2022 Fedora Release Engineering - 1.1-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + * Thu Jul 29 2021 Richard W.M. Jones - 1.1-10 - Miscellaneous upstream fixes. From d3bdd041a09c519a2a6f785c3354427dd64ff616 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 23 Jul 2022 11:50:37 +0000 Subject: [PATCH 60/71] Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- vhostmd.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vhostmd.spec b/vhostmd.spec index a80967a..cb92e82 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -3,7 +3,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 1.1 -Release: 11%{?dist} +Release: 12%{?dist} License: GPLv2+ URL: https://github.com/vhostmd/vhostmd @@ -181,6 +181,9 @@ exit 0 %changelog +* Sat Jul 23 2022 Fedora Release Engineering - 1.1-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + * Sat Jan 22 2022 Fedora Release Engineering - 1.1-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild From e3ded7567e275941739aa467980aa3e6f32d09c3 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 21 Jan 2023 06:15:48 +0000 Subject: [PATCH 61/71] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- vhostmd.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vhostmd.spec b/vhostmd.spec index cb92e82..2fc308f 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -3,7 +3,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 1.1 -Release: 12%{?dist} +Release: 13%{?dist} License: GPLv2+ URL: https://github.com/vhostmd/vhostmd @@ -181,6 +181,9 @@ exit 0 %changelog +* Sat Jan 21 2023 Fedora Release Engineering - 1.1-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + * Sat Jul 23 2022 Fedora Release Engineering - 1.1-12 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild From 2485551a731bcc88ce469708ae94c22e3a51c617 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 22 Jul 2023 17:36:07 +0000 Subject: [PATCH 62/71] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- vhostmd.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vhostmd.spec b/vhostmd.spec index 2fc308f..b50cd21 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -3,7 +3,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 1.1 -Release: 13%{?dist} +Release: 14%{?dist} License: GPLv2+ URL: https://github.com/vhostmd/vhostmd @@ -181,6 +181,9 @@ exit 0 %changelog +* Sat Jul 22 2023 Fedora Release Engineering - 1.1-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Sat Jan 21 2023 Fedora Release Engineering - 1.1-13 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild From 04570aaf13bba412b792be9729d7464525ead14c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Mon, 24 Jul 2023 13:11:09 +0100 Subject: [PATCH 63/71] Correct license from GPLv2+ to LGPL-2.1-or-later (SPDX format) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The existing license was incorrectly declaring the project as being GPLv2+, when the code is clearly LGPL licensed. Upon correcting the license, we use the SPDX terminology. Signed-off-by: Daniel P. Berrangé --- vhostmd.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vhostmd.spec b/vhostmd.spec index b50cd21..30e89e4 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -4,7 +4,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 1.1 Release: 14%{?dist} -License: GPLv2+ +License: LGPL-2.1-or-later URL: https://github.com/vhostmd/vhostmd From f0ff0e1b37ed19477f1349637fd36c55400a2143 Mon Sep 17 00:00:00 2001 From: Nils Koenig Date: Thu, 19 Oct 2023 17:56:03 +0200 Subject: [PATCH 64/71] Use systemd-sysusers to create vhostmd user See also BZ 2095483wq https://bugzilla.redhat.com/show_bug.cgi?id=2095483 --- vhostmd.spec | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/vhostmd.spec b/vhostmd.spec index 30e89e4..95f39a4 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -125,11 +125,7 @@ rm $RPM_BUILD_ROOT%{_datadir}/vhostmd/scripts/pagerate.pl %pre # UID:GID 112:112 reserved, see RHBZ#534109. -getent group vhostmd >/dev/null || groupadd -g 112 -r vhostmd -getent passwd vhostmd >/dev/null || \ -useradd -u 112 -r -g vhostmd -d %{_datadir}/vhostmd -s /sbin/nologin \ --c "Virtual Host Metrics Daemon" vhostmd -exit 0 +%sysusers_create_inline u vhostmd 112 "Virtual Host Metrics Daemon" %{_datadir}/vhostmd /sbin/nologin %post From 8cbdb24e2b3b4e8acdc99ee9bf7f282c3228a1e6 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Sun, 24 Dec 2023 15:14:28 -0500 Subject: [PATCH 65/71] Fix for https://fedoraproject.org/wiki/Changes/PortingToModernC https://github.com/vhostmd/vhostmd/pull/13 --- 0020-implicit-function-declarations.patch | 74 +++++++++++++++++++++++ vhostmd.spec | 2 + 2 files changed, 76 insertions(+) create mode 100644 0020-implicit-function-declarations.patch diff --git a/0020-implicit-function-declarations.patch b/0020-implicit-function-declarations.patch new file mode 100644 index 0000000..37d0272 --- /dev/null +++ b/0020-implicit-function-declarations.patch @@ -0,0 +1,74 @@ +From cf555d3bf079ff60b363dba4dc48a349dce5d3b4 Mon Sep 17 00:00:00 2001 +From: Yaakov Selkowitz +Date: Sun, 24 Dec 2023 14:54:09 -0500 +Subject: [PATCH] Fix implicit declarations +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Errors raised in Fedora rawhide and ELN which have added the +-Werror=implicit-function-declaration flag for C: + +virt-util.c:96:9: error: implicit declaration of function ‘calloc’ +virt-util.c:129:10: error: implicit declaration of function ‘free’ + +virtio.c:160:9: error: implicit declaration of function ‘free’ +virtio.c:254:31: error: implicit declaration of function ‘bsearch’ +virtio.c:259:13: error: implicit declaration of function ‘qsort’ +virtio.c:586:33: error: implicit declaration of function ‘calloc’ + +libmetrics.c:136:28: error: implicit declaration of function 'atoi' +libmetrics.c:142:29: error: implicit declaration of function 'atoll' +libmetrics.c:148:28: error: implicit declaration of function 'atof' +libmetrics.c:170:12: error: implicit declaration of function 'calloc' +libmetrics.c:189:12: error: implicit declaration of function 'free' +libmetrics.c:311:7: error: implicit declaration of function 'posix_memalign' +libmetrics.c:385:26: error: implicit declaration of function 'malloc' +libmetrics.c:848:28: error: implicit declaration of function 'realloc' + +Signed-off-by: Yaakov Selkowitz +--- + libmetrics/libmetrics.c | 1 + + vhostmd/virt-util.c | 1 + + vhostmd/virtio.c | 1 + + 3 files changed, 3 insertions(+) + +diff --git a/libmetrics/libmetrics.c b/libmetrics/libmetrics.c +index 8819074..c83fd03 100644 +--- a/libmetrics/libmetrics.c ++++ b/libmetrics/libmetrics.c +@@ -21,6 +21,7 @@ + #include + + #include ++#include + #include + #include + #include +diff --git a/vhostmd/virt-util.c b/vhostmd/virt-util.c +index a94cccd..40765c3 100644 +--- a/vhostmd/virt-util.c ++++ b/vhostmd/virt-util.c +@@ -21,6 +21,7 @@ + #include + + #include ++#include + #include + #include + +diff --git a/vhostmd/virtio.c b/vhostmd/virtio.c +index a6c2515..98340ce 100644 +--- a/vhostmd/virtio.c ++++ b/vhostmd/virtio.c +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + #include + + #include "util.h" +-- +2.43.0 + diff --git a/vhostmd.spec b/vhostmd.spec index 95f39a4..d5db983 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -33,6 +33,8 @@ Patch0016: 0016-vhostmd-Check-return-value-of-file-functions.patch Patch0017: 0017-vhostmd-Check-for-valide-file-handle-before-calling-.patch Patch0018: 0018-vhostmd-Fix-memory-leak-in-vhostmd_run.patch Patch0019: 0019-virtio-Fix-strncpy-length-parameter.patch +# https://github.com/vhostmd/vhostmd/pull/13 +Patch0020: 0020-implicit-function-declarations.patch BuildRequires: make BuildRequires: gcc From da4b24f541d666bfad50883fa5e741a8fe3cecd9 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 27 Jan 2024 07:42:42 +0000 Subject: [PATCH 66/71] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- vhostmd.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vhostmd.spec b/vhostmd.spec index d5db983..26b2954 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -3,7 +3,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 1.1 -Release: 14%{?dist} +Release: 15%{?dist} License: LGPL-2.1-or-later URL: https://github.com/vhostmd/vhostmd @@ -179,6 +179,9 @@ rm $RPM_BUILD_ROOT%{_datadir}/vhostmd/scripts/pagerate.pl %changelog +* Sat Jan 27 2024 Fedora Release Engineering - 1.1-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Sat Jul 22 2023 Fedora Release Engineering - 1.1-14 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild From 3e64712b1ead22938fc8c798428816f542a31f6a Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 20 Jul 2024 08:44:51 +0000 Subject: [PATCH 67/71] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- vhostmd.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vhostmd.spec b/vhostmd.spec index 26b2954..5b28244 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -3,7 +3,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 1.1 -Release: 15%{?dist} +Release: 16%{?dist} License: LGPL-2.1-or-later URL: https://github.com/vhostmd/vhostmd @@ -179,6 +179,9 @@ rm $RPM_BUILD_ROOT%{_datadir}/vhostmd/scripts/pagerate.pl %changelog +* Sat Jul 20 2024 Fedora Release Engineering - 1.1-16 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Sat Jan 27 2024 Fedora Release Engineering - 1.1-15 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 7b6141f39606fb725bb6b0a70d040f7371d9e8c7 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sun, 19 Jan 2025 14:18:40 +0000 Subject: [PATCH 68/71] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- vhostmd.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vhostmd.spec b/vhostmd.spec index 5b28244..704b23b 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -3,7 +3,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 1.1 -Release: 16%{?dist} +Release: 17%{?dist} License: LGPL-2.1-or-later URL: https://github.com/vhostmd/vhostmd @@ -179,6 +179,9 @@ rm $RPM_BUILD_ROOT%{_datadir}/vhostmd/scripts/pagerate.pl %changelog +* Sun Jan 19 2025 Fedora Release Engineering - 1.1-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Sat Jul 20 2024 Fedora Release Engineering - 1.1-16 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild From 4dab2b5b60f6915ced596a22b60d1da93d001b8e Mon Sep 17 00:00:00 2001 From: Nils Koenig Date: Wed, 15 Jan 2025 23:00:18 +0100 Subject: [PATCH 69/71] Added rpminspect.yaml which avoids a xmllint check for dtd docu files. --- rpminspect.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 rpminspect.yaml diff --git a/rpminspect.yaml b/rpminspect.yaml new file mode 100644 index 0000000..4347770 --- /dev/null +++ b/rpminspect.yaml @@ -0,0 +1,5 @@ +xml: + # Regular expression (man 7 regex) matching directories to ignore + # during the xml inspection. Skip DTD files, which + # contain a mix of XML and code. + exclude_path: .*(\.dtd)$ From 661e2929636a597007239a9be9d598e21a7ce879 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 25 Jul 2025 20:04:19 +0000 Subject: [PATCH 70/71] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- vhostmd.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vhostmd.spec b/vhostmd.spec index 704b23b..7402f2c 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -3,7 +3,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 1.1 -Release: 17%{?dist} +Release: 18%{?dist} License: LGPL-2.1-or-later URL: https://github.com/vhostmd/vhostmd @@ -179,6 +179,9 @@ rm $RPM_BUILD_ROOT%{_datadir}/vhostmd/scripts/pagerate.pl %changelog +* Fri Jul 25 2025 Fedora Release Engineering - 1.1-18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Sun Jan 19 2025 Fedora Release Engineering - 1.1-17 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild From 9c76ecd62a43070af372159969aaff1a87fc52bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Thu, 2 Oct 2025 10:18:22 +0100 Subject: [PATCH 71/71] Disable build on i686 architecture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit vhostmd is a leaf package so there is no reason to continue building it on i686. Signed-off-by: Daniel P. Berrangé --- vhostmd.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vhostmd.spec b/vhostmd.spec index 7402f2c..93a1476 100644 --- a/vhostmd.spec +++ b/vhostmd.spec @@ -3,7 +3,7 @@ Summary: Virtualization host metrics daemon Name: vhostmd Version: 1.1 -Release: 18%{?dist} +Release: 19%{?dist} License: LGPL-2.1-or-later URL: https://github.com/vhostmd/vhostmd @@ -36,6 +36,8 @@ Patch0019: 0019-virtio-Fix-strncpy-length-parameter.patch # https://github.com/vhostmd/vhostmd/pull/13 Patch0020: 0020-implicit-function-declarations.patch +ExcludeArch: %{ix86} + BuildRequires: make BuildRequires: gcc BuildRequires: chrpath @@ -179,6 +181,9 @@ rm $RPM_BUILD_ROOT%{_datadir}/vhostmd/scripts/pagerate.pl %changelog +* Thu Oct 2 2025 Daniel P. Berrangé - 1.1-19 +- Disable build on i686 architecture + * Fri Jul 25 2025 Fedora Release Engineering - 1.1-18 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild