[libvirt] [PATCH] Unify int types handling in protocol files
by Roman Bogorodskiy
From: Jasper Lievisse Adriaanse <jasper(a)openbsd.org>
Some of the protocol files already include handing of the missing int
types such as xdr_uint64_t, some don't. To fix it everywhere, move out
of the appropriate defines to internal.h and include it whenever needed.
Signed-off-by: Roman Bogorodskiy <bogorodskiy(a)gmail.com>
---
src/admin/admin_protocol.x | 2 ++
src/internal.h | 19 +++++++++++++++++++
src/lxc/lxc_monitor_protocol.x | 19 +------------------
src/remote/remote_protocol.x | 19 -------------------
src/rpc/virnetprotocol.x | 19 -------------------
5 files changed, 22 insertions(+), 56 deletions(-)
diff --git a/src/admin/admin_protocol.x b/src/admin/admin_protocol.x
index 878983d..2b25d9a 100644
--- a/src/admin/admin_protocol.x
+++ b/src/admin/admin_protocol.x
@@ -22,6 +22,8 @@
* Author: Martin Kletzander <mkletzan(a)redhat.com>
*/
+%#include "internal.h"
+
/*----- Data types. -----*/
/* Length of long, but not unbounded, strings.
diff --git a/src/internal.h b/src/internal.h
index db26fb0..037332d 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -517,4 +517,23 @@ enum {
EXIT_ENOENT = 127, /* Could not find program to exec */
};
+/* cygwin's xdr implementation defines xdr_u_int64_t instead of xdr_uint64_t
+ * and lacks IXDR_PUT_INT32 and IXDR_GET_INT32
+ */
+# ifdef HAVE_XDR_U_INT64_T
+# define xdr_uint64_t xdr_u_int64_t
+# endif
+# ifndef IXDR_PUT_INT32
+# define IXDR_PUT_INT32 IXDR_PUT_LONG
+# endif
+# ifndef IXDR_GET_INT32
+# define IXDR_GET_INT32 IXDR_GET_LONG
+# endif
+# ifndef IXDR_PUT_U_INT32
+# define IXDR_PUT_U_INT32 IXDR_PUT_U_LONG
+# endif
+# ifndef IXDR_GET_U_INT32
+# define IXDR_GET_U_INT32 IXDR_GET_U_LONG
+# endif
+
#endif /* __VIR_INTERNAL_H__ */
diff --git a/src/lxc/lxc_monitor_protocol.x b/src/lxc/lxc_monitor_protocol.x
index 205d7c2..f4dae2e 100644
--- a/src/lxc/lxc_monitor_protocol.x
+++ b/src/lxc/lxc_monitor_protocol.x
@@ -4,24 +4,7 @@
* the libvirt_lxc helper program.
*/
-/* cygwin's xdr implementation defines xdr_u_int64_t instead of xdr_uint64_t
- * and lacks IXDR_PUT_INT32 and IXDR_GET_INT32
- */
-%#ifdef HAVE_XDR_U_INT64_T
-%# define xdr_uint64_t xdr_u_int64_t
-%#endif
-%#ifndef IXDR_PUT_INT32
-%# define IXDR_PUT_INT32 IXDR_PUT_LONG
-%#endif
-%#ifndef IXDR_GET_INT32
-%# define IXDR_GET_INT32 IXDR_GET_LONG
-%#endif
-%#ifndef IXDR_PUT_U_INT32
-%# define IXDR_PUT_U_INT32 IXDR_PUT_U_LONG
-%#endif
-%#ifndef IXDR_GET_U_INT32
-%# define IXDR_GET_U_INT32 IXDR_GET_U_LONG
-%#endif
+%#include "internal.h"
enum virLXCMonitorExitStatus {
VIR_LXC_MONITOR_EXIT_STATUS_ERROR,
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 80f4a8b..89268c0 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -40,25 +40,6 @@
%#include "internal.h"
%#include <arpa/inet.h>
-/* cygwin's xdr implementation defines xdr_u_int64_t instead of xdr_uint64_t
- * and lacks IXDR_PUT_INT32 and IXDR_GET_INT32
- */
-%#ifdef HAVE_XDR_U_INT64_T
-%# define xdr_uint64_t xdr_u_int64_t
-%#endif
-%#ifndef IXDR_PUT_INT32
-%# define IXDR_PUT_INT32 IXDR_PUT_LONG
-%#endif
-%#ifndef IXDR_GET_INT32
-%# define IXDR_GET_INT32 IXDR_GET_LONG
-%#endif
-%#ifndef IXDR_PUT_U_INT32
-%# define IXDR_PUT_U_INT32 IXDR_PUT_U_LONG
-%#endif
-%#ifndef IXDR_GET_U_INT32
-%# define IXDR_GET_U_INT32 IXDR_GET_U_LONG
-%#endif
-
/*----- Data types. -----*/
/* Length of long, but not unbounded, strings.
diff --git a/src/rpc/virnetprotocol.x b/src/rpc/virnetprotocol.x
index 7b6f753..d61a7ab 100644
--- a/src/rpc/virnetprotocol.x
+++ b/src/rpc/virnetprotocol.x
@@ -23,25 +23,6 @@
%#include "internal.h"
%#include <arpa/inet.h>
-/* cygwin's xdr implementation defines xdr_u_int64_t instead of xdr_uint64_t
- * and lacks IXDR_PUT_INT32 and IXDR_GET_INT32
- */
-%#ifdef HAVE_XDR_U_INT64_T
-%# define xdr_uint64_t xdr_u_int64_t
-%#endif
-%#ifndef IXDR_PUT_INT32
-%# define IXDR_PUT_INT32 IXDR_PUT_LONG
-%#endif
-%#ifndef IXDR_GET_INT32
-%# define IXDR_GET_INT32 IXDR_GET_LONG
-%#endif
-%#ifndef IXDR_PUT_U_INT32
-%# define IXDR_PUT_U_INT32 IXDR_PUT_U_LONG
-%#endif
-%#ifndef IXDR_GET_U_INT32
-%# define IXDR_GET_U_INT32 IXDR_GET_U_LONG
-%#endif
-
/*----- Data types. -----*/
/* Initial message size.
--
2.4.6
8 years, 10 months
[libvirt] [PATCH] examples: Use one top level makefile
by Cole Robinson
Using one Makefile per example subdirectory essentially serializes 'make'
calls. Convert to one example/Makefile that builds and distributes
all the subdir files. This reduces example/ rebuild time from about 5.8
seconds to 1.5 seconds on my machine.
One slight difference is that we no longer ship Makefile.am with the
examples in the rpm. This was virtually useless anyways since the Makefile
was very specific to libvirt infrastructure, so wasn't generically
reusable anyways.
Tested with 'make distcheck' and 'make rpm'
---
Makefile.am | 13 +-----
configure.ac | 16 +------
examples/Makefile.am | 89 ++++++++++++++++++++++++++++++++++++++
examples/apparmor/Makefile.am | 43 ------------------
examples/dominfo/Makefile.am | 25 -----------
examples/dommigrate/Makefile.am | 5 ---
examples/domsuspend/Makefile.am | 27 ------------
examples/domsuspend/suspend.c | 2 +
examples/domtop/Makefile.am | 29 -------------
examples/hellolibvirt/Makefile.am | 21 ---------
examples/lxcconvert/Makefile.am | 18 --------
examples/object-events/Makefile.am | 24 ----------
examples/openauth/Makefile.am | 21 ---------
examples/polkit/Makefile.am | 17 --------
examples/rename/Makefile.am | 24 ----------
examples/systemtap/Makefile.am | 19 --------
examples/xml/nwfilter/Makefile.am | 54 -----------------------
libvirt.spec.in | 6 +--
18 files changed, 97 insertions(+), 356 deletions(-)
create mode 100644 examples/Makefile.am
delete mode 100644 examples/apparmor/Makefile.am
delete mode 100644 examples/dominfo/Makefile.am
delete mode 100644 examples/dommigrate/Makefile.am
delete mode 100644 examples/domsuspend/Makefile.am
delete mode 100644 examples/domtop/Makefile.am
delete mode 100644 examples/hellolibvirt/Makefile.am
delete mode 100644 examples/lxcconvert/Makefile.am
delete mode 100644 examples/object-events/Makefile.am
delete mode 100644 examples/openauth/Makefile.am
delete mode 100644 examples/polkit/Makefile.am
delete mode 100644 examples/rename/Makefile.am
delete mode 100644 examples/systemtap/Makefile.am
delete mode 100644 examples/xml/nwfilter/Makefile.am
diff --git a/Makefile.am b/Makefile.am
index 6f217bc..708d051 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,18 +20,10 @@ LCOV = lcov
GENHTML = genhtml
SUBDIRS = . gnulib/lib include src daemon tools docs gnulib/tests \
- tests po examples/object-events examples/hellolibvirt \
- examples/dominfo examples/domsuspend examples/apparmor \
- examples/xml/nwfilter examples/openauth examples/systemtap \
- tools/wireshark examples/dommigrate examples/polkit \
- examples/lxcconvert examples/domtop examples/rename
+ tests po examples tools/wireshark
ACLOCAL_AMFLAGS = -I m4
-XML_EXAMPLES = \
- $(patsubst $(srcdir)/%,%,$(wildcard $(addprefix $(srcdir)/examples/xml/, \
- test/*.xml storage/*.xml)))
-
EXTRA_DIST = \
config-post.h \
ChangeLog-old \
@@ -46,8 +38,7 @@ EXTRA_DIST = \
autogen.sh \
cfg.mk \
run.in \
- AUTHORS.in \
- $(XML_EXAMPLES)
+ AUTHORS.in
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libvirt.pc libvirt-qemu.pc libvirt-lxc.pc
diff --git a/configure.ac b/configure.ac
index a566f5b..a46f9b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2810,21 +2810,9 @@ AC_CONFIG_FILES([\
po/Makefile.in \
include/libvirt/Makefile include/libvirt/libvirt-common.h \
daemon/Makefile \
- tools/Makefile \
+ examples/Makefile \
tests/Makefile \
- examples/apparmor/Makefile \
- examples/object-events/Makefile \
- examples/domsuspend/Makefile \
- examples/dominfo/Makefile \
- examples/dommigrate/Makefile \
- examples/domtop/Makefile \
- examples/openauth/Makefile \
- examples/hellolibvirt/Makefile \
- examples/rename/Makefile \
- examples/systemtap/Makefile \
- examples/xml/nwfilter/Makefile \
- examples/lxcconvert/Makefile \
- examples/polkit/Makefile \
+ tools/Makefile \
tools/wireshark/Makefile \
tools/wireshark/src/Makefile])
AC_OUTPUT
diff --git a/examples/Makefile.am b/examples/Makefile.am
new file mode 100644
index 0000000..50fc011
--- /dev/null
+++ b/examples/Makefile.am
@@ -0,0 +1,89 @@
+## Process this file with automake to produce Makefile.in
+
+## Copyright (C) 2005-2016 Red Hat, 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, see
+## <http://www.gnu.org/licenses/>.
+
+FILTERS = $(wildcard xml/nwfilter/*.xml)
+
+EXTRA_DIST = \
+ apparmor/TEMPLATE.qemu \
+ apparmor/TEMPLATE.lxc \
+ apparmor/libvirt-qemu \
+ apparmor/libvirt-lxc \
+ apparmor/usr.lib.libvirt.virt-aa-helper \
+ apparmor/usr.sbin.libvirtd \
+ lxcconvert/virt-lxc-convert \
+ polkit/libvirt-acl.rules \
+ systemtap/events.stp \
+ systemtap/rpc-monitor.stp \
+ $(FILTERS) \
+ $(wildcard xml/storage/*.xml) \
+ $(wildcard xml/test/*.xml)
+
+
+INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir) \
+ -I$(top_builddir)/gnulib/lib -I$(top_srcdir)/gnulib/lib
+LDADD = $(STATIC_BINARIES) $(WARN_CFLAGS) $(COVERAGE_LDFLAGS) \
+ $(top_builddir)/src/libvirt.la $(top_builddir)/gnulib/lib/libgnu.la
+
+noinst_PROGRAMS=dominfo/info1 dommigrate/dommigrate domsuspend/suspend \
+ domtop/domtop hellolibvirt/hellolibvirt object-events/event-test \
+ openauth/openauth rename/rename
+
+dominfo_info1_SOURCES = dominfo/info1.c
+dommigrate_dommigrate_SOURCES = dommigrate/dommigrate.c
+domsuspend_suspend_SOURCES = domsuspend/suspend.c
+domtop_domtop_SOURCES = domtop/domtop.c
+hellolibvirt_hellolibvirt_SOURCES = hellolibvirt/hellolibvirt.c
+object_events_event_test_SOURCES = object-events/event-test.c
+openauth_openauth_SOURCES = openauth/openauth.c
+rename_rename_SOURCES = rename/rename.c
+
+if WITH_APPARMOR_PROFILES
+apparmordir = $(sysconfdir)/apparmor.d/
+apparmor_DATA = \
+ apparmor/usr.lib.libvirt.virt-aa-helper \
+ apparmor/usr.sbin.libvirtd \
+ $(NULL)
+
+abstractionsdir = $(apparmordir)/abstractions
+abstractions_DATA = \
+ apparmor/libvirt-qemu \
+ apparmor/libvirt-lxc \
+ $(NULL)
+
+templatesdir = $(apparmordir)/libvirt
+templates_DATA = \
+ apparmor/TEMPLATE.qemu \
+ apparmor/TEMPLATE.lxc \
+ $(NULL)
+endif WITH_APPARMOR_PROFILES
+
+if WITH_NWFILTER
+NWFILTER_DIR = "$(DESTDIR)$(sysconfdir)/libvirt/nwfilter"
+
+install-data-local:
+ $(MKDIR_P) "$(NWFILTER_DIR)"
+ for f in $(FILTERS); do \
+ $(INSTALL_DATA) $$f "$(NWFILTER_DIR)"; \
+ done
+
+uninstall-local::
+ for f in $(FILTERS); do \
+ rm -f "$(NWFILTER_DIR)/`basename $$f`"; \
+ done
+ -test -z $(shell ls $(NWFILTER_DIR)) || rmdir $(NWFILTER_DIR)
+endif WITH_NWFILTER
diff --git a/examples/apparmor/Makefile.am b/examples/apparmor/Makefile.am
deleted file mode 100644
index 7a20e16..0000000
--- a/examples/apparmor/Makefile.am
+++ /dev/null
@@ -1,43 +0,0 @@
-## Copyright (C) 2005-2011, 2013 Red Hat, 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, see
-## <http://www.gnu.org/licenses/>.
-
-EXTRA_DIST= \
- TEMPLATE.qemu \
- TEMPLATE.lxc \
- libvirt-qemu \
- libvirt-lxc \
- usr.lib.libvirt.virt-aa-helper \
- usr.sbin.libvirtd
-
-if WITH_APPARMOR_PROFILES
-apparmordir = $(sysconfdir)/apparmor.d/
-apparmor_DATA = \
- usr.lib.libvirt.virt-aa-helper \
- usr.sbin.libvirtd \
- $(NULL)
-
-abstractionsdir = $(apparmordir)/abstractions
-abstractions_DATA = \
- libvirt-qemu \
- libvirt-lxc \
- $(NULL)
-
-templatesdir = $(apparmordir)/libvirt
-templates_DATA = \
- TEMPLATE.qemu \
- TEMPLATE.lxc \
- $(NULL)
-endif WITH_APPARMOR_PROFILES
diff --git a/examples/dominfo/Makefile.am b/examples/dominfo/Makefile.am
deleted file mode 100644
index 4a30c77..0000000
--- a/examples/dominfo/Makefile.am
+++ /dev/null
@@ -1,25 +0,0 @@
-## Copyright (C) 2005-2013 Red Hat, 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, see
-## <http://www.gnu.org/licenses/>.
-
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
-LDADDS = $(STATIC_BINARIES) $(WARN_CFLAGS) $(top_builddir)/src/libvirt.la \
- $(COVERAGE_LDFLAGS)
-
-noinst_PROGRAMS=info1
-
-info1_SOURCES=info1.c
-info1_LDFLAGS=
-info1_LDADD= $(LDADDS)
diff --git a/examples/dommigrate/Makefile.am b/examples/dommigrate/Makefile.am
deleted file mode 100644
index db271bb..0000000
--- a/examples/dommigrate/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir)
-noinst_PROGRAMS = dommigrate
-dommigrate_CFLAGS = $(WARN_CFLAGS)
-dommigrate_SOURCES = dommigrate.c
-dommigrate_LDADD = $(top_builddir)/src/libvirt.la
diff --git a/examples/domsuspend/Makefile.am b/examples/domsuspend/Makefile.am
deleted file mode 100644
index b8e65f2..0000000
--- a/examples/domsuspend/Makefile.am
+++ /dev/null
@@ -1,27 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-## Copyright (C) 2013 Red Hat, 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, see
-## <http://www.gnu.org/licenses/>.
-
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
-LDADDS = $(STATIC_BINARIES) $(WARN_CFLAGS) $(top_builddir)/src/libvirt.la \
- $(COVERAGE_LDFLAGS)
-
-noinst_PROGRAMS=suspend
-
-suspend_SOURCES=suspend.c
-suspend_LDFLAGS=
-suspend_LDADD= $(LDADDS)
diff --git a/examples/domsuspend/suspend.c b/examples/domsuspend/suspend.c
index b1c49ec..11f7302 100644
--- a/examples/domsuspend/suspend.c
+++ b/examples/domsuspend/suspend.c
@@ -21,6 +21,8 @@
* Author: Michal Privoznik <mprivozn(a)redhat.com>
*/
+#include <config.h>
+
#include <errno.h>
#include <getopt.h>
#include <libvirt/libvirt.h>
diff --git a/examples/domtop/Makefile.am b/examples/domtop/Makefile.am
deleted file mode 100644
index dbebb46..0000000
--- a/examples/domtop/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-## Copyright (C) 2014 Red Hat, 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, see
-## <http://www.gnu.org/licenses/>.
-
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
- -I$(top_builddir)/gnulib/lib -I$(top_srcdir)/gnulib/lib \
- -I$(top_srcdir)
-LDADDS = $(STATIC_BINARIES) $(WARN_CFLAGS) $(top_builddir)/src/libvirt.la \
- $(top_builddir)/gnulib/lib/libgnu.la $(COVERAGE_LDFLAGS)
-
-noinst_PROGRAMS=domtop
-
-domtop_SOURCES=domtop.c
-domtop_LDFLAGS=
-domtop_LDADD= $(LDADDS)
diff --git a/examples/hellolibvirt/Makefile.am b/examples/hellolibvirt/Makefile.am
deleted file mode 100644
index 55ea972..0000000
--- a/examples/hellolibvirt/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-## Copyright (C) 2005-2013 Red Hat, 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, see
-## <http://www.gnu.org/licenses/>.
-
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir)
-noinst_PROGRAMS = hellolibvirt
-hellolibvirt_CFLAGS = $(WARN_CFLAGS)
-hellolibvirt_SOURCES = hellolibvirt.c
-hellolibvirt_LDADD = $(top_builddir)/src/libvirt.la
diff --git a/examples/lxcconvert/Makefile.am b/examples/lxcconvert/Makefile.am
deleted file mode 100644
index 09cf5d9..0000000
--- a/examples/lxcconvert/Makefile.am
+++ /dev/null
@@ -1,18 +0,0 @@
-## Copyright (C) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
-##
-## 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, see
-## <http://www.gnu.org/licenses/>.
-
-EXTRA_DIST= \
- virt-lxc-convert
diff --git a/examples/object-events/Makefile.am b/examples/object-events/Makefile.am
deleted file mode 100644
index 86500a0..0000000
--- a/examples/object-events/Makefile.am
+++ /dev/null
@@ -1,24 +0,0 @@
-## Copyright (C) 2005-2011, 2013 Red Hat, 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, see
-## <http://www.gnu.org/licenses/>.
-
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
- -I$(top_builddir)/gnulib/lib -I$(top_srcdir)/gnulib/lib \
- -I$(top_srcdir)
-noinst_PROGRAMS = event-test
-event_test_CFLAGS = $(WARN_CFLAGS)
-event_test_SOURCES = event-test.c
-event_test_LDADD = $(top_builddir)/src/libvirt.la \
- $(top_builddir)/gnulib/lib/libgnu.la
diff --git a/examples/openauth/Makefile.am b/examples/openauth/Makefile.am
deleted file mode 100644
index 7bb8604..0000000
--- a/examples/openauth/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-## Copyright (C) 2005-2013 Red Hat, 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, see
-## <http://www.gnu.org/licenses/>.
-
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir)
-noinst_PROGRAMS = openauth
-openauth_CFLAGS = $(WARN_CFLAGS)
-openauth_SOURCES = openauth.c
-openauth_LDADD = $(top_builddir)/src/libvirt.la
diff --git a/examples/polkit/Makefile.am b/examples/polkit/Makefile.am
deleted file mode 100644
index 4d213e8..0000000
--- a/examples/polkit/Makefile.am
+++ /dev/null
@@ -1,17 +0,0 @@
-## Copyright (C) 2015 Red Hat, 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, see
-## <http://www.gnu.org/licenses/>.
-
-EXTRA_DIST = libvirt-acl.rules
diff --git a/examples/rename/Makefile.am b/examples/rename/Makefile.am
deleted file mode 100644
index 1b3484c..0000000
--- a/examples/rename/Makefile.am
+++ /dev/null
@@ -1,24 +0,0 @@
-## Copyright (C) 2005-2013 Red Hat, 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, see
-## <http://www.gnu.org/licenses/>.
-
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
-LDADDS = $(STATIC_BINARIES) $(WARN_CFLAGS) $(top_builddir)/src/libvirt.la \
- $(COVERAGE_LDFLAGS)
-
-noinst_PROGRAMS=rename
-
-rename_SOURCES=rename.c
-rename_LDADD= $(LDADDS)
diff --git a/examples/systemtap/Makefile.am b/examples/systemtap/Makefile.am
deleted file mode 100644
index 3938b9c..0000000
--- a/examples/systemtap/Makefile.am
+++ /dev/null
@@ -1,19 +0,0 @@
-## Copyright (C) 2005-2011, 2013 Red Hat, 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, see
-## <http://www.gnu.org/licenses/>.
-
-EXTRA_DIST = \
- events.stp \
- rpc-monitor.stp
diff --git a/examples/xml/nwfilter/Makefile.am b/examples/xml/nwfilter/Makefile.am
deleted file mode 100644
index ec1e7ee..0000000
--- a/examples/xml/nwfilter/Makefile.am
+++ /dev/null
@@ -1,54 +0,0 @@
-## Copyright (C) 2005-2011, 2013 Red Hat, 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, see
-## <http://www.gnu.org/licenses/>.
-
-FILTERS = \
- allow-arp.xml \
- allow-dhcp-server.xml \
- allow-dhcp.xml \
- allow-incoming-ipv4.xml \
- allow-ipv4.xml \
- clean-traffic.xml \
- no-arp-spoofing.xml \
- no-arp-ip-spoofing.xml \
- no-arp-mac-spoofing.xml \
- no-ip-multicast.xml \
- no-ip-spoofing.xml \
- no-mac-broadcast.xml \
- no-mac-spoofing.xml \
- no-other-l2-traffic.xml \
- no-other-rarp-traffic.xml \
- qemu-announce-self.xml \
- qemu-announce-self-rarp.xml
-
-EXTRA_DIST=$(FILTERS)
-
-confdir = $(sysconfdir)/libvirt
-
-NWFILTER_DIR = "$(DESTDIR)$(sysconfdir)/libvirt/nwfilter"
-
-if WITH_NWFILTER
-install-data-local:
- $(MKDIR_P) "$(NWFILTER_DIR)"
- for f in $(FILTERS); do \
- $(INSTALL_DATA) $(srcdir)/$$f "$(NWFILTER_DIR)"; \
- done
-
-uninstall-local::
- for f in $(FILTERS); do \
- rm -f "$(NWFILTER_DIR)/$$f"; \
- done
- -test -z $(shell ls $(NWFILTER_DIR)) || rmdir $(NWFILTER_DIR)
-endif WITH_NWFILTER
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 3afef66..9962513 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1547,10 +1547,8 @@ rm -fr %{buildroot}
# on RHEL 5, thus we need to expand it here.
make install DESTDIR=%{?buildroot} SYSTEMD_UNIT_DIR=%{_unitdir}
-for i in object-events dominfo domsuspend hellolibvirt openauth xml/nwfilter systemtap dommigrate domtop rename
-do
- (cd examples/$i ; make clean ; rm -rf .deps .libs Makefile Makefile.in)
-done
+make -C examples distclean
+
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt/lock-driver/*.la
--
2.5.0
8 years, 10 months
[libvirt] [PATCH] cfg.mk: Drop period after filename for indent failures
by Cole Robinson
The period makes it more difficult to copy/paste the errant filename
for manual fixup
---
Pushed as trivial
cfg.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cfg.mk b/cfg.mk
index cf3f36c..b009b28 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -1095,7 +1095,7 @@ test-wrap-argv:
res=$$? ; \
rm $${file}-t ; \
test $$res == 0 || { \
- echo "$(ME): Incorrect line wrapping in $$file." 1>&2; \
+ echo "$(ME): Incorrect line wrapping in $$file" 1>&2; \
echo "$(ME): Use test-wrap-argv.pl to wrap test data files" 1>&2; \
exit 1; } \
done
--
2.5.0
8 years, 10 months
[libvirt] [PATCH 0/2] Couple of coverity fixes
by Michal Privoznik
I went through coverity report and found these.
Michal Privoznik (2):
virDomainMigrateUnmanagedParams: Don't blindly dereference @dconnuri
virt-host-validate-common: Print warning on missing IOMMU
src/libvirt-domain.c | 2 +-
src/qemu/qemu_migration.c | 2 +-
tools/virt-host-validate-common.c | 3 ---
3 files changed, 2 insertions(+), 5 deletions(-)
--
2.4.10
8 years, 10 months
[libvirt] [PATCH] qemu: Fix crash when defining XML with bogus emulator
by Cole Robinson
We weren't checking for failure of qemuCaps lookup
---
src/qemu/qemu_domain.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 00c780d..97534c0 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1247,7 +1247,9 @@ qemuDomainDefPostParse(virDomainDefPtr def,
!(def->emulator = virDomainDefGetDefaultEmulator(def, caps)))
return ret;
- qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator);
+ if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache,
+ def->emulator)))
+ goto cleanup;
if (qemuDomainDefAddDefaultDevices(def, qemuCaps) < 0)
goto cleanup;
--
2.5.0
8 years, 10 months
[libvirt] Hot plug multi function PCI devices
by Ziviani .
Hello list!
I'm new here and interested in hot-plug multi-function PCI devices.
Basically I'd like to know why Libvirt does not support it. I've been
through the archives and basically found this thread:
https://www.redhat.com/archives/libvir-list/2011-May/msg00457.html
But Qemu seems to handle it accordingly:
virsh qemu-monitor-command --hmp fedora-23 'device_add
vfio-pci,host=00:16.0,addr=08.0'
virsh qemu-monitor-command --hmp fedora-23 'device_add
vfio-pci,host=00:16.3,addr=08.3'
GUEST:
# lspci
(snip)
00:08.0 Communication controller: Intel Corporation 8 Series HECI #0 (rev
04)
00:08.3 Serial controller: Intel Corporation 8 Series HECI KT (rev 04)
However, using Libvirt:
% virsh attach-device fedora-23 pci_0000_00_16_0.xml --live
Device attached successfully
% virsh attach-device fedora-23 pci_0000_00_16_3.xml --live
error: Failed to attach device from pci_0000_00_16_3.xml
error: internal error: Only PCI device addresses with function=0 are
supported
I made some changes on domain_addr.c[1] for testing and it worked.
[1]https://gist.github.com/jrziviani/1da184c7fd0b413e0426
% virsh attach-device fedora-23 pci_0000_00_16_3.xml --live
Device attached successfully
GUEST:
# lspci
(snip)
00:08.0 Communication controller: Intel Corporation 8 Series HECI #0 (rev
04)
00:08.3 Serial controller: Intel Corporation 8 Series HECI KT (rev 04)
So there is more to it that I'm not aware?
Thank you!
8 years, 10 months
[libvirt] [PATCH v2] tests: Add newlines with VIR_TEST_REGENERATE_OUTPUT
by Cole Robinson
Since test files are formatted predictably nowadays, we can make
VIR_TEST_REGENERATE_OUTPUT handle most cases for us with a simple
replacement. test-wrap-argv.pl is still canon, but this bit makes
it easier to confirm test output changes during active development.
---
v2: Rebase on .git master
tests/testutils.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/tests/testutils.c b/tests/testutils.c
index 6645d61..0091fcd 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -469,10 +469,19 @@ virtTestDifferenceFullInternal(FILE *stream,
actualStart = actual;
actualEnd = actual + (strlen(actual)-1);
- if (regenerate && virTestGetRegenerate() > 0) {
+ if (regenerate && (virTestGetRegenerate() > 0) && expectName && actual) {
+ char *regencontent;
+
+ /* Try to properly indent qemu argv files */
+ if (!(regencontent = virStringReplace(actual, " -", " \\\n-")))
+ return -1;
+
if (expectName && actual &&
- virFileWriteStr(expectName, actual, 0666) < 0)
+ virFileWriteStr(expectName, regencontent, 0666) < 0) {
+ VIR_FREE(regencontent);
return -1;
+ }
+ VIR_FREE(regencontent);
}
if (!virTestGetDebug())
--
2.5.0
8 years, 10 months
[libvirt] [PATCH] util: add missing newline
by Laine Stump
Somehow I managed to backspace over the newline between the closing
brace and goto cleanup; in commit 36e244f3.
---
Pushed under trivial rule.
src/util/virnetdevvportprofile.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprofile.c
index 61676b4..4140cdc 100644
--- a/src/util/virnetdevvportprofile.c
+++ b/src/util/virnetdevvportprofile.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2014 Red Hat, Inc.
+ * Copyright (C) 2009-2016 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -592,7 +592,8 @@ virNetDevVPortProfileGetStatus(struct nlattr **tb, int32_t vf,
tb_port[IFLA_PORT_VF] ?
*(uint32_t *)RTA_DATA(tb_port[IFLA_PORT_VF]) : -1,
uuidstr);
- } goto cleanup;
+ }
+ goto cleanup;
}
} else {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
--
2.5.0
8 years, 10 months
[libvirt] [PATCH] Fix USB model defaults for ppc64
by Martin Kletzander
The condition was checking for UHCI (and OHCI for ppc64) availability so
that it can specify the proper device instead of legacy usb. However,
for ppc64, we don't need to check both OHCI and UHCI, but only OHCI as
that is the legacy default. The condition is so big that it was just a
matter of time when someone will make a mistake there, so let's use more
lines so that it is visible what the condition checks for.
This fixes usage of -device instead of -usb for ppc64 that supports
pci-usb-ohci and does not support piix3-usb-uhci.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/qemu/qemu_command.c | 34 +++++++++++++++-------
.../qemuxml2argv-ppc64-usb-controller-legacy.args | 20 +++++++++++++
.../qemuxml2argv-ppc64-usb-controller-legacy.xml | 1 +
.../qemuxml2argv-ppc64-usb-controller.args | 20 +++++++++++++
.../qemuxml2argv-ppc64-usb-controller.xml | 28 ++++++++++++++++++
tests/qemuxml2argvtest.c | 3 ++
6 files changed, 95 insertions(+), 11 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller-legacy.args
create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller-legacy.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller.xml
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 1f0593526b55..3f464a5fc21d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10049,18 +10049,30 @@ qemuBuildCommandLine(virConnectPtr conn,
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
cont->model == -1 &&
- !qemuDomainMachineIsQ35(def) &&
- (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI) ||
- (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI) &&
- ARCH_IS_PPC64(def->os.arch)))) {
- if (usblegacy) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("Multiple legacy USB controllers are "
- "not supported"));
- goto error;
+ !qemuDomainMachineIsQ35(def)) {
+ bool need_legacy = false;
+
+ /* We're not using legacy usb controller for q35 */
+ if (ARCH_IS_PPC64(def->os.arch)) {
+ /* For ppc64 the legacy was OHCI */
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI))
+ need_legacy = true;
+ } else {
+ /* For anything else, we used * PIIX3_USB_UHCI */
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI))
+ need_legacy = true;
+ }
+
+ if (need_legacy) {
+ if (usblegacy) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Multiple legacy USB controllers are "
+ "not supported"));
+ goto error;
+ }
+ usblegacy = true;
+ continue;
}
- usblegacy = true;
- continue;
}
virCommandAddArg(cmd, "-device");
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller-legacy.args b/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller-legacy.args
new file mode 100644
index 000000000000..3dee41e86481
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller-legacy.args
@@ -0,0 +1,20 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/libexec/qemu-system-ppc64 \
+-name QEMUGuest1 \
+-S \
+-M pseries \
+-m 256 \
+-smp 1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-monitor unix:/tmp/test-monitor,server,nowait \
+-boot c \
+-usb \
+-net none \
+-serial none \
+-parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller-legacy.xml b/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller-legacy.xml
new file mode 120000
index 000000000000..831d9d4f1c1b
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller-legacy.xml
@@ -0,0 +1 @@
+qemuxml2argv-ppc64-usb-controller.xml
\ No newline at end of file
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller.args b/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller.args
new file mode 100644
index 000000000000..3dee41e86481
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller.args
@@ -0,0 +1,20 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/libexec/qemu-system-ppc64 \
+-name QEMUGuest1 \
+-S \
+-M pseries \
+-m 256 \
+-smp 1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-monitor unix:/tmp/test-monitor,server,nowait \
+-boot c \
+-usb \
+-net none \
+-serial none \
+-parallel none
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller.xml b/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller.xml
new file mode 100644
index 000000000000..ce180ee34989
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc64-usb-controller.xml
@@ -0,0 +1,28 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='ppc64' machine='pseries'>hvm</type>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <pae/>
+ </features>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/libexec/qemu-system-ppc64</emulator>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+ </controller>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 63480ce8af19..1476def2f57d 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1764,6 +1764,9 @@ mymain(void)
QEMU_CAPS_VIRTIO_MOUSE, QEMU_CAPS_VIRTIO_TABLET);
DO_TEST("virtio-input-passthrough", QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_INPUT_HOST);
+ DO_TEST("ppc64-usb-controller", QEMU_CAPS_PCI_OHCI);
+ DO_TEST("ppc64-usb-controller-legacy", QEMU_CAPS_PIIX3_USB_UHCI);
+
qemuTestDriverFree(&driver);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
--
2.7.0
8 years, 10 months
[libvirt] [PATCH] tests: qemuxml2argv: Add tests for USB controller on q35
by Andrea Bolognani
---
.../qemuxml2argv-usb-controller-default-q35.args | 21 +++++++++++++++++
.../qemuxml2argv-usb-controller-default-q35.xml | 27 ++++++++++++++++++++++
...argv-usb-controller-default-unavailable-q35.xml | 27 ++++++++++++++++++++++
.../qemuxml2argv-usb-controller-explicit-q35.args | 21 +++++++++++++++++
.../qemuxml2argv-usb-controller-explicit-q35.xml | 27 ++++++++++++++++++++++
...rgv-usb-controller-explicit-unavailable-q35.xml | 27 ++++++++++++++++++++++
tests/qemuxml2argvtest.c | 17 +++++++++++++-
7 files changed, 166 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-q35.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-q35.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-unavailable-q35.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-q35.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-q35.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-unavailable-q35.xml
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-q35.args b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-q35.args
new file mode 100644
index 0000000..a746d37
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-q35.args
@@ -0,0 +1,21 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/libexec/qemu-kvm \
+-name q35-test \
+-S \
+-M q35 \
+-m 2048 \
+-smp 1 \
+-uuid 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 \
+-nographic \
+-nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait \
+-no-acpi \
+-boot c \
+-device pci-bridge,chassis_nr=56,id=pci.2,bus=pci.1,addr=0x1 \
+-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
+-device piix3-usb-uhci,id=usb,bus=pcie.0,addr=0x1
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-q35.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-q35.xml
new file mode 100644
index 0000000..26eecef
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-q35.xml
@@ -0,0 +1,27 @@
+<domain type='qemu'>
+ <name>q35-test</name>
+ <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
+ <memory unit='KiB'>2097152</memory>
+ <currentMemory unit='KiB'>2097152</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='q35'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/libexec/qemu-kvm</emulator>
+ <controller type='pci' index='0' model='pcie-root'/>
+ <controller type='pci' index='2' model='pci-bridge'>
+ <model name='pci-bridge'/>
+ <target chassisNr='56'/>
+ </controller>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+ </controller>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-unavailable-q35.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-unavailable-q35.xml
new file mode 100644
index 0000000..26eecef
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-default-unavailable-q35.xml
@@ -0,0 +1,27 @@
+<domain type='qemu'>
+ <name>q35-test</name>
+ <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
+ <memory unit='KiB'>2097152</memory>
+ <currentMemory unit='KiB'>2097152</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='q35'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/libexec/qemu-kvm</emulator>
+ <controller type='pci' index='0' model='pcie-root'/>
+ <controller type='pci' index='2' model='pci-bridge'>
+ <model name='pci-bridge'/>
+ <target chassisNr='56'/>
+ </controller>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+ </controller>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-q35.args b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-q35.args
new file mode 100644
index 0000000..6fd058c
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-q35.args
@@ -0,0 +1,21 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/libexec/qemu-kvm \
+-name q35-test \
+-S \
+-M q35 \
+-m 2048 \
+-smp 1 \
+-uuid 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 \
+-nographic \
+-nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait \
+-no-acpi \
+-boot c \
+-device pci-bridge,chassis_nr=56,id=pci.2,bus=pci.1,addr=0x1 \
+-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
+-device nec-usb-xhci,id=usb,bus=pcie.0,addr=0x1
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-q35.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-q35.xml
new file mode 100644
index 0000000..f3b34ee
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-q35.xml
@@ -0,0 +1,27 @@
+<domain type='qemu'>
+ <name>q35-test</name>
+ <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
+ <memory unit='KiB'>2097152</memory>
+ <currentMemory unit='KiB'>2097152</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='q35'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/libexec/qemu-kvm</emulator>
+ <controller type='pci' index='0' model='pcie-root'/>
+ <controller type='pci' index='2' model='pci-bridge'>
+ <model name='pci-bridge'/>
+ <target chassisNr='56'/>
+ </controller>
+ <controller type='usb' index='0' model='nec-xhci'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+ </controller>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-unavailable-q35.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-unavailable-q35.xml
new file mode 100644
index 0000000..f3b34ee
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-controller-explicit-unavailable-q35.xml
@@ -0,0 +1,27 @@
+<domain type='qemu'>
+ <name>q35-test</name>
+ <uuid>11dbdcdd-4c3b-482b-8903-9bdb8c0a2774</uuid>
+ <memory unit='KiB'>2097152</memory>
+ <currentMemory unit='KiB'>2097152</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='q35'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/libexec/qemu-kvm</emulator>
+ <controller type='pci' index='0' model='pcie-root'/>
+ <controller type='pci' index='2' model='pci-bridge'>
+ <model name='pci-bridge'/>
+ <target chassisNr='56'/>
+ </controller>
+ <controller type='usb' index='0' model='nec-xhci'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
+ </controller>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 63480ce..b023522 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1181,7 +1181,22 @@ mymain(void)
QEMU_CAPS_USB_HUB);
DO_TEST_PARSE_ERROR("usb-none-usbtablet",
QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
-
+ DO_TEST("usb-controller-default-q35",
+ QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_PCI_OHCI,
+ QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_NEC_USB_XHCI);
+ DO_TEST_FAILURE("usb-controller-default-unavailable-q35",
+ QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_PCI_OHCI,
+ QEMU_CAPS_NEC_USB_XHCI);
+ DO_TEST("usb-controller-explicit-q35",
+ QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_PCI_OHCI,
+ QEMU_CAPS_PIIX3_USB_UHCI, QEMU_CAPS_NEC_USB_XHCI);
+ DO_TEST_FAILURE("usb-controller-explicit-unavailable-q35",
+ QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_PCI_OHCI,
+ QEMU_CAPS_PIIX3_USB_UHCI);
DO_TEST("smbios", QEMU_CAPS_SMBIOS_TYPE);
DO_TEST_PARSE_ERROR("smbios-date", QEMU_CAPS_SMBIOS_TYPE);
--
2.5.0
8 years, 10 months