SHA256
1
0
forked from pool/xen

Merge with SR#290432 and xentop fixes

OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=355
This commit is contained in:
Charles Arnold 2015-04-07 15:28:04 +00:00 committed by Git OBS Bridge
parent 6c53f9313d
commit c05f69363f
5 changed files with 210 additions and 33 deletions

View File

@ -1,3 +1,41 @@
Index: xen-4.5.0-testing/tools/libxl/libxl_dm.c
===================================================================
--- xen-4.5.0-testing.orig/tools/libxl/libxl_dm.c
+++ xen-4.5.0-testing/tools/libxl/libxl_dm.c
@@ -440,6 +440,15 @@ static char ** libxl__build_device_model
flexarray_append(dm_args, "-mon");
flexarray_append(dm_args, "chardev=libxl-cmd,mode=control");
+ flexarray_append(dm_args, "-chardev");
+ flexarray_append(dm_args,
+ libxl__sprintf(gc, "socket,id=libxenstat-cmd,"
+ "path=%s/qmp-libxenstat-%d,server,nowait",
+ libxl__run_dir_path(), guest_domid));
+
+ flexarray_append(dm_args, "-mon");
+ flexarray_append(dm_args, "chardev=libxenstat-cmd,mode=control");
+
for (i = 0; i < guest_config->num_channels; i++) {
connection = guest_config->channels[i].connection;
devid = guest_config->channels[i].devid;
Index: xen-4.5.0-testing/tools/libxl/libxl_qmp.c
===================================================================
--- xen-4.5.0-testing.orig/tools/libxl/libxl_qmp.c
+++ xen-4.5.0-testing/tools/libxl/libxl_qmp.c
@@ -723,6 +723,13 @@ void libxl__qmp_cleanup(libxl__gc *gc, u
LOGE(ERROR, "Failed to remove QMP socket file %s", qmp_socket);
}
}
+
+ qmp_socket = GCSPRINTF("%s/qmp-libxenstat-%d", libxl__run_dir_path(), domid);
+ if (unlink(qmp_socket) == -1) {
+ if (errno != ENOENT) {
+ LOGE(ERROR, "Failed to remove QMP socket file %s", qmp_socket);
+ }
+ }
}
int libxl__qmp_query_serial(libxl__qmp_handler *qmp)
Index: xen-4.5.0-testing/tools/xenstat/libxenstat/Makefile
===================================================================
--- xen-4.5.0-testing.orig/tools/xenstat/libxenstat/Makefile
@ -11,6 +49,15 @@ Index: xen-4.5.0-testing/tools/xenstat/libxenstat/Makefile
OBJECTS-$(CONFIG_Linux) += src/xenstat_linux.o
OBJECTS-$(CONFIG_SunOS) += src/xenstat_solaris.o
OBJECTS-$(CONFIG_NetBSD) += src/xenstat_netbsd.o
@@ -32,7 +32,7 @@ OBJECTS-$(CONFIG_FreeBSD) += src/xenstat
SONAME_FLAGS=-Wl,$(SONAME_LDFLAG) -Wl,libxenstat.so.$(MAJOR)
CFLAGS+=-fPIC
-CFLAGS+=-Isrc $(CFLAGS_libxenctrl) $(CFLAGS_libxenstore) $(CFLAGS_xeninclude)
+CFLAGS+=-Isrc $(CFLAGS_libxenctrl) $(CFLAGS_libxenstore) $(CFLAGS_xeninclude) -include $(XEN_ROOT)/tools/config.h
LDLIBS-y = $(LDLIBS_libxenstore) $(LDLIBS_libxenctrl)
LDLIBS-$(CONFIG_SunOS) += -lkstat
Index: xen-4.5.0-testing/tools/xenstat/xentop/Makefile
===================================================================
--- xen-4.5.0-testing.orig/tools/xenstat/xentop/Makefile
@ -40,24 +87,27 @@ Index: xen-4.5.0-testing/tools/xenstat/libxenstat/src/xenstat.c
===================================================================
--- xen-4.5.0-testing.orig/tools/xenstat/libxenstat/src/xenstat.c
+++ xen-4.5.0-testing/tools/xenstat/libxenstat/src/xenstat.c
@@ -657,6 +657,24 @@ static void xenstat_uninit_xen_version(x
@@ -657,6 +657,27 @@ static void xenstat_uninit_xen_version(x
* VBD functions
*/
+/* Save VBD information */
+xenstat_vbd *xenstat_save_vbd(xenstat_domain *domain, xenstat_vbd *vbd)
+{
+ if (domain->vbds == NULL) {
+ domain->num_vbds = 1;
+ domain->vbds = malloc(sizeof(xenstat_vbd));
+ } else {
+ xenstat_vbd *vbds = domain->vbds;
+
+ domain->num_vbds++;
+ domain->vbds = realloc(domain->vbds,
+ domain->num_vbds *
+ sizeof(xenstat_vbd));
+
+ if (domain->vbds == NULL) {
+ domain->num_vbds = 0;
+ free(vbds);
+ }
+ if (domain->vbds != NULL)
+ else {
+ domain->vbds[domain->num_vbds - 1] = *vbd;
+ }
+
+ return domain->vbds;
+}
@ -105,7 +155,7 @@ Index: xen-4.5.0-testing/tools/xenstat/libxenstat/src/xenstat_qmp.c
===================================================================
--- /dev/null
+++ xen-4.5.0-testing/tools/xenstat/libxenstat/src/xenstat_qmp.c
@@ -0,0 +1,387 @@
@@ -0,0 +1,451 @@
+/* libxenstat: statistics-collection library for Xen
+ *
+ * This library is free software; you can redistribute it and/or
@ -127,12 +177,24 @@ Index: xen-4.5.0-testing/tools/xenstat/libxenstat/src/xenstat_qmp.c
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include "yajl/yajl_tree.h"
+
+#include <xenctrl.h>
+
+#include "xenstat_priv.h"
+
+#ifdef HAVE_YAJL_YAJL_VERSION_H
+# include <yajl/yajl_version.h>
+#endif
+
+/* YAJL version check */
+#if defined(YAJL_MAJOR) && (YAJL_MAJOR > 1)
+# define HAVE_YAJL_V2 1
+#endif
+
+#ifdef HAVE_YAJL_V2
+
+#include <yajl/yajl_tree.h>
+
+static unsigned char *qmp_query(int, char *);
+
+enum query_blockstats {
@ -153,10 +215,28 @@ Index: xen-4.5.0-testing/tools/xenstat/libxenstat/src/xenstat_qmp.c
+};
+
+
+/* Given the qmp device name, get the image filename associated with it */
+/* Given the qmp device name, get the image filename associated with it
+ QMP Syntax for querying block infomation:
+ In: { "execute": "query-block" }
+ Out: {"return": [{
+ "device": 'str, "locked": 'bool', "removable": bool,
+ "inserted": {
+ "iops_rd": 'int',
+ "image": {
+ "virtual-size": 'int', "filename": 'str', "cluster-size": 'int',
+ "format": 'str', "actual-size": 'int', "dirty-flag": 'bool'
+ },
+ "iops_wr": 'int', "ro": 'bool', "backing_file_depth": 'int',
+ "drv": 'str', "iops": 'int', "bps_wr": 'int', "encrypted": 'bool',
+ "bps": 'int', "bps_rd": 'int',
+ "file": 'str', "encryption_key_missing": 'bool'
+ },
+ "type": 'str'
+ }]}
+*/
+static char *qmp_get_block_image(xenstat_node *node, char *qmp_devname, int qfd)
+{
+ char errbuf[1024], *tmp, *file = NULL;
+ char *tmp, *file = NULL;
+ char *query_block_cmd = "{ \"execute\": \"query-block\" }";
+ static const char *const qblock[] = {
+ [ QMP_BLOCK_RETURN ] = "return",
@ -172,8 +252,8 @@ Index: xen-4.5.0-testing/tools/xenstat/libxenstat/src/xenstat_qmp.c
+ if ((qmp_stats = qmp_query(qfd, query_block_cmd)) == NULL)
+ return NULL;
+
+ /* Use libyajl version 2.1.x or newer for the tree parser feature with bug fixes */
+ if ((info = yajl_tree_parse((char *)qmp_stats, errbuf, sizeof(errbuf))) == NULL) {
+ /* Use libyajl version 2.0.3 or newer for the tree parser feature with bug fixes */
+ if ((info = yajl_tree_parse((char *)qmp_stats, NULL, 0)) == NULL) {
+ free(qmp_stats);
+ return NULL;
+ }
@ -214,9 +294,9 @@ Index: xen-4.5.0-testing/tools/xenstat/libxenstat/src/xenstat_qmp.c
+}
+
+
+/* Given a QMP device name, find the associated xenstore qdisk device id */
+static void get_xs_devid_from_qmp_devname(xenstat_node * node, unsigned int domid, char *qmp_devname,
+ unsigned int *dev, unsigned int *sector_size, int qfd)
+/* Given a QMP device name, lookup the associated xenstore qdisk device id */
+static void lookup_xenstore_devid(xenstat_node * node, unsigned int domid, char *qmp_devname,
+ int qfd, unsigned int *dev, unsigned int *sector_size)
+{
+ char **dev_ids, *tmp, *ptr, *image, path[80];
+ unsigned int num_dev_ids;
@ -269,7 +349,7 @@ Index: xen-4.5.0-testing/tools/xenstat/libxenstat/src/xenstat_qmp.c
+/* Parse the stats buffer which contains I/O data for all the disks belonging to domid */
+static void qmp_parse_stats(xenstat_node *node, unsigned int domid, unsigned char *stats_buf, int qfd)
+{
+ char *qmp_devname, errbuf[1024];
+ char *qmp_devname;
+ static const char *const qstats[] = {
+ [ QMP_STATS_RETURN ] = "return",
+ [ QMP_STATS_DEVICE ] = "device",
@ -287,7 +367,7 @@ Index: xen-4.5.0-testing/tools/xenstat/libxenstat/src/xenstat_qmp.c
+ int i, j;
+
+ /* Use libyajl version 2.0.3 or newer for the tree parser feature */
+ if ((info = yajl_tree_parse((char *)stats_buf, errbuf, sizeof(errbuf))) == NULL)
+ if ((info = yajl_tree_parse((char *)stats_buf, NULL, 0)) == NULL)
+ return;
+
+ ptr[0] = qstats[QMP_STATS_RETURN]; /* "return" */
@ -329,7 +409,7 @@ Index: xen-4.5.0-testing/tools/xenstat/libxenstat/src/xenstat_qmp.c
+ }
+ /* With the QMP device name, lookup the xenstore qdisk device ID and set vdb.dev */
+ if (qmp_devname)
+ get_xs_devid_from_qmp_devname(node, domid, qmp_devname, &vbd.dev, &sector_size, qfd);
+ lookup_xenstore_devid(node, domid, qmp_devname, qfd, &vbd.dev, &sector_size);
+ if ((domain = xenstat_node_domain(node, domid)) == NULL)
+ continue;
+ if ((xenstat_save_vbd(domain, &vbd)) == NULL)
@ -340,7 +420,7 @@ Index: xen-4.5.0-testing/tools/xenstat/libxenstat/src/xenstat_qmp.c
+ yajl_tree_free(info);
+}
+
+/* Write a command via the QMP */
+/* Write a command via the QMP. Returns number of bytes written */
+static size_t qmp_write(int qfd, char *cmd, size_t cmd_len)
+{
+ size_t pos = 0;
@ -366,23 +446,24 @@ Index: xen-4.5.0-testing/tools/xenstat/libxenstat/src/xenstat_qmp.c
+/* Read the data sent in response to a QMP execute query. Returns 1 for success */
+static int qmp_read(int qfd, unsigned char **qstats)
+{
+ unsigned char buf[1024], *ptr = NULL;
+ unsigned char buf[1024], *ptr;
+ struct pollfd pfd[2];
+ int n, qsize = 0;
+
+ *qstats = NULL;
+ pfd[0].fd = qfd;
+ pfd[0].events = POLLIN;
+ while ((n = poll(pfd, POLLIN, 10)) > 0) {
+ if (pfd[0].revents & POLLIN) {
+ if ((n = read(qfd, buf, sizeof(buf))) < 0) {
+ free(*qstats);
+ return 0;
+ }
+ if (ptr == NULL)
+ ptr = malloc(n+1);
+ else
+ ptr = realloc(ptr, qsize+n+1);
+ if (ptr == NULL)
+ ptr = realloc(*qstats, qsize+n+1);
+ if (ptr == NULL) {
+ free(*qstats);
+ return 0;
+ }
+ memcpy(&ptr[qsize], buf, n);
+ qsize += n;
+ ptr[qsize] = 0;
@ -433,7 +514,7 @@ Index: xen-4.5.0-testing/tools/xenstat/libxenstat/src/xenstat_qmp.c
+ return s;
+}
+
+/* Get all the active domains */
+/* Get up to 1024 active domains */
+static xc_domaininfo_t *get_domain_ids(int *num_doms)
+{
+ xc_domaininfo_t *dominfo;
@ -448,7 +529,32 @@ Index: xen-4.5.0-testing/tools/xenstat/libxenstat/src/xenstat_qmp.c
+ return dominfo;
+}
+
+/* Gather the qdisk statistics by querying QMP */
+/* Gather the qdisk statistics by querying QMP
+ Resources: http://wiki.qemu.org/QMP and qmp-commands.hx from the qemu code
+ QMP Syntax for entering command mode. This command must be issued before
+ issuing any other command:
+ In: {"execute": "qmp_capabilities"}
+ Out: {"return": {}}
+ QMP Syntax for querying block statistics:
+ In: { "execute": "query-blockstats" }
+ Out: {"return": [{
+ "device": 'str',
+ "parent": {
+ "stats": {
+ "flush_total_time_ns": 'int', "wr_highest_offset": 'int',
+ "wr_total_time_ns": 'int', "wr_bytes": 'int',
+ "rd_total_time_ns": 'int', "flush_operations": 'int',
+ "wr_operations": 'int', "rd_bytes": 'int', "rd_operations": 'int'
+ }
+ },
+ "stats": {
+ "flush_total_time_ns": 'int', "wr_highest_offset": 'int',
+ "wr_total_time_ns": 'int', "wr_bytes": 'int',
+ "rd_total_time_ns": 'int', "flush_operations": 'int',
+ "wr_operations": 'int', "rd_bytes": 'int', "rd_operations": 'int'
+ }
+ }]}
+*/
+void read_attributes_qdisk(xenstat_node * node)
+{
+ char *cmd_mode = "{ \"execute\": \"qmp_capabilities\" }";
@ -473,7 +579,7 @@ Index: xen-4.5.0-testing/tools/xenstat/libxenstat/src/xenstat_qmp.c
+ free(val);
+
+ /* Connect to this VMs QMP socket */
+ snprintf(path, sizeof(path), "/var/run/xen/qmp-libxl-%i", dominfo[i].domain);
+ snprintf(path, sizeof(path), "/var/run/xen/qmp-libxenstat-%i", dominfo[i].domain);
+ if ((qfd = qmp_connect(path)) < 0) {
+ continue;
+ }
@ -493,3 +599,11 @@ Index: xen-4.5.0-testing/tools/xenstat/libxenstat/src/xenstat_qmp.c
+ free(dominfo);
+}
+
+#else /* !HAVE_YAJL_V2 */
+
+/* Statistics gathering for qdisks requires at least yajl v2 */
+void read_attributes_qdisk(xenstat_node * node)
+{
+}
+
+#endif /* !HAVE_YAJL_V2 */

View File

@ -0,0 +1,21 @@
--- /dev/null 2015-03-12 10:40:51.327307686 +0000
+++ xen-4.5.0-testing/tools/firmware/etherboot/patches/ipxe-no-error-logical-not-parentheses.patch 2015-03-12 12:21:37.394804667 +0000
@@ -0,0 +1,11 @@
+--- ipxe/src/Makefile.housekeeping.orig 2015-03-12 12:15:50.054891858 +0000
++++ ipxe/src/Makefile.housekeeping 2015-03-12 12:16:05.978071221 +0000
+@@ -415,7 +415,7 @@
+ # Inhibit -Werror if NO_WERROR is specified on make command line
+ #
+ ifneq ($(NO_WERROR),1)
+-CFLAGS += -Werror
++CFLAGS += -Werror -Wno-logical-not-parentheses
+ ASFLAGS += --fatal-warnings
+ endif
+
--- xen-4.5.0-testing/tools/firmware/etherboot/patches/series.orig 2015-03-12 12:24:54.895029501 +0000
+++ xen-4.5.0-testing/tools/firmware/etherboot/patches/series 2015-03-12 12:25:42.367564285 +0000
@@ -3,3 +3,4 @@
build_fix_2.patch
build_fix_3.patch
build-compare.patch
+ipxe-no-error-logical-not-parentheses.patch

15
xen-c99-fix.patch Normal file
View File

@ -0,0 +1,15 @@
--- xen-4.5.0-testing/tools/firmware/seabios-dir-remote/src/hw/usb-hid.h.orig 2015-03-12 10:49:39.606373644 +0000
+++ xen-4.5.0-testing/tools/firmware/seabios-dir-remote/src/hw/usb-hid.h 2015-03-12 10:49:55.481555672 +0000
@@ -4,10 +4,10 @@
// usb-hid.c
struct usbdevice_s;
int usb_hid_setup(struct usbdevice_s *usbdev);
-inline int usb_kbd_active(void);
-inline int usb_kbd_command(int command, u8 *param);
-inline int usb_mouse_active(void);
-inline int usb_mouse_command(int command, u8 *param);
+int usb_kbd_active(void);
+int usb_kbd_command(int command, u8 *param);
+int usb_mouse_active(void);
+int usb_mouse_command(int command, u8 *param);
void usb_check_event(void);

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Fri Apr 3 10:54:05 MDT 2015 - carnold@suse.com
- xentop: Fix memory leak on read failure
551ac326-xentop-add-support-for-qdisk.patch
-------------------------------------------------------------------
Tue Mar 31 16:03:54 MDT 2015 - carnold@suse.com
- Dropped xentop-add-support-for-qdisk.patch in favor of upstream
version
551ac326-xentop-add-support-for-qdisk.patch
-------------------------------------------------------------------
Mon Mar 16 10:14:15 MDT 2015 - carnold@suse.com
@ -5,6 +18,16 @@ Mon Mar 16 10:14:15 MDT 2015 - carnold@suse.com
5124efbe-add-qxl-support.patch
qemu-xen-enable-spice-support.patch
-------------------------------------------------------------------
Thu Mar 12 12:33:45 UTC 2015 - rguenther@suse.com
- Add xen-c99-fix.patch to remove pointless inline specifier on
function declarations which break build with a C99 compiler which
GCC 5 is by default.
- Add ipxe-no-error-logical-not-parentheses.patch to supply
-Wno-logical-not-parentheses to the ipxe build to fix
breakage with GCC 5.
-------------------------------------------------------------------
Wed Mar 11 13:15:07 MDT 2015 - carnold@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package xen
#
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2015 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
@ -201,6 +201,7 @@ Source99: baselibs.conf
Source20000: xenalyze.hg.tar.bz2
# Upstream patches
Patch1: 5124efbe-add-qxl-support.patch
Patch2: 551ac326-xentop-add-support-for-qdisk.patch
# Upstream qemu
Patch250: VNC-Support-for-ExtendedKeyEvent-client-message.patch
Patch251: 0001-net-move-the-tap-buffer-into-TAPState.patch
@ -222,7 +223,7 @@ Patch311: xl-coredump-file-location.patch
Patch330: suspend_evtchn_lock.patch
Patch331: xenpaging.doc.patch
Patch332: local_attach_support_for_phy.patch
Patch333: xentop-add-support-for-qdisk.patch
Patch333: xen-c99-fix.patch
# Qemu traditional
Patch350: blktap.patch
Patch351: cdrom-removable.patch
@ -291,6 +292,7 @@ Patch604: xen.build-compare.ipxe.patch
Patch605: xen.build-compare.vgabios.patch
Patch606: xen.build-compare.seabios.patch
Patch607: xen.build-compare.man.patch
Patch608: ipxe-no-error-logical-not-parentheses.patch
# Build patches
Patch99996: xen.stubdom.newlib.patch
Patch99998: tmp_build.patch
@ -498,6 +500,7 @@ Authors:
%setup -q -n %xen_build_dir -a 1 -a 2 -a 3 -a 4 -a 5 -a 57 -a 20000
# Upstream patches
%patch1 -p1
%patch2 -p1
# Upstream qemu patches
%patch250 -p1
%patch251 -p1
@ -587,6 +590,7 @@ Authors:
%patch605 -p1
%patch606 -p1
%patch607 -p1
%patch608 -p1
# Build patches
%patch99996 -p1
%patch99998 -p1