66 Commits

Author SHA1 Message Date
Jim Fehlig
52b2dbf5c7 vhostmd release 1.1
Update configure.ac and vhostmd.changes for release.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
v1.1
2019-04-10 16:25:00 -06:00
Michael Trapp
68997b09da Add a timeout to the metrics request and fix the timeout value
A timeout in the send request part of dump_virtio_metrics()
should prevent the send from looping forever. Also change the
existing 30 second timeout value to a more reasonable value of
5 seconds.
2019-03-15 11:42:50 -06:00
Michael Trapp
7d31666a22 Add function name to error messages in dump_virtio functions 2019-03-15 11:18:43 -06:00
Michael Trapp
c2c22fa2b8 Remove read_metrics() from the libmetrics constructor
The metrics disk can be opened with the first get_metrics() request.
2019-03-15 11:17:19 -06:00
Michael Trapp
ad0777cd20 Remove d_type check for channel directory.
We can't rely on d_type == DT_DIR because on some filesystems
d_type is not supported. A check for domain-ID-NAME/org.github.vhostmd.1
should be sufficient.
2019-02-06 10:03:29 -07:00
Michael Trapp
57698b6b2c Don't pass NULL string to library log function 2018-12-10 16:45:05 -07:00
Michael Trapp
89ba5ba4ba Remove libserialclient
There is no need to keep the dump_virtio code in a separate library.
Revert libserialclient changes and move the code to libmetrics.
2018-12-10 16:41:32 -07:00
Jim Fehlig
29c8c5ef6c vhostmd release 1.0
Update conigure.ac, AUTHORS, and vhostmd.changes for release.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
v1.0
2018-11-30 15:05:20 -07:00
Jim Fehlig
4323a00ace Change bug report notification to virt-tools-list
The README already states that all correspondence for vhostmd
should take place on the virt-tools-list. Change the bug-report
email in AC_INIT to match.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2018-11-30 13:20:26 -07:00
Jim Fehlig
e5b56a4f76 Change last occurrences of C++ comment style to C
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2018-11-30 12:06:07 -07:00
Jim Fehlig
386228b841 Remove commented code
The code has been commented since importing vhostmd to git. I think
it is safe to remove it.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2018-11-30 12:02:01 -07:00
Michael Trapp
983bb879c3 Add virtio support to vm-dump-metrics
virtio functions are available in libmetrics
and in libserialclient (with minimal dependencies).
2018-11-30 11:49:49 -07:00
Michael Trapp
dffac68595 Activate virtio support in vhostmd
Activate the virtio code and extend DTD/XML to support a virtio section
for virtio related configuration and a new transport type virtio.
2018-11-30 11:49:49 -07:00
Michael Trapp
cfd4e6f198 Add virtio functions
At the vhostmd side virtio channels are Unix domain sockets from QEMU
which are created during a VM start and removed when the VM is stopped.

Basically this implementation
- monitors a directory for new virtio channels
- for valid IDs, also known by libvirtd, it connects to the UDS
- buffers VM/HOST metrics and handles request/response on the sockets

It provides the functions
virtio_init()
    init function of virtio layer
virtio_run()
    the start_routine for the virtio-thread to handle the virtio based
    communication
virtio_metrics_update()
    called for each VM/HOST metrics update to update the virtio internal
    metrics buffer.
virtio_stop()
    stop the virtio-thread
2018-11-30 11:49:34 -07:00
Michael Trapp
c1d67a50fa Extend vu_buffer struct
With the virtio implementation vu_buffer is used for socket IO
and therefore information about the current position after a
write is required.
2018-11-29 11:02:58 -07:00
Michael Trapp
ce60e3d98f Fix update_interval behaviour
Vhostmd uses the update_interval value to sleep() between the metrics updates.
But a long runtime of the metrics updates can result in a noticeable longer
time between the updates and a consumer might read 'old' data after waiting
update_interval seconds.
Fix the delay between updates, that
'runtime of metrics update' + 'sleep time' matches the update_interval value.
2018-11-29 11:02:44 -07:00
Michael Trapp
afde95c0cb Initialize allocated buffer
buffer_grow uses realloc to extend the buffer, due to the fact that
realloc doesn't guarantee that allocated memory is initialized there
should be a memset.
2018-11-29 11:01:20 -07:00
Jim Fehlig
f10651f4a8 vm-dump-metrics: Fix WITH_XENSTORE logic
The use of WITH_XENSTORE in vm-dump-metrics is clumbsy in some
cases and flat out wrong in others. E.g. if WITH_XENSTORE is not
defined then vbd transport is excluded as an option for retrieving
the metrics. Improve use of WITH_XENSTORE and fix the broken logic.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2018-10-23 15:54:17 -06:00
Jim Fehlig
8dc172ad44 vm-dump-metrics: Fix formating or usage function
The formatting in the usage function of vm-dump-metrics used a
lot of spaces for whitespace. Replace some occurrences with tabs
and remove others that were causing ugly formatting of help.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2018-10-23 15:40:27 -06:00
Jim Fehlig
d1a230d6d3 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>
2018-07-06 14:54:41 -06:00
Jim Fehlig
6439d22cea 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>
2018-06-21 09:41:00 -06:00
Michael Trapp
03dc99825a 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.
2018-06-21 09:32:10 -06:00
Michael Trapp
c7646e329c 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.
2018-06-21 09:28:01 -06:00
Jim Fehlig
302e49730f 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>
2018-06-20 16:39:20 -06:00
Jim Fehlig
b015f73b74 Fix typo in systemd service file
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2018-06-11 15:25:58 -06:00
Jim Fehlig
66967ef343 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>
2018-06-07 11:15:47 -06:00
Jim Fehlig
1586cf7722 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>
2018-06-07 11:15:47 -06:00
Jim Fehlig
3dd984f729 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>
2018-06-07 11:15:47 -06:00
Jim Fehlig
d12766463a 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>
2018-06-06 13:40:42 -06:00
Jim Fehlig
498bace866 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>
2018-06-06 13:40:17 -06:00
Jim Fehlig
8a0534ac90
Merge pull request #5 from johanneskastl/master
fix typo in vhostmd.init: virutalization
2018-05-11 17:10:32 -06:00
Johannes Kastl
3e4df5dd16 fix typo in vhostmd.init: virutalization 2018-05-06 16:23:05 +02:00
Richard W.M. Jones
972ac212ab Fix name and location of the vhostmd.conf file.
Thanks: Xianghua Chen
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1359593
2017-02-22 11:39:59 +00:00
Jim Fehlig
7a2936ec4e Add contact info to README
Extended README with contact info (virt-tools-list) for
comments, suggestions, and patches.
2016-03-09 18:40:56 -07:00
Eduardo Otubo
8fd4d84727 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>
2012-08-06 13:22:13 -06:00
Richard W.M. Jones
efba4feaef 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.
2012-05-10 10:14:50 +01:00
Richard W.M. Jones
8684995d87 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)
2012-03-05 14:58:21 +00:00
Richard W.M. Jones
9bc1da0925 Version 0.5. 2012-01-16 14:30:21 +00:00
Richard W.M. Jones
71c970164e Fix signed/unsigned comparison problems. 2012-01-16 12:15:16 +00:00
Richard W.M. Jones
30ab9c8a80 dump_xenstore_metrics: Refactor this function.
Multiple fixes in this function:
 - use 'ret' as intended -- to set the return code
 - jump to 'out' label on error paths
 - you don't need to test if a variable is not NULL before calling free
 - fp == stdout, not stderr, so we don't close stdout(!)
 - formatting
2012-01-16 12:10:37 +00:00
Richard W.M. Jones
667952366e Mark unused parameters with ATTRIBUTE_UNUSED.
This macro is defined for gcc so that unused parameters don't
provoke warnings.
2012-01-16 12:09:21 +00:00
Richard W.M. Jones
3c07c04248 configure: If using --enable-debug, enable -Wextra (extra warnings). 2012-01-16 12:08:18 +00:00
Richard W.M. Jones
5aeb25de3e tests: Link with -dl.
The tests use dl* functions, so this library is required.
2012-01-16 12:07:48 +00:00
Alex Zeffertt
44191e60d3 Fix build when './configure --enable-xenctrl' is used
Hi all,

The attached patch against v0.4 fixes the build when --enable-xenctrl is used.

If this configure option is used vhostmd does not link against libvirt or
virt-util.o, but a few bits of code were assuming that these were always linked in.

Please could you consider this patch for inclusion in the vhostmd project.

Regards,

Alex Zeffertt

Fix build when "./configure --enable-xenctrl" is used.

This option disables the use of libvirt.  Instead libxc gets used to
find out stuff about VMs.

If this option is used then virt-util.c does not get built.  This
patch removes the linker dependencies on virt-util.o when
--enable-xenctrl is used.

Signed-off-by: <alex.zeffertt@eu.citrix.com>
2010-01-07 12:22:41 -07:00
Richard Jones
3098c776c8 Version 0.4. 2009-12-09 14:41:52 +00:00
Richard Jones
a6d2dc8bb2 configure.ac: Fix C compiler detection to be compatible with automake.
This avoid the following error:

test/Makefile.am:17: compiling `main.c' with per-target flags requires `AM_PROG_CC_C_O' in `configure.ac'

Since this will create scripts like ./compile, ./depcomp etc we
also need to add those to the .gitignore file.

After applying this patch you may need to rerun 'autoreconf -i'.
2009-12-09 14:41:52 +00:00
Richard Jones
6aba263066 chdir ("/") when daemonizing self. 2009-12-09 14:30:29 +00:00
Richard Jones
e9db007b12 vm-dump-metrics: On error, exit with status code 1.
Make vm-dump-metrics exit with an error status code of 1 if
it fails, so that we can detect this failure from scripts etc.
2009-10-16 13:57:20 +01:00
Richard Jones
ef2efc1174 vm-dump-metrics: Fix segmentation fault if Xenstore does not exist.
Running vm-dump-metrics when there is no metrics disk *and*
no Xen / Xenstore, causes a segmentation fault because of an
unchecked call to xs_domain_open.

Reported to Red Hat as:

https://bugzilla.redhat.com/show_bug.cgi?id=529348
2009-10-16 13:57:15 +01:00
Richard Jones
ea2f772da7 Add CONNECT substitution <action>s.
Allow CONNECT to be substituted in any <action>s in order to
pass the correct libvirt URI down to actions such as virsh.  The
correct way to run virsh is now:

  virsh -r CONNECT cmd [...]

which substitutes as either:

  virsh -r --connect 'uri' cmd [...]

or:

  virsh -r cmd [...]

Note that you should always run virsh readonly (-r option).

Also corrects the documentation: ID should be VMID.

Also this cleans up the string replacement code and ensures that
it doesn't leak memory on failure.
2009-10-15 18:00:13 +01:00