From 2377d5739b03bb4b3e76e14142db8f1cdb1663b0 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 13 Oct 2009 17:56:10 +0000 Subject: [PATCH 1/8] Initial import. --- .cvsignore | 1 + ...ther-changes-to-avoid-using-xenstore.patch | 61 ++++++ import.log | 1 + sources | 1 + vhostmd.conf | 93 ++++++++ vhostmd.init | 109 ++++++++++ vhostmd.spec | 204 ++++++++++++++++++ vhostmd.sysconfig | 5 + 8 files changed, 475 insertions(+) create mode 100644 0001-Further-changes-to-avoid-using-xenstore.patch create mode 100644 import.log create mode 100644 vhostmd.conf create mode 100644 vhostmd.init create mode 100644 vhostmd.spec create mode 100644 vhostmd.sysconfig diff --git a/.cvsignore b/.cvsignore index e69de29..869264c 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +vhostmd-0.4.tar.bz2 diff --git a/0001-Further-changes-to-avoid-using-xenstore.patch b/0001-Further-changes-to-avoid-using-xenstore.patch new file mode 100644 index 0000000..1425ba6 --- /dev/null +++ b/0001-Further-changes-to-avoid-using-xenstore.patch @@ -0,0 +1,61 @@ +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/import.log b/import.log new file mode 100644 index 0000000..f204a59 --- /dev/null +++ b/import.log @@ -0,0 +1 @@ +vhostmd-0_4-0_1_git326f0012172_fc11:F-12:vhostmd-0.4-0.1.git326f0012172.fc11.src.rpm:1255456515 diff --git a/sources b/sources index e69de29..af60bb7 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +3e96ae064b7accaea68160d48379c92f vhostmd-0.4.tar.bz2 diff --git a/vhostmd.conf b/vhostmd.conf new file mode 100644 index 0000000..e649ba3 --- /dev/null +++ b/vhostmd.conf @@ -0,0 +1,93 @@ + + + + + + + + + host-metrics-disk + /dev/shm/vhostmd0 + + 256 + + 60 + /bin:/sbin:/usr/bin:/usr/sbin:/usr/share/vhostmd/scripts + vbd + + + + + HostName + hostname + + + VirtualizationVendor + echo Fedora + + + VirtualizationProductInfo + virsh version | grep API | gawk -F': ' '{print $2}' + + + TotalPhyCPUs + virsh nodeinfo | grep 'CPU(s):' | gawk -F': +' '{print $2}' + + + NumCPUs + virsh nodeinfo | grep 'CPU(s):' | gawk -F': +' '{print $2}' + + + TotalPhyMem + virsh nodeinfo | grep 'Memory size:' | gawk -F' +' '{print $3}' + + + UsedMem + free | grep '^Mem:' | gawk '{print $3}' + + + FreeMem + free | grep '^Mem:' | gawk '{print $4}' + + + 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 dominfo NAME | sed 's/: */:/' | \ + gawk -F: '/CPU time/ {print $2;}' + + + diff --git a/vhostmd.init b/vhostmd.init new file mode 100644 index 0000000..5555592 --- /dev/null +++ b/vhostmd.init @@ -0,0 +1,109 @@ +#!/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 + +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 new file mode 100644 index 0000000..7aa201e --- /dev/null +++ b/vhostmd.spec @@ -0,0 +1,204 @@ +# Xen is only available on a limited number of architectures +%ifarch %{ix86} x86_64 ia64 +%global have_xen 1 +%else +%global have_xen 0 +%endif + +Summary: Virtualization host metrics daemon +Name: vhostmd +Version: 0.4 +Release: 0.1.git326f0012172%{?dist} +License: GPLv2+ +Group: System Environment/Daemons +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. +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 + +Requires(post): chkconfig +Requires(preun): chkconfig +Requires(preun): initscripts +Requires(postun): initscripts + + +%description +vhostmd provides a "metrics communication channel" between a host and +its hosted virtual machines, allowing limited introspection of host +resource usage from within virtual machines. + + +%package -n vm-dump-metrics +Summary: Virtualization host metrics dump +Group: Applications/System + + +%description -n vm-dump-metrics +Executable to dump all available virtualization host metrics to stdout +or a file. + + +%package -n vm-dump-metrics-devel +Summary: Virtualization host metrics dump development +Group: Development/Libraries +Requires: vm-dump-metrics = %{version} +Requires: pkgconfig + + +%description -n vm-dump-metrics-devel +Header and libraries necessary for metrics gathering development + + +%prep +%setup -q + +%patch0 -p1 +./autogen.sh + + +%build +%configure \ +%if %{have_xen} == 0 + --without-xenstore \ +%endif + --enable-shared --disable-static +make %{_smp_mflags} + + +%install +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 + +chrpath --delete $RPM_BUILD_ROOT%{_sbindir}/vm-dump-metrics + +# Remove docdir - we'll make a proper one ourselves. +rm -r $RPM_BUILD_ROOT%{_docdir}/vhostmd + +# Remove metric.dtd from /etc. +rm $RPM_BUILD_ROOT%{_sysconfdir}/vhostmd/metric.dtd + +# The default configuration file is great for Xen, not so great +# for anyone else. Replace it with one which is better for libvirt +# users. +mv $RPM_BUILD_ROOT%{_sysconfdir}/vhostmd/vhostmd.conf \ + $RPM_BUILD_ROOT%{_sysconfdir}/vhostmd/vhostmd.conf.for.xen +cp %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/vhostmd/vhostmd.conf + + +%clean +rm -rf $RPM_BUILD_ROOT + + +%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 + + +%post -n vm-dump-metrics -p /sbin/ldconfig + + +%postun -n vm-dump-metrics -p /sbin/ldconfig + + +%files +%defattr(-,root,root,-) +%doc AUTHORS ChangeLog COPYING README +%doc mdisk.xml metric.dtd vhostmd.dtd vhostmd.xml + +%{_sbindir}/vhostmd + +%dir %{_sysconfdir}/vhostmd +%config(noreplace) %{_sysconfdir}/vhostmd/vhostmd.conf +%config(noreplace) %{_sysconfdir}/vhostmd/vhostmd.conf.for.xen +%config %{_sysconfdir}/vhostmd/vhostmd.dtd +%{_sysconfdir}/init.d/%{name} +%config(noreplace) %{_sysconfdir}/sysconfig/%{name} + +%dir %{_datadir}/vhostmd +%dir %{_datadir}/vhostmd/scripts +%{_datadir}/vhostmd/scripts/pagerate.pl + +%{_mandir}/man8/vhostmd.8.gz + + +%files -n vm-dump-metrics +%defattr(-,root,root,-) +%doc COPYING +%{_sbindir}/vm-dump-metrics +%{_libdir}/libmetrics.so.0 +%{_libdir}/libmetrics.so.0.0.0 +%{_mandir}/man1/vm-dump-metrics.1.gz + + +%files -n vm-dump-metrics-devel +%defattr(-,root,root,-) +%doc README +%{_libdir}/libmetrics.so +%dir %{_includedir}/vhostmd +%{_includedir}/vhostmd/libmetrics.h + + +%changelog +* 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. +- Add patch to fix --without-xenstore option. +- Use have_xen RPM macro. + +* Mon Oct 12 2009 Richard W.M. Jones - 0.3-3 +- Remove metric.dtd file from /etc (fixes rpmlint warning), but + vhostmd.dtd has to remain because it is needed to validate the + XML configuration file. +- Remove ExclusiveArch, instead conditionally depend on xen-devel. +- Use a better, less noisy, more minimal configuration file which + doesn't depend on Xen. + +* Thu Oct 8 2009 Richard W.M. Jones - 0.3-1 +- New upstream version 0.3. + +* Fri Aug 14 2009 Richard W.M. Jones - 0.2-1 +- Initial packaging for Fedora, based on SuSE package. diff --git a/vhostmd.sysconfig b/vhostmd.sysconfig new file mode 100644 index 0000000..8422c3e --- /dev/null +++ b/vhostmd.sysconfig @@ -0,0 +1,5 @@ +# Uncomment the following line to print verbose messages. +#VHOSTMD_VERBOSE=1 + +# Override the default configuration file path. +#VHOSTMD_CONFIG=/path/to/vhostmd.conf From 28418f7ebc665696c7443fb6d22afb9acb1087f2 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 15 Oct 2009 17:53:54 +0000 Subject: [PATCH 2/8] - 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 ab41d1cbf554e77bba63dbb10eba74cfeb2b480d Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 16 Oct 2009 16:10:56 +0000 Subject: [PATCH 3/8] - 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 18a678da7656772dca2865236e69ff96dfc89a90 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 2 Nov 2009 11:03:47 +0000 Subject: [PATCH 4/8] 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 c27b3611d172ee5be7a045951b55ec548ee468fa Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 17 Nov 2009 11:21:12 +0000 Subject: [PATCH 5/8] - 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). - Use fixed UID:GID 112:112 (RHBZ#534109). - vm-dump-metrics-devel package should require version and release of base package. --- vhostmd.conf | 6 +++++- vhostmd.init | 3 +++ vhostmd.spec | 22 ++++++++++++++++++---- vhostmd.sysconfig | 5 ++++- 4 files changed, 30 insertions(+), 6 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 1b253da..0650fb7 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.6.gite9db007b%{?dist}.1 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 @@ -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,19 @@ exit 0 %changelog +* Tue Nov 17 2009 Richard W.M. Jones - 0.4-0.9.gite9db007b.fc12.1 +- 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). +- Use fixed UID:GID 112:112 (RHBZ#534109). +- 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. 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 1f063dac31b33a672be1d032a6ab946984873ddf Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Thu, 26 Nov 2009 01:13:35 +0000 Subject: [PATCH 6/8] 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 41455267ccccd73cf2bc79d20d6bf55f832bd532 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Sat, 8 May 2010 02:27:25 +0000 Subject: [PATCH 7/8] Initialize branch EL-6 for vhostmd --- branch | 1 + 1 file changed, 1 insertion(+) create mode 100644 branch diff --git a/branch b/branch new file mode 100644 index 0000000..46381b9 --- /dev/null +++ b/branch @@ -0,0 +1 @@ +EL-6 From 243e29ac46039cae742b43e7013f36b66c83f0d2 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 29 Jul 2010 14:58:06 +0000 Subject: [PATCH 8/8] dist-git conversion --- .cvsignore => .gitignore | 0 Makefile | 21 --------------------- branch | 1 - import.log | 1 - 4 files changed, 23 deletions(-) rename .cvsignore => .gitignore (100%) delete mode 100644 Makefile delete mode 100644 branch delete mode 100644 import.log diff --git a/.cvsignore b/.gitignore similarity index 100% rename from .cvsignore rename to .gitignore diff --git a/Makefile b/Makefile deleted file mode 100644 index ab78374..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile for source rpm: vhostmd -# $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 $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attept a checkout -define checkout-makefile-common -test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) diff --git a/branch b/branch deleted file mode 100644 index 46381b9..0000000 --- a/branch +++ /dev/null @@ -1 +0,0 @@ -EL-6 diff --git a/import.log b/import.log deleted file mode 100644 index f204a59..0000000 --- a/import.log +++ /dev/null @@ -1 +0,0 @@ -vhostmd-0_4-0_1_git326f0012172_fc11:F-12:vhostmd-0.4-0.1.git326f0012172.fc11.src.rpm:1255456515