Hello community, here is the log from the commit of package vhostmd for openSUSE:Factory checked in at 2019-04-14 12:23:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/vhostmd (Old) and /work/SRC/openSUSE:Factory/.vhostmd.new.27019 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "vhostmd" Sun Apr 14 12:23:19 2019 rev:28 rq:693805 version:1.1 Changes: -------- --- /work/SRC/openSUSE:Factory/vhostmd/vhostmd.changes 2018-12-06 12:18:52.613419345 +0100 +++ /work/SRC/openSUSE:Factory/.vhostmd.new.27019/vhostmd.changes 2019-04-14 12:23:19.659825625 +0200 @@ -1,0 +2,8 @@ +Fri Apr 12 19:27:24 UTC 2019 - James Fehlig <[email protected]> + +- Update to vhostmd 1.1 + - Merge libserialclient with libmetrics + - Misc bug fixes and improvements + - bsc#1129772 + +------------------------------------------------------------------- Old: ---- vhostmd-1.0.tar.bz2 New: ---- vhostmd-1.1.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ vhostmd.spec ++++++ --- /var/tmp/diff_new_pack.2FAsoZ/_old 2019-04-14 12:23:21.187827050 +0200 +++ /var/tmp/diff_new_pack.2FAsoZ/_new 2019-04-14 12:23:21.211827072 +0200 @@ -1,7 +1,7 @@ # # spec file for package vhostmd # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,7 +24,7 @@ %endif Name: vhostmd -Version: 1.0 +Version: 1.1 Release: 0 Summary: Virtual Host Metrics Daemon (vhostmd) License: LGPL-2.1-or-later @@ -148,12 +148,10 @@ %files -n libmetrics0 %defattr(-,root,root) %{_libdir}/libmetrics.so.* -%{_libdir}/libserialclient.so.* %files -n libmetrics-devel %defattr(-,root,root) %{_libdir}/libmetrics.so -%{_libdir}/libserialclient.so %dir %{_includedir}/vhostmd %{_includedir}/vhostmd/libmetrics.h ++++++ libmetrics-link.patch ++++++ --- /var/tmp/diff_new_pack.2FAsoZ/_old 2019-04-14 12:23:21.531827370 +0200 +++ /var/tmp/diff_new_pack.2FAsoZ/_new 2019-04-14 12:23:21.559827396 +0200 @@ -2,12 +2,13 @@ libmetrics uses libxml, so link with it. -Index: vhostmd-1.0/libmetrics/Makefile.am +Index: vhostmd-1.1/libmetrics/Makefile.am =================================================================== ---- vhostmd-1.0.orig/libmetrics/Makefile.am -+++ vhostmd-1.0/libmetrics/Makefile.am -@@ -33,3 +33,4 @@ libserialclient_la_SOURCES = \ - libserialclient_la_DEPENDENCIES = \ - libserialclient.h +--- vhostmd-1.1.orig/libmetrics/Makefile.am ++++ vhostmd-1.1/libmetrics/Makefile.am +@@ -19,3 +19,5 @@ libmetrics_la_SOURCES = \ + libmetrics_la_DEPENDENCIES = \ + libmetrics.h ++ +libmetrics_la_LIBADD = $(LIBXML_LIBS) ++++++ manpage.patch ++++++ --- /var/tmp/diff_new_pack.2FAsoZ/_old 2019-04-14 12:23:21.587827423 +0200 +++ /var/tmp/diff_new_pack.2FAsoZ/_new 2019-04-14 12:23:21.587827423 +0200 @@ -1,7 +1,7 @@ -Index: vhostmd-1.0/docs/man/vm-dump-metrics.1 +Index: vhostmd-1.1/docs/man/vm-dump-metrics.1 =================================================================== ---- vhostmd-1.0.orig/docs/man/vm-dump-metrics.1 -+++ vhostmd-1.0/docs/man/vm-dump-metrics.1 +--- vhostmd-1.1.orig/docs/man/vm-dump-metrics.1 ++++ vhostmd-1.1/docs/man/vm-dump-metrics.1 @@ -10,8 +10,12 @@ vm-dump-metrics \- Dump VM metrics. .BR vm-dump-metrics reads virtualization hosts provided metrics decription and dumps output ++++++ value-newline.patch ++++++ --- /var/tmp/diff_new_pack.2FAsoZ/_old 2019-04-14 12:23:21.595827430 +0200 +++ /var/tmp/diff_new_pack.2FAsoZ/_new 2019-04-14 12:23:21.595827430 +0200 @@ -1,7 +1,7 @@ -Index: vhostmd-1.0/vhostmd/metric.c +Index: vhostmd-1.1/vhostmd/metric.c =================================================================== ---- vhostmd-1.0.orig/vhostmd/metric.c -+++ vhostmd-1.0/vhostmd/metric.c +--- vhostmd-1.1.orig/vhostmd/metric.c ++++ vhostmd-1.1/vhostmd/metric.c @@ -280,6 +280,12 @@ int metric_value_get(metric *m) goto out; ++++++ vhostmd-1.0.tar.bz2 -> vhostmd-1.1.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vhostmd-1.0/configure.ac new/vhostmd-1.1/configure.ac --- old/vhostmd-1.0/configure.ac 2018-11-30 23:05:20.000000000 +0100 +++ new/vhostmd-1.1/configure.ac 2019-04-11 00:25:00.000000000 +0200 @@ -1,4 +1,4 @@ -AC_INIT(Virtual Host Metrics Daemon, 1.0, [email protected], vhostmd) +AC_INIT(Virtual Host Metrics Daemon, 1.1, [email protected], vhostmd) AC_CONFIG_SRCDIR(vhostmd/vhostmd.c) AC_CONFIG_HEADERS([config.h]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vhostmd-1.0/libmetrics/Makefile.am new/vhostmd-1.1/libmetrics/Makefile.am --- old/vhostmd-1.0/libmetrics/Makefile.am 2018-11-30 23:05:20.000000000 +0100 +++ new/vhostmd-1.1/libmetrics/Makefile.am 2019-04-11 00:25:00.000000000 +0200 @@ -6,7 +6,7 @@ AM_CFLAGS += -DWITH_XENSTORE endif -lib_LTLIBRARIES=libmetrics.la libserialclient.la +lib_LTLIBRARIES=libmetrics.la libmetricsincdir=$(includedir)/vhostmd libmetricsinc_HEADERS = libmetrics.h @@ -15,21 +15,7 @@ libmetrics.c \ vm_metrics.c \ host_metrics.c \ - libserialclient.c \ libmetrics.h libmetrics_la_DEPENDENCIES = \ - libmetrics.h \ - libserialclient.h - - -libserialclientincdir= -libserialclientinc_HEADERS = libserialclient.h - -libserialclient_la_SOURCES = \ - libserialclient.c \ - libserialclient.h - -libserialclient_la_DEPENDENCIES = \ - libserialclient.h - + libmetrics.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vhostmd-1.0/libmetrics/libmetrics.c new/vhostmd-1.1/libmetrics/libmetrics.c --- old/vhostmd-1.0/libmetrics/libmetrics.c 2018-11-30 23:05:20.000000000 +0100 +++ new/vhostmd-1.1/libmetrics/libmetrics.c 2019-04-11 00:25:00.000000000 +0200 @@ -422,6 +422,9 @@ error: if (dir) closedir(dir); + + libmsg("%s(): Unable to read metrics disk\n", __func__); + return -1; } @@ -641,10 +644,7 @@ if (mdisk_alloc() == NULL) goto error; - if (read_mdisk(mdisk) != 0) { - libmsg("%s(): Unable to read metrics disk\n", __func__); - goto error; - } + mdisk->sum = 0; return; error: @@ -664,7 +664,7 @@ { FILE *fp; - if (mdisk == NULL) { + if (mdisk == NULL || read_mdisk(mdisk) < 0) { errno = ENOMEDIUM; return -1; } @@ -681,8 +681,8 @@ } if (fwrite(mdisk->buffer, 1, mdisk->length, fp) != mdisk->length) { - libmsg("Error, unable to export metrics to file:%s - error:%s\n", - dest_file, strerror(errno)); + libmsg("Error, unable to export metrics to file:%s - error:%s\n", + dest_file ? dest_file : "stdout", strerror(errno)); } if (dest_file) fclose(fp); @@ -775,3 +775,145 @@ } #endif +/* + * dump metrics from virtio serial port to buffer + */ +static char *get_virtio_metrics(void) +{ + const char request[] = "GET /metrics/XML\n\n", end_token[] = "\n\n"; + const char dev[] = "/dev/virtio-ports/org.github.vhostmd.1"; + + char *response = NULL; + int fd = -1; + size_t pos; + size_t buf_size = (1 << 16); + const size_t req_len = (size_t) strlen(request); + const time_t timeout = 5; + time_t end_time; + + response = calloc(1UL, buf_size); + if (response == NULL) + goto error; + + fd = open(dev, O_RDWR | O_NONBLOCK); + + if (fd < 0) { + libmsg("%s(): Unable to export metrics: open(%s) %s\n", + __func__, dev, strerror(errno)); + goto error; + } + + pos = 0; + end_time = time(NULL) + timeout; + while (pos < req_len) { + ssize_t len = write(fd, &request[pos], req_len - pos); + if (len > 0) + pos += (size_t) len; + else { + if (errno == EAGAIN) { + usleep(10000); + if (time(NULL) > end_time) { + libmsg("%s(): Unable to send metrics request" + " - timeout after %us\n", __func__, timeout); + goto error; + } + } + else + goto error; + } + } + + pos = 0; + end_time = time(NULL) + timeout; + do { + ssize_t len = read(fd, &response[pos], buf_size - pos - 1); + if (len > 0) { + pos += (size_t) len; + response[pos] = 0; + + if ((pos + 1) >= buf_size) { + buf_size = buf_size << 1; /* increase response buffer */ + if (buf_size > (1 << 24)) /* max 16MB */ + goto error; + + response = realloc(response, buf_size); + if (response == NULL) + goto error; + + memset(&response[pos], 0, buf_size - pos); + } + } else { + if (errno == EAGAIN) { + usleep(10000); + if (time(NULL) > end_time) { + libmsg("%s(): Unable to read metrics" + " - timeout after %us\n", __func__, timeout); + goto error; + } + } else + goto error; + } + } while ((pos < (size_t) strlen(end_token) || + strcmp(end_token, &response[pos - (size_t) strlen(end_token)]) != 0) && + pos < buf_size); + + if (fd >= 0) + close(fd); + + return response; + + error: + if (fd >= 0) + close(fd); + if (response) + free(response); + + libmsg("%s(): Unable to read metrics\n", __func__); + + return NULL; +} + +/* + * dump metrics from virtio serial port to xml formatted file + */ +int dump_virtio_metrics(const char *dest_file) +{ + FILE *fp = stdout; + char *response = NULL; + size_t len; + + response = get_virtio_metrics(); + if (response == NULL) + goto error; + + len = strlen(response); + + if (dest_file) { + fp = fopen(dest_file, "w"); + if (fp == NULL) { + libmsg("%s(), unable to dump metrics: fopen(%s) %s\n", + __func__, dest_file, strerror(errno)); + goto error; + } + } + + if (fwrite(response, 1UL, len, fp) != len) { + libmsg("%s(), unable to export metrics to file:%s %s\n", + __func__, dest_file ? dest_file : "stdout", strerror(errno)); + goto error; + } + + if (response) + free(response); + + return 0; + + error: + if (dest_file && fp) + fclose(fp); + + if (response) + free(response); + + return -1; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vhostmd-1.0/libmetrics/libmetrics.h new/vhostmd-1.1/libmetrics/libmetrics.h --- old/vhostmd-1.0/libmetrics/libmetrics.h 2018-11-30 23:05:20.000000000 +0100 +++ new/vhostmd-1.1/libmetrics/libmetrics.h 2019-04-11 00:25:00.000000000 +0200 @@ -102,8 +102,4 @@ /* dump metrics from virtio serial port to xml formatted file */ int dump_virtio_metrics(const char *dest_file); - -/* dump metrics from virtio serial port to buffer */ -const char *get_virtio_metrics(const char *dev_name); - #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vhostmd-1.0/libmetrics/libserialclient.c new/vhostmd-1.1/libmetrics/libserialclient.c --- old/vhostmd-1.0/libmetrics/libserialclient.c 2018-11-30 23:05:20.000000000 +0100 +++ new/vhostmd-1.1/libmetrics/libserialclient.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,172 +0,0 @@ -/* - * Copyright (C) 2018 SAP SE - * - * 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: Michael Trapp <[email protected]> - */ - -#include <config.h> - -#include <stdio.h> -#include <stdlib.h> -#include <time.h> -#include <string.h> -#include <fcntl.h> -#include <unistd.h> -#include <errno.h> - -#include "libserialclient.h" - - -/* - * dump metrics from virtio serial port to xml formatted file - */ -int dump_virtio_metrics(const char *dest_file) -{ - FILE *fp = stdout; - char *response; - size_t len; - - response = get_virtio_metrics(NULL); - if (response == NULL) - goto error; - - len = strlen(response); - - if (dest_file) { - fp = fopen(dest_file, "w"); - if (fp == NULL) { - fprintf(stderr, - "LIB_SERIALCLIENT: Error, unable to dump metrics: fopen(%s) %s\n", - dest_file, strerror(errno)); - goto error; - } - } - - if (fwrite(response, 1UL, len, fp) != len) { - fprintf(stderr, - "LIB_SERIALCLIENT: Error, unable to export metrics to file:%s - error:%s\n", - dest_file ? dest_file : "STDOUT", strerror(errno)); - goto error; - } - - if (response) - free(response); - - return 0; - - error: - if (dest_file && fp) - fclose(fp); - - if (response) - free(response); - - return -1; -} - -/* - * dump metrics from virtio serial port to buffer - */ -char *get_virtio_metrics(const char *dev_name) -{ - const char request[] = "GET /metrics/XML\n\n", end_token[] = "\n\n"; - const char *dev; - char *response = NULL; - int fd = -1; - size_t pos; - size_t buf_size = (1 << 16); - const size_t req_len = (size_t) strlen(request); - const time_t start_time = time(NULL); - - if (dev_name) - dev = dev_name; - else - dev = "/dev/virtio-ports/org.github.vhostmd.1"; - - response = calloc(1UL, buf_size); - if (response == NULL) - goto error; - - fd = open(dev, O_RDWR | O_NONBLOCK); - - if (fd < 0) { - fprintf(stderr, - "LIB_SERIALCLIENT: Error, unable to dump metrics: open(%s) %s\n", - dev, strerror(errno)); - goto error; - } - - pos = 0; - while (pos < req_len) { - ssize_t len = write(fd, &request[pos], req_len - pos); - if (len > 0) - pos += (size_t) len; - else { - if (errno == EAGAIN) - usleep(10000); - else - goto error; - } - } - - pos = 0; - do { - ssize_t len = read(fd, &response[pos], buf_size - pos - 1); - if (len > 0) { - pos += (size_t) len; - response[pos] = 0; - - if ((pos + 1) >= buf_size) { - buf_size = buf_size << 1; /* increase response buffer */ - if (buf_size > (1 << 24)) /* max 16MB */ - goto error; - - response = realloc(response, buf_size); - if (response == NULL) - goto error; - - memset(&response[pos], 0, buf_size - pos); - } - } else { - if (errno == EAGAIN) { - usleep(10000); - if (time(NULL) > (start_time + 30)) { - fprintf(stderr, - "LIB_SERIALCLIENT: Error, unable to read metrics" - " - timeout after 30s\n"); - goto error; - } - } else - goto error; - } - } while ((pos < (size_t) strlen(end_token) || - strcmp(end_token, &response[pos - (size_t) strlen(end_token)]) != 0) && - pos < buf_size); - - if (fd >= 0) - close(fd); - - return response; - - error: - if (fd >= 0) - close(fd); - if (response) - free(response); - - return NULL; -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vhostmd-1.0/libmetrics/libserialclient.h new/vhostmd-1.1/libmetrics/libserialclient.h --- old/vhostmd-1.0/libmetrics/libserialclient.h 2018-11-30 23:05:20.000000000 +0100 +++ new/vhostmd-1.1/libmetrics/libserialclient.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2018 SAP SE - * - * 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: Michael Trapp <[email protected]> - */ - -#ifndef __LIBSERIALCLIENT_H__ -#define __LIBSERIALCLIENT_H__ - -/* dump metrics from virtio serial port to xml formatted file */ -int dump_virtio_metrics(const char *dest_file); - -/* dump metrics from virtio serial port to buffer */ -char *get_virtio_metrics(const char *dev_name); - -#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vhostmd-1.0/vhostmd/virtio.c new/vhostmd-1.1/vhostmd/virtio.c --- old/vhostmd-1.0/vhostmd/virtio.c 2018-11-30 23:05:20.000000000 +0100 +++ new/vhostmd-1.1/vhostmd/virtio.c 2019-04-11 00:25:00.000000000 +0200 @@ -278,8 +278,7 @@ while ((ent = readdir(dir)) != NULL) { int rc, id; - if (ent->d_type == DT_DIR && - sscanf(ent->d_name, "domain-%d-", &id) == 1) { + if (sscanf(ent->d_name, "domain-%d-", &id) == 1) { char tmp[SUN_PATH_LEN + 8]; struct stat st; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vhostmd-1.0/vhostmd.changes new/vhostmd-1.1/vhostmd.changes --- old/vhostmd-1.0/vhostmd.changes 2018-11-30 23:05:20.000000000 +0100 +++ new/vhostmd-1.1/vhostmd.changes 2019-04-11 00:25:00.000000000 +0200 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Wed Apr 10 22:21:29 UTC 2019 - <[email protected]> + +- Version 1.1 + - Merge libserialclient with libmetrics + - Misc bug fixes and improvements + +------------------------------------------------------------------- Fri Nov 30 20:35:18 UTC 2018 - [email protected] - Version 1.0 ++++++ vhostmd-conf.patch ++++++ --- /var/tmp/diff_new_pack.2FAsoZ/_old 2019-04-14 12:23:21.659827489 +0200 +++ /var/tmp/diff_new_pack.2FAsoZ/_new 2019-04-14 12:23:21.659827489 +0200 @@ -5,10 +5,10 @@ Users can uncomment it and restart vhostmd if virtio transport is desired, similar to the xenstore transport. -Index: vhostmd-1.0/vhostmd.xml +Index: vhostmd-1.1/vhostmd.xml =================================================================== ---- vhostmd-1.0.orig/vhostmd.xml -+++ vhostmd-1.0/vhostmd.xml +--- vhostmd-1.1.orig/vhostmd.xml ++++ vhostmd-1.1/vhostmd.xml @@ -40,7 +40,7 @@ the logical && operator must be replaced <update_period>5</update_period> <path>/usr/sbin:/sbin:/usr/bin:/bin:/usr/share/vhostmd/scripts</path>
