Initial import.
This commit is contained in:
parent
2762c157b6
commit
e2f04176bd
@ -0,0 +1 @@
|
||||
vhostmd-0.4.tar.bz2
|
||||
61
0001-Further-changes-to-avoid-using-xenstore.patch
Normal file
61
0001-Further-changes-to-avoid-using-xenstore.patch
Normal file
@ -0,0 +1,61 @@
|
||||
From c0cbeed281739194adfb9c43d01197a4f84d8d95 Mon Sep 17 00:00:00 2001
|
||||
From: Richard Jones <rjones@redhat.com>
|
||||
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
|
||||
|
||||
1
import.log
Normal file
1
import.log
Normal file
@ -0,0 +1 @@
|
||||
vhostmd-0_4-0_1_git326f0012172_fc11:HEAD:vhostmd-0.4-0.1.git326f0012172.fc11.src.rpm:1255456588
|
||||
93
vhostmd.conf
Normal file
93
vhostmd.conf
Normal file
@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" ?>
|
||||
<!DOCTYPE vhostmd SYSTEM "vhostmd.dtd">
|
||||
|
||||
<!--
|
||||
|
||||
Configuration file for virtual host metrics daemon (vhostmd).
|
||||
|
||||
A better, less noisy, more minimal configuration file
|
||||
which doesn't depend on Xen.
|
||||
|
||||
Supported metric types are: int32, uint32, int64, uint64, real32,
|
||||
real64, and string.
|
||||
|
||||
A metric's value is set to the output produced by executing its action.
|
||||
|
||||
'action' can include the special token NAME, in which case the name of
|
||||
the vm currently under inspection is substituted for NAME. Only useful
|
||||
within the vm element.
|
||||
|
||||
-->
|
||||
|
||||
<vhostmd>
|
||||
<globals>
|
||||
<disk>
|
||||
<name>host-metrics-disk</name>
|
||||
<path>/dev/shm/vhostmd0</path>
|
||||
<!-- must be between [128 KB, 256 MB] in size -->
|
||||
<size unit="k">256</size>
|
||||
</disk>
|
||||
<update_period>60</update_period>
|
||||
<path>/bin:/sbin:/usr/bin:/usr/sbin:/usr/share/vhostmd/scripts</path>
|
||||
<transport>vbd</transport>
|
||||
<!-- <transport>xenstore</transport> -->
|
||||
</globals>
|
||||
<metrics>
|
||||
<metric type="string" context="host">
|
||||
<name>HostName</name>
|
||||
<action>hostname</action>
|
||||
</metric>
|
||||
<metric type="string" context="host">
|
||||
<name>VirtualizationVendor</name>
|
||||
<action>echo Fedora</action>
|
||||
</metric>
|
||||
<metric type="string" context="host">
|
||||
<name>VirtualizationProductInfo</name>
|
||||
<action>virsh version | grep API | gawk -F': ' '{print $2}'</action>
|
||||
</metric>
|
||||
<metric type="uint32" context="host">
|
||||
<name>TotalPhyCPUs</name>
|
||||
<action>virsh nodeinfo | grep 'CPU(s):' | gawk -F': +' '{print $2}'</action>
|
||||
</metric>
|
||||
<metric type="uint32" context="host">
|
||||
<name>NumCPUs</name>
|
||||
<action>virsh nodeinfo | grep 'CPU(s):' | gawk -F': +' '{print $2}'</action>
|
||||
</metric>
|
||||
<metric type="uint64" context="host">
|
||||
<name>TotalPhyMem</name>
|
||||
<action>virsh nodeinfo | grep 'Memory size:' | gawk -F' +' '{print $3}'</action>
|
||||
</metric>
|
||||
<metric type="uint64" context="host">
|
||||
<name>UsedMem</name>
|
||||
<action>free | grep '^Mem:' | gawk '{print $3}'</action>
|
||||
</metric>
|
||||
<metric type="uint64" context="host">
|
||||
<name>FreeMem</name>
|
||||
<action>free | grep '^Mem:' | gawk '{print $4}'</action>
|
||||
</metric>
|
||||
<metric type="uint64" context="host">
|
||||
<name>PagedInMemory</name>
|
||||
<action>echo "$((`vmstat -s | gawk '/pages paged in/ {print $1}'` / 1024))"</action>
|
||||
</metric>
|
||||
<metric type="uint64" context="host">
|
||||
<name>PagedOutMemory</name>
|
||||
<action>echo "$((`vmstat -s | gawk '/pages paged out/ {print $1}'` / 1024))"</action>
|
||||
</metric>
|
||||
<metric type="group" context="host">
|
||||
<name>PageRates</name>
|
||||
<action>pagerate.pl</action>
|
||||
<variable name="PageInRate" type="uint64"/>
|
||||
<variable name="PageFaultRate" type="uint64"/>
|
||||
</metric>
|
||||
<!--<metric type="real64" context="host">
|
||||
<name>TotalCPUTime</name>
|
||||
<action>virsh dominfo 0 | sed 's/: */:/' | \
|
||||
gawk -F: '/CPU time/ {print $2;}'</action>
|
||||
</metric>-->
|
||||
<metric type="real64" context="vm">
|
||||
<name>TotalCPUTime</name>
|
||||
<action>virsh dominfo NAME | sed 's/: */:/' | \
|
||||
gawk -F: '/CPU time/ {print $2;}'</action>
|
||||
</metric>
|
||||
</metrics>
|
||||
</vhostmd>
|
||||
109
vhostmd.init
Normal file
109
vhostmd.init
Normal file
@ -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 $?
|
||||
204
vhostmd.spec
Normal file
204
vhostmd.spec
Normal file
@ -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 <rjones@redhat.com> - 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 <rjones@redhat.com> - 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 <rjones@redhat.com> - 0.3-1
|
||||
- New upstream version 0.3.
|
||||
|
||||
* Fri Aug 14 2009 Richard W.M. Jones <rjones@redhat.com> - 0.2-1
|
||||
- Initial packaging for Fedora, based on SuSE package.
|
||||
5
vhostmd.sysconfig
Normal file
5
vhostmd.sysconfig
Normal file
@ -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
|
||||
Loading…
Reference in New Issue
Block a user