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] - 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