import vhostmd-1.1-4.el8
This commit is contained in:
parent
6846dd3d32
commit
54ca6863ab
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
||||
SOURCES/vhostmd-0.5.tar.bz2
|
||||
SOURCES/vhostmd-1.1.tar.gz
|
||||
|
||||
@ -1 +1 @@
|
||||
b2512846366f6b6881bd19cd450ad994b05860e0 SOURCES/vhostmd-0.5.tar.bz2
|
||||
93e6bbbf15be248e7da222d377d2b98fb4c2be24 SOURCES/vhostmd-1.1.tar.gz
|
||||
|
||||
42
SOURCES/0001-Relax-virtio-requirement-in-config-file.patch
Normal file
42
SOURCES/0001-Relax-virtio-requirement-in-config-file.patch
Normal file
@ -0,0 +1,42 @@
|
||||
From 83cc269f6892852be94467cea771b3ad1da8a369 Mon Sep 17 00:00:00 2001
|
||||
From: Jim Fehlig <jfehlig@suse.com>
|
||||
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 <virtio> 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 <jfehlig@suse.com>
|
||||
---
|
||||
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
|
||||
-->
|
||||
|
||||
<!ELEMENT vhostmd (globals,metrics)>
|
||||
-<!ELEMENT globals (disk,virtio,update_period,path,transport+)>
|
||||
+<!ELEMENT globals (disk,virtio*,update_period,path,transport+)>
|
||||
|
||||
<!ELEMENT disk (name,path,size)>
|
||||
<!ELEMENT name (#PCDATA)>
|
||||
--
|
||||
2.24.1
|
||||
|
||||
@ -1,40 +0,0 @@
|
||||
From 8684995d87e08fadd44e1814e810c770a1f60273 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
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 <getopt.h>
|
||||
#include <signal.h>
|
||||
#include <pwd.h>
|
||||
+#include <grp.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
@@ -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
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
From efba4feaef25ea7efc9e35cfa6e92b69784aa88f Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
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
|
||||
|
||||
@ -1,51 +0,0 @@
|
||||
From 8fd4d847277bb9a7e53f8bb3f3f935004d8e5cc4 Mon Sep 17 00:00:00 2001
|
||||
From: Eduardo Otubo <eduardo.otubo@gmail.com>
|
||||
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 <eduardo.otubo@gmail.com>
|
||||
---
|
||||
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
|
||||
|
||||
@ -1,34 +0,0 @@
|
||||
From 7a2936ec4e6bd5a47ef8ac4f4b889c70b8a78e9b Mon Sep 17 00:00:00 2001
|
||||
From: Jim Fehlig <jfehlig@suse.com>
|
||||
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
|
||||
|
||||
@ -1,41 +0,0 @@
|
||||
From 972ac212abcf0eacd7039b3a5987bd9ae2083607 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
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 <file> Configuration file (/etc/vhostmd.xml default)
|
||||
+ -f | --config <file> Configuration file (/etc/vhostmd/vhostmd.conf default)
|
||||
-p | --pid-file <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 <file>
|
||||
-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
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
From 3e4df5dd16c59a804373564602aa045b0599aa82 Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Kastl <kastl@b1-systems.de>
|
||||
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
|
||||
|
||||
@ -1,61 +0,0 @@
|
||||
From 498bace866c16842d677a00b1df8ab62e0724d55 Mon Sep 17 00:00:00 2001
|
||||
From: Jim Fehlig <jfehlig@suse.com>
|
||||
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 <jfehlig@suse.com>
|
||||
---
|
||||
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
|
||||
|
||||
@ -1,128 +0,0 @@
|
||||
From d12766463a9de3b8490e6a552db83bf7d4853896 Mon Sep 17 00:00:00 2001
|
||||
From: Jim Fehlig <jfehlig@suse.com>
|
||||
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 <jfehlig@suse.com>
|
||||
---
|
||||
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
|
||||
|
||||
@ -1,311 +0,0 @@
|
||||
From 3dd984f7299d1364d6e7a902776e1fcfd83d6370 Mon Sep 17 00:00:00 2001
|
||||
From: Jim Fehlig <jfehlig@suse.com>
|
||||
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 <jfehlig@suse.com>
|
||||
---
|
||||
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 <plc@novell.com>
|
||||
- *
|
||||
- * Preliminary, this could be done better
|
||||
- */
|
||||
-
|
||||
-#include <config.h>
|
||||
-
|
||||
-#include <stdio.h>
|
||||
-#include <string.h>
|
||||
-#include <xenctrl.h>
|
||||
-#include <xs.h>
|
||||
-
|
||||
-#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
|
||||
|
||||
@ -1,222 +0,0 @@
|
||||
From 1586cf7722d8ca45e4e4fff67be1ae0567e6d4b8 Mon Sep 17 00:00:00 2001
|
||||
From: Jim Fehlig <jfehlig@suse.com>
|
||||
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 <jfehlig@suse.com>
|
||||
---
|
||||
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 <plc@novell.com>
|
||||
- */
|
||||
-
|
||||
-#include <config.h>
|
||||
-
|
||||
-#include <stdio.h>
|
||||
-#include <stdarg.h>
|
||||
-#include <stdlib.h>
|
||||
-#include <string.h>
|
||||
-#include <strings.h>
|
||||
-
|
||||
-#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
|
||||
|
||||
@ -1,58 +0,0 @@
|
||||
From 66967ef343c40d91918384540f9868b43c90c433 Mon Sep 17 00:00:00 2001
|
||||
From: Jim Fehlig <jfehlig@suse.com>
|
||||
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 <jfehlig@suse.com>
|
||||
---
|
||||
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 <arpa/inet.h>
|
||||
#include <libxml/xpath.h>
|
||||
#ifdef WITH_XENSTORE
|
||||
-#include <xs.h>
|
||||
+#include <xenstore.h>
|
||||
#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 <errno.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/xpath.h>
|
||||
-#include <xs.h>
|
||||
+#include <xenstore.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "metric.h"
|
||||
--
|
||||
2.19.0.rc0
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
From b015f73b742db6285d8201e87387a7217e89dbfd Mon Sep 17 00:00:00 2001
|
||||
From: Jim Fehlig <jfehlig@suse.com>
|
||||
Date: Mon, 11 Jun 2018 15:25:58 -0600
|
||||
Subject: [PATCH 12/17] Fix typo in systemd service file
|
||||
|
||||
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
|
||||
---
|
||||
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
|
||||
|
||||
@ -1,70 +0,0 @@
|
||||
From 302e49730f862a10b3b5b58905d803d27853f7d6 Mon Sep 17 00:00:00 2001
|
||||
From: Jim Fehlig <jfehlig@suse.com>
|
||||
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 <jfehlig@suse.com>
|
||||
---
|
||||
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 <uri> 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
|
||||
|
||||
@ -1,110 +0,0 @@
|
||||
From c7646e329ca61a038777f58042539611ac42b007 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Trapp <Michael.Trapp@sap.com>
|
||||
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
|
||||
|
||||
@ -1,40 +0,0 @@
|
||||
From 03dc99825ad3d53cfcc7d8c2b8288b1549f261d6 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Trapp <Michael.Trapp@sap.com>
|
||||
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
|
||||
|
||||
@ -1,39 +0,0 @@
|
||||
From 6439d22cea451e54b58bb9d6e8072cc6c58694be Mon Sep 17 00:00:00 2001
|
||||
From: Jim Fehlig <jfehlig@suse.com>
|
||||
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 <jfehlig@suse.com>
|
||||
---
|
||||
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
|
||||
|
||||
@ -1,175 +0,0 @@
|
||||
From d1a230d6d3ca4ded376f6522688d379bac347fbe Mon Sep 17 00:00:00 2001
|
||||
From: Jim Fehlig <jfehlig@suse.com>
|
||||
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 <action> element.
|
||||
|
||||
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
|
||||
---
|
||||
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 <path> element.
|
||||
+When chaining commands, '&', '<' and '>' are reserved characters,
|
||||
+therefore '&', '<' and '>' must be used instead. For example,
|
||||
+the logical && operator must be replaced with "&&".
|
||||
+
|
||||
-->
|
||||
|
||||
<vhostmd>
|
||||
@@ -28,52 +34,75 @@ within the vm element.
|
||||
<size unit="k">256</size>
|
||||
</disk>
|
||||
<update_period>5</update_period>
|
||||
- <path>/usr/bin:/usr/sbin:/usr/share/vhostmd/scripts</path>
|
||||
+ <path>/usr/sbin:/sbin:/usr/bin:/bin:/usr/share/vhostmd/scripts</path>
|
||||
<transport>vbd</transport>
|
||||
<!-- <transport>xenstore</transport> -->
|
||||
</globals>
|
||||
<metrics>
|
||||
<metric type="string" context="host">
|
||||
<name>HostName</name>
|
||||
- <action>virsh CONNECT hostname | tr -d '[:space:]'</action>
|
||||
+ <action>
|
||||
+ virsh CONNECT hostname | tr -d '[:space:]'
|
||||
+ </action>
|
||||
</metric>
|
||||
<metric type="string" context="host">
|
||||
<name>VirtualizationVendor</name>
|
||||
- <action>/bin/rpm -q --info xen | grep Vendor: | \
|
||||
- awk '{print substr($0, index($0,$5)) }'</action>
|
||||
+ <action>
|
||||
+ [ -f /proc/xen/privcmd ] && RPM="xen" || RPM="libvirt"; \
|
||||
+ rpm -q --queryformat "%{VENDOR}\n" $RPM | sort -u | sed -e 's/<.*//' -e 's/ *$//'
|
||||
+ </action>
|
||||
</metric>
|
||||
<metric type="string" context="host">
|
||||
<name>VirtualizationProductInfo</name>
|
||||
- <action>xm info | gawk '/^xen_(major|minor|extra)/ {print $3}' | \
|
||||
- tr -d . | tr '[:space:]' .</action>
|
||||
+ <action>
|
||||
+ [ -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
|
||||
+ </action>
|
||||
</metric>
|
||||
<metric type="uint32" context="host">
|
||||
<name>TotalPhyCPUs</name>
|
||||
- <action>xm info | gawk '/^nr_cpus/ {print $3}'</action>
|
||||
+ <action>
|
||||
+ virsh nodeinfo | awk '/^CPU\(s\)/ {print $2}'
|
||||
+ </action>
|
||||
</metric>
|
||||
<metric type="uint32" context="host">
|
||||
<name>NumCPUs</name>
|
||||
- <action>xm info | gawk '/^nr_cpus/ {print $3}'</action>
|
||||
+ <action>
|
||||
+ virsh nodeinfo | awk '/^CPU\(s\)/ {print $2}'
|
||||
+ </action>
|
||||
</metric>
|
||||
<metric type="uint64" context="host">
|
||||
<name>TotalPhyMem</name>
|
||||
- <action>xm info | gawk '/^total_memory/ {print $3}'</action>
|
||||
+ <action>
|
||||
+ echo $((`virsh nodeinfo | awk '/^Memory/ {print $3}'` / 1024))
|
||||
+ </action>
|
||||
</metric>
|
||||
<metric type="uint64" context="host">
|
||||
<name>UsedMem</name>
|
||||
- <action>echo "$((`xentop -b -i 1 | gawk '/Domain-0/ {print $5}'` / 1024))"</action>
|
||||
+ <action>
|
||||
+ [ -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; }'
|
||||
+ </action>
|
||||
</metric>
|
||||
<metric type="uint64" context="host">
|
||||
<name>FreeMem</name>
|
||||
- <action>xm info | gawk '/^max_free_memory/ {print $3}'</action>
|
||||
+ <action>
|
||||
+ [ -f /proc/xen/privcmd ] && xl info | awk '/^free_memory/ {print $3}' || \
|
||||
+ free | egrep -i '^[[:space:]]*(.*buffers/cache:)' | awk '{ printf "%d\n", $4/1024; }'
|
||||
+ </action>
|
||||
</metric>
|
||||
<metric type="uint64" context="host">
|
||||
<name>PagedInMemory</name>
|
||||
- <action>echo "$((`vmstat -s | gawk '/pages paged in/ {print $1}'` / 1024))"</action>
|
||||
+ <action>
|
||||
+ vmstat -s | awk '/pages paged in/ {printf "%d\n", $1 / 1024 * $(getconf PAGESIZE) / 1024;}'
|
||||
+ </action>
|
||||
</metric>
|
||||
<metric type="uint64" context="host">
|
||||
<name>PagedOutMemory</name>
|
||||
- <action>echo "$((`vmstat -s | gawk '/pages paged out/ {print $1}'` / 1024))"</action>
|
||||
+ <action>
|
||||
+ vmstat -s | awk '/pages paged out/ {printf "%d\n", $1 / 1024 * $(getconf PAGESIZE) / 1024;}'
|
||||
+ </action>
|
||||
</metric>
|
||||
<metric type="group" context="host">
|
||||
<name>PageRates</name>
|
||||
@@ -83,13 +112,45 @@ within the vm element.
|
||||
</metric>
|
||||
<metric type="real64" context="host">
|
||||
<name>TotalCPUTime</name>
|
||||
- <action>virsh CONNECT dominfo 0 | sed 's/: */:/' | \
|
||||
- gawk -F: '/CPU time/ {print $2;}'</action>
|
||||
+ <action>
|
||||
+ [ -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;
|
||||
+ }'
|
||||
+ </action>
|
||||
</metric>
|
||||
<metric type="real64" context="vm">
|
||||
<name>TotalCPUTime</name>
|
||||
- <action>virsh CONNECT dominfo NAME | sed 's/: */:/' | \
|
||||
- gawk -F: '/CPU time/ {print $2;}'</action>
|
||||
+ <action>
|
||||
+ virsh CONNECT dominfo NAME | sed 's/: */:/' | \
|
||||
+ awk -F: '/CPU time/ {print $2;}' | sed 's/s//'
|
||||
+ </action>
|
||||
</metric>
|
||||
</metrics>
|
||||
</vhostmd>
|
||||
--
|
||||
2.19.0.rc0
|
||||
|
||||
@ -80,10 +80,15 @@ way.
|
||||
<!-- must be between [128 KB, 256 MB] in size -->
|
||||
<size unit="k">256</size>
|
||||
</disk>
|
||||
<virtio>
|
||||
<max_channels>1024</max_channels>
|
||||
<expiration_time>15</expiration_time>
|
||||
</virtio>
|
||||
<update_period>60</update_period>
|
||||
<path>/bin:/sbin:/usr/bin:/usr/sbin:/usr/share/vhostmd/scripts</path>
|
||||
<transport>vbd</transport>
|
||||
<!-- <transport>xenstore</transport> -->
|
||||
<transport>virtio</transport>
|
||||
</globals>
|
||||
<metrics>
|
||||
<metric type="string" context="host">
|
||||
@ -97,8 +102,7 @@ way.
|
||||
<metric type="string" context="host">
|
||||
<name>VirtualizationVendor</name>
|
||||
<action>
|
||||
rpm -qi libvirt| grep Vendor: \
|
||||
| awk '{ print substr($0, index($0, $5)); }' | sort -u
|
||||
rpm -q --queryformat "%{VENDOR}\n" libvirt | sort -u
|
||||
</action>
|
||||
</metric>
|
||||
<!-- SAP "CIM" -->
|
||||
|
||||
@ -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 $?
|
||||
@ -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:///
|
||||
@ -2,38 +2,19 @@
|
||||
|
||||
Summary: Virtualization host metrics daemon
|
||||
Name: vhostmd
|
||||
Version: 0.5
|
||||
Release: 18%{?dist}
|
||||
Version: 1.1
|
||||
Release: 4%{?dist}
|
||||
License: GPLv2+
|
||||
|
||||
URL: http://gitorious.org/vhostmd
|
||||
URL: https://github.com/vhostmd/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
|
||||
Source0: https://github.com/vhostmd/vhostmd/archive/v%{version}/%{name}-%{version}.tar.gz
|
||||
Source1: 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
|
||||
# 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: gcc
|
||||
BuildRequires: chrpath
|
||||
@ -96,7 +77,6 @@ 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
|
||||
|
||||
chrpath --delete $RPM_BUILD_ROOT%{_sbindir}/vm-dump-metrics
|
||||
@ -111,7 +91,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)
|
||||
@ -177,6 +157,26 @@ exit 0
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Jan 31 2020 Richard W.M. Jones <rjones@redhat.com> - 1.1-4.el8
|
||||
- Prevent updates from previous versions from breaking
|
||||
resolves: rhbz#1782897
|
||||
|
||||
* Mon Nov 25 2019 Richard W.M. Jones <rjones@redhat.com> - 1.1-3.el8
|
||||
- Fix URL
|
||||
resolves: rhbz#1775565
|
||||
|
||||
* Mon Nov 25 2019 Richard W.M. Jones <rjones@redhat.com> - 1.1-2.el8
|
||||
- Fix vhostmd.conf
|
||||
related: rhbz#1689213
|
||||
|
||||
* Thu Aug 29 2019 Richard W.M. Jones <rjones@redhat.com> - 1.1-1.el8.1
|
||||
- Upstream version 1.1.
|
||||
- Remove patches, since all included 1.1.
|
||||
resolves: 1689213
|
||||
|
||||
* Thu Mar 21 2019 Richard W.M. Jones <rjones@redhat.com> - 0.5-19
|
||||
- Add gating tests resolves: rhbz#1682784
|
||||
|
||||
* Tue Oct 16 2018 Richard W.M. Jones <rjones@redhat.com> - 0.5-19
|
||||
- Include all upstream patches since 0.5.
|
||||
- Enable systemd init scripts (RHBZ#1592400).
|
||||
|
||||
Loading…
Reference in New Issue
Block a user