[libvirt] [PATCH 2/7] tests: move sexpr2xml tests to WITH_LIBXL

2018-03-28 Thread Jim Fehlig
In preparation of removing the legacy Xen driver, move the
sexpr2xml tests from WITH_XEN to WITH_LIBXL. Even though the
legacy driver will be removed, we'll want to maintain the ability
to convert sexpr to XML. Requires fixing up the tests to account
for different behavior of Xen vs libxl post parse functions.

There is some test file fallout due to differences in handling
of default values between xend and libxl.

Signed-off-by: Jim Fehlig 
---
 tests/Makefile.am  | 22 +++---
 tests/sexpr2xmldata/sexpr2xml-boot-grub.xml|  3 +-
 tests/sexpr2xmldata/sexpr2xml-bridge-ipaddr.xml|  3 +-
 tests/sexpr2xmldata/sexpr2xml-curmem.xml   |  1 -
 .../sexpr2xml-disk-block-shareable.xml |  1 -
 tests/sexpr2xmldata/sexpr2xml-disk-block.xml   |  3 +-
 .../sexpr2xml-disk-drv-blktap-qcow.xml |  1 -
 .../sexpr2xml-disk-drv-blktap-raw.xml  |  1 -
 .../sexpr2xml-disk-drv-blktap2-raw.xml |  1 -
 tests/sexpr2xmldata/sexpr2xml-disk-file.xml|  3 +-
 tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml  |  7 ++---
 tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml  |  7 ++---
 tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml|  7 ++---
 tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml  |  7 ++---
 tests/sexpr2xmldata/sexpr2xml-fv-kernel.xml|  3 +-
 tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml |  7 ++---
 tests/sexpr2xmldata/sexpr2xml-fv-net-netfront.xml  |  7 ++---
 tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml  |  7 ++---
 .../sexpr2xml-fv-serial-dev-2-ports.xml|  7 ++---
 .../sexpr2xml-fv-serial-dev-2nd-port.xml   |  7 ++---
 tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml   |  7 ++---
 tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml   |  7 ++---
 tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml   |  7 ++---
 tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml|  7 ++---
 tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml  |  7 ++---
 .../sexpr2xml-fv-serial-tcp-telnet.xml |  7 ++---
 tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml|  7 ++---
 tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml|  7 ++---
 tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml   |  7 ++---
 tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml |  7 ++---
 tests/sexpr2xmldata/sexpr2xml-fv-sound.xml |  7 ++---
 tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml  |  7 ++---
 tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml |  7 ++---
 tests/sexpr2xmldata/sexpr2xml-fv-utc.xml   |  7 ++---
 tests/sexpr2xmldata/sexpr2xml-fv-v2.xml|  7 ++---
 tests/sexpr2xmldata/sexpr2xml-fv.xml   |  7 ++---
 tests/sexpr2xmldata/sexpr2xml-net-bridged.xml  |  3 +-
 tests/sexpr2xmldata/sexpr2xml-net-e1000.xml|  3 +-
 tests/sexpr2xmldata/sexpr2xml-net-routed.xml   |  3 +-
 tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml  |  6 ++--
 tests/sexpr2xmldata/sexpr2xml-pci-devs.xml |  5 ++--
 .../sexpr2xml-pv-bootloader-cmdline.xml|  3 +-
 tests/sexpr2xmldata/sexpr2xml-pv-bootloader.xml|  3 +-
 tests/sexpr2xmldata/sexpr2xml-pv-localtime.xml |  3 +-
 tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml |  3 +-
 .../sexpr2xml-pv-vfb-new-vncdisplay.xml|  3 +-
 tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml   |  3 +-
 .../sexpr2xmldata/sexpr2xml-pv-vfb-type-crash.xml  |  3 +-
 tests/sexpr2xmldata/sexpr2xml-pv.xml   |  3 +-
 tests/sexpr2xmldata/sexpr2xml-vif-rate.xml |  7 ++---
 tests/sexpr2xmltest.c  | 35 +++---
 51 files changed, 115 insertions(+), 188 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8262ba202..351745c8d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -272,12 +272,12 @@ ssh_SOURCES = ssh.c
 ssh_LDADD = $(COVERAGE_LDFLAGS)
 
 if WITH_XEN
-test_programs += sexpr2xmltest \
-   xmconfigtest xencapstest
+test_programs += xmconfigtest xencapstest
 endif WITH_XEN
 
 if WITH_LIBXL
-test_programs += xlconfigtest xml2sexprtest libxlxml2domconfigtest
+test_programs += xlconfigtest xml2sexprtest sexpr2xmltest \
+   libxlxml2domconfigtest
 test_libraries += virmocklibxl.la
 endif WITH_LIBXL
 
@@ -501,11 +501,6 @@ if WITH_XEN
 xen_LDADDS = ../src/libvirt_driver_xen_impl.la
 xen_LDADDS += $(LDADDS)
 
-sexpr2xmltest_SOURCES = \
-   sexpr2xmltest.c testutilsxen.c testutilsxen.h \
-   testutils.c testutils.h
-sexpr2xmltest_LDADD = $(xen_LDADDS)
-
 xmconfigtest_SOURCES = \
xmconfigtest.c testutilsxen.c testutilsxen.h \
testutils.c testutils.h
@@ -516,8 +511,7 @@ xencapstest_SOURCES = \
 xencapstest_LDADD = $(xen_LDADDS)
 
 else ! WITH_XEN
-EXTRA_DIST += sexpr2xmltest.c xmconfigtest.c \
-   xencapstest.c \
+EXTRA_DIST += xmconfigtest.c xencapstest.c \
testutilsxen.c testutilsxen.h
 endif ! WITH_XEN
 
@@ -538,6 +532,11 @@ xml2sexprtest_SOURCES = \
testutils.c 

[libvirt] [PATCH 1/7] tests: move xml2sexpr tests to WITH_LIBXL

2018-03-28 Thread Jim Fehlig
In preparation of removing the legacy Xen driver, move the
xml2sexpr tests from WITH_XEN to WITH_LIBXL. Even though the
legacy driver will be removed, we'll want to maintain the ability
to convert sexpr <-> XML.

There is some test file fallout due to differences in handling
of default values between xend and libxl.

Signed-off-by: Jim Fehlig 
---
 tests/Makefile.am  | 18 +-
 tests/xml2sexprdata/xml2sexpr-escape.sexpr |  2 +-
 tests/xml2sexprdata/xml2sexpr-fv-force-hpet.sexpr  |  2 +-
 tests/xml2sexprdata/xml2sexpr-fv-force-nohpet.sexpr|  2 +-
 tests/xml2sexprdata/xml2sexpr-fv-kernel.sexpr  |  2 +-
 tests/xml2sexprdata/xml2sexpr-fv-localtime.sexpr   |  2 +-
 tests/xml2sexprdata/xml2sexpr-fv-net-netfront.sexpr|  2 +-
 tests/xml2sexprdata/xml2sexpr-fv-net-rate.sexpr|  2 +-
 tests/xml2sexprdata/xml2sexpr-fv-parallel-tcp.sexpr|  2 +-
 .../xml2sexpr-fv-serial-dev-2-ports.sexpr  |  2 +-
 .../xml2sexpr-fv-serial-dev-2nd-port.sexpr |  2 +-
 tests/xml2sexprdata/xml2sexpr-fv-serial-file.sexpr |  2 +-
 tests/xml2sexprdata/xml2sexpr-fv-serial-null.sexpr |  2 +-
 tests/xml2sexprdata/xml2sexpr-fv-serial-pipe.sexpr |  2 +-
 tests/xml2sexprdata/xml2sexpr-fv-serial-pty.sexpr  |  2 +-
 tests/xml2sexprdata/xml2sexpr-fv-serial-stdio.sexpr|  2 +-
 .../xml2sexprdata/xml2sexpr-fv-serial-tcp-telnet.sexpr |  2 +-
 tests/xml2sexprdata/xml2sexpr-fv-serial-tcp.sexpr  |  2 +-
 tests/xml2sexprdata/xml2sexpr-fv-serial-udp.sexpr  |  2 +-
 tests/xml2sexprdata/xml2sexpr-fv-serial-unix.sexpr |  2 +-
 tests/xml2sexprdata/xml2sexpr-fv-sound.sexpr   |  2 +-
 tests/xml2sexprdata/xml2sexpr-fv-usbmouse.sexpr|  2 +-
 tests/xml2sexprdata/xml2sexpr-fv-utc.sexpr |  2 +-
 tests/xml2sexprdata/xml2sexpr-fv-v2.sexpr  |  2 +-
 tests/xml2sexprdata/xml2sexpr-fv-vncunused.sexpr   |  2 +-
 tests/xml2sexprdata/xml2sexpr-fv.sexpr |  2 +-
 tests/xml2sexprtest.c  |  7 +++
 27 files changed, 37 insertions(+), 38 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 289ef35bd..8262ba202 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -272,12 +272,12 @@ ssh_SOURCES = ssh.c
 ssh_LDADD = $(COVERAGE_LDFLAGS)
 
 if WITH_XEN
-test_programs += xml2sexprtest sexpr2xmltest \
+test_programs += sexpr2xmltest \
xmconfigtest xencapstest
 endif WITH_XEN
 
 if WITH_LIBXL
-test_programs += xlconfigtest libxlxml2domconfigtest
+test_programs += xlconfigtest xml2sexprtest libxlxml2domconfigtest
 test_libraries += virmocklibxl.la
 endif WITH_LIBXL
 
@@ -501,11 +501,6 @@ if WITH_XEN
 xen_LDADDS = ../src/libvirt_driver_xen_impl.la
 xen_LDADDS += $(LDADDS)
 
-xml2sexprtest_SOURCES = \
-   xml2sexprtest.c testutilsxen.c testutilsxen.h \
-   testutils.c testutils.h
-xml2sexprtest_LDADD = $(xen_LDADDS)
-
 sexpr2xmltest_SOURCES = \
sexpr2xmltest.c testutilsxen.c testutilsxen.h \
testutils.c testutils.h
@@ -521,7 +516,7 @@ xencapstest_SOURCES = \
 xencapstest_LDADD = $(xen_LDADDS)
 
 else ! WITH_XEN
-EXTRA_DIST += xml2sexprtest.c sexpr2xmltest.c xmconfigtest.c \
+EXTRA_DIST += sexpr2xmltest.c xmconfigtest.c \
xencapstest.c \
testutilsxen.c testutilsxen.h
 endif ! WITH_XEN
@@ -538,6 +533,11 @@ xlconfigtest_SOURCES = \
testutils.c testutils.h
 xlconfigtest_LDADD =$(libxl_LDADDS)
 
+xml2sexprtest_SOURCES = \
+   xml2sexprtest.c testutilsxen.c testutilsxen.h \
+   testutils.c testutils.h
+xml2sexprtest_LDADD = $(libxl_LDADDS)
+
 libxlxml2domconfigtest_SOURCES = \
libxlxml2domconfigtest.c testutilsxen.c testutilsxen.h \
testutils.c testutils.h
@@ -549,7 +549,7 @@ virmocklibxl_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
 virmocklibxl_la_LIBADD = $(MOCKLIBS_LIBS)
 
 else ! WITH_LIBXL
-EXTRA_DIST += xlconfigtest.c libxlxml2domconfigtest.c
+EXTRA_DIST += xlconfigtest.c xml2sexprtest.c libxlxml2domconfigtest.c
 endif ! WITH_LIBXL
 
 QEMUMONITORTESTUTILS_SOURCES = \
diff --git a/tests/xml2sexprdata/xml2sexpr-escape.sexpr 
b/tests/xml2sexprdata/xml2sexpr-escape.sexpr
index 3c2ab8cd2..75411ceb1 100644
--- a/tests/xml2sexprdata/xml2sexpr-escape.sexpr
+++ b/tests/xml2sexprdata/xml2sexpr-escape.sexpr
@@ -5,7 +5,7 @@
 (ramdisk '/var/lib/xen/initrd.img.0u-Vhq')\
 (args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/\
 core/test/5.91/x86_64/os="devel"  ')\
-(loader '/usr/lib/xen/boot/hvmloader')(vcpus 2)(boot c)(usb 1)(parallel none)\
+(loader '/usr/lib/xen/boot/hvmloader')(vcpus 2)(boot c)(pae 1)(usb 1)(parallel 
none)\
 (serial pty)(device_model '/usr/lib/xen/bin/qemu-dm')(rtc_timeoffset 0)\
 (localtime 0)))(localtime 0)\
 (device (vbd (dev 'xvda:disk')(uname 'file:/root/\'\\some.img')(mode 'w'
diff --git a/tests/xml2sexprdata/xml2sexpr-fv-force-hpet.sexpr 
b/tests/xml2sexprdata/xml2sexpr-fv-force-hpet.sexpr
index 

[libvirt] [PATCH 6/7] docs: remove mention of legacy Xen driver

2018-03-28 Thread Jim Fehlig
Signed-off-by: Jim Fehlig 
---
 docs/architecture.html.in | 28 --
 docs/bugs.html.in |  3 +-
 docs/uri.html.in  | 74 ---
 docs/windows.html.in  |  2 +-
 4 files changed, 9 insertions(+), 98 deletions(-)

diff --git a/docs/architecture.html.in b/docs/architecture.html.in
index f1461ba88..cab4880a5 100644
--- a/docs/architecture.html.in
+++ b/docs/architecture.html.in
@@ -19,32 +19,16 @@
 in "Domain 0", which is the primary Linux OS loaded on the machine. That OS
 kernel provides most if not all of the actual drivers used by the set of
 domains. It also runs the Xen Store, a database of information shared by the
-hypervisor, the kernels, the drivers and the xen daemon. Xend. The xen daemon
-supervise the control and execution of the sets of domains. The hypervisor,
+hypervisor, the backend drivers, any running domains, and libxl (aka 
libxenlight).
+libxl provides a set of APIs for creating and managing domains, which can be 
used
+by applications such as the xl tool provided by Xen or libvirt. The hypervisor,
 drivers, kernels and daemons communicate though a shared system bus
 implemented in the hypervisor. The figure below tries to provide a view of
 this environment:
 
-The library can be initialized in 2 ways depending on the level of
-privilege of the embedding program. If it runs with root access,
-virConnectOpen() can be used, it will use three different ways to connect to
-the Xen infrastructure:
-
-  a connection to the Xen Daemon though an HTTP RPC layer
-  a read/write connection to the Xen Store
-  use Xen Hypervisor calls
-  when used as non-root libvirt connect to a proxy daemon running
-  as root and providing read-only support
-
-The library will usually interact with the Xen daemon for any operation
-changing the state of the system, but for performance and accuracy reasons
-may talk directly to the hypervisor when gathering state information at
-least when possible (i.e. when the running program using libvirt has root
-privilege access).
-If it runs without root access virConnectOpenReadOnly() should be used 
to
-connect to initialize the library. It will then fork a libvirt_proxy
-program running as root and providing read_only access to the API, this is
-then only useful for reporting and monitoring.
+The library will interact with libxl for all management operations
+on a Xen system.
+Not that the libvirt libxl driver only supports root access.
 
 QEmu and KVM support
 
diff --git a/docs/bugs.html.in b/docs/bugs.html.in
index 12a1090c1..553422338 100644
--- a/docs/bugs.html.in
+++ b/docs/bugs.html.in
@@ -122,7 +122,8 @@
   The hardware architecture being used
   The name of the hypervisor (Xen, QEMU, KVM)
   The XML config of the guest domain if relevant
-  For Xen hypervisor, the XenD logfile from /var/log/xen
+  For Xen hypervisor, the domain logfiles from /var/log/xen and
+  /var/log/libvirt/libxl
   For QEMU/KVM, the domain logfile from /var/log/libvirt/qemu
 
 
diff --git a/docs/uri.html.in b/docs/uri.html.in
index ade726089..5df73613a 100644
--- a/docs/uri.html.in
+++ b/docs/uri.html.in
@@ -253,59 +253,6 @@ the user to type a URI in directly (if that is 
appropriate).  If your
 application wishes to connect specifically to a Xen hypervisor, then
 for future proofing it should choose a full xen:/// URI.
 
-
-  File paths (xend-unix-server)
-
-
-If XenD is running and configured in /etc/xen/xend-config.sxp:
-
-
-(xend-unix-server yes)
-
-
-then it listens on a Unix domain socket, usually at
-/var/lib/xend/xend-socket.  You may pass a different path
-using a file URI such as:
-
-
-virsh -c ///var/run/xend/xend-socket
-
-
-  Legacy: http://... (xend-http-server)
-
-
-If XenD is running and configured in /etc/xen/xend-config.sxp:
-
-
-
-(xend-http-server yes)
-
-
-then it listens on TCP port 8000.  libvirt allows you to
-try to connect to xend running on remote machines by passing
-http://hostname[:port]/, for example:
-
-
-
-virsh -c http://oirase/ list
-
-
-This method is unencrypted and insecure and is definitely not
-recommended for production use.  Instead use libvirt's 
remote support.
-
-
-Notes:
-
-
-   The HTTP client does not fully support IPv6. 
-   Many features do not work as expected across HTTP connections, in
- particular, virConnectGetCapabilities.
- The remote support however does work
- correctly. 
-   XenD's new-style XMLRPC interface is not supported by
- libvirt, only the old-style sexpr interface known in the Xen
- documentation as "unix server" or "http server".
-
 
   Legacy: "xen"
 
@@ -313,27 +260,6 @@ Notes:
 Another legacy URI is to specify name as the string
 "xen".  This will continue to refer to the Xen
 hypervisor.  However you should prefer a full xen:/// URI in all 

[libvirt] [PATCH 7/7] spec: remove legacy xen driver

2018-03-28 Thread Jim Fehlig
Signed-off-by: Jim Fehlig 
---
 libvirt.spec.in | 57 -
 1 file changed, 4 insertions(+), 53 deletions(-)

diff --git a/libvirt.spec.in b/libvirt.spec.in
index b55a947ec..dcfa50022 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -18,7 +18,6 @@
 %{!?enable_autotools:%global enable_autotools 0}
 
 # The hypervisor drivers that run in libvirtd
-%define with_xen   0%{!?_without_xen:1}
 %define with_qemu  0%{!?_without_qemu:1}
 %define with_lxc   0%{!?_without_lxc:1}
 %define with_uml   0%{!?_without_uml:1}
@@ -96,7 +95,6 @@
 
 # Xen is available only on i386 x86_64 ia64
 %ifnarch %{ix86} x86_64 ia64
-%define with_xen 0
 %define with_libxl 0
 %endif
 
@@ -161,11 +159,6 @@
 %define with_firewalld 1
 %endif
 
-# RHEL-6 stopped including Xen on all archs.
-%if 0%{?rhel}
-%define with_xen 0
-%endif
-
 # fuse is used to provide virtualized /proc for LXC
 %if %{with_lxc} && 0%{?rhel} != 6
 %define with_fuse  0%{!?_without_fuse:1}
@@ -280,9 +273,6 @@ Requires: libvirt-daemon-driver-qemu = %{version}-%{release}
 %if %{with_uml}
 Requires: libvirt-daemon-driver-uml = %{version}-%{release}
 %endif
-%if %{with_xen}
-Requires: libvirt-daemon-driver-xen = %{version}-%{release}
-%endif
 %if %{with_vbox}
 Requires: libvirt-daemon-driver-vbox = %{version}-%{release}
 %endif
@@ -316,7 +306,7 @@ BuildRequires: %{python}
 %if %{with_systemd}
 BuildRequires: systemd-units
 %endif
-%if %{with_xen} || %{with_libxl}
+%if %{with_libxl}
 BuildRequires: xen-devel
 %endif
 BuildRequires: libxml2-devel
@@ -376,11 +366,6 @@ BuildRequires: util-linux
 BuildRequires: libacl-devel
 # From QEMU RPMs
 BuildRequires: /usr/bin/qemu-img
-%else
-%if %{with_xen}
-# From Xen RPMs
-BuildRequires: /usr/sbin/qcow-create
-%endif
 %endif
 # For LVM drivers
 BuildRequires: lvm2
@@ -629,11 +614,6 @@ Requires: util-linux
 %if %{with_qemu}
 # From QEMU RPMs
 Requires: /usr/bin/qemu-img
-%else
-%if %{with_xen}
-# From Xen RPMs
-Requires: /usr/sbin/qcow-create
-%endif
 %endif
 
 %description daemon-driver-storage-core
@@ -838,19 +818,6 @@ User Mode Linux
 %endif
 
 
-%if %{with_xen}
-%package daemon-driver-xen
-Summary: Xen driver plugin for the libvirtd daemon
-Group: Development/Libraries
-Requires: libvirt-daemon = %{version}-%{release}
-
-%description daemon-driver-xen
-The Xen driver plugin for the libvirtd daemon, providing
-an implementation of the hypervisor driver APIs using
-Xen
-%endif
-
-
 %if %{with_vbox}
 %package daemon-driver-vbox
 Summary: VirtualBox driver plugin for the libvirtd daemon
@@ -961,15 +928,12 @@ capabilities of UML
 %endif
 
 
-%if %{with_xen} || %{with_libxl}
+%if %{with_libxl}
 %package daemon-xen
 Summary: Server side daemon & driver required to run XEN guests
 Group: Development/Libraries
 
 Requires: libvirt-daemon = %{version}-%{release}
-%if %{with_xen}
-Requires: libvirt-daemon-driver-xen = %{version}-%{release}
-%endif
 %if %{with_libxl}
 Requires: libvirt-daemon-driver-libxl = %{version}-%{release}
 %endif
@@ -1164,12 +1128,6 @@ echo "This RPM requires either Fedora >= %{min_fedora} 
or RHEL >= %{min_rhel}"
 exit 1
 %endif
 
-%if %{with_xen}
-%define arg_xen --with-xen
-%else
-%define arg_xen --without-xen
-%endif
-
 %if %{with_qemu}
 %define arg_qemu --with-qemu
 %else
@@ -1337,8 +1295,7 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' 
%{_specdir}/%{name}.spec)
 %endif
 
 rm -f po/stamp-po
-%configure %{?arg_xen} \
-   %{?arg_qemu} \
+%configure %{?arg_qemu} \
%{?arg_openvz} \
%{?arg_lxc} \
%{?arg_vbox} \
@@ -1997,12 +1954,6 @@ exit 0
 %{_libdir}/%{name}/connection-driver/libvirt_driver_uml.so
 %endif
 
-%if %{with_xen}
-%files daemon-driver-xen
-%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/xen/
-%{_libdir}/%{name}/connection-driver/libvirt_driver_xen.so
-%endif
-
 %if %{with_libxl}
 %files daemon-driver-libxl
 %config(noreplace) %{_sysconfdir}/libvirt/libxl.conf
@@ -2037,7 +1988,7 @@ exit 0
 %files daemon-uml
 %endif
 
-%if %{with_xen} || %{with_libxl}
+%if %{with_libxl}
 %files daemon-xen
 %endif
 
-- 
2.16.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 0/7] Remove the legacy xen driver

2018-03-28 Thread Jim Fehlig
Long overdue first cut at remove the old xen driver. The first 3 patches
move existing tests to WITH_LIBXL since we'll want to continue supporting
conversion of the various xen config formats. The remain patches remove
the cruft.

Jim Fehlig (7):
  tests: move xml2sexpr tests to WITH_LIBXL
  tests: move sexpr2xml tests to WITH_LIBXL
  tests: move xmconfig tests to WITH_LIBXL
  Remove xencaps tests and data files
  Remove the xend driver
  docs: remove mention of legacy Xen driver
  spec: remove legacy xen driver

 configure.ac   |7 +-
 docs/architecture.html.in  |   28 +-
 docs/bugs.html.in  |3 +-
 docs/uri.html.in   |   74 -
 docs/windows.html.in   |2 +-
 libvirt.spec.in|   57 +-
 m4/virt-driver-xen.m4  |  142 -
 po/POTFILES.in |7 -
 src/Makefile.am|1 -
 src/xen/Makefile.inc.am|   67 -
 src/xen/block_stats.c  |  355 ---
 src/xen/block_stats.h  |   38 -
 src/xen/xen_driver.c   | 2845 -
 src/xen/xen_driver.h   |  204 --
 src/xen/xen_hypervisor.c   | 3125 ---
 src/xen/xen_hypervisor.h   |  142 -
 src/xen/xen_inotify.c  |  447 ---
 src/xen/xen_inotify.h  |   33 -
 src/xen/xend_internal.c| 3221 
 src/xen/xend_internal.h|  213 --
 src/xen/xm_internal.c  | 1484 -
 src/xen/xm_internal.h  |  105 -
 src/xen/xs_internal.c  |  920 --
 src/xen/xs_internal.h  |  101 -
 tests/Makefile.am  |   59 +-
 tests/sexpr2xmldata/sexpr2xml-boot-grub.xml|3 +-
 tests/sexpr2xmldata/sexpr2xml-bridge-ipaddr.xml|3 +-
 tests/sexpr2xmldata/sexpr2xml-curmem.xml   |1 -
 .../sexpr2xml-disk-block-shareable.xml |1 -
 tests/sexpr2xmldata/sexpr2xml-disk-block.xml   |3 +-
 .../sexpr2xml-disk-drv-blktap-qcow.xml |1 -
 .../sexpr2xml-disk-drv-blktap-raw.xml  |1 -
 .../sexpr2xml-disk-drv-blktap2-raw.xml |1 -
 tests/sexpr2xmldata/sexpr2xml-disk-file.xml|3 +-
 tests/sexpr2xmldata/sexpr2xml-fv-autoport.xml  |7 +-
 tests/sexpr2xmldata/sexpr2xml-fv-empty-kernel.xml  |7 +-
 tests/sexpr2xmldata/sexpr2xml-fv-force-hpet.xml|7 +-
 tests/sexpr2xmldata/sexpr2xml-fv-force-nohpet.xml  |7 +-
 tests/sexpr2xmldata/sexpr2xml-fv-kernel.xml|3 +-
 tests/sexpr2xmldata/sexpr2xml-fv-localtime.xml |7 +-
 tests/sexpr2xmldata/sexpr2xml-fv-net-netfront.xml  |7 +-
 tests/sexpr2xmldata/sexpr2xml-fv-parallel-tcp.xml  |7 +-
 .../sexpr2xml-fv-serial-dev-2-ports.xml|7 +-
 .../sexpr2xml-fv-serial-dev-2nd-port.xml   |7 +-
 tests/sexpr2xmldata/sexpr2xml-fv-serial-file.xml   |7 +-
 tests/sexpr2xmldata/sexpr2xml-fv-serial-null.xml   |7 +-
 tests/sexpr2xmldata/sexpr2xml-fv-serial-pipe.xml   |7 +-
 tests/sexpr2xmldata/sexpr2xml-fv-serial-pty.xml|7 +-
 tests/sexpr2xmldata/sexpr2xml-fv-serial-stdio.xml  |7 +-
 .../sexpr2xml-fv-serial-tcp-telnet.xml |7 +-
 tests/sexpr2xmldata/sexpr2xml-fv-serial-tcp.xml|7 +-
 tests/sexpr2xmldata/sexpr2xml-fv-serial-udp.xml|7 +-
 tests/sexpr2xmldata/sexpr2xml-fv-serial-unix.xml   |7 +-
 tests/sexpr2xmldata/sexpr2xml-fv-sound-all.xml |7 +-
 tests/sexpr2xmldata/sexpr2xml-fv-sound.xml |7 +-
 tests/sexpr2xmldata/sexpr2xml-fv-usbmouse.xml  |7 +-
 tests/sexpr2xmldata/sexpr2xml-fv-usbtablet.xml |7 +-
 tests/sexpr2xmldata/sexpr2xml-fv-utc.xml   |7 +-
 tests/sexpr2xmldata/sexpr2xml-fv-v2.xml|7 +-
 tests/sexpr2xmldata/sexpr2xml-fv.xml   |7 +-
 tests/sexpr2xmldata/sexpr2xml-net-bridged.xml  |3 +-
 tests/sexpr2xmldata/sexpr2xml-net-e1000.xml|3 +-
 tests/sexpr2xmldata/sexpr2xml-net-routed.xml   |3 +-
 tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml  |6 +-
 tests/sexpr2xmldata/sexpr2xml-pci-devs.xml |5 +-
 .../sexpr2xml-pv-bootloader-cmdline.xml|3 +-
 tests/sexpr2xmldata/sexpr2xml-pv-bootloader.xml|3 +-
 tests/sexpr2xmldata/sexpr2xml-pv-localtime.xml |3 +-
 tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml |3 +-
 .../sexpr2xml-pv-vfb-new-vncdisplay.xml|3 +-
 tests/sexpr2xmldata/sexpr2xml-pv-vfb-new.xml   |3 +-
 

[libvirt] [PATCH 3/7] tests: move xmconfig tests to WITH_LIBXL

2018-03-28 Thread Jim Fehlig
In preparation of removing the legacy Xen driver, move the
xmconfig tests from WITH_XEN to WITH_LIBXL. Even though the
legacy driver will be removed, we'll want to maintain the ability
to convert xm config to XML. Requires fixing up the tests to account
for different behavior of Xen vs libxl post parse functions. For
consistency with other Xen config tests, change the  arch to
x86_64.

There is some test file fallout due to differences in handling of
default values between xend and libxl.

Signed-off-by: Jim Fehlig 
---
 tests/Makefile.am  | 19 +--
 tests/xmconfigdata/test-disk-drv-blktap-raw.xml|  3 +--
 tests/xmconfigdata/test-disk-drv-blktap2-raw.xml   |  3 +--
 tests/xmconfigdata/test-escape-paths.xml   | 11 +--
 .../xmconfigdata/test-fullvirt-default-feature.xml |  9 -
 tests/xmconfigdata/test-fullvirt-force-hpet.xml|  9 -
 tests/xmconfigdata/test-fullvirt-force-nohpet.xml  |  9 -
 tests/xmconfigdata/test-fullvirt-localtime.xml |  9 -
 tests/xmconfigdata/test-fullvirt-net-netfront.xml  |  9 -
 tests/xmconfigdata/test-fullvirt-new-cdrom.xml |  9 -
 tests/xmconfigdata/test-fullvirt-nohap.xml |  9 -
 tests/xmconfigdata/test-fullvirt-parallel-tcp.xml  |  9 -
 tests/xmconfigdata/test-fullvirt-serial-file.xml   |  9 -
 tests/xmconfigdata/test-fullvirt-serial-null.xml   |  9 -
 tests/xmconfigdata/test-fullvirt-serial-pipe.xml   |  9 -
 tests/xmconfigdata/test-fullvirt-serial-pty.xml|  9 -
 tests/xmconfigdata/test-fullvirt-serial-stdio.xml  |  9 -
 .../test-fullvirt-serial-tcp-telnet.xml|  9 -
 tests/xmconfigdata/test-fullvirt-serial-tcp.xml|  9 -
 tests/xmconfigdata/test-fullvirt-serial-udp.xml|  9 -
 tests/xmconfigdata/test-fullvirt-serial-unix.xml   |  9 -
 tests/xmconfigdata/test-fullvirt-sound.xml |  9 -
 tests/xmconfigdata/test-fullvirt-usbmouse.xml  |  9 -
 tests/xmconfigdata/test-fullvirt-usbtablet.xml |  9 -
 tests/xmconfigdata/test-fullvirt-utc.xml   |  9 -
 tests/xmconfigdata/test-no-source-cdrom.xml|  9 -
 tests/xmconfigdata/test-paravirt-maxvcpus.xml  |  5 ++---
 tests/xmconfigdata/test-paravirt-net-e1000.xml |  5 ++---
 tests/xmconfigdata/test-paravirt-net-vifname.xml   |  5 ++---
 .../test-paravirt-new-pvfb-vncdisplay.xml  |  5 ++---
 tests/xmconfigdata/test-paravirt-new-pvfb.xml  |  5 ++---
 tests/xmconfigdata/test-paravirt-vcpu.xml  |  5 ++---
 tests/xmconfigdata/test-pci-devs.xml   | 11 ++-
 tests/xmconfigtest.c   | 22 +++---
 34 files changed, 125 insertions(+), 172 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 351745c8d..18a6672de 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -272,12 +272,12 @@ ssh_SOURCES = ssh.c
 ssh_LDADD = $(COVERAGE_LDFLAGS)
 
 if WITH_XEN
-test_programs += xmconfigtest xencapstest
+test_programs += xencapstest
 endif WITH_XEN
 
 if WITH_LIBXL
 test_programs += xlconfigtest xml2sexprtest sexpr2xmltest \
-   libxlxml2domconfigtest
+   xmconfigtest libxlxml2domconfigtest
 test_libraries += virmocklibxl.la
 endif WITH_LIBXL
 
@@ -501,18 +501,12 @@ if WITH_XEN
 xen_LDADDS = ../src/libvirt_driver_xen_impl.la
 xen_LDADDS += $(LDADDS)
 
-xmconfigtest_SOURCES = \
-   xmconfigtest.c testutilsxen.c testutilsxen.h \
-   testutils.c testutils.h
-xmconfigtest_LDADD = $(xen_LDADDS)
-
 xencapstest_SOURCES = \
xencapstest.c testutils.h testutils.c
 xencapstest_LDADD = $(xen_LDADDS)
 
 else ! WITH_XEN
-EXTRA_DIST += xmconfigtest.c xencapstest.c \
-   testutilsxen.c testutilsxen.h
+EXTRA_DIST += xencapstest.c testutilsxen.c testutilsxen.h
 endif ! WITH_XEN
 
 if WITH_LIBXL
@@ -537,6 +531,11 @@ sexpr2xmltest_SOURCES = \
testutils.c testutils.h
 sexpr2xmltest_LDADD = $(libxl_LDADDS)
 
+xmconfigtest_SOURCES = \
+   xmconfigtest.c testutilsxen.c testutilsxen.h \
+   testutils.c testutils.h
+xmconfigtest_LDADD = $(libxl_LDADDS)
+
 libxlxml2domconfigtest_SOURCES = \
libxlxml2domconfigtest.c testutilsxen.c testutilsxen.h \
testutils.c testutils.h
@@ -549,7 +548,7 @@ virmocklibxl_la_LIBADD = $(MOCKLIBS_LIBS)
 
 else ! WITH_LIBXL
 EXTRA_DIST += xlconfigtest.c xml2sexprtest.c sexpr2xmltest.c \
-   libxlxml2domconfigtest.c
+   xmconfigtest.c libxlxml2domconfigtest.c
 endif ! WITH_LIBXL
 
 QEMUMONITORTESTUTILS_SOURCES = \
diff --git a/tests/xmconfigdata/test-disk-drv-blktap-raw.xml 
b/tests/xmconfigdata/test-disk-drv-blktap-raw.xml
index cf859bad9..b8a1eafdd 100644
--- a/tests/xmconfigdata/test-disk-drv-blktap-raw.xml
+++ b/tests/xmconfigdata/test-disk-drv-blktap-raw.xml
@@ -6,7 +6,7 @@
   2
   /usr/bin/pygrub
   
-linux
+linux
   
   
   destroy
@@ -28,6 +28,5 @@

[libvirt] [PATCH 4/7] Remove xencaps tests and data files

2018-03-28 Thread Jim Fehlig
Signed-off-by: Jim Fehlig 
---
 tests/Makefile.am  |  20 ---
 tests/testutilsxen.c   |  64 -
 tests/testutilsxen.h   |   2 -
 tests/vircapstest.c|  34 -
 tests/virdrivermoduletest.c|   3 -
 tests/virschematest.c  |   3 +-
 tests/xencapsdata/xen-i686-pae-hvm.caps|   1 -
 tests/xencapsdata/xen-i686-pae-hvm.cpuinfo |  37 -
 tests/xencapsdata/xen-i686-pae-hvm.xml |  49 ---
 tests/xencapsdata/xen-i686-pae.caps|   1 -
 tests/xencapsdata/xen-i686-pae.cpuinfo |  18 ---
 tests/xencapsdata/xen-i686-pae.xml |  32 -
 tests/xencapsdata/xen-i686.caps|   1 -
 tests/xencapsdata/xen-i686.cpuinfo |  18 ---
 tests/xencapsdata/xen-i686.xml |  29 
 tests/xencapsdata/xen-ia64-be-hvm.caps |   1 -
 tests/xencapsdata/xen-ia64-be-hvm.cpuinfo  |  29 
 tests/xencapsdata/xen-ia64-be-hvm.xml  |  45 --
 tests/xencapsdata/xen-ia64-be.caps |   1 -
 tests/xencapsdata/xen-ia64-be.cpuinfo  |  29 
 tests/xencapsdata/xen-ia64-be.xml  |  29 
 tests/xencapsdata/xen-ia64-hvm.caps|   1 -
 tests/xencapsdata/xen-ia64-hvm.cpuinfo |  29 
 tests/xencapsdata/xen-ia64-hvm.xml |  41 --
 tests/xencapsdata/xen-ia64.caps|   1 -
 tests/xencapsdata/xen-ia64.cpuinfo |  29 
 tests/xencapsdata/xen-ia64.xml |  26 
 tests/xencapsdata/xen-ppc64.caps   |   1 -
 tests/xencapsdata/xen-ppc64.cpuinfo|   0
 tests/xencapsdata/xen-ppc64.xml|  26 
 tests/xencapsdata/xen-x86_64-hvm.caps  |   1 -
 tests/xencapsdata/xen-x86_64-hvm.cpuinfo   |  47 --
 tests/xencapsdata/xen-x86_64-hvm.xml   |  61 
 tests/xencapsdata/xen-x86_64.caps  |   1 -
 tests/xencapsdata/xen-x86_64.cpuinfo   |  47 --
 tests/xencapsdata/xen-x86_64.xml   |  29 
 tests/xencapstest.c| 224 -
 37 files changed, 1 insertion(+), 1009 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 18a6672de..9390a790b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -160,7 +160,6 @@ EXTRA_DIST = \
virusbtestdata \
vmwareverdata \
vmx2xmldata \
-   xencapsdata \
xlconfigdata \
xmconfigdata \
xml2sexprdata \
@@ -271,10 +270,6 @@ endif WITH_SECDRIVER_SELINUX
 ssh_SOURCES = ssh.c
 ssh_LDADD = $(COVERAGE_LDFLAGS)
 
-if WITH_XEN
-test_programs += xencapstest
-endif WITH_XEN
-
 if WITH_LIBXL
 test_programs += xlconfigtest xml2sexprtest sexpr2xmltest \
xmconfigtest libxlxml2domconfigtest
@@ -497,18 +492,6 @@ sockettest_SOURCES = \
testutils.c testutils.h
 sockettest_LDADD = $(LDADDS)
 
-if WITH_XEN
-xen_LDADDS = ../src/libvirt_driver_xen_impl.la
-xen_LDADDS += $(LDADDS)
-
-xencapstest_SOURCES = \
-   xencapstest.c testutils.h testutils.c
-xencapstest_LDADD = $(xen_LDADDS)
-
-else ! WITH_XEN
-EXTRA_DIST += xencapstest.c testutilsxen.c testutilsxen.h
-endif ! WITH_XEN
-
 if WITH_LIBXL
 libxl_LDADDS = ../src/libvirt_driver_libxl_impl.la
 if WITH_NETWORK
@@ -983,9 +966,6 @@ endif WITH_LXC
 if WITH_QEMU
 vircapstest_SOURCES += testutilsqemu.c testutilsqemu.h
 endif WITH_QEMU
-if WITH_XEN
-vircapstest_SOURCES += testutilsxen.c testutilsxen.h
-endif WITH_XEN
 vircapstest_LDADD = $(qemu_LDADDS) $(LDADDS)
 
 domaincapsmock_la_SOURCES = domaincapsmock.c
diff --git a/tests/testutilsxen.c b/tests/testutilsxen.c
index 4328441b7..c08ec4a6e 100644
--- a/tests/testutilsxen.c
+++ b/tests/testutilsxen.c
@@ -7,70 +7,6 @@
 #include "testutilshostcpus.h"
 #include "domain_conf.h"
 
-virCapsPtr testXenCapsInit(void)
-{
-struct utsname utsname;
-virCapsPtr caps;
-virCapsGuestPtr guest;
-virCapsGuestMachinePtr *machines;
-int nmachines;
-static const char *const x86_machines[] = {
-"xenfv"
-};
-static const char *const xen_machines[] = {
-"xenpv"
-};
-
-uname();
-if ((caps = virCapabilitiesNew(VIR_ARCH_I686,
-   false, false)) == NULL)
-return NULL;
-
-nmachines = ARRAY_CARDINALITY(x86_machines);
-if ((machines = virCapabilitiesAllocMachines(x86_machines, nmachines)) == 
NULL)
-goto cleanup;
-
-if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_HVM, 
VIR_ARCH_I686,
- "/usr/lib/xen/bin/qemu-dm", NULL,
- nmachines, machines)) == NULL)
-goto cleanup;
-machines = NULL;
-
-if (virCapabilitiesAddGuestDomain(guest,
-  VIR_DOMAIN_VIRT_XEN,
-  NULL,
-  NULL,
-  0,
-  NULL) == NULL)
-goto cleanup;
-

[libvirt] [PATCH 4/8] Deprecate QEMU_CAPS_NETDEV

2018-03-28 Thread Ján Tomko
This makes qemuDomainSupportsNetdev identical to
qemuDomainSupportsNicdev and leaves some code in
qemuDomainAttachNetDevice to be cleaned up later.

Signed-off-by: Ján Tomko 
---
 src/qemu/qemu_capabilities.c   |  13 +-
 src/qemu/qemu_capabilities.h   |   2 +-
 src/qemu/qemu_domain.c |   4 +-
 src/qemu/qemu_hotplug.c| 120 +---
 src/qemu/qemu_process.c|   6 -
 tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml   |   1 -
 tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml   |   1 -
 tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml   |   1 -
 tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml   |   1 -
 tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml   |   1 -
 tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml   |   1 -
 tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml   |   1 -
 tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml |   1 -
 tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml   |   1 -
 tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml   |   1 -
 tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml  |   1 -
 tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml   |   1 -
 tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml |   1 -
 tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml   |   1 -
 tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml   |   1 -
 tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml  |   1 -
 tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml   |   1 -
 tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml   |   1 -
 tests/qemucapabilitiesdata/caps_2.6.0.aarch64.xml  |   1 -
 tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml|   1 -
 tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml   |   1 -
 tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml|   1 -
 tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml   |   1 -
 tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml|   1 -
 tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml   |   1 -
 tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml|   1 -
 tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml|   1 -
 tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml   |   1 -
 tests/qemuhelptest.c   |   2 -
 .../aarch64-aavmf-virtio-mmio.args |   4 +-
 tests/qemuxml2argvdata/aarch64-kvm-32-on-64.args   |   4 +-
 .../aarch64-video-virtio-gpu-pci.args  |   6 +-
 .../aarch64-virt-2.6-virtio-pci-default.args   |   5 +-
 .../qemuxml2argvdata/aarch64-virt-default-nic.args |   4 +-
 tests/qemuxml2argvdata/aarch64-virt-virtio.args|   4 +-
 .../aarch64-virtio-pci-default.args|   5 +-
 .../aarch64-virtio-pci-manual-addresses.args   |  10 +-
 tests/qemuxml2argvdata/arm-vexpressa9-virtio.args  |   4 +-
 tests/qemuxml2argvdata/arm-virt-virtio.args|   4 +-
 tests/qemuxml2argvdata/boot-complex-bootindex.args |  11 +-
 tests/qemuxml2argvdata/boot-complex.args   |  10 +-
 tests/qemuxml2argvdata/boot-order.args |   6 +-
 tests/qemuxml2argvdata/boot-strict.args|  11 +-
 tests/qemuxml2argvdata/controller-order.args   |   5 +-
 tests/qemuxml2argvdata/disk-copy_on_read.args  |   6 +-
 tests/qemuxml2argvdata/disk-ioeventfd.args |   4 +-
 tests/qemuxml2argvdata/event_idx.args  |   6 +-
 tests/qemuxml2argvdata/graphics-spice-timeout.args |   5 +-
 .../qemuxml2argvdata/intel-iommu-caching-mode.args |   5 +-
 .../machine-loadparm-multiple-disks-nets-s390.args |  11 +-
 .../machine-loadparm-net-s390.args |   6 +-
 tests/qemuxml2argvdata/net-client.args |   5 +-
 tests/qemuxml2argvdata/net-eth-hostip.args |   5 +-
 tests/qemuxml2argvdata/net-eth-ifname.args |   5 +-
 tests/qemuxml2argvdata/net-eth-names.args  |   9 +-
 tests/qemuxml2argvdata/net-eth.args|   5 +-
 tests/qemuxml2argvdata/net-mcast.args  |   5 +-
 tests/qemuxml2argvdata/net-server.args |   5 +-
 tests/qemuxml2argvdata/net-udp.args|   6 +-
 tests/qemuxml2argvdata/net-user.args   |   5 +-
 tests/qemuxml2argvdata/net-virtio-ccw.args |  10 +-
 tests/qemuxml2argvdata/net-virtio-device.args  |   6 +-
 .../net-virtio-disable-offloads.args   |   4 +-
 .../qemuxml2argvdata/net-virtio-rxtxqueuesize.args |   6 +-
 tests/qemuxml2argvdata/net-virtio-s390.args|   4 +-
 tests/qemuxml2argvdata/net-virtio.args |   5 +-
 tests/qemuxml2argvdata/pci-bridge.args | 151 +++-
 tests/qemuxml2argvdata/pci-expander-bus.args   | 151 +++-
 tests/qemuxml2argvdata/pci-rom.args|  12 +-
 tests/qemuxml2argvdata/pcie-expander-bus.args  | 155 -
 tests/qemuxml2argvdata/q35-pci-force-address.args  |   5 +-
 tests/qemuxml2argvdata/user-aliases.args   |  18 +--
 tests/qemuxml2argvdata/virtio-lun.args |   5 +-
 

[libvirt] [PATCH 5/8] Clean up qemuDomainAttachNetDevice

2018-03-28 Thread Ján Tomko
Now that we assume -netdev support, we no longer set the VLAN
or need the hostPlugged bool.

Signed-off-by: Ján Tomko 
---
 src/qemu/qemu_hotplug.c | 42 +-
 1 file changed, 13 insertions(+), 29 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 7f5c68e0c..a3e20c6e8 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -825,7 +825,6 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
 char *nicstr = NULL;
 char *netstr = NULL;
 int ret = -1;
-int vlan;
 bool releaseaddr = false;
 bool iface_connected = false;
 virDomainNetType actualType;
@@ -836,7 +835,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
 char *charDevAlias = NULL;
 bool charDevPlugged = false;
 bool netdevPlugged = false;
-bool hostPlugged = false;
+char *netdev_name;
 
 /* preallocate new slot for device */
 if (VIR_REALLOC_N(vm->def->nets, vm->def->nnets + 1) < 0)
@@ -1029,7 +1028,6 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
 
 releaseaddr = true;
 
-vlan = -1;
 if (VIR_ALLOC_N(tapfdName, tapfdSize) < 0 ||
 VIR_ALLOC_N(vhostfdName, vhostfdSize) < 0)
 goto cleanup;
@@ -1078,7 +1076,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
 for (i = 0; i < vhostfdSize; i++)
 VIR_FORCE_CLOSE(vhostfd[i]);
 
-if (!(nicstr = qemuBuildNicDevStr(vm->def, net, vlan, 0,
+if (!(nicstr = qemuBuildNicDevStr(vm->def, net, -1, 0,
   queueSize, priv->qemuCaps)))
 goto try_remove;
 
@@ -1169,31 +1167,17 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
 goto cleanup;
 
 virErrorPreserveLast();
-if (vlan < 0) {
-char *netdev_name;
-if (virAsprintf(_name, "host%s", net->info.alias) >= 0) {
-qemuDomainObjEnterMonitor(driver, vm);
-if (charDevPlugged &&
-qemuMonitorDetachCharDev(priv->mon, charDevAlias) < 0)
-VIR_WARN("Failed to remove associated chardev %s", 
charDevAlias);
-if (netdevPlugged &&
-qemuMonitorRemoveNetdev(priv->mon, netdev_name) < 0)
-VIR_WARN("Failed to remove network backend for netdev %s",
- netdev_name);
-ignore_value(qemuDomainObjExitMonitor(driver, vm));
-VIR_FREE(netdev_name);
-}
-} else {
-char *hostnet_name;
-if (virAsprintf(_name, "host%s", net->info.alias) >= 0) {
-qemuDomainObjEnterMonitor(driver, vm);
-if (hostPlugged &&
-qemuMonitorRemoveHostNetwork(priv->mon, vlan, hostnet_name) < 
0)
-VIR_WARN("Failed to remove network backend for vlan %d, net 
%s",
- vlan, hostnet_name);
-ignore_value(qemuDomainObjExitMonitor(driver, vm));
-VIR_FREE(hostnet_name);
-}
+if (virAsprintf(_name, "host%s", net->info.alias) >= 0) {
+qemuDomainObjEnterMonitor(driver, vm);
+if (charDevPlugged &&
+qemuMonitorDetachCharDev(priv->mon, charDevAlias) < 0)
+VIR_WARN("Failed to remove associated chardev %s", charDevAlias);
+if (netdevPlugged &&
+qemuMonitorRemoveNetdev(priv->mon, netdev_name) < 0)
+VIR_WARN("Failed to remove network backend for netdev %s",
+ netdev_name);
+ignore_value(qemuDomainObjExitMonitor(driver, vm));
+VIR_FREE(netdev_name);
 }
 virErrorRestore();
 goto cleanup;
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 2/8] Mandate QEMU >= 0.15.0

2018-03-28 Thread Ján Tomko
In Nov 2015 commit fc604c1 mandated at least QEMU 0.12.0, which was
released in Dec 2009.

Increase the requirement to 0.15.0 (Aug 2011), which was the first
release that stopped promising HMP compatibility.

This lets us assume every QEMU supports JSON monitor.

Signed-off-by: Ján Tomko 
---
 src/qemu/qemu_capabilities.c  |  11 +-
 tests/qemuhelpdata/qemu-0.12.1| 198 
 tests/qemuhelpdata/qemu-0.12.1-device |  62 
 tests/qemuhelpdata/qemu-kvm-0.12.3| 215 --
 tests/qemuhelpdata/qemu-kvm-0.12.3-device |  63 
 tests/qemuhelpdata/qemu-kvm-0.13.0| 242 --
 tests/qemuhelpdata/qemu-kvm-0.13.0-device |  90 ---
 tests/qemuhelptest.c  | 117 ---
 8 files changed, 4 insertions(+), 994 deletions(-)
 delete mode 100644 tests/qemuhelpdata/qemu-0.12.1
 delete mode 100644 tests/qemuhelpdata/qemu-0.12.1-device
 delete mode 100644 tests/qemuhelpdata/qemu-kvm-0.12.3
 delete mode 100644 tests/qemuhelpdata/qemu-kvm-0.12.3-device
 delete mode 100644 tests/qemuhelpdata/qemu-kvm-0.13.0
 delete mode 100644 tests/qemuhelpdata/qemu-kvm-0.13.0-device

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 73527820a..f2b385f4c 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1368,7 +1368,7 @@ virQEMUCapsComputeCmdFlags(const char *help,
  * is most likely buggy when used with -no-shutdown (which applies for qemu
  * 0.14.* and 0.15.0)
  */
-if (strstr(help, "-no-shutdown") && (version < 14000 || version > 15000))
+if (strstr(help, "-no-shutdown") && version > 15000)
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_SHUTDOWN);
 
 if (strstr(help, "dump-guest-core=on|off"))
@@ -1493,9 +1493,9 @@ int virQEMUCapsParseHelpStr(const char *qemu,
 
 *version = (major * 1000 * 1000) + (minor * 1000) + micro;
 
-if (*version < 12000) {
+if (*version < 15000) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _("QEMU version >= 0.12.00 is required, but %d.%d.%d 
found"),
+   _("QEMU version >= 0.15.00 is required, but %d.%d.%d 
found"),
major, minor, micro);
 goto cleanup;
 }
@@ -4430,10 +4430,7 @@ virQEMUCapsInitHelp(virQEMUCapsPtr qemuCaps, uid_t 
runUid, gid_t runGid, const c
 virQEMUCapsClear(qemuCaps, QEMU_CAPS_NO_ACPI);
 }
 
-/* virQEMUCapsExtractDeviceStr will only set additional caps if qemu
- * understands the 0.13.0+ notion of "-device driver,".  */
-if (strstr(help, "-device driver,?") &&
-virQEMUCapsExtractDeviceStr(qemuCaps->binary,
+if (virQEMUCapsExtractDeviceStr(qemuCaps->binary,
 qemuCaps, runUid, runGid) < 0) {
 goto cleanup;
 }
diff --git a/tests/qemuhelpdata/qemu-0.12.1 b/tests/qemuhelpdata/qemu-0.12.1
deleted file mode 100644
index 0caa3b36a..0
--- a/tests/qemuhelpdata/qemu-0.12.1
+++ /dev/null
@@ -1,198 +0,0 @@
-QEMU PC emulator version 0.12.1, Copyright (c) 2003-2008 Fabrice Bellard
-usage: qemu [options] [disk_image]
-
-'disk_image' is a raw hard image image for IDE hard disk 0
-
-Standard options:
--h or -help display this help and exit
--versiondisplay version information and exit
--M machine  select emulated machine (-M ? for list)
--cpu cpuselect CPU (-cpu ? for list)
--smp n[,maxcpus=cpus][,cores=cores][,threads=threads][,sockets=sockets]
-set the number of CPUs to 'n' [default=1]
-maxcpus= maximum number of total cpus, including
-  offline CPUs for hotplug etc.
-cores= number of CPU cores on one socket
-threads= number of threads on one CPU core
-sockets= number of discrete sockets in the system
--numa node[,mem=size][,cpus=cpu[-cpu]][,nodeid=node]
--fda/-fdb file  use 'file' as floppy disk 0/1 image
--hda/-hdb file  use 'file' as IDE hard disk 0/1 image
--hdc/-hdd file  use 'file' as IDE hard disk 2/3 image
--cdrom file use 'file' as IDE cdrom image (cdrom is ide1 master)
--drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i]
-   [,cyls=c,heads=h,secs=s[,trans=t]][,snapshot=on|off]
-   [,cache=writethrough|writeback|none][,format=f][,serial=s]
-   [,addr=A][,id=name][,aio=threads|native]
-use 'file' as a drive image
--set group.id.arg=value
-set  parameter for item  of type 
-i.e. -set drive.$id.file=/path/to/image
--global driver.property=value
-set a global default for a driver property
--mtdblock file  use 'file' as on-board Flash memory image
--sd fileuse 'file' as SecureDigital card image
--pflash fileuse 'file' as a parallel flash image
--boot [order=drives][,once=drives][,menu=on|off]
-'drives': floppy (a), hard disk (c), 

[libvirt] [PATCH 0/8] Move the minimum QEMU version closer to 1.3.0

2018-03-28 Thread Ján Tomko
1.3.0 was released in December 2012, it merged KVM and QEMU and is
above our 1.2.0 requirement for QMP capability probing.

Ján Tomko (8):
  virQEMUCapsParseHelpStr: remove unused check_yajl parameter
  Mandate QEMU >= 0.15.0
  Deprecate QEMU_CAPS_PCI_MULTIFUNCTION
  Deprecate QEMU_CAPS_NETDEV
  Clean up qemuDomainAttachNetDevice
  Remove unused qemuDomainNetVLAN
  Remove qemuDomainSupportsNetdev
  Deprecate QEMU_CAPS_MONITOR_JSON

 src/qemu/qemu_capabilities.c   |  62 +-
 src/qemu/qemu_capabilities.h   |   6 +-
 src/qemu/qemu_capspriv.h   |   1 -
 src/qemu/qemu_command.c|  41 +---
 src/qemu/qemu_domain.c |  16 --
 src/qemu/qemu_domain.h |   6 -
 src/qemu/qemu_driver.c |  18 +-
 src/qemu/qemu_hotplug.c| 138 +++-
 src/qemu/qemu_interface.c  |   2 +-
 src/qemu/qemu_process.c|   8 +-
 tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml   |   3 -
 tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml   |   3 -
 tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml   |   3 -
 tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml   |   3 -
 tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml   |   3 -
 tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml   |   3 -
 tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml   |   3 -
 tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml |   3 -
 tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml   |   3 -
 tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml   |   3 -
 tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml  |   3 -
 tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml   |   3 -
 tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml |   3 -
 tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml   |   3 -
 tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml   |   3 -
 tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml  |   3 -
 tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml   |   3 -
 tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml   |   3 -
 tests/qemucapabilitiesdata/caps_2.6.0.aarch64.xml  |   3 -
 tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml|   3 -
 tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml   |   3 -
 tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml|   3 -
 tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml   |   3 -
 tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml|   3 -
 tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml   |   3 -
 tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml|   3 -
 tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml|   3 -
 tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml   |   3 -
 tests/qemuhelpdata/qemu-0.12.1 | 198 -
 tests/qemuhelpdata/qemu-0.12.1-device  |  62 --
 tests/qemuhelpdata/qemu-kvm-0.12.3 | 215 --
 tests/qemuhelpdata/qemu-kvm-0.12.3-device  |  63 --
 tests/qemuhelpdata/qemu-kvm-0.13.0 | 242 -
 tests/qemuhelpdata/qemu-kvm-0.13.0-device  |  90 
 tests/qemuhelptest.c   | 130 +--
 .../aarch64-aavmf-virtio-mmio.args |   6 +-
 tests/qemuxml2argvdata/aarch64-acpi-uefi.args  |   2 +-
 .../qemuxml2argvdata/aarch64-cpu-passthrough.args  |   2 +-
 tests/qemuxml2argvdata/aarch64-gic-host.args   |   2 +-
 tests/qemuxml2argvdata/aarch64-gic-none-tcg.args   |   2 +-
 tests/qemuxml2argvdata/aarch64-gic-v2.args |   2 +-
 tests/qemuxml2argvdata/aarch64-gic-v3.args |   2 +-
 tests/qemuxml2argvdata/aarch64-kvm-32-on-64.args   |   6 +-
 tests/qemuxml2argvdata/aarch64-noacpi-nouefi.args  |   2 +-
 tests/qemuxml2argvdata/aarch64-noacpi-uefi.args|   2 +-
 tests/qemuxml2argvdata/aarch64-pci-serial.args |   2 +-
 .../aarch64-usb-controller-nec-xhci.args   |   2 +-
 .../aarch64-usb-controller-qemu-xhci.args  |   2 +-
 tests/qemuxml2argvdata/aarch64-video-default.args  |   2 +-
 .../aarch64-video-virtio-gpu-pci.args  |   8 +-
 .../aarch64-virt-2.6-virtio-pci-default.args   |   7 +-
 .../qemuxml2argvdata/aarch64-virt-default-nic.args |   6 +-
 tests/qemuxml2argvdata/aarch64-virt-virtio.args|   6 +-
 .../aarch64-virtio-pci-default.args|   7 +-
 .../aarch64-virtio-pci-manual-addresses.args   |  12 +-
 tests/qemuxml2argvdata/acpi-table.args |   2 +-
 tests/qemuxml2argvdata/arm-vexpressa9-basic.args   |   2 +-
 tests/qemuxml2argvdata/arm-vexpressa9-nodevs.args  |   2 +-
 tests/qemuxml2argvdata/arm-vexpressa9-virtio.args  |   6 +-
 tests/qemuxml2argvdata/arm-virt-virtio.args|   6 +-
 tests/qemuxml2argvdata/autoindex.args  |   2 +-
 tests/qemuxml2argvdata/balloon-ccw-deflate.args|   2 +-
 tests/qemuxml2argvdata/balloon-device-auto.args|   2 +-
 .../balloon-device-deflate-off.args   

[libvirt] [PATCH 3/8] Deprecate QEMU_CAPS_PCI_MULTIFUNCTION

2018-03-28 Thread Ján Tomko
Supported since QEMU 0.13, but we require QEMU 0.15.

Signed-off-by: Ján Tomko 
---
 src/qemu/qemu_capabilities.c   |  4 --
 src/qemu/qemu_capabilities.h   |  2 +-
 src/qemu/qemu_command.c| 15 --
 tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml   |  1 -
 tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml   |  1 -
 tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml   |  1 -
 tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml   |  1 -
 tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml   |  1 -
 tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml   |  1 -
 tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml   |  1 -
 tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml |  1 -
 tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml   |  1 -
 tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml   |  1 -
 tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml  |  1 -
 tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml   |  1 -
 tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml |  1 -
 tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml   |  1 -
 tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml   |  1 -
 tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml  |  1 -
 tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml   |  1 -
 tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml   |  1 -
 tests/qemucapabilitiesdata/caps_2.6.0.aarch64.xml  |  1 -
 tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml|  1 -
 tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml   |  1 -
 tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml|  1 -
 tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml   |  1 -
 tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml|  1 -
 tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml   |  1 -
 tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml|  1 -
 tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml|  1 -
 tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml   |  1 -
 tests/qemuhelptest.c   |  2 -
 tests/qemuxml2argvtest.c   | 56 --
 tests/qemuxml2xmltest.c| 27 ++-
 34 files changed, 14 insertions(+), 120 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index f2b385f4c..61663864f 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1395,9 +1395,6 @@ virQEMUCapsComputeCmdFlags(const char *help,
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV);
 #endif
 
-if (version >= 13000)
-virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_MULTIFUNCTION);
-
 if (version >= 1001000) {
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_IPV6_MIGRATION);
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_SHARE_POLICY);
@@ -1700,7 +1697,6 @@ static struct virQEMUCapsStringFlags 
virQEMUCapsObjectPropsVirtioBalloon[] = {
 };
 
 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = {
-{ "multifunction", QEMU_CAPS_PCI_MULTIFUNCTION },
 { "bootindex", QEMU_CAPS_BOOTINDEX },
 { "ioeventfd", QEMU_CAPS_VIRTIO_IOEVENTFD },
 { "event_idx", QEMU_CAPS_VIRTIO_BLK_EVENT_IDX },
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 3f3c29f8f..32527ce78 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -132,7 +132,7 @@ typedef enum {
 X_QEMU_CAPS_DEVICE_QXL_VGA, /* primary qxl device named qxl-vga? */
 
 /* 60 */
-QEMU_CAPS_PCI_MULTIFUNCTION, /* -device multifunction=on|off */
+X_QEMU_CAPS_PCI_MULTIFUNCTION, /* -device multifunction=on|off */
 QEMU_CAPS_VIRTIO_IOEVENTFD, /* virtio-{net|blk}-pci.ioeventfd=on */
 QEMU_CAPS_SGA, /* Serial Graphics Adapter */
 QEMU_CAPS_VIRTIO_BLK_EVENT_IDX, /* virtio-blk-pci.event_idx */
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 89fd08b64..3241b1cf5 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -356,21 +356,6 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
 goto cleanup;
 }
 
-if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_MULTIFUNCTION)) {
-if (info->addr.pci.function != 0) {
-virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-   _("Only PCI device addresses with function=0 "
- "are supported with this QEMU binary"));
-goto cleanup;
-}
-if (info->addr.pci.multi == VIR_TRISTATE_SWITCH_ON) {
-virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-   _("'multifunction=on' is not supported with "
- "this QEMU binary"));
-goto cleanup;
-}
-}
-
 if (contIsPHB && contTargetIndex > 0) {
 /* The PCI bus created by a spapr-pci-host-bridge device with
  * alias 'x' will be called 'x.0' rather than 'x'; however,
diff --git 

[libvirt] [PATCH 7/8] Remove qemuDomainSupportsNetdev

2018-03-28 Thread Ján Tomko
Now that we assume QEMU_CAPS_NETDEV, the only thing left to check
is whether we need to use the legacy -net syntax because of
a non-conforming armchitecture.

Signed-off-by: Ján Tomko 
---
 src/qemu/qemu_command.c   | 20 +---
 src/qemu/qemu_domain.c| 10 --
 src/qemu/qemu_domain.h|  4 
 src/qemu/qemu_hotplug.c   |  2 +-
 src/qemu/qemu_interface.c |  2 +-
 5 files changed, 7 insertions(+), 31 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 3241b1cf5..3dda9156d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8222,7 +8222,7 @@ qemuBuildVhostuserCommandLine(virQEMUDriverPtr driver,
 unsigned int queues = net->driver.virtio.queues;
 char *nic = NULL;
 
-if (!qemuDomainSupportsNetdev(def, qemuCaps, net)) {
+if (!qemuDomainSupportsNicdev(def, net)) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Netdev support unavailable"));
 goto error;
@@ -8557,23 +8557,14 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
 goto cleanup;
 }
 
-/* Possible combinations:
- *
- *  1. Old way:   -net nic,model=e1000,vlan=1 -net tap,vlan=1
- *  2. Semi-new:  -device e1000,vlan=1-net tap,vlan=1
- *  3. Best way:  -netdev type=tap,id=netdev1 -device e1000,id=netdev1
- *
- * NB, no support for -netdev without use of -device
- */
-if (qemuDomainSupportsNetdev(def, qemuCaps, net)) {
+if (qemuDomainSupportsNicdev(def, net)) {
 if (!(host = qemuBuildHostNetStr(net, driver,
  ',', vlan,
  tapfdName, tapfdSize,
  vhostfdName, vhostfdSize)))
 goto cleanup;
 virCommandAddArgList(cmd, "-netdev", host, NULL);
-}
-if (qemuDomainSupportsNicdev(def, net)) {
+
 if (!(nic = qemuBuildNicDevStr(def, net, vlan, bootindex,
vhostfdSize, qemuCaps)))
 goto cleanup;
@@ -8582,8 +8573,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
 if (!(nic = qemuBuildNicStr(net, "nic,", vlan)))
 goto cleanup;
 virCommandAddArgList(cmd, "-net", nic, NULL);
-}
-if (!qemuDomainSupportsNetdev(def, qemuCaps, net)) {
+
 if (!(host = qemuBuildHostNetStr(net, driver,
  ',', vlan,
  tapfdName, tapfdSize,
@@ -8663,7 +8653,7 @@ qemuBuildNetCommandLine(virQEMUDriverPtr driver,
 int vlan;
 
 /* VLANs are not used with -netdev, so don't record them */
-if (qemuDomainSupportsNetdev(def, qemuCaps, net))
+if (qemuDomainSupportsNicdev(def, net))
 vlan = -1;
 else
 vlan = i;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index e4a8c45cf..b4ce6c145 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -9109,16 +9109,6 @@ qemuDomainSupportsNicdev(virDomainDefPtr def,
 return true;
 }
 
-bool
-qemuDomainSupportsNetdev(virDomainDefPtr def,
- virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED,
- virDomainNetDefPtr net)
-{
-if (!qemuDomainSupportsNicdev(def, net))
-return false;
-return true;
-}
-
 bool
 qemuDomainNetSupportsMTU(virDomainNetType type)
 {
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 43352412c..c01cc85e0 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -799,10 +799,6 @@ int qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver,
 bool qemuDomainSupportsNicdev(virDomainDefPtr def,
   virDomainNetDefPtr net);
 
-bool qemuDomainSupportsNetdev(virDomainDefPtr def,
-  virQEMUCapsPtr qemuCaps,
-  virDomainNetDefPtr net);
-
 bool qemuDomainNetSupportsMTU(virDomainNetType type);
 
 int qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index a3e20c6e8..a70ec5b6e 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -956,7 +956,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
 queueSize = net->driver.virtio.queues;
 if (!queueSize)
 queueSize = 1;
-if (!qemuDomainSupportsNetdev(vm->def, priv->qemuCaps, net)) {
+if (!qemuDomainSupportsNicdev(vm->def, net)) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Netdev support unavailable"));
 goto cleanup;
diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c
index cebb49022..24c0174bf 100644
--- a/src/qemu/qemu_interface.c
+++ b/src/qemu/qemu_interface.c
@@ -646,7 +646,7 @@ qemuInterfaceOpenVhostNet(virDomainDefPtr def,
  * option), don't try to open the device.
  */
   

[libvirt] [PATCH 1/8] virQEMUCapsParseHelpStr: remove unused check_yajl parameter

2018-03-28 Thread Ján Tomko
Commit 6e769eba in Jan 2012 added an error message when using qemu 0.15
and newer with libvirt without JSON support.

However commit 3399875 (July 2012) added the 'check_yajl' parameter
to perform this check only on domain startup and commit 15ee6614
in Sep 2012 removed this last caller passing 'true' to this function.

Remove the dead code.

Signed-off-by: Ján Tomko 
---
 src/qemu/qemu_capabilities.c | 24 
 src/qemu/qemu_capspriv.h |  1 -
 tests/qemuhelptest.c |  2 +-
 3 files changed, 5 insertions(+), 22 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index e54dde69a..73527820a 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1257,8 +1257,7 @@ virQEMUCapsInit(virFileCachePtr cache)
 static int
 virQEMUCapsComputeCmdFlags(const char *help,
unsigned int version,
-   virQEMUCapsPtr qemuCaps,
-   bool check_yajl ATTRIBUTE_UNUSED)
+   virQEMUCapsPtr qemuCaps)
 {
 const char *p;
 const char *fsdev, *netdev;
@@ -1391,21 +1390,9 @@ virQEMUCapsComputeCmdFlags(const char *help,
 #else
 /* Starting with qemu 0.15 and newer, upstream qemu no longer
  * promises to keep the human interface stable, but requests that
- * we use QMP (the JSON interface) for everything.  If the user
- * forgot to include YAJL libraries when building their own
- * libvirt but is targeting a newer qemu, we are better off
- * telling them to recompile (the spec file includes the
- * dependency, so distros won't hit this).  This check is
- * also in m4/virt-yajl.m4 (see $with_yajl).  */
-if (version >= 15000) {
-if (check_yajl) {
-virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-   _("this qemu binary requires libvirt to be "
- "compiled with yajl"));
-return -1;
-}
+ * we use QMP (the JSON interface) for everything. */
+if (version >= 15000)
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV);
-}
 #endif
 
 if (version >= 13000)
@@ -1449,7 +1436,6 @@ int virQEMUCapsParseHelpStr(const char *qemu,
 unsigned int *version,
 bool *is_kvm,
 unsigned int *kvm_version,
-bool check_yajl,
 const char *qmperr)
 {
 unsigned major, minor, micro;
@@ -1530,8 +1516,7 @@ int virQEMUCapsParseHelpStr(const char *qemu,
 goto cleanup;
 }
 
-if (virQEMUCapsComputeCmdFlags(help, *version,
-   qemuCaps, check_yajl) < 0)
+if (virQEMUCapsComputeCmdFlags(help, *version, qemuCaps) < 0)
 goto cleanup;
 
 strflags = virBitmapToString(qemuCaps->flags, true, false);
@@ -4432,7 +4417,6 @@ virQEMUCapsInitHelp(virQEMUCapsPtr qemuCaps, uid_t 
runUid, gid_t runGid, const c
 >version,
 _kvm,
 >kvmVersion,
-false,
 qmperr) < 0)
 goto cleanup;
 
diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h
index 222f3368e..979816240 100644
--- a/src/qemu/qemu_capspriv.h
+++ b/src/qemu/qemu_capspriv.h
@@ -93,7 +93,6 @@ virQEMUCapsParseHelpStr(const char *qemu,
 unsigned int *version,
 bool *is_kvm,
 unsigned int *kvm_version,
-bool check_yajl,
 const char *qmperr);
 
 int
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 1336eeef5..84f18c039 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -59,7 +59,7 @@ static int testHelpStrParsing(const void *data)
 goto cleanup;
 
 if (virQEMUCapsParseHelpStr("QEMU", help, flags,
-, _kvm, _version, false, NULL) 
== -1) {
+, _kvm, _version, NULL) == -1) {
 virErrorPtr err = virGetLastError();
 
 if (info->error && err && err->code == info->error)
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 6/8] Remove unused qemuDomainNetVLAN

2018-03-28 Thread Ján Tomko
Signed-off-by: Ján Tomko 
---
 src/qemu/qemu_domain.c | 6 --
 src/qemu/qemu_domain.h | 2 --
 2 files changed, 8 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 6b22f9dc3..e4a8c45cf 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -9142,12 +9142,6 @@ qemuDomainNetSupportsMTU(virDomainNetType type)
 return false;
 }
 
-int
-qemuDomainNetVLAN(virDomainNetDefPtr def)
-{
-return qemuDomainDeviceAliasIndex(>info, "net");
-}
-
 
 virDomainDiskDefPtr
 qemuDomainDiskByName(virDomainDefPtr def,
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 63d9fb6d2..43352412c 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -805,8 +805,6 @@ bool qemuDomainSupportsNetdev(virDomainDefPtr def,
 
 bool qemuDomainNetSupportsMTU(virDomainNetType type);
 
-int qemuDomainNetVLAN(virDomainNetDefPtr def);
-
 int qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
   virDomainObjPtr vm);
 
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 5/9] Introduce JSON_CFLAGS and JSON_LIBS

2018-03-28 Thread Ján Tomko
Just copy YAJL_CFLAGS and YAJL_LIBS at this time.

Signed-off-by: Ján Tomko 
---
 m4/virt-json.m4  | 2 ++
 src/Makefile.am  | 8 
 src/util/Makefile.inc.am | 4 ++--
 tests/Makefile.am| 2 +-
 4 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/m4/virt-json.m4 b/m4/virt-json.m4
index 2f2125b56..9e026931e 100644
--- a/m4/virt-json.m4
+++ b/m4/virt-json.m4
@@ -54,6 +54,8 @@ AC_DEFUN([LIBVIRT_CHECK_JSON],[
   if test "$with_yajl" = "yes"; then
 AC_DEFINE([WITH_JSON], [1], [whether a JSON library is available])
   fi
+  AC_SUBST([JSON_CFLAGS], [$YAJL_CFLAGS])
+  AC_SUBST([JSON_LIBS], [$YAJL_LIBS])
 
 ])
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 8b1e4c8a4..fd09bfd17 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -545,7 +545,7 @@ libvirt_admin_la_CFLAGS = \
 libvirt_admin_la_CFLAGS += \
$(XDR_CFLAGS) \
$(CAPNG_CFLAGS) \
-   $(YAJL_CFLAGS) \
+   $(JSON_CFLAGS) \
$(SSH2_CFLAGS) \
$(SASL_CFLAGS) \
$(GNUTLS_CFLAGS) \
@@ -553,7 +553,7 @@ libvirt_admin_la_CFLAGS += \
 
 libvirt_admin_la_LIBADD += \
$(CAPNG_LIBS) \
-   $(YAJL_LIBS) \
+   $(JSON_LIBS) \
$(DEVMAPPER_LIBS) \
$(LIBXML_LIBS) \
$(SSH2_LIBS) \
@@ -993,14 +993,14 @@ libvirt_nss_la_SOURCES = \
 libvirt_nss_la_CFLAGS = \
-DLIBVIRT_NSS \
$(AM_CFLAGS) \
-   $(YAJL_CFLAGS) \
+   $(JSON_CFLAGS) \
$(NULL)
 libvirt_nss_la_LDFLAGS = \
$(AM_LDFLAGS) \
$(NULL)
 
 libvirt_nss_la_LIBADD = \
-   $(YAJL_LIBS) \
+   $(JSON_LIBS) \
$(NULL)
 endif WITH_NSS
 
diff --git a/src/util/Makefile.inc.am b/src/util/Makefile.inc.am
index a3c3b711f..5adc24fee 100644
--- a/src/util/Makefile.inc.am
+++ b/src/util/Makefile.inc.am
@@ -245,7 +245,7 @@ libvirt_util_la_SOURCES = \
$(NULL)
 libvirt_util_la_CFLAGS = \
$(CAPNG_CFLAGS) \
-   $(YAJL_CFLAGS) \
+   $(JSON_CFLAGS) \
$(LIBNL_CFLAGS) \
$(AM_CFLAGS) \
$(AUDIT_CFLAGS) \
@@ -258,7 +258,7 @@ libvirt_util_la_CFLAGS = \
$(NULL)
 libvirt_util_la_LIBADD = \
$(CAPNG_LIBS) \
-   $(YAJL_LIBS) \
+   $(JSON_LIBS) \
$(LIBNL_LIBS) \
$(THREAD_LIBS) \
$(AUDIT_LIBS) \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 249c533dc..ed0cd60f4 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -46,7 +46,7 @@ AM_CFLAGS = \
$(SASL_CFLAGS) \
$(SELINUX_CFLAGS) \
$(APPARMOR_CFLAGS) \
-   $(YAJL_CFLAGS) \
+   $(JSON_CFLAGS) \
$(COVERAGE_CFLAGS) \
$(XDR_CFLAGS) \
$(WARN_CFLAGS)
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 6/9] virt-json.m4: generalize yajl dependency

2018-03-28 Thread Ján Tomko
The QEMU driver needs a JSON library, not necessarily yajl.
Check for yajl first, then explicitly check if we found a JSON
library, to allow use of a different one.

Signed-off-by: Ján Tomko 
---
 m4/virt-json.m4 | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/m4/virt-json.m4 b/m4/virt-json.m4
index 9e026931e..5e4bcc7c9 100644
--- a/m4/virt-json.m4
+++ b/m4/virt-json.m4
@@ -22,21 +22,21 @@ AC_DEFUN([LIBVIRT_ARG_JSON],[
 ])
 
 AC_DEFUN([LIBVIRT_CHECK_JSON],[
-  dnl YAJL JSON library http://lloyd.github.com/yajl/
+  need_json=no
   if test "$with_qemu:$with_yajl" = yes:check; then
-dnl Some versions of qemu require the use of yajl; try to detect them
+dnl Some versions of qemu require the use of JSON; try to detect them
 dnl here, although we do not require qemu to exist in order to compile.
 dnl This check mirrors src/qemu/qemu_capabilities.c
 AC_PATH_PROGS([QEMU], [qemu-kvm qemu kvm qemu-system-x86_64],
   [], [$PATH:/usr/bin:/usr/libexec])
 if test -x "$QEMU"; then
   if $QEMU -help 2>/dev/null | grep -q libvirt; then
-with_yajl=yes
+need_json=yes
   else
 [qemu_version_sed='s/.*ersion \([0-9.,]*\).*/\1/']
 qemu_version=`$QEMU -version | sed "$qemu_version_sed"`
 case $qemu_version in
-  [[1-9]].* | 0.15.* ) with_yajl=yes ;;
+  [[1-9]].* | 0.15.* ) need_json=yes ;;
   0.* | '' ) ;;
   *) AC_MSG_ERROR([Unexpected qemu version string]) ;;
 esac
@@ -44,6 +44,7 @@ AC_DEFUN([LIBVIRT_CHECK_JSON],[
 fi
   fi
 
+  dnl YAJL JSON library http://lloyd.github.com/yajl/
   LIBVIRT_CHECK_LIB_ALT([YAJL], [yajl],
 [yajl_parse_complete], [yajl/yajl_common.h],
 [YAJL2], [yajl],
@@ -53,6 +54,8 @@ AC_DEFUN([LIBVIRT_CHECK_JSON],[
  [test "$with_yajl" = "yes"])
   if test "$with_yajl" = "yes"; then
 AC_DEFINE([WITH_JSON], [1], [whether a JSON library is available])
+  elif "$need_json" = "yes"; then
+AC_MSG_ERROR([QEMU needs JSON but no library is available])
   fi
   AC_SUBST([JSON_CFLAGS], [$YAJL_CFLAGS])
   AC_SUBST([JSON_LIBS], [$YAJL_LIBS])
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 4/9] Introduce WITH_JSON

2018-03-28 Thread Ján Tomko
A library-agnostic constant used by all the code that requires
a working virjson implementation, but does not depent on yajl.

The only remaining usage outside virjson.c is the empty array
test in virmacmaptest.c.

Signed-off-by: Ján Tomko 
---
 m4/virt-json.m4|  7 +++
 src/qemu/qemu_capabilities.c   |  2 +-
 src/qemu/qemu_driver.c |  4 ++--
 tests/Makefile.am  | 10 +-
 tests/cputest.c| 16 
 tests/libxlxml2domconfigtest.c |  4 ++--
 tests/qemuagenttest.c  |  2 +-
 tests/qemucapabilitiestest.c   |  2 +-
 tests/qemucaps2xmltest.c   |  2 +-
 tests/qemucommandutiltest.c|  2 +-
 tests/qemuhelptest.c   |  2 +-
 tests/qemuhotplugtest.c|  2 +-
 tests/qemumonitorjsontest.c|  2 +-
 tests/virmocklibxl.c   |  4 ++--
 tests/virnetdaemontest.c   |  2 +-
 tests/virstoragetest.c |  4 ++--
 16 files changed, 37 insertions(+), 30 deletions(-)

diff --git a/m4/virt-json.m4 b/m4/virt-json.m4
index 1179ff5bb..2f2125b56 100644
--- a/m4/virt-json.m4
+++ b/m4/virt-json.m4
@@ -48,6 +48,13 @@ AC_DEFUN([LIBVIRT_CHECK_JSON],[
 [yajl_parse_complete], [yajl/yajl_common.h],
 [YAJL2], [yajl],
 [yajl_tree_parse], [yajl/yajl_common.h])
+
+  AM_CONDITIONAL([WITH_JSON],
+ [test "$with_yajl" = "yes"])
+  if test "$with_yajl" = "yes"; then
+AC_DEFINE([WITH_JSON], [1], [whether a JSON library is available])
+  fi
+
 ])
 
 AC_DEFUN([LIBVIRT_RESULT_JSON],[
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index e54dde69a..3d8b83a41 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1385,7 +1385,7 @@ virQEMUCapsComputeCmdFlags(const char *help,
  * incomplete to contemplate using. The 0.13.0 release
  * is good enough to use, even though it lacks one or
  * two features. */
-#if WITH_YAJL
+#if WITH_JSON
 if (version >= 13000)
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_MONITOR_JSON);
 #else
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7bcc4936d..ffda906f3 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2122,7 +2122,7 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
  */
 if ((!useAgent) ||
 (ret < 0 && (acpiRequested || !flags))) {
-#if WITH_YAJL
+#if WITH_JSON
 if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON)) {
 if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NO_SHUTDOWN)) {
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -2134,7 +2134,7 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
 virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("ACPI reboot is not supported without the JSON 
monitor"));
 goto endjob;
-#if WITH_YAJL
+#if WITH_JSON
 }
 #endif
 qemuDomainSetFakeReboot(driver, vm, isReboot);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 289ef35bd..249c533dc 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -333,9 +333,9 @@ if WITH_CIL
 test_programs += objectlocking
 endif WITH_CIL
 
-if WITH_YAJL
+if WITH_JSON
 test_programs += virjsontest
-endif WITH_YAJL
+endif WITH_JSON
 
 test_programs += \
networkxml2xmltest \
@@ -1233,15 +1233,15 @@ virdeterministichashmock_la_LIBADD = $(MOCKLIBS_LIBS)
 
 test_libraries += virdeterministichashmock.la
 
-if WITH_YAJL
+if WITH_JSON
 virmacmaptest_SOURCES = \
virmacmaptest.c testutils.h testutils.c
 virmacmaptest_LDADD = $(LDADDS)
 
 test_programs += virmacmaptest
-else ! WITH_YAJL
+else ! WITH_JSON
 EXTRA_DIST +=  virmacmaptest.c
-endif ! WITH_YAJL
+endif ! WITH_JSON
 
 virnetdevtest_SOURCES = \
virnetdevtest.c testutils.h testutils.c
diff --git a/tests/cputest.c b/tests/cputest.c
index 1e79edbef..ab1054266 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -40,7 +40,7 @@
 #include "cpu/cpu_map.h"
 #include "virstring.h"
 
-#if WITH_QEMU && WITH_YAJL
+#if WITH_QEMU && WITH_JSON
 # include "testutilsqemu.h"
 # include "qemumonitortestutils.h"
 # define __QEMU_CAPSPRIV_H_ALLOW__
@@ -67,7 +67,7 @@ struct data {
 int result;
 };
 
-#if WITH_QEMU && WITH_YAJL
+#if WITH_QEMU && WITH_JSON
 static virQEMUDriver driver;
 #endif
 
@@ -479,7 +479,7 @@ typedef enum {
 JSON_MODELS_REQUIRED,
 } cpuTestCPUIDJson;
 
-#if WITH_QEMU && WITH_YAJL
+#if WITH_QEMU && WITH_JSON
 static virQEMUCapsPtr
 cpuTestMakeQEMUCaps(const struct data *data)
 {
@@ -554,7 +554,7 @@ cpuTestGetCPUModels(const struct data *data,
 return 0;
 }
 
-#else /* if WITH_QEMU && WITH_YAJL */
+#else /* if WITH_QEMU && WITH_JSON */
 
 static int
 cpuTestGetCPUModels(const struct data *data,
@@ -834,7 +834,7 @@ cpuTestUpdateLive(const void *arg)
 }
 
 
-#if WITH_QEMU && WITH_YAJL
+#if WITH_QEMU && WITH_JSON
 static int
 cpuTestJSONCPUID(const void *arg)
 {
@@ -911,7 +911,7 @@ mymain(void)

[libvirt] [PATCH 3/9] configure: rename LIBVIRT_*_YAJL to LIBVIRT_*_JSON

2018-03-28 Thread Ján Tomko
Rename the top-level functions that deal with yajl to prepare
for the possibility of a different JSON library.

Introduce a separate JSON libraries section in the configure summary
and rename the m4 file to virt-json.m4.

Signed-off-by: Ján Tomko 
---
 configure.ac  | 9 ++---
 m4/{virt-yajl.m4 => virt-json.m4} | 8 
 2 files changed, 10 insertions(+), 7 deletions(-)
 rename m4/{virt-yajl.m4 => virt-json.m4} (94%)

diff --git a/configure.ac b/configure.ac
index 115eb6088..bef10c0fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -253,6 +253,7 @@ LIBVIRT_ARG_FUSE
 LIBVIRT_ARG_GLUSTER
 LIBVIRT_ARG_GNUTLS
 LIBVIRT_ARG_HAL
+LIBVIRT_ARG_JSON
 LIBVIRT_ARG_LIBPCAP
 LIBVIRT_ARG_LIBSSH
 LIBVIRT_ARG_LIBXML
@@ -272,7 +273,6 @@ LIBVIRT_ARG_SSH2
 LIBVIRT_ARG_UDEV
 LIBVIRT_ARG_VIRTUALPORT
 LIBVIRT_ARG_WIRESHARK
-LIBVIRT_ARG_YAJL
 
 LIBVIRT_CHECK_ACL
 LIBVIRT_CHECK_APPARMOR
@@ -292,6 +292,7 @@ LIBVIRT_CHECK_FUSE
 LIBVIRT_CHECK_GLUSTER
 LIBVIRT_CHECK_GNUTLS
 LIBVIRT_CHECK_HAL
+LIBVIRT_CHECK_JSON
 LIBVIRT_CHECK_LIBNL
 LIBVIRT_CHECK_LIBPARTED
 LIBVIRT_CHECK_LIBPCAP
@@ -315,7 +316,6 @@ LIBVIRT_CHECK_UDEV
 LIBVIRT_CHECK_VIRTUALPORT
 LIBVIRT_CHECK_WIRESHARK
 LIBVIRT_CHECK_XDR
-LIBVIRT_CHECK_YAJL
 
 AC_CHECK_SIZEOF([long])
 
@@ -1011,7 +1011,10 @@ LIBVIRT_RESULT_VIRTUALPORT
 LIBVIRT_RESULT_XDR
 LIBVIRT_RESULT_XEN
 LIBVIRT_RESULT_XENAPI
-LIBVIRT_RESULT_YAJL
+AC_MSG_NOTICE([])
+AC_MSG_NOTICE([JSON libraries])
+AC_MSG_NOTICE([])
+LIBVIRT_RESULT_JSON
 AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Windows])
 AC_MSG_NOTICE([])
diff --git a/m4/virt-yajl.m4 b/m4/virt-json.m4
similarity index 94%
rename from m4/virt-yajl.m4
rename to m4/virt-json.m4
index c4ea0102a..1179ff5bb 100644
--- a/m4/virt-yajl.m4
+++ b/m4/virt-json.m4
@@ -1,4 +1,4 @@
-dnl The libyajl.so library
+dnl The JSON libraries
 dnl
 dnl Copyright (C) 2012-2013 Red Hat, Inc.
 dnl
@@ -17,11 +17,11 @@ dnl License along with this library.  If not, see
 dnl .
 dnl
 
-AC_DEFUN([LIBVIRT_ARG_YAJL],[
+AC_DEFUN([LIBVIRT_ARG_JSON],[
   LIBVIRT_ARG_WITH_FEATURE([YAJL], [yajl], [check])
 ])
 
-AC_DEFUN([LIBVIRT_CHECK_YAJL],[
+AC_DEFUN([LIBVIRT_CHECK_JSON],[
   dnl YAJL JSON library http://lloyd.github.com/yajl/
   if test "$with_qemu:$with_yajl" = yes:check; then
 dnl Some versions of qemu require the use of yajl; try to detect them
@@ -50,6 +50,6 @@ AC_DEFUN([LIBVIRT_CHECK_YAJL],[
 [yajl_tree_parse], [yajl/yajl_common.h])
 ])
 
-AC_DEFUN([LIBVIRT_RESULT_YAJL],[
+AC_DEFUN([LIBVIRT_RESULT_JSON],[
   LIBVIRT_RESULT_LIB([YAJL])
 ])
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 7/9] build: link setuid_rpc_client against JSON_LIBS

2018-03-28 Thread Ján Tomko
I have no idea how it builds without and switching to Jansson
exposes this.

Signed-off-by: Ján Tomko 
---
 src/Makefile.am | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/Makefile.am b/src/Makefile.am
index fd09bfd17..2d2805818 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -743,6 +743,7 @@ libvirt_setuid_rpc_client_la_LDFLAGS = \
$(AM_LDFLAGS) \
$(LIBXML_LIBS) \
$(SECDRIVER_LIBS) \
+   $(JSON_LIBS) \
$(NULL)
 libvirt_setuid_rpc_client_la_CFLAGS = \
-DLIBVIRT_SETUID_RPC_CLIENT \
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 8/9] virjson: add support for Jansson

2018-03-28 Thread Ján Tomko
Check for the presence of Jansson library and prefer it to yajl
if possible.

The minimum required version is 2.7.

Internally, virJSONValue still stores numbers as strings even
though Jansson uses numeric variables for them.

The configure script is particularly hideous, but will hopefully
go away after we stop aiming to support compiling on CentOS 6.

Signed-off-by: Ján Tomko 
---
 configure.ac   |   1 +
 m4/virt-json.m4|  55 +++---
 src/util/virjson.c | 219 +
 3 files changed, 264 insertions(+), 11 deletions(-)

diff --git a/configure.ac b/configure.ac
index bef10c0fb..fe93209d7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -987,6 +987,7 @@ LIBVIRT_RESULT_FUSE
 LIBVIRT_RESULT_GLUSTER
 LIBVIRT_RESULT_GNUTLS
 LIBVIRT_RESULT_HAL
+LIBVIRT_RESULT_JANSSON
 LIBVIRT_RESULT_LIBNL
 LIBVIRT_RESULT_LIBPCAP
 LIBVIRT_RESULT_LIBSSH
diff --git a/m4/virt-json.m4 b/m4/virt-json.m4
index 5e4bcc7c9..a5ae3edcd 100644
--- a/m4/virt-json.m4
+++ b/m4/virt-json.m4
@@ -18,12 +18,24 @@ dnl .
 dnl
 
 AC_DEFUN([LIBVIRT_ARG_JSON],[
+  LIBVIRT_ARG_WITH_FEATURE([JANSSON], [jansson], [check])
   LIBVIRT_ARG_WITH_FEATURE([YAJL], [yajl], [check])
 ])
 
 AC_DEFUN([LIBVIRT_CHECK_JSON],[
+  if test "$with_yajl:$with_jansson" = "yes:yes"; then
+AC_MSG_ERROR("Compiling with both jansson and yajl is unsupported")
+  fi
+
+  if test "$with_yajl" = "yes"; then
+with_jansson=no
+  elif test "$with_jansson" = "yes"; then
+with_yajl=no
+  fi
+
   need_json=no
-  if test "$with_qemu:$with_yajl" = yes:check; then
+  if test "$with_qemu:$with_yajl" = yes:check or
+ test "$with_qemu:$with_jansson" = yes:check; then
 dnl Some versions of qemu require the use of JSON; try to detect them
 dnl here, although we do not require qemu to exist in order to compile.
 dnl This check mirrors src/qemu/qemu_capabilities.c
@@ -44,24 +56,45 @@ AC_DEFUN([LIBVIRT_CHECK_JSON],[
 fi
   fi
 
-  dnl YAJL JSON library http://lloyd.github.com/yajl/
-  LIBVIRT_CHECK_LIB_ALT([YAJL], [yajl],
-[yajl_parse_complete], [yajl/yajl_common.h],
-[YAJL2], [yajl],
-[yajl_tree_parse], [yajl/yajl_common.h])
+  dnl Jansson http://www.digip.org/jansson/
+  LIBVIRT_CHECK_PKG([JANSSON], [jansson], [2.7])
+
+  if test "$with_jansson" = "no"; then
+dnl YAJL JSON library http://lloyd.github.com/yajl/
+LIBVIRT_CHECK_LIB_ALT([YAJL], [yajl],
+  [yajl_parse_complete], [yajl/yajl_common.h],
+  [YAJL2], [yajl],
+  [yajl_tree_parse], [yajl/yajl_common.h])
+  else
+AM_CONDITIONAL([WITH_YAJL], 0)
+AM_CONDITIONAL([WITH_YAJL2], 0)
+  fi
 
   AM_CONDITIONAL([WITH_JSON],
- [test "$with_yajl" = "yes"])
-  if test "$with_yajl" = "yes"; then
+ [test "$with_yajl" = "yes" || test "$with_jansson" = "yes"])
+  if test "$with_yajl" = "yes" || test "$with_jansson" = "yes"; then
 AC_DEFINE([WITH_JSON], [1], [whether a JSON library is available])
   elif "$need_json" = "yes"; then
 AC_MSG_ERROR([QEMU needs JSON but no library is available])
   fi
-  AC_SUBST([JSON_CFLAGS], [$YAJL_CFLAGS])
-  AC_SUBST([JSON_LIBS], [$YAJL_LIBS])
+
+  if test "$with_jansson" = "yes"; then
+AC_SUBST([JSON_CFLAGS], [$JANSSON_CFLAGS])
+AC_SUBST([JSON_LIBS], [$JANSSON_LIBS])
+  else
+AC_SUBST([JSON_CFLAGS], [$YAJL_CFLAGS])
+AC_SUBST([JSON_LIBS], [$YAJL_LIBS])
+  fi
 
 ])
 
 AC_DEFUN([LIBVIRT_RESULT_JSON],[
-  LIBVIRT_RESULT_LIB([YAJL])
+  if test "$with_jansson" = "yes"; then
+msg = "Jansson"
+  elif test "$with_yajl" = "yes"; then
+msg = "yajl"
+  else
+msg = "none"
+  fi
+  LIBVIRT_RESULT([JSON library:], [$msg])
 ])
diff --git a/src/util/virjson.c b/src/util/virjson.c
index 6a02ddf0c..86cbd6eef 100644
--- a/src/util/virjson.c
+++ b/src/util/virjson.c
@@ -1951,6 +1951,225 @@ virJSONValueToString(virJSONValuePtr object,
 }
 
 
+#elif WITH_JANSSON
+# include 
+
+static virJSONValuePtr
+virJSONValueFromJansson(json_t *json)
+{
+virJSONValuePtr ret = NULL;
+const char *key;
+json_t *cur;
+size_t i;
+
+switch (json_typeof(json)) {
+case JSON_OBJECT:
+ret = virJSONValueNewObject();
+if (!ret)
+goto error;
+
+json_object_foreach(json, key, cur) {
+virJSONValuePtr val = virJSONValueFromJansson(cur);
+if (!val)
+goto error;
+
+if (virJSONValueObjectAppend(ret, key, val) < 0)
+goto error;
+}
+
+break;
+
+case JSON_ARRAY:
+ret = virJSONValueNewArray();
+if (!ret)
+goto error;
+
+json_array_foreach(json, i, cur) {
+virJSONValuePtr val = virJSONValueFromJansson(cur);
+if (!val)
+goto error;
+
+if (virJSONValueArrayAppend(ret, val) < 0)
+   

[libvirt] [PATCH 0/9] Add Jansson support

2018-03-28 Thread Ján Tomko
Prefer Jansson, but allow fallback/choice of yajl.

Support for yajl can hopefully be dropped after we ditch CentOS 6
which has no Jansson.

Ján Tomko (9):
  virmacmaptest: depend on yajl for 'empty' test
  virjsontest: Use a more stable floating point number for testing
  configure: rename LIBVIRT_*_YAJL to LIBVIRT_*_JSON
  Introduce WITH_JSON
  Introduce JSON_CFLAGS and JSON_LIBS
  virt-json.m4: generalize yajl dependency
  build: link setuid_rpc_client against JSON_LIBS
  virjson: add support for Jansson
  virt-json.m4: simplify QEMU check

 configure.ac   |  10 +-
 m4/virt-json.m4|  86 
 m4/virt-yajl.m4|  55 ---
 src/Makefile.am|   9 +-
 src/qemu/qemu_capabilities.c   |   2 +-
 src/qemu/qemu_driver.c |   4 +-
 src/util/Makefile.inc.am   |   4 +-
 src/util/virjson.c | 219 +
 tests/Makefile.am  |  12 +--
 tests/cputest.c|  16 +--
 tests/libxlxml2domconfigtest.c |   4 +-
 tests/qemuagenttest.c  |   2 +-
 tests/qemucapabilitiestest.c   |   2 +-
 tests/qemucaps2xmltest.c   |   2 +-
 tests/qemucommandutiltest.c|   2 +-
 tests/qemuhelptest.c   |   2 +-
 tests/qemuhotplugtest.c|   2 +-
 tests/qemumonitorjsontest.c|   2 +-
 tests/virjsontest.c|   2 +-
 tests/virmacmaptest.c  |   3 +
 tests/virmocklibxl.c   |   4 +-
 tests/virnetdaemontest.c   |   2 +-
 tests/virstoragetest.c |   4 +-
 23 files changed, 354 insertions(+), 96 deletions(-)
 create mode 100644 m4/virt-json.m4
 delete mode 100644 m4/virt-yajl.m4

-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 2/9] virjsontest: Use a more stable floating point number for testing

2018-03-28 Thread Ján Tomko
We store all JSON numbers as strings. To allow using json libraries
that store them in numeric types, use a more predictable and normalized
value.

Signed-off-by: Ján Tomko 
---
 tests/virjsontest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/virjsontest.c b/tests/virjsontest.c
index 685df7276..22bfd028a 100644
--- a/tests/virjsontest.c
+++ b/tests/virjsontest.c
@@ -540,7 +540,7 @@ mymain(void)
 DO_TEST_PARSE("number without garbage", "[ 234545 ]", "[234545]");
 DO_TEST_PARSE_FAIL("number with garbage", "[ 2345b45 ]");
 
-DO_TEST_PARSE("float without garbage", "[ 0.0314159e+100 ]", 
"[0.0314159e+100]");
+DO_TEST_PARSE("float without garbage", "[ 1.024e19 ]", "[1.024e19]");
 DO_TEST_PARSE_FAIL("float with garbage", "[ 0.0314159ee+100 ]");
 
 DO_TEST_PARSE("string", "[ \"The meaning of life\" ]",
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 9/9] virt-json.m4: simplify QEMU check

2018-03-28 Thread Ján Tomko
If we build with QEMU, it very probably needs JSON.

Signed-off-by: Ján Tomko 
---
 m4/virt-json.m4 | 22 --
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/m4/virt-json.m4 b/m4/virt-json.m4
index a5ae3edcd..d87cf56eb 100644
--- a/m4/virt-json.m4
+++ b/m4/virt-json.m4
@@ -36,24 +36,10 @@ AC_DEFUN([LIBVIRT_CHECK_JSON],[
   need_json=no
   if test "$with_qemu:$with_yajl" = yes:check or
  test "$with_qemu:$with_jansson" = yes:check; then
-dnl Some versions of qemu require the use of JSON; try to detect them
-dnl here, although we do not require qemu to exist in order to compile.
-dnl This check mirrors src/qemu/qemu_capabilities.c
-AC_PATH_PROGS([QEMU], [qemu-kvm qemu kvm qemu-system-x86_64],
-  [], [$PATH:/usr/bin:/usr/libexec])
-if test -x "$QEMU"; then
-  if $QEMU -help 2>/dev/null | grep -q libvirt; then
-need_json=yes
-  else
-[qemu_version_sed='s/.*ersion \([0-9.,]*\).*/\1/']
-qemu_version=`$QEMU -version | sed "$qemu_version_sed"`
-case $qemu_version in
-  [[1-9]].* | 0.15.* ) need_json=yes ;;
-  0.* | '' ) ;;
-  *) AC_MSG_ERROR([Unexpected qemu version string]) ;;
-esac
-  fi
-fi
+dnl Nearly all supported QEMU versions require JSON.
+dnl Assume we need it by default, but still let the user
+dnl shoot it the foot.
+need_json=yes
   fi
 
   dnl Jansson http://www.digip.org/jansson/
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 1/9] virmacmaptest: depend on yajl for 'empty' test

2018-03-28 Thread Ján Tomko
While an empty array is formatted with two newlines with yajl,
jansson does not put any newlines between the brackets.

Signed-off-by: Ján Tomko 
---
 tests/virmacmaptest.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/virmacmaptest.c b/tests/virmacmaptest.c
index 6e3e9984d..e0cf8f91a 100644
--- a/tests/virmacmaptest.c
+++ b/tests/virmacmaptest.c
@@ -205,8 +205,11 @@ mymain(void)
 DO_TEST_BASIC("simple2", "f24", "aa:bb:cc:dd:ee:ff", "a1:b2:c3:d4:e5:f6");
 DO_TEST_BASIC("simple2", "f25", "00:11:22:33:44:55", "aa:bb:cc:00:11:22");
 
+#if WITH_YAJL
+/* other JSON libraries might format an empty array differently */
 DO_TEST_FLUSH_PROLOGUE;
 DO_TEST_FLUSH_EPILOGUE("empty");
+#endif
 
 DO_TEST_FLUSH_PROLOGUE;
 DO_TEST_FLUSH("f24", "aa:bb:cc:dd:ee:ff");
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH v2 2/9] secret: Alter virSecretObjListRemove processing

2018-03-28 Thread John Ferlan
Current processing requires a "fire dance" unlocking the @obj,
adding an @obj ref, locking the @secrets, and relocking @obj
in order to ensure proper lock ordering.

This can be avoided by changing virSecretObjListRemove to take
a @uuidstr instead of @obj. Then, we can lock the @secrets list,
look up the @obj by @uuidstr (like we do when adding), and remove
the @obj from the list. This removes the last reference to the
object effectively reaping it.

NB: Since prior to calling we remove the reference to the object
we cannot pass anything contained within the object (such as the
obj->def) because it's possible that the object could be reaped
by two competing remove threads.

Signed-off-by: John Ferlan 
---
 src/conf/virsecretobj.c| 38 +-
 src/conf/virsecretobj.h|  2 +-
 src/secret/secret_driver.c | 15 +--
 3 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/src/conf/virsecretobj.c b/src/conf/virsecretobj.c
index 4aaf47b5d..09f6ead64 100644
--- a/src/conf/virsecretobj.c
+++ b/src/conf/virsecretobj.c
@@ -284,32 +284,25 @@ virSecretObjListFindByUsage(virSecretObjListPtr secrets,
 /*
  * virSecretObjListRemove:
  * @secrets: list of secret objects
- * @secret: a secret object
+ * @uuidstr: secret uuid to find
+ *
+ * Find the object by the @uuidstr in the list, remove the object from
+ * the list hash table, and free the object.
  *
- * Remove the object from the hash table.  The caller must hold the lock
- * on the driver owning @secrets and must have also locked @secret to
- * ensure no one else is either waiting for @secret or still using it.
+ * Upon entry it's expected that prior to entry any locks on
+ * the object related to @uuidstr will have been removed.
  */
 void
 virSecretObjListRemove(virSecretObjListPtr secrets,
-   virSecretObjPtr obj)
+   const char *uuidstr)
 {
-char uuidstr[VIR_UUID_STRING_BUFLEN];
-virSecretDefPtr def;
-
-if (!obj)
-return;
-def = obj->def;
-
-virUUIDFormat(def->uuid, uuidstr);
-virObjectRef(obj);
-virObjectUnlock(obj);
+virSecretObjPtr obj;
 
 virObjectRWLockWrite(secrets);
-virObjectLock(obj);
-virHashRemoveEntry(secrets->objs, uuidstr);
-virObjectUnlock(obj);
-virObjectUnref(obj);
+if ((obj = virSecretObjListFindByUUIDLocked(secrets, uuidstr))) {
+virHashRemoveEntry(secrets->objs, uuidstr);
+virSecretObjEndAPI();
+}
 virObjectRWUnlock(secrets);
 }
 
@@ -927,8 +920,11 @@ virSecretLoad(virSecretObjListPtr secrets,
 def = NULL;
 
 if (virSecretLoadValue(obj) < 0) {
-virSecretObjListRemove(secrets, obj);
-virObjectLock(obj);
+char uuidstr[VIR_UUID_STRING_BUFLEN];
+
+virUUIDFormat(obj->def->uuid, uuidstr);
+virSecretObjEndAPI();
+virSecretObjListRemove(secrets, uuidstr);
 goto cleanup;
 }
 
diff --git a/src/conf/virsecretobj.h b/src/conf/virsecretobj.h
index d412ee6a7..68bafc718 100644
--- a/src/conf/virsecretobj.h
+++ b/src/conf/virsecretobj.h
@@ -49,7 +49,7 @@ virSecretObjListFindByUsage(virSecretObjListPtr secrets,
 
 void
 virSecretObjListRemove(virSecretObjListPtr secrets,
-   virSecretObjPtr obj);
+   const char *uuidstr);
 
 virSecretObjPtr
 virSecretObjListAdd(virSecretObjListPtr secrets,
diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c
index 23a3c9bda..75bc2b0cf 100644
--- a/src/secret/secret_driver.c
+++ b/src/secret/secret_driver.c
@@ -270,9 +270,11 @@ secretDefineXML(virConnectPtr conn,
 virSecretObjSetDef(obj, backup);
 VIR_STEAL_PTR(def, objDef);
 } else {
-virSecretObjListRemove(driver->secrets, obj);
-virObjectUnref(obj);
-obj = NULL;
+char uuidstr[VIR_UUID_STRING_BUFLEN];
+
+virUUIDFormat(objDef->uuid, uuidstr);
+virSecretObjEndAPI();
+virSecretObjListRemove(driver->secrets, uuidstr);
 }
 
  cleanup:
@@ -392,6 +394,7 @@ secretUndefine(virSecretPtr secret)
 int ret = -1;
 virSecretObjPtr obj;
 virSecretDefPtr def;
+char uuidstr[VIR_UUID_STRING_BUFLEN];
 virObjectEventPtr event = NULL;
 
 if (!(obj = secretObjFromSecret(secret)))
@@ -412,9 +415,9 @@ secretUndefine(virSecretPtr secret)
 
 virSecretObjDeleteData(obj);
 
-virSecretObjListRemove(driver->secrets, obj);
-virObjectUnref(obj);
-obj = NULL;
+virUUIDFormat(def->uuid, uuidstr);
+virSecretObjEndAPI();
+virSecretObjListRemove(driver->secrets, uuidstr);
 
 ret = 0;
 
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v2 6/9] storage: Clean up storagePoolCreateXML error processing

2018-03-28 Thread John Ferlan
Rather than 3 separate, but same 4 lines of code - let's create an
error label to make a common error path. This will help shortly when
the error path changes slightly.

Signed-off-by: John Ferlan 
---
 src/storage/storage_driver.c | 27 +++
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index d5e38af5a..6276545eb 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -744,22 +744,14 @@ storagePoolCreateXML(virConnectPtr conn,
 
 if (build_flags ||
 (flags & VIR_STORAGE_POOL_CREATE_WITH_BUILD)) {
-if (backend->buildPool(obj, build_flags) < 0) {
-virStoragePoolObjRemove(driver->pools, obj);
-virObjectUnref(obj);
-obj = NULL;
-goto cleanup;
-}
+if (backend->buildPool(obj, build_flags) < 0)
+goto error;
 }
 }
 
 if (backend->startPool &&
-backend->startPool(obj) < 0) {
-virStoragePoolObjRemove(driver->pools, obj);
-virObjectUnref(obj);
-obj = NULL;
-goto cleanup;
-}
+backend->startPool(obj) < 0)
+goto error;
 
 stateFile = virFileBuildPath(driver->stateDir, def->name, ".xml");
 
@@ -770,10 +762,7 @@ storagePoolCreateXML(virConnectPtr conn,
 unlink(stateFile);
 if (backend->stopPool)
 backend->stopPool(obj);
-virStoragePoolObjRemove(driver->pools, obj);
-virObjectUnref(obj);
-obj = NULL;
-goto cleanup;
+goto error;
 }
 
 event = virStoragePoolEventLifecycleNew(def->name,
@@ -793,6 +782,12 @@ storagePoolCreateXML(virConnectPtr conn,
 virObjectEventStateQueue(driver->storageEventState, event);
 virStoragePoolObjEndAPI();
 return pool;
+
+ error:
+virStoragePoolObjRemove(driver->pools, obj);
+virObjectUnref(obj);
+obj = NULL;
+goto cleanup;
 }
 
 static virStoragePoolPtr
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v2 9/9] storagepool: Alter virStoragePoolObjRemove processing

2018-03-28 Thread John Ferlan
Current processing requires a "fire dance" unlocking the @obj,
adding an @obj ref, locking the @pools, and relocking @obj in
order to ensure proper lock ordering.

This can be avoided by changing virStoragePoolObjRemove to
take a @name instead of @obj. Then, we can lock the @pools
list, look up the @obj by @name (like we do when adding),
and remove the @obj from the list. This removes the last
reference to the object effectively reaping it.

NB: Since prior to calling we remove the reference to the object
we cannot pass anything contained within the object (such as the
obj->def or obj->def->name) because it's possible that the object
could be reaped by two competing remove threads.

Signed-off-by: John Ferlan 
---
 src/conf/virstorageobj.c | 41 +
 src/conf/virstorageobj.h |  2 +-
 src/storage/storage_driver.c | 44 +---
 src/test/test_driver.c   | 30 +++---
 4 files changed, 78 insertions(+), 39 deletions(-)

diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c
index f48f08a64..df6febfd0 100644
--- a/src/conf/virstorageobj.c
+++ b/src/conf/virstorageobj.c
@@ -1034,21 +1034,31 @@ virStoragePoolObjVolumeListExport(virConnectPtr conn,
 }
 
 
+/*
+ * virStoragePoolObjRemove:
+ * @pools: list of storage pool objects
+ * @name: name of storage pool to remove
+ *
+ * Find the object by name in the list, remove the object from
+ * each hash table in the list, and free the object.
+ *
+ * Upon entry it's expected that prior to entry any locks on
+ * the object related to @name will have been removed.
+ */
 void
 virStoragePoolObjRemove(virStoragePoolObjListPtr pools,
-virStoragePoolObjPtr obj)
+const char *name)
 {
+virStoragePoolObjPtr obj;
 char uuidstr[VIR_UUID_STRING_BUFLEN];
 
-virUUIDFormat(obj->def->uuid, uuidstr);
-virObjectRef(obj);
-virObjectUnlock(obj);
 virObjectRWLockWrite(pools);
-virObjectLock(obj);
-virHashRemoveEntry(pools->objs, uuidstr);
-virHashRemoveEntry(pools->objsName, obj->def->name);
-virObjectUnlock(obj);
-virObjectUnref(obj);
+if ((obj = virStoragePoolObjFindByNameLocked(pools, name))) {
+virUUIDFormat(obj->def->uuid, uuidstr);
+virHashRemoveEntry(pools->objs, uuidstr);
+virHashRemoveEntry(pools->objsName, name);
+virStoragePoolObjEndAPI();
+}
 virObjectRWUnlock(pools);
 }
 
@@ -1117,6 +1127,7 @@ virStoragePoolObjLoad(virStoragePoolObjListPtr pools,
 {
 virStoragePoolDefPtr def = NULL;
 virStoragePoolObjPtr obj = NULL;
+char *name = NULL;
 
 if (!(def = virStoragePoolDefParseFile(path)))
 return NULL;
@@ -1129,6 +1140,9 @@ virStoragePoolObjLoad(virStoragePoolObjListPtr pools,
 goto error;
 }
 
+if (VIR_STRDUP(name, def->name) < 0)
+goto error;
+
 if (!(obj = virStoragePoolObjAssignDef(pools, def)))
 goto error;
 def = NULL;
@@ -1144,13 +1158,16 @@ virStoragePoolObjLoad(virStoragePoolObjListPtr pools,
 obj->autostart = virFileLinkPointsTo(obj->autostartLink,
  obj->configFile);
 
+VIR_FREE(name);
+
 return obj;
 
  error:
-if (obj) {
-virStoragePoolObjRemove(pools, obj);
-virObjectUnref(obj);
+if (obj && name) {
+virStoragePoolObjEndAPI();
+virStoragePoolObjRemove(pools, name);
 }
+VIR_FREE(name);
 virStoragePoolDefFree(def);
 return NULL;
 }
diff --git a/src/conf/virstorageobj.h b/src/conf/virstorageobj.h
index dd7001c4b..047b08a92 100644
--- a/src/conf/virstorageobj.h
+++ b/src/conf/virstorageobj.h
@@ -242,7 +242,7 @@ virStoragePoolObjListNew(void);
 
 void
 virStoragePoolObjRemove(virStoragePoolObjListPtr pools,
-virStoragePoolObjPtr obj);
+const char *name);
 
 int
 virStoragePoolObjIsDuplicate(virStoragePoolObjListPtr pools,
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 6276545eb..814e5cb97 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -82,19 +82,21 @@ static void storageDriverUnlock(void)
 /**
  * virStoragePoolUpdateInactive:
  * @poolptr: pointer to a variable holding the pool object pointer
+ * @name: Name of the pool
  *
  * This function is supposed to be called after a pool becomes inactive. The
  * function switches to the new config object for persistent pools. Inactive
  * pools are removed.
  */
 static void
-virStoragePoolUpdateInactive(virStoragePoolObjPtr *objptr)
+virStoragePoolUpdateInactive(virStoragePoolObjPtr *objptr,
+ const char *name)
 {
 virStoragePoolObjPtr obj = *objptr;
 
 if (!virStoragePoolObjGetConfigFile(obj)) {
-virStoragePoolObjRemove(driver->pools, obj);
-virObjectUnref(obj);
+virStoragePoolObjEndAPI();
+

[libvirt] [PATCH v2 4/9] nodedev: Alter virNodeDeviceObjListRemove processing

2018-03-28 Thread John Ferlan
Current processing requires a "fire dance" unlocking the @obj,
adding an @obj ref, locking the @devs, and relocking @obj in
order to ensure proper proper lock ordering.

This can be avoided by changing virNodeDeviceObjListRemove to
take @name instead of @obj. Then, we can lock the @devs list,
look up the @obj by @name (like we do when adding), and remove
the @obj from the list. This removes the last reference to the
object effectively reaping it.

NB: Since prior to calling we remove the reference to the object
we cannot pass anything contained within the object (such as the
obj->def or obj->def->name) because it's possible that the object
could be reaped by two competing remove threads.

Signed-off-by: John Ferlan 
---
 src/conf/virnodedeviceobj.c| 29 +
 src/conf/virnodedeviceobj.h|  2 +-
 src/node_device/node_device_hal.c  | 16 +---
 src/node_device/node_device_udev.c | 13 +
 src/test/test_driver.c | 28 ++--
 5 files changed, 50 insertions(+), 38 deletions(-)

diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c
index ad0f27ee4..9064a6cfb 100644
--- a/src/conf/virnodedeviceobj.c
+++ b/src/conf/virnodedeviceobj.c
@@ -470,23 +470,28 @@ virNodeDeviceObjListAssignDef(virNodeDeviceObjListPtr 
devs,
 }
 
 
+/*
+ * virNodeDeviceObjListRemove:
+ * @devs: list of node device objects
+ * @name: a node device definition
+ *
+ * Find the object by name in the list, remove the object from the
+ * list hash table, and free the object.
+ *
+ * Upon entry it's expected that prior to entry any locks on
+ * the object related to @name will have been removed.
+ */
 void
 virNodeDeviceObjListRemove(virNodeDeviceObjListPtr devs,
-   virNodeDeviceObjPtr obj)
+   const char *name)
 {
-virNodeDeviceDefPtr def;
-
-if (!obj)
-return;
-def = obj->def;
+virNodeDeviceObjPtr obj;
 
-virObjectRef(obj);
-virObjectUnlock(obj);
 virObjectRWLockWrite(devs);
-virObjectLock(obj);
-virHashRemoveEntry(devs->objs, def->name);
-virObjectUnlock(obj);
-virObjectUnref(obj);
+if ((obj = virNodeDeviceObjListFindByNameLocked(devs, name))) {
+virHashRemoveEntry(devs->objs, name);
+virNodeDeviceObjEndAPI();
+}
 virObjectRWUnlock(devs);
 }
 
diff --git a/src/conf/virnodedeviceobj.h b/src/conf/virnodedeviceobj.h
index 87f908369..b9752bc62 100644
--- a/src/conf/virnodedeviceobj.h
+++ b/src/conf/virnodedeviceobj.h
@@ -72,7 +72,7 @@ virNodeDeviceObjListAssignDef(virNodeDeviceObjListPtr devs,
 
 void
 virNodeDeviceObjListRemove(virNodeDeviceObjListPtr devs,
-   virNodeDeviceObjPtr dev);
+   const char *name);
 
 int
 virNodeDeviceObjListGetParentHost(virNodeDeviceObjListPtr devs,
diff --git a/src/node_device/node_device_hal.c 
b/src/node_device/node_device_hal.c
index 6ad56f416..46a419a6e 100644
--- a/src/node_device/node_device_hal.c
+++ b/src/node_device/node_device_hal.c
@@ -511,8 +511,8 @@ dev_refresh(const char *udi)
 /* Simply "rediscover" device -- incrementally handling changes
  * to sub-capabilities (like net.80203) is nasty ... so avoid it.
  */
-virNodeDeviceObjListRemove(driver->devs, obj);
-virObjectUnref(obj);
+virNodeDeviceObjEndAPI();
+virNodeDeviceObjListRemoveDef(driver->devs, name);
 dev_create(udi);
 } else {
 VIR_DEBUG("no device named %s", name);
@@ -536,12 +536,14 @@ device_removed(LibHalContext *ctx ATTRIBUTE_UNUSED,
 virNodeDeviceObjPtr obj;
 
 obj = virNodeDeviceObjListFindByName(driver->devs, name);
-VIR_DEBUG("%s", name);
-if (obj)
-virNodeDeviceObjListRemove(driver->devs, obj);
-else
+if (!obj) {
 VIR_DEBUG("no device named %s", name);
-virObjectUnref(obj);
+return;
+}
+
+VIR_DEBUG("%s", name);
+virNodeDeviceObjEndAPI();
+virNodeDeviceObjListRemove(driver->devs, name);
 }
 
 
diff --git a/src/node_device/node_device_udev.c 
b/src/node_device/node_device_udev.c
index e87eb32a8..f6d223fe4 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1282,6 +1282,7 @@ udevRemoveOneDevice(struct udev_device *device)
 virNodeDeviceDefPtr def;
 virObjectEventPtr event = NULL;
 const char *name = NULL;
+char *defname = NULL;
 
 name = udev_device_get_syspath(device);
 if (!(obj = virNodeDeviceObjListFindBySysfsPath(driver->devs, name))) {
@@ -1290,15 +1291,19 @@ udevRemoveOneDevice(struct udev_device *device)
 return -1;
 }
 def = virNodeDeviceObjGetDef(obj);
+if (VIR_STRDUP(defname, def->name) < 0) {
+virNodeDeviceObjEndAPI();
+return -1;
+}
 
 event = virNodeDeviceEventLifecycleNew(def->name,
VIR_NODE_DEVICE_EVENT_DELETED,
 

[libvirt] [PATCH v2 8/9] conf: Move virStoragePoolObjRemove closer to AssignDef

2018-03-28 Thread John Ferlan
A subsequent patch will need to use the local FindByUUIDLocked,
so rather than create a forward decl or move when needed, let's
just do it now for ease of future review.

Signed-off-by: John Ferlan 
---
 src/conf/virstorageobj.c | 38 +++---
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c
index 471262f29..f48f08a64 100644
--- a/src/conf/virstorageobj.c
+++ b/src/conf/virstorageobj.c
@@ -517,25 +517,6 @@ virStoragePoolObjListSearch(virStoragePoolObjListPtr pools,
 }
 
 
-void
-virStoragePoolObjRemove(virStoragePoolObjListPtr pools,
-virStoragePoolObjPtr obj)
-{
-char uuidstr[VIR_UUID_STRING_BUFLEN];
-
-virUUIDFormat(obj->def->uuid, uuidstr);
-virObjectRef(obj);
-virObjectUnlock(obj);
-virObjectRWLockWrite(pools);
-virObjectLock(obj);
-virHashRemoveEntry(pools->objs, uuidstr);
-virHashRemoveEntry(pools->objsName, obj->def->name);
-virObjectUnlock(obj);
-virObjectUnref(obj);
-virObjectRWUnlock(pools);
-}
-
-
 static virStoragePoolObjPtr
 virStoragePoolObjFindByUUIDLocked(virStoragePoolObjListPtr pools,
   const unsigned char *uuid)
@@ -1053,6 +1034,25 @@ virStoragePoolObjVolumeListExport(virConnectPtr conn,
 }
 
 
+void
+virStoragePoolObjRemove(virStoragePoolObjListPtr pools,
+virStoragePoolObjPtr obj)
+{
+char uuidstr[VIR_UUID_STRING_BUFLEN];
+
+virUUIDFormat(obj->def->uuid, uuidstr);
+virObjectRef(obj);
+virObjectUnlock(obj);
+virObjectRWLockWrite(pools);
+virObjectLock(obj);
+virHashRemoveEntry(pools->objs, uuidstr);
+virHashRemoveEntry(pools->objsName, obj->def->name);
+virObjectUnlock(obj);
+virObjectUnref(obj);
+virObjectRWUnlock(pools);
+}
+
+
 /**
  * virStoragePoolObjAssignDef:
  * @pools: Storage Pool object list pointer
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v2 5/9] conf: Clean up virStoragePoolObjLoad error processing

2018-03-28 Thread John Ferlan
Use an error label to converge all the clean up processing options.

Signed-off-by: John Ferlan 
---
 src/conf/virstorageobj.c | 37 +++--
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c
index 799b8c9fa..471262f29 100644
--- a/src/conf/virstorageobj.c
+++ b/src/conf/virstorageobj.c
@@ -1115,8 +1115,8 @@ virStoragePoolObjLoad(virStoragePoolObjListPtr pools,
   const char *path,
   const char *autostartLink)
 {
-virStoragePoolDefPtr def;
-virStoragePoolObjPtr obj;
+virStoragePoolDefPtr def = NULL;
+virStoragePoolObjPtr obj = NULL;
 
 if (!(def = virStoragePoolDefParseFile(path)))
 return NULL;
@@ -1126,32 +1126,33 @@ virStoragePoolObjLoad(virStoragePoolObjListPtr pools,
_("Storage pool config filename '%s' does "
  "not match pool name '%s'"),
path, def->name);
-virStoragePoolDefFree(def);
-return NULL;
+goto error;
 }
 
-if (!(obj = virStoragePoolObjAssignDef(pools, def))) {
-virStoragePoolDefFree(def);
-return NULL;
-}
+if (!(obj = virStoragePoolObjAssignDef(pools, def)))
+goto error;
+def = NULL;
 
 VIR_FREE(obj->configFile);  /* for driver reload */
-if (VIR_STRDUP(obj->configFile, path) < 0) {
-virStoragePoolObjRemove(pools, obj);
-virObjectUnref(obj);
-return NULL;
-}
+if (VIR_STRDUP(obj->configFile, path) < 0)
+goto error;
+
 VIR_FREE(obj->autostartLink); /* for driver reload */
-if (VIR_STRDUP(obj->autostartLink, autostartLink) < 0) {
-virStoragePoolObjRemove(pools, obj);
-virObjectUnref(obj);
-return NULL;
-}
+if (VIR_STRDUP(obj->autostartLink, autostartLink) < 0)
+goto error;
 
 obj->autostart = virFileLinkPointsTo(obj->autostartLink,
  obj->configFile);
 
 return obj;
+
+ error:
+if (obj) {
+virStoragePoolObjRemove(pools, obj);
+virObjectUnref(obj);
+}
+virStoragePoolDefFree(def);
+return NULL;
 }
 
 
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v2 7/9] test: Clean up testStoragePoolCreateXML error processing

2018-03-28 Thread John Ferlan
Rather than 2 separate, but same 4 lines of code - let's create an
error label to make a common error path. This will help shortly when
the error path changes slightly.

Signed-off-by: John Ferlan 
---
 src/test/test_driver.c | 22 ++
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 568d537e9..0a284e3d1 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -4562,20 +4562,12 @@ testStoragePoolCreateXML(virConnectPtr conn,
  * rename a few fields to mock that. */
 if (testCreateVport(privconn,
 def->source.adapter.data.fchost.wwnn,
-def->source.adapter.data.fchost.wwpn) < 0) {
-virStoragePoolObjRemove(privconn->pools, obj);
-virObjectUnref(obj);
-obj = NULL;
-goto cleanup;
-}
+def->source.adapter.data.fchost.wwpn) < 0)
+goto error;
 }
 
-if (testStoragePoolObjSetDefaults(obj) == -1) {
-virStoragePoolObjRemove(privconn->pools, obj);
-virObjectUnref(obj);
-obj = NULL;
-goto cleanup;
-}
+if (testStoragePoolObjSetDefaults(obj) == -1)
+goto error;
 
 /* *SetDefaults fills this in for the persistent pools, but this
  * would be a transient pool so remove it; otherwise, the Destroy
@@ -4596,6 +4588,12 @@ testStoragePoolCreateXML(virConnectPtr conn,
 virStoragePoolObjEndAPI();
 testDriverUnlock(privconn);
 return pool;
+
+ error:
+virStoragePoolObjRemove(privconn->pools, obj);
+virObjectUnref(obj);
+obj = NULL;
+goto cleanup;
 }
 
 
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v2 3/9] interface: Alter virInterfaceObjListRemove processing

2018-03-28 Thread John Ferlan
Current processing requires a "fire dance" unlocking the @obj,
adding an @obj ref, locking the @interfaces, and relocking @obj
in order to ensure proper lock ordering.

This can be avoided by changing virInterfaceObjListRemove to
take @name instead of @obj. Then, we can lock the @interfaces
list, look up the @obj by @name (like we do when adding), and
remove the @obj from the list. This removes the last reference
to the object effectively reaping it.

NB: Since prior to calling we remove the reference to the object
we cannot pass anything contained within the object (such as the
obj->def or obj->def->name) because it's possible that the object
could be reaped by two competing remove threads.

Signed-off-by: John Ferlan 
---
 src/conf/virinterfaceobj.c | 26 +-
 src/conf/virinterfaceobj.h |  2 +-
 src/test/test_driver.c |  4 ++--
 3 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/src/conf/virinterfaceobj.c b/src/conf/virinterfaceobj.c
index f90c0bd9c..c3a7d4cd8 100644
--- a/src/conf/virinterfaceobj.c
+++ b/src/conf/virinterfaceobj.c
@@ -358,20 +358,28 @@ virInterfaceObjListAssignDef(virInterfaceObjListPtr 
interfaces,
 }
 
 
+/*
+ * virInterfaceObjListRemove:
+ * @interfaces: list of interface objects
+ * @name: name of interface definition to remove
+ *
+ * Find the object by name in the list, remove the object from the
+ * list hash table, and free the object.
+ *
+ * Upon entry it's expected that prior to entry any locks on
+ * the object related to @name will have been removed.
+ */
 void
 virInterfaceObjListRemove(virInterfaceObjListPtr interfaces,
-  virInterfaceObjPtr obj)
+  const char *name)
 {
-if (!obj)
-return;
+virInterfaceObjPtr obj;
 
-virObjectRef(obj);
-virObjectUnlock(obj);
 virObjectRWLockWrite(interfaces);
-virObjectLock(obj);
-virHashRemoveEntry(interfaces->objsName, obj->def->name);
-virObjectUnlock(obj);
-virObjectUnref(obj);
+if ((obj = virInterfaceObjListFindByNameLocked(interfaces, name))) {
+virHashRemoveEntry(interfaces->objsName, name);
+virInterfaceObjEndAPI();
+}
 virObjectRWUnlock(interfaces);
 }
 
diff --git a/src/conf/virinterfaceobj.h b/src/conf/virinterfaceobj.h
index 799d38038..82eb2ee87 100644
--- a/src/conf/virinterfaceobj.h
+++ b/src/conf/virinterfaceobj.h
@@ -66,7 +66,7 @@ virInterfaceObjListAssignDef(virInterfaceObjListPtr 
interfaces,
 
 void
 virInterfaceObjListRemove(virInterfaceObjListPtr interfaces,
-  virInterfaceObjPtr obj);
+  const char *name);
 
 typedef bool
 (*virInterfaceObjListFilter)(virConnectPtr conn,
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 99c27cc0a..d8dcb 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -4092,8 +4092,8 @@ testInterfaceUndefine(virInterfacePtr iface)
 if (!(obj = testInterfaceObjFindByName(privconn, iface->name)))
 return -1;
 
-virInterfaceObjListRemove(privconn->ifaces, obj);
-virObjectUnref(obj);
+virInterfaceObjEndAPI();
+virInterfaceObjListRemove(privconn->ifaces, iface->name);
 
 return 0;
 }
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v2 0/9] Be consistent with vir*Obj*Remove* APIs

2018-03-28 Thread John Ferlan
v1: https://www.redhat.com/archives/libvir-list/2018-March/msg01295.html

NB: This can wait until 4.2.0 is release, but I figured I'd post this
now just to put it on the radar and of course in hopes that someone
will look during the idle moment or two before the release.

Changes since v1:

 Short story: Rework the processing of the code

 Longer story:

 In his review Erik noted that there's a "fire dance" when processing
 the vir*Obj*Remove APIs of requiring a locked object upon entry, then
 adding a reference to that object, unlocking the object, locking the
 list to which it is contained, and then relocking the object.

 So it took some time to think about it and during one lengthy meeting
 today I had the aha moment that the *Remove API's could take the same
 key (e.g., uuid or name) used to Add or Find the object and use it for
 the Remove API. This allows the Remove API to not require a locked (and
 reffed) object upon entry and perform the lock dance, remove the object,
 and return just just a reffed object forcing the caller to know to Unref
 object.

 Instead, let's simplify things. The *Remove API can take the key, Find
 the object in the list, remove it from the hash tables, and dispose of
 the object. In essence the antecedent to the Add or AssignDef API's
 taking a def, creating an object, and adding it the object to the hash
 table(s). If there are two *Remove threads competing, one will win and
 perform the removal, while the other will call *Remove, but won't find
 the object in the hash table, and just return none the wiser.

 And yes, I think this can also work for the Domain code, but it's going
 to take a few patch series to get there as that code is not consistent
 between consumers.

John Ferlan (9):
  secret: Rework LoadAllConfigs
  secret: Alter virSecretObjListRemove processing
  interface: Alter virInterfaceObjListRemove processing
  nodedev: Alter virNodeDeviceObjListRemove processing
  conf: Clean up virStoragePoolObjLoad error processing
  storage: Clean up storagePoolCreateXML error processing
  test: Clean up testStoragePoolCreateXML error processing
  conf: Move virStoragePoolObjRemove closer to AssignDef
  storagepool: Alter virStoragePoolObjRemove processing

 src/conf/virinterfaceobj.c | 26 +++
 src/conf/virinterfaceobj.h |  2 +-
 src/conf/virnodedeviceobj.c| 29 +++-
 src/conf/virnodedeviceobj.h|  2 +-
 src/conf/virsecretobj.c| 58 +++-
 src/conf/virsecretobj.h|  2 +-
 src/conf/virstorageobj.c   | 92 +++---
 src/conf/virstorageobj.h   |  2 +-
 src/node_device/node_device_hal.c  | 16 ---
 src/node_device/node_device_udev.c | 13 --
 src/secret/secret_driver.c | 15 ---
 src/storage/storage_driver.c   | 65 +++
 src/test/test_driver.c | 78 +---
 13 files changed, 225 insertions(+), 175 deletions(-)

-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v2 1/9] secret: Rework LoadAllConfigs

2018-03-28 Thread John Ferlan
Move the virSecretObjEndAPI into virSecretLoad and alter the processing
in order to accomodate that.

Signed-off-by: John Ferlan 
---
 src/conf/virsecretobj.c | 22 ++
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/conf/virsecretobj.c b/src/conf/virsecretobj.c
index 47e0b2896..4aaf47b5d 100644
--- a/src/conf/virsecretobj.c
+++ b/src/conf/virsecretobj.c
@@ -906,12 +906,13 @@ virSecretLoadValue(virSecretObjPtr obj)
 }
 
 
-static virSecretObjPtr
+static int
 virSecretLoad(virSecretObjListPtr secrets,
   const char *file,
   const char *path,
   const char *configDir)
 {
+int ret = -1;
 virSecretDefPtr def = NULL;
 virSecretObjPtr obj = NULL;
 
@@ -927,13 +928,16 @@ virSecretLoad(virSecretObjListPtr secrets,
 
 if (virSecretLoadValue(obj) < 0) {
 virSecretObjListRemove(secrets, obj);
-virObjectUnref(obj);
-obj = NULL;
+virObjectLock(obj);
+goto cleanup;
 }
 
+ret = 0;
+
  cleanup:
 virSecretDefFree(def);
-return obj;
+virSecretObjEndAPI();
+return ret;
 }
 
 
@@ -952,7 +956,6 @@ virSecretLoadAllConfigs(virSecretObjListPtr secrets,
  * loop (if any).  It's better to keep the secrets we managed to find. */
 while (virDirRead(dir, , NULL) > 0) {
 char *path;
-virSecretObjPtr obj;
 
 if (!virFileHasSuffix(de->d_name, ".xml"))
 continue;
@@ -960,15 +963,10 @@ virSecretLoadAllConfigs(virSecretObjListPtr secrets,
 if (!(path = virFileBuildPath(configDir, de->d_name, NULL)))
 continue;
 
-if (!(obj = virSecretLoad(secrets, de->d_name, path, configDir))) {
-VIR_ERROR(_("Error reading secret: %s"),
-  virGetLastErrorMessage());
-VIR_FREE(path);
-continue;
-}
+if (virSecretLoad(secrets, de->d_name, path, configDir) < 0)
+VIR_ERROR(_("Error reading secret: %s"), virGetLastErrorMessage());
 
 VIR_FREE(path);
-virSecretObjEndAPI();
 }
 
 VIR_DIR_CLOSE(dir);
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH v6.1 2/9] libxl: pass driver config to libxlMakeDomBuildInfo

2018-03-28 Thread Jim Fehlig

On 03/27/2018 05:55 PM, Marek Marczykowski-Górecki wrote:

Preparation for global nestedhvm configuration - libxlMakeDomBuildInfo
needs access to libxlDriverConfig.
No functional change.

Adjusting tests require slightly more mockup functions, because of
libxlDriverConfigNew() call.

Signed-off-by: Marek Marczykowski-Górecki 
---
Changes since v6:
  - tests: add libxl_get_free_memory mock needed on Xen 4.5
Changes since v4:
  - drop now unneeded parameters
Changes since v3:
  - new patch, preparation
---
  src/libxl/libxl_conf.c | 13 +++--
  src/libxl/libxl_conf.h |  4 +---
  src/libxl/libxl_domain.c   |  2 +-
  tests/libxlxml2domconfigtest.c | 23 ---
  tests/virmocklibxl.c   | 30 ++
  5 files changed, 55 insertions(+), 17 deletions(-)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 2d2a707..e7727a1 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -271,10 +271,11 @@ libxlMakeChrdevStr(virDomainChrDefPtr def, char **buf)
  
  static int

  libxlMakeDomBuildInfo(virDomainDefPtr def,
-  libxl_ctx *ctx,
+  libxlDriverConfigPtr cfg,
virCapsPtr caps,
libxl_domain_config *d_config)
  {
+libxl_ctx *ctx = cfg->ctx;
  libxl_domain_build_info *b_info = _config->b_info;
  int hvm = def->os.type == VIR_DOMAIN_OSTYPE_HVM;
  size_t i;
@@ -2287,17 +2288,17 @@ libxlDriverNodeGetInfo(libxlDriverPrivatePtr driver, 
virNodeInfoPtr info)
  int
  libxlBuildDomainConfig(virPortAllocatorPtr graphicsports,
 virDomainDefPtr def,
-   const char *channelDir LIBXL_ATTR_UNUSED,
-   libxl_ctx *ctx,
-   virCapsPtr caps,
+   libxlDriverConfigPtr cfg,
 libxl_domain_config *d_config)
  {
+virCapsPtr caps = cfg->caps;
+libxl_ctx *ctx = cfg->ctx;
  libxl_domain_config_init(d_config);
  
  if (libxlMakeDomCreateInfo(ctx, def, _config->c_info) < 0)

  return -1;
  
-if (libxlMakeDomBuildInfo(def, ctx, caps, d_config) < 0)

+if (libxlMakeDomBuildInfo(def, cfg, caps, d_config) < 0)
  return -1;
  
  #ifdef LIBXL_HAVE_VNUMA

@@ -2329,7 +2330,7 @@ libxlBuildDomainConfig(virPortAllocatorPtr graphicsports,
  #endif
  
  #ifdef LIBXL_HAVE_DEVICE_CHANNEL

-if (libxlMakeChannelList(channelDir, def, d_config) < 0)
+if (libxlMakeChannelList(cfg->channelDir, def, d_config) < 0)
  return -1;
  #endif
  
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h

index 264df11..ce9db26 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -215,9 +215,7 @@ libxlCreateXMLConf(void);
  int
  libxlBuildDomainConfig(virPortAllocatorPtr graphicsports,
 virDomainDefPtr def,
-   const char *channelDir LIBXL_ATTR_UNUSED,
-   libxl_ctx *ctx,
-   virCapsPtr caps,
+   libxlDriverConfigPtr cfg,
 libxl_domain_config *d_config);
  
  static inline void

diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 395c8a9..8879481 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -1253,7 +1253,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver,
  goto cleanup_dom;
  
  if (libxlBuildDomainConfig(driver->reservedGraphicsPorts, vm->def,

-   cfg->channelDir, cfg->ctx, cfg->caps, _config) 
< 0)
+   cfg, _config) < 0)
  goto cleanup_dom;
  
  if (cfg->autoballoon && libxlDomainFreeMem(cfg->ctx, _config) < 0)

diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c
index bd4c3af..cfbc37c 100644
--- a/tests/libxlxml2domconfigtest.c
+++ b/tests/libxlxml2domconfigtest.c
@@ -56,8 +56,8 @@ testCompareXMLToDomConfig(const char *xmlfile,
  int ret = -1;
  libxl_domain_config actualconfig;
  libxl_domain_config expectconfig;
+libxlDriverConfigPtr cfg;
  xentoollog_logger *log = NULL;
-libxl_ctx *ctx = NULL;
  virPortAllocatorPtr gports = NULL;
  virDomainXMLOptionPtr xmlopt = NULL;
  virDomainDefPtr vmdef = NULL;
@@ -68,10 +68,18 @@ testCompareXMLToDomConfig(const char *xmlfile,
  libxl_domain_config_init();
  libxl_domain_config_init();
  
+if (!(cfg = libxlDriverConfigNew()))

+goto cleanup;
+
+cfg->caps = caps;
+
  if (!(log = (xentoollog_logger *)xtl_createlogger_stdiostream(stderr, 
XTL_DEBUG, 0)))
  goto cleanup;
  
-if (libxl_ctx_alloc(, LIBXL_VERSION, 0, log) < 0)

+/* replace logger with stderr one */
+libxl_ctx_free(cfg->ctx);
+
+if (libxl_ctx_alloc(>ctx, LIBXL_VERSION, 0, log) < 0)
  goto cleanup;
  
  if (!(gports = virPortAllocatorNew("vnc", 5900, 6000,

@@ -85,22 

Re: [libvirt] [PATCH] snip my name and email

2018-03-28 Thread David Kiarie
On Wed, Mar 28, 2018 at 7:52 PM, Daniel P. Berrangé 
wrote:

> On Wed, Mar 28, 2018 at 07:49:09PM +0300, David Kiarie wrote:
> > On Wed, Mar 28, 2018 at 7:46 PM, David Kiarie 
> > wrote:
> >
> > >
> > >
> > > On Wed, Mar 28, 2018 at 7:43 PM, Daniel P. Berrangé <
> berra...@redhat.com>
> > > wrote:
> > >
> > >> On Wed, Mar 28, 2018 at 07:33:11PM +0300, David Kiarie wrote:
> > >> > On Wed, Mar 28, 2018 at 5:32 PM, Daniel P. Berrangé <
> > >> berra...@redhat.com>
> > >> > wrote:
> > >> >
> > >> > > On Mon, Mar 26, 2018 at 10:29:06AM +0300, David Kiarie wrote:
> > >> > > > I'd like to snip my name and email from these files
> > >> > >
> > >> > > Any particular reason why ?
> > >> > >
> > >> > >
> > >> > Yes, I do have a particular reason why but it's not very relevant
> around
> > >> > here.
> > >>
> > >> NB, patches require a  Signed-off-by line to be commited, so can you
> > >> resend with that.
> > >>
> > >
> > > I'm just angry about some internet idiot who might use my name to
> track me
> > > around.
> > >
> > >
> > >>
> > >> >
> > >> > > > ---
> > >> > > >  src/xenconfig/xen_xl.c | 1 -
> > >> > > >  src/xenconfig/xen_xl.h | 1 -
> > >> > > >  2 files changed, 2 deletions(-)
> > >> > >
> > >> > > It is also mentioned in test/xlconfigtest.c.
> > >>
> > >> And presumably you want to remove from this file too ?
> > >>
> > >
> > > I'm just confused. Not so sure he's smart enough to figure that out.
> > >
> >
> > Okay, shall I redo this patch or would you be kind enough to do it ?
>
> You'll need to resend, and also add a Signed-off-by line so that we can
> commit it.
>

What ? You mean my patch didn't have a Signed-off-by line  ?!

It's long since I did git.


> Regards,
> Daniel
> --
> |: https://berrange.com  -o-https://www.flickr.com/photos/
> dberrange :|
> |: https://libvirt.org -o-
> https://fstop138.berrange.com :|
> |: https://entangle-photo.org-o-https://www.instagram.com/
> dberrange :|
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] snip my name and email

2018-03-28 Thread Daniel P . Berrangé
On Wed, Mar 28, 2018 at 07:49:09PM +0300, David Kiarie wrote:
> On Wed, Mar 28, 2018 at 7:46 PM, David Kiarie 
> wrote:
> 
> >
> >
> > On Wed, Mar 28, 2018 at 7:43 PM, Daniel P. Berrangé 
> > wrote:
> >
> >> On Wed, Mar 28, 2018 at 07:33:11PM +0300, David Kiarie wrote:
> >> > On Wed, Mar 28, 2018 at 5:32 PM, Daniel P. Berrangé <
> >> berra...@redhat.com>
> >> > wrote:
> >> >
> >> > > On Mon, Mar 26, 2018 at 10:29:06AM +0300, David Kiarie wrote:
> >> > > > I'd like to snip my name and email from these files
> >> > >
> >> > > Any particular reason why ?
> >> > >
> >> > >
> >> > Yes, I do have a particular reason why but it's not very relevant around
> >> > here.
> >>
> >> NB, patches require a  Signed-off-by line to be commited, so can you
> >> resend with that.
> >>
> >
> > I'm just angry about some internet idiot who might use my name to track me
> > around.
> >
> >
> >>
> >> >
> >> > > > ---
> >> > > >  src/xenconfig/xen_xl.c | 1 -
> >> > > >  src/xenconfig/xen_xl.h | 1 -
> >> > > >  2 files changed, 2 deletions(-)
> >> > >
> >> > > It is also mentioned in test/xlconfigtest.c.
> >>
> >> And presumably you want to remove from this file too ?
> >>
> >
> > I'm just confused. Not so sure he's smart enough to figure that out.
> >
> 
> Okay, shall I redo this patch or would you be kind enough to do it ?

You'll need to resend, and also add a Signed-off-by line so that we can
commit it.

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] snip my name and email

2018-03-28 Thread David Kiarie
On Wed, Mar 28, 2018 at 7:46 PM, David Kiarie 
wrote:

>
>
> On Wed, Mar 28, 2018 at 7:43 PM, Daniel P. Berrangé 
> wrote:
>
>> On Wed, Mar 28, 2018 at 07:33:11PM +0300, David Kiarie wrote:
>> > On Wed, Mar 28, 2018 at 5:32 PM, Daniel P. Berrangé <
>> berra...@redhat.com>
>> > wrote:
>> >
>> > > On Mon, Mar 26, 2018 at 10:29:06AM +0300, David Kiarie wrote:
>> > > > I'd like to snip my name and email from these files
>> > >
>> > > Any particular reason why ?
>> > >
>> > >
>> > Yes, I do have a particular reason why but it's not very relevant around
>> > here.
>>
>> NB, patches require a  Signed-off-by line to be commited, so can you
>> resend with that.
>>
>
> I'm just angry about some internet idiot who might use my name to track me
> around.
>
>
>>
>> >
>> > > > ---
>> > > >  src/xenconfig/xen_xl.c | 1 -
>> > > >  src/xenconfig/xen_xl.h | 1 -
>> > > >  2 files changed, 2 deletions(-)
>> > >
>> > > It is also mentioned in test/xlconfigtest.c.
>>
>> And presumably you want to remove from this file too ?
>>
>
> I'm just confused. Not so sure he's smart enough to figure that out.
>

Okay, shall I redo this patch or would you be kind enough to do it ?


>
>
>>
>> Regards,
>> Daniel
>> --
>> |: https://berrange.com  -o-https://www.flickr.com/photos/
>> dberrange :|
>> |: https://libvirt.org -o-
>> https://fstop138.berrange.com :|
>> |: https://entangle-photo.org-o-https://www.instagram.com/dber
>> range :|
>>
>
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] snip my name and email

2018-03-28 Thread David Kiarie
On Wed, Mar 28, 2018 at 7:33 PM, David Kiarie 
wrote:

>
>
> On Wed, Mar 28, 2018 at 5:32 PM, Daniel P. Berrangé 
> wrote:
>
>> On Mon, Mar 26, 2018 at 10:29:06AM +0300, David Kiarie wrote:
>> > I'd like to snip my name and email from these files
>>
>> Any particular reason why ?
>>
>>
> Yes, I do have a particular reason why but it's not very relevant around
> here.
>
>> > ---
>> >  src/xenconfig/xen_xl.c | 1 -
>> >  src/xenconfig/xen_xl.h | 1 -
>> >  2 files changed, 2 deletions(-)
>>
>> It is also mentioned in test/xlconfigtest.c.
>>
>> NB, your name & email are still recorded in git history and email
>> archives for eternity
>>
>> Your name, but not email, is also mentioned in the news files,
>> and that file isn't one we'd want to remove since its relevant
>> historical record.
>>
>>
> I prefectly understand that.
>

*perfectly, that is ;-)


>
>
>> >
>> > diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
>> > index e1ec8e7..a3f8af1 100644
>> > --- a/src/xenconfig/xen_xl.c
>> > +++ b/src/xenconfig/xen_xl.c
>> > @@ -17,7 +17,6 @@
>> >   * License along with this library.  If not, see
>> >   * .
>> >   *
>> > - * Author: Kiarie Kahurani 
>> >   * Author: Jim Fehlig 
>> >   */
>> >
>> > diff --git a/src/xenconfig/xen_xl.h b/src/xenconfig/xen_xl.h
>> > index dd96326..8342f53 100644
>> > --- a/src/xenconfig/xen_xl.h
>> > +++ b/src/xenconfig/xen_xl.h
>> > @@ -17,7 +17,6 @@
>> >   * License along with this library.  If not, see
>> >   * .
>> >   *
>> > - * Author: Kiarie Kahurani
>> >   */
>> >
>> >  #ifndef __VIR_XEN_XL_H__
>> > --
>> > 2.16.2
>> >
>>
>> Regards,
>> Daniel
>> --
>> |: https://berrange.com  -o-https://www.flickr.com/photos/
>> dberrange :|
>> |: https://libvirt.org -o-
>> https://fstop138.berrange.com :|
>> |: https://entangle-photo.org-o-https://www.instagram.com/dber
>> range :|
>>
>
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] snip my name and email

2018-03-28 Thread David Kiarie
On Wed, Mar 28, 2018 at 5:32 PM, Daniel P. Berrangé 
wrote:

> On Mon, Mar 26, 2018 at 10:29:06AM +0300, David Kiarie wrote:
> > I'd like to snip my name and email from these files
>
> Any particular reason why ?
>
>
Yes, I do have a particular reason why but it's not very relevant around
here.

> > ---
> >  src/xenconfig/xen_xl.c | 1 -
> >  src/xenconfig/xen_xl.h | 1 -
> >  2 files changed, 2 deletions(-)
>
> It is also mentioned in test/xlconfigtest.c.
>
> NB, your name & email are still recorded in git history and email
> archives for eternity
>
> Your name, but not email, is also mentioned in the news files,
> and that file isn't one we'd want to remove since its relevant
> historical record.
>
>
I prefectly understand that.


> >
> > diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
> > index e1ec8e7..a3f8af1 100644
> > --- a/src/xenconfig/xen_xl.c
> > +++ b/src/xenconfig/xen_xl.c
> > @@ -17,7 +17,6 @@
> >   * License along with this library.  If not, see
> >   * .
> >   *
> > - * Author: Kiarie Kahurani 
> >   * Author: Jim Fehlig 
> >   */
> >
> > diff --git a/src/xenconfig/xen_xl.h b/src/xenconfig/xen_xl.h
> > index dd96326..8342f53 100644
> > --- a/src/xenconfig/xen_xl.h
> > +++ b/src/xenconfig/xen_xl.h
> > @@ -17,7 +17,6 @@
> >   * License along with this library.  If not, see
> >   * .
> >   *
> > - * Author: Kiarie Kahurani
> >   */
> >
> >  #ifndef __VIR_XEN_XL_H__
> > --
> > 2.16.2
> >
>
> Regards,
> Daniel
> --
> |: https://berrange.com  -o-https://www.flickr.com/photos/
> dberrange :|
> |: https://libvirt.org -o-
> https://fstop138.berrange.com :|
> |: https://entangle-photo.org-o-https://www.instagram.com/
> dberrange :|
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] snip my name and email

2018-03-28 Thread David Kiarie
On Wed, Mar 28, 2018 at 7:43 PM, Daniel P. Berrangé 
wrote:

> On Wed, Mar 28, 2018 at 07:33:11PM +0300, David Kiarie wrote:
> > On Wed, Mar 28, 2018 at 5:32 PM, Daniel P. Berrangé  >
> > wrote:
> >
> > > On Mon, Mar 26, 2018 at 10:29:06AM +0300, David Kiarie wrote:
> > > > I'd like to snip my name and email from these files
> > >
> > > Any particular reason why ?
> > >
> > >
> > Yes, I do have a particular reason why but it's not very relevant around
> > here.
>
> NB, patches require a  Signed-off-by line to be commited, so can you
> resend with that.
>

I'm just angry about some internet idiot who might use my name to track me
around.


>
> >
> > > > ---
> > > >  src/xenconfig/xen_xl.c | 1 -
> > > >  src/xenconfig/xen_xl.h | 1 -
> > > >  2 files changed, 2 deletions(-)
> > >
> > > It is also mentioned in test/xlconfigtest.c.
>
> And presumably you want to remove from this file too ?
>

I'm just confused. Not so sure he's smart enough to figure that out.


>
> Regards,
> Daniel
> --
> |: https://berrange.com  -o-https://www.flickr.com/photos/
> dberrange :|
> |: https://libvirt.org -o-
> https://fstop138.berrange.com :|
> |: https://entangle-photo.org-o-https://www.instagram.com/
> dberrange :|
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] snip my name and email

2018-03-28 Thread Daniel P . Berrangé
On Wed, Mar 28, 2018 at 07:33:11PM +0300, David Kiarie wrote:
> On Wed, Mar 28, 2018 at 5:32 PM, Daniel P. Berrangé 
> wrote:
> 
> > On Mon, Mar 26, 2018 at 10:29:06AM +0300, David Kiarie wrote:
> > > I'd like to snip my name and email from these files
> >
> > Any particular reason why ?
> >
> >
> Yes, I do have a particular reason why but it's not very relevant around
> here.

NB, patches require a  Signed-off-by line to be commited, so can you
resend with that.

> 
> > > ---
> > >  src/xenconfig/xen_xl.c | 1 -
> > >  src/xenconfig/xen_xl.h | 1 -
> > >  2 files changed, 2 deletions(-)
> >
> > It is also mentioned in test/xlconfigtest.c.

And presumably you want to remove from this file too ?

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 6/7] remote: use a separate connection for secret APIs

2018-03-28 Thread Daniel P . Berrangé
Signed-off-by: Daniel P. Berrangé 
---
 src/remote/remote_daemon.h  |  1 +
 src/remote/remote_daemon_dispatch.c | 19 +++
 src/rpc/gendispatch.pl  |  6 ++
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/src/remote/remote_daemon.h b/src/remote/remote_daemon.h
index 1b906401d3..2b757d9cd6 100644
--- a/src/remote/remote_daemon.h
+++ b/src/remote/remote_daemon.h
@@ -78,6 +78,7 @@ struct daemonClientPrivate {
 virConnectPtr networkConn;
 virConnectPtr nodedevConn;
 virConnectPtr nwfilterConn;
+virConnectPtr secretConn;
 
 daemonClientStreamPtr streams;
 };
diff --git a/src/remote/remote_daemon_dispatch.c 
b/src/remote/remote_daemon_dispatch.c
index dcfc0abf46..1a30d73049 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -1708,7 +1708,7 @@ remoteClientFreePrivateCallbacks(struct 
daemonClientPrivate *priv)
 DEREG_CB(priv->nodedevConn, priv->nodeDeviceEventCallbacks,
  priv->nnodeDeviceEventCallbacks,
  virConnectNodeDeviceEventDeregisterAny, "node device");
-DEREG_CB(priv->conn, priv->secretEventCallbacks,
+DEREG_CB(priv->secretConn, priv->secretEventCallbacks,
  priv->nsecretEventCallbacks,
  virConnectSecretEventDeregisterAny, "secret");
 DEREG_CB(priv->conn, priv->qemuEventCallbacks,
@@ -1748,6 +1748,8 @@ void remoteClientFree(void *data)
 virConnectClose(priv->nodedevConn);
 if (priv->nwfilterConn)
 virConnectClose(priv->nwfilterConn);
+if (priv->secretConn)
+virConnectClose(priv->secretConn);
 
 VIR_FREE(priv);
 }
@@ -1826,6 +1828,7 @@ remoteDispatchConnectOpen(virNetServerPtr server 
ATTRIBUTE_UNUSED,
 priv->networkConn = virObjectRef(priv->conn);
 priv->nodedevConn = virObjectRef(priv->conn);
 priv->nwfilterConn = virObjectRef(priv->conn);
+priv->secretConn = virObjectRef(priv->conn);
 
 /* force update the @readonly attribute which was inherited from the
  * virNetServerService object - this is important for sockets that are RW
@@ -4047,12 +4050,12 @@ remoteDispatchSecretGetValue(virNetServerPtr server 
ATTRIBUTE_UNUSED,
 struct daemonClientPrivate *priv =
 virNetServerClientGetPrivateData(client);
 
-if (!priv->conn) {
+if (!priv->secretConn) {
 virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
 goto cleanup;
 }
 
-if (!(secret = get_nonnull_secret(priv->conn, args->secret)))
+if (!(secret = get_nonnull_secret(priv->secretConn, args->secret)))
 goto cleanup;
 
 if (!(value = virSecretGetValue(secret, _size, args->flags)))
@@ -6086,7 +6089,7 @@ 
remoteDispatchConnectSecretEventRegisterAny(virNetServerPtr server ATTRIBUTE_UNU
 virNetServerClientGetPrivateData(client);
 virSecretPtr secret = NULL;
 
-if (!priv->conn) {
+if (!priv->secretConn) {
 virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
 goto cleanup;
 }
@@ -6094,7 +6097,7 @@ 
remoteDispatchConnectSecretEventRegisterAny(virNetServerPtr server ATTRIBUTE_UNU
 virMutexLock(>lock);
 
 if (args->secret &&
-!(secret = get_nonnull_secret(priv->conn, *args->secret)))
+!(secret = get_nonnull_secret(priv->secretConn, *args->secret)))
 goto cleanup;
 
 if (args->eventID >= VIR_SECRET_EVENT_ID_LAST || args->eventID < 0) {
@@ -6120,7 +6123,7 @@ 
remoteDispatchConnectSecretEventRegisterAny(virNetServerPtr server ATTRIBUTE_UNU
callback) < 0)
 goto cleanup;
 
-if ((callbackID = virConnectSecretEventRegisterAny(priv->conn,
+if ((callbackID = virConnectSecretEventRegisterAny(priv->secretConn,
secret,
args->eventID,

secretEventCallbacks[args->eventID],
@@ -6158,7 +6161,7 @@ 
remoteDispatchConnectSecretEventDeregisterAny(virNetServerPtr server ATTRIBUTE_U
 struct daemonClientPrivate *priv =
 virNetServerClientGetPrivateData(client);
 
-if (!priv->conn) {
+if (!priv->secretConn) {
 virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
 goto cleanup;
 }
@@ -6176,7 +6179,7 @@ 
remoteDispatchConnectSecretEventDeregisterAny(virNetServerPtr server ATTRIBUTE_U
 goto cleanup;
 }
 
-if (virConnectSecretEventDeregisterAny(priv->conn, args->callbackID) < 0)
+if (virConnectSecretEventDeregisterAny(priv->secretConn, args->callbackID) 
< 0)
 goto cleanup;
 
 VIR_DELETE_ELEMENT(priv->secretEventCallbacks, i,
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index d8ab8b17dd..58de379c8a 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -137,6 +137,9 @@ sub get_conn_arg {
 if ($type =~ /remote_nonnull_nwfilter/) {

[libvirt] [PATCH 3/7] remote: use a separate connection for network APIs

2018-03-28 Thread Daniel P . Berrangé
Signed-off-by: Daniel P. Berrangé 
---
 src/remote/remote_daemon.h  |  1 +
 src/remote/remote_daemon_dispatch.c | 19 +++
 src/rpc/gendispatch.pl  |  6 ++
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/src/remote/remote_daemon.h b/src/remote/remote_daemon.h
index 31f433c15d..60be78fe0b 100644
--- a/src/remote/remote_daemon.h
+++ b/src/remote/remote_daemon.h
@@ -75,6 +75,7 @@ struct daemonClientPrivate {
  */
 virConnectPtr conn;
 virConnectPtr interfaceConn;
+virConnectPtr networkConn;
 
 daemonClientStreamPtr streams;
 };
diff --git a/src/remote/remote_daemon_dispatch.c 
b/src/remote/remote_daemon_dispatch.c
index 7971646c28..d0bc474850 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -1699,7 +1699,7 @@ remoteClientFreePrivateCallbacks(struct 
daemonClientPrivate *priv)
 DEREG_CB(priv->conn, priv->domainEventCallbacks,
  priv->ndomainEventCallbacks,
  virConnectDomainEventDeregisterAny, "domain");
-DEREG_CB(priv->conn, priv->networkEventCallbacks,
+DEREG_CB(priv->networkConn, priv->networkEventCallbacks,
  priv->nnetworkEventCallbacks,
  virConnectNetworkEventDeregisterAny, "network");
 DEREG_CB(priv->conn, priv->storageEventCallbacks,
@@ -1742,6 +1742,8 @@ void remoteClientFree(void *data)
 virConnectClose(priv->conn);
 if (priv->interfaceConn)
 virConnectClose(priv->interfaceConn);
+if (priv->networkConn)
+virConnectClose(priv->networkConn);
 
 VIR_FREE(priv);
 }
@@ -1817,6 +1819,7 @@ remoteDispatchConnectOpen(virNetServerPtr server 
ATTRIBUTE_UNUSED,
 goto cleanup;
 
 priv->interfaceConn = virObjectRef(priv->conn);
+priv->networkConn = virObjectRef(priv->conn);
 
 /* force update the @readonly attribute which was inherited from the
  * virNetServerService object - this is important for sockets that are RW
@@ -5713,7 +5716,7 @@ 
remoteDispatchConnectNetworkEventRegisterAny(virNetServerPtr server ATTRIBUTE_UN
 virNetServerClientGetPrivateData(client);
 virNetworkPtr net = NULL;
 
-if (!priv->conn) {
+if (!priv->networkConn) {
 virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
 goto cleanup;
 }
@@ -5721,7 +5724,7 @@ 
remoteDispatchConnectNetworkEventRegisterAny(virNetServerPtr server ATTRIBUTE_UN
 virMutexLock(>lock);
 
 if (args->net &&
-!(net = get_nonnull_network(priv->conn, *args->net)))
+!(net = get_nonnull_network(priv->networkConn, *args->net)))
 goto cleanup;
 
 if (args->eventID >= VIR_NETWORK_EVENT_ID_LAST || args->eventID < 0) {
@@ -5747,7 +5750,7 @@ 
remoteDispatchConnectNetworkEventRegisterAny(virNetServerPtr server ATTRIBUTE_UN
callback) < 0)
 goto cleanup;
 
-if ((callbackID = virConnectNetworkEventRegisterAny(priv->conn,
+if ((callbackID = virConnectNetworkEventRegisterAny(priv->networkConn,
 net,
 args->eventID,
 
networkEventCallbacks[args->eventID],
@@ -5786,7 +5789,7 @@ 
remoteDispatchConnectNetworkEventDeregisterAny(virNetServerPtr server ATTRIBUTE_
 struct daemonClientPrivate *priv =
 virNetServerClientGetPrivateData(client);
 
-if (!priv->conn) {
+if (!priv->networkConn) {
 virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
 goto cleanup;
 }
@@ -5804,7 +5807,7 @@ 
remoteDispatchConnectNetworkEventDeregisterAny(virNetServerPtr server ATTRIBUTE_
 goto cleanup;
 }
 
-if (virConnectNetworkEventDeregisterAny(priv->conn, args->callbackID) < 0)
+if (virConnectNetworkEventDeregisterAny(priv->networkConn, 
args->callbackID) < 0)
 goto cleanup;
 
 VIR_DELETE_ELEMENT(priv->networkEventCallbacks, i,
@@ -6467,12 +6470,12 @@ remoteDispatchNetworkGetDHCPLeases(virNetServerPtr 
server ATTRIBUTE_UNUSED,
 virNetworkPtr net = NULL;
 int nleases = 0;
 
-if (!priv->conn) {
+if (!priv->networkConn) {
 virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
 goto cleanup;
 }
 
-if (!(net = get_nonnull_network(priv->conn, args->net)))
+if (!(net = get_nonnull_network(priv->networkConn, args->net)))
 goto cleanup;
 
 if ((nleases = virNetworkGetDHCPLeases(net,
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index 23b17c0815..5bab13bb7b 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -128,6 +128,9 @@ sub get_conn_arg {
 if ($type =~ /remote_nonnull_interface/) {
 return "priv->interfaceConn";
 }
+if ($type =~ /remote_nonnull_network/) {
+return "priv->networkConn";
+}
 }
 
 # This is 

[libvirt] [PATCH 1/7] rpc: refactor way connection object is generated for remote dispatch

2018-03-28 Thread Daniel P . Berrangé
Calling a push_privconn method to directly push the connection object
name into the arg list is inconvenient. Refactor so that we acquire
the connection variable name upfront, and push it to the arg list
separately. This allows various hardcoded usage of "priv->conn" to
be parameterized.

Signed-off-by: Daniel P. Berrangé 
---
 src/rpc/gendispatch.pl | 48 ++--
 1 file changed, 22 insertions(+), 26 deletions(-)

diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index fb15cc4849..e11921f3d9 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -110,19 +110,13 @@ sub name_to_TypeName {
 return $typename;
 }
 
-sub push_privconn {
-my $args = shift;
-
-if (!@$args) {
-if ($structprefix eq "admin") {
-push(@$args, "priv->dmn");
-} else {
-push(@$args, "priv->conn");
-}
+sub get_conn_arg {
+if ($structprefix eq "admin") {
+return "priv->dmn";
 }
+return "priv->conn";
 }
 
-
 # Read the input file (usually remote_protocol.x) and form an
 # opinion about the name, args and return type of each RPC.
 my ($name, $ProcName, $id, $flags, %calls, @calls, %opts);
@@ -487,6 +481,8 @@ elsif ($mode eq "server") {
 my @free_list = ();
 my @free_list_on_error = ("virNetMessageSaveError(rerr);");
 
+my $conn = get_conn_arg();
+
 # handle arguments to the function
 if ($argtype ne "void") {
 # node device is special, as it's identified by name
@@ -497,7 +493,7 @@ elsif ($mode eq "server") {
 $has_node_device = 1;
 push(@vars_list, "virNodeDevicePtr dev = NULL");
 push(@getters_list,
- "if (!(dev = virNodeDeviceLookupByName(priv->conn, 
args->name)))\n" .
+ "if (!(dev = virNodeDeviceLookupByName($conn, 
args->name)))\n" .
  "goto cleanup;\n");
 push(@args_list, "dev");
 push(@free_list,
@@ -513,7 +509,7 @@ elsif ($mode eq "server") {
 
 push(@vars_list, "vir${type_name}Ptr $2 = NULL");
 push(@getters_list,
- "if (!($2 = get_nonnull_$1(priv->conn, 
args->$2)))\n" .
+ "if (!($2 = get_nonnull_$1($conn, args->$2)))\n" .
  "goto cleanup;\n");
 push(@args_list, "$2");
 push(@free_list,
@@ -522,7 +518,7 @@ elsif ($mode eq "server") {
 push(@vars_list, "virDomainPtr dom = NULL");
 push(@vars_list, "virDomainSnapshotPtr snapshot = NULL");
 push(@getters_list,
- "if (!(dom = get_nonnull_domain(priv->conn, 
args->${1}.dom)))\n" .
+ "if (!(dom = get_nonnull_domain($conn, 
args->${1}.dom)))\n" .
  "goto cleanup;\n" .
  "\n" .
  "if (!(snapshot = 
get_nonnull_domain_snapshot(dom, args->${1})))\n" .
@@ -532,11 +528,11 @@ elsif ($mode eq "server") {
  "virObjectUnref(snapshot);\n" .
  "virObjectUnref(dom);");
 } elsif ($args_member =~ 
m/^(?:(?:admin|remote)_string|remote_uuid) (\S+)<\S+>;/) {
-push_privconn(\@args_list);
+push(@args_list, $conn) if !@args_list;
 push(@args_list, "args->$1.$1_val");
 push(@args_list, "args->$1.$1_len");
 } elsif ($args_member =~ 
m/^(?:opaque|(?:admin|remote)_nonnull_string) (\S+)<\S+>;(.*)$/) {
-push_privconn(\@args_list);
+push(@args_list, $conn) if !@args_list;
 
 my $cast = "";
 my $arg_name = $1;
@@ -553,7 +549,7 @@ elsif ($mode eq "server") {
 push(@args_list, "${cast}args->$arg_name.${arg_name}_val");
 push(@args_list, "args->$arg_name.${arg_name}_len");
 } elsif ($args_member =~ m/^(?:unsigned )?int (\S+)<\S+>;/) {
-push_privconn(\@args_list);
+push(@args_list, $conn) if !@args_list;
 
 push(@args_list, "args->$1.$1_val");
 push(@args_list, "args->$1.$1_len");
@@ -561,7 +557,7 @@ elsif ($mode eq "server") {
 push(@vars_list, "virTypedParameterPtr $1 = NULL");
 push(@vars_list, "int n$1 = 0");
 if ($call->{ProcName} eq "NodeSetMemoryParameters") {
-push(@args_list, "priv->conn");
+push(@args_list, "$conn");
 }
 push(@args_list, "$1");
 push(@args_list, "n$1");
@@ -576,25 +572,25 @@ elsif ($mode eq "server") {
 

[libvirt] [PATCH 2/7] remote: use a separate connection for interface APIs

2018-03-28 Thread Daniel P . Berrangé
Signed-off-by: Daniel P. Berrangé 
---
 src/remote/remote_daemon.h  |  1 +
 src/remote/remote_daemon_dispatch.c |  4 
 src/rpc/gendispatch.pl  | 25 -
 3 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/src/remote/remote_daemon.h b/src/remote/remote_daemon.h
index 4467f71da9..31f433c15d 100644
--- a/src/remote/remote_daemon.h
+++ b/src/remote/remote_daemon.h
@@ -74,6 +74,7 @@ struct daemonClientPrivate {
  * called, it will be set back to NULL if that succeeds.
  */
 virConnectPtr conn;
+virConnectPtr interfaceConn;
 
 daemonClientStreamPtr streams;
 };
diff --git a/src/remote/remote_daemon_dispatch.c 
b/src/remote/remote_daemon_dispatch.c
index 121d114ae3..7971646c28 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -1740,6 +1740,8 @@ void remoteClientFree(void *data)
 
 if (priv->conn)
 virConnectClose(priv->conn);
+if (priv->interfaceConn)
+virConnectClose(priv->interfaceConn);
 
 VIR_FREE(priv);
 }
@@ -1814,6 +1816,8 @@ remoteDispatchConnectOpen(virNetServerPtr server 
ATTRIBUTE_UNUSED,
 if (priv->conn == NULL)
 goto cleanup;
 
+priv->interfaceConn = virObjectRef(priv->conn);
+
 /* force update the @readonly attribute which was inherited from the
  * virNetServerService object - this is important for sockets that are RW
  * by default, but do accept RO flags, e.g. TCP
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index e11921f3d9..23b17c0815 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -111,9 +111,32 @@ sub name_to_TypeName {
 }
 
 sub get_conn_arg {
+my $proc = shift;
+my $args = shift;
+my $rets = shift;
+
 if ($structprefix eq "admin") {
 return "priv->dmn";
 }
+
+my @types;
+push @types, @{$args} if $args;
+push @types, @{$rets} if $rets;
+
+# This correctly detects most APIs
+foreach my $type (@types) {
+if ($type =~ /remote_nonnull_interface/) {
+return "priv->interfaceConn";
+}
+}
+
+# This is for the few virConnect APIs that
+# return things which aren't objects. eg list
+# of pool names, or number of pools.
+if ($proc =~ /Connect.*Interface/ || $proc =~ /InterfaceChange/) {
+return "priv->interfaceConn";
+}
+
 return "priv->conn";
 }
 
@@ -481,7 +504,7 @@ elsif ($mode eq "server") {
 my @free_list = ();
 my @free_list_on_error = ("virNetMessageSaveError(rerr);");
 
-my $conn = get_conn_arg();
+my $conn = get_conn_arg($call->{ProcName}, $call->{args_members}, 
$call->{ret_members});
 
 # handle arguments to the function
 if ($argtype ne "void") {
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 4/7] remote: use a separate connection for nodedev APIs

2018-03-28 Thread Daniel P . Berrangé
Signed-off-by: Daniel P. Berrangé 
---
 src/remote/remote_daemon.h  |  1 +
 src/remote/remote_daemon_dispatch.c | 19 +++
 src/rpc/gendispatch.pl  |  6 ++
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/src/remote/remote_daemon.h b/src/remote/remote_daemon.h
index 60be78fe0b..517eec1fc2 100644
--- a/src/remote/remote_daemon.h
+++ b/src/remote/remote_daemon.h
@@ -76,6 +76,7 @@ struct daemonClientPrivate {
 virConnectPtr conn;
 virConnectPtr interfaceConn;
 virConnectPtr networkConn;
+virConnectPtr nodedevConn;
 
 daemonClientStreamPtr streams;
 };
diff --git a/src/remote/remote_daemon_dispatch.c 
b/src/remote/remote_daemon_dispatch.c
index d0bc474850..baa4f1eadc 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -1705,7 +1705,7 @@ remoteClientFreePrivateCallbacks(struct 
daemonClientPrivate *priv)
 DEREG_CB(priv->conn, priv->storageEventCallbacks,
  priv->nstorageEventCallbacks,
  virConnectStoragePoolEventDeregisterAny, "storage");
-DEREG_CB(priv->conn, priv->nodeDeviceEventCallbacks,
+DEREG_CB(priv->nodedevConn, priv->nodeDeviceEventCallbacks,
  priv->nnodeDeviceEventCallbacks,
  virConnectNodeDeviceEventDeregisterAny, "node device");
 DEREG_CB(priv->conn, priv->secretEventCallbacks,
@@ -1744,6 +1744,8 @@ void remoteClientFree(void *data)
 virConnectClose(priv->interfaceConn);
 if (priv->networkConn)
 virConnectClose(priv->networkConn);
+if (priv->nodedevConn)
+virConnectClose(priv->nodedevConn);
 
 VIR_FREE(priv);
 }
@@ -1820,6 +1822,7 @@ remoteDispatchConnectOpen(virNetServerPtr server 
ATTRIBUTE_UNUSED,
 
 priv->interfaceConn = virObjectRef(priv->conn);
 priv->networkConn = virObjectRef(priv->conn);
+priv->nodedevConn = virObjectRef(priv->conn);
 
 /* force update the @readonly attribute which was inherited from the
  * virNetServerService object - this is important for sockets that are RW
@@ -3779,12 +3782,12 @@ remoteDispatchNodeDeviceGetParent(virNetServerPtr 
server ATTRIBUTE_UNUSED,
 struct daemonClientPrivate *priv =
 virNetServerClientGetPrivateData(client);
 
-if (!priv->conn) {
+if (!priv->nodedevConn) {
 virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
 goto cleanup;
 }
 
-if (!(dev = virNodeDeviceLookupByName(priv->conn, args->name)))
+if (!(dev = virNodeDeviceLookupByName(priv->nodedevConn, args->name)))
 goto cleanup;
 
 parent = virNodeDeviceGetParent(dev);
@@ -5959,7 +5962,7 @@ 
remoteDispatchConnectNodeDeviceEventRegisterAny(virNetServerPtr server ATTRIBUTE
 virNetServerClientGetPrivateData(client);
 virNodeDevicePtr  dev = NULL;
 
-if (!priv->conn) {
+if (!priv->nodedevConn) {
 virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
 goto cleanup;
 }
@@ -5967,7 +5970,7 @@ 
remoteDispatchConnectNodeDeviceEventRegisterAny(virNetServerPtr server ATTRIBUTE
 virMutexLock(>lock);
 
 if (args->dev &&
-!(dev = get_nonnull_node_device(priv->conn, *args->dev)))
+!(dev = get_nonnull_node_device(priv->nodedevConn, *args->dev)))
 goto cleanup;
 
 if (args->eventID >= VIR_NODE_DEVICE_EVENT_ID_LAST || args->eventID < 0) {
@@ -5993,7 +5996,7 @@ 
remoteDispatchConnectNodeDeviceEventRegisterAny(virNetServerPtr server ATTRIBUTE
callback) < 0)
 goto cleanup;
 
-if ((callbackID = virConnectNodeDeviceEventRegisterAny(priv->conn,
+if ((callbackID = virConnectNodeDeviceEventRegisterAny(priv->nodedevConn,
dev,
args->eventID,

nodeDeviceEventCallbacks[args->eventID],
@@ -6031,7 +6034,7 @@ 
remoteDispatchConnectNodeDeviceEventDeregisterAny(virNetServerPtr server ATTRIBU
 struct daemonClientPrivate *priv =
 virNetServerClientGetPrivateData(client);
 
-if (!priv->conn) {
+if (!priv->nodedevConn) {
 virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
 goto cleanup;
 }
@@ -6049,7 +6052,7 @@ 
remoteDispatchConnectNodeDeviceEventDeregisterAny(virNetServerPtr server ATTRIBU
 goto cleanup;
 }
 
-if (virConnectNodeDeviceEventDeregisterAny(priv->conn, args->callbackID) < 
0)
+if (virConnectNodeDeviceEventDeregisterAny(priv->nodedevConn, 
args->callbackID) < 0)
 goto cleanup;
 
 VIR_DELETE_ELEMENT(priv->nodeDeviceEventCallbacks, i,
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index 5bab13bb7b..0e7567fbde 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -131,6 +131,9 @@ sub get_conn_arg {
 if ($type =~ /remote_nonnull_network/) {
 

[libvirt] [PATCH 5/7] remote: use a separate connection for nwfilter APIs

2018-03-28 Thread Daniel P . Berrangé
Signed-off-by: Daniel P. Berrangé 
---
 src/remote/remote_daemon.h  | 1 +
 src/remote/remote_daemon_dispatch.c | 3 +++
 src/rpc/gendispatch.pl  | 6 ++
 3 files changed, 10 insertions(+)

diff --git a/src/remote/remote_daemon.h b/src/remote/remote_daemon.h
index 517eec1fc2..1b906401d3 100644
--- a/src/remote/remote_daemon.h
+++ b/src/remote/remote_daemon.h
@@ -77,6 +77,7 @@ struct daemonClientPrivate {
 virConnectPtr interfaceConn;
 virConnectPtr networkConn;
 virConnectPtr nodedevConn;
+virConnectPtr nwfilterConn;
 
 daemonClientStreamPtr streams;
 };
diff --git a/src/remote/remote_daemon_dispatch.c 
b/src/remote/remote_daemon_dispatch.c
index baa4f1eadc..dcfc0abf46 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -1746,6 +1746,8 @@ void remoteClientFree(void *data)
 virConnectClose(priv->networkConn);
 if (priv->nodedevConn)
 virConnectClose(priv->nodedevConn);
+if (priv->nwfilterConn)
+virConnectClose(priv->nwfilterConn);
 
 VIR_FREE(priv);
 }
@@ -1823,6 +1825,7 @@ remoteDispatchConnectOpen(virNetServerPtr server 
ATTRIBUTE_UNUSED,
 priv->interfaceConn = virObjectRef(priv->conn);
 priv->networkConn = virObjectRef(priv->conn);
 priv->nodedevConn = virObjectRef(priv->conn);
+priv->nwfilterConn = virObjectRef(priv->conn);
 
 /* force update the @readonly attribute which was inherited from the
  * virNetServerService object - this is important for sockets that are RW
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index 0e7567fbde..d8ab8b17dd 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -134,6 +134,9 @@ sub get_conn_arg {
 if ($type =~ /remote_nonnull_node_device/) {
 return "priv->nodedevConn";
 }
+if ($type =~ /remote_nonnull_nwfilter/) {
+return "priv->nwfilterConn";
+}
 }
 
 # This is for the few virConnect APIs that
@@ -148,6 +151,9 @@ sub get_conn_arg {
 if ($proc =~ /Node.*Device/) {
 return "priv->nodedevConn";
 }
+if ($proc =~ /Connect.*NWFilter/) {
+return "priv->nodedevConn";
+}
 
 return "priv->conn";
 }
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 7/7] remote: use a separate connection for storage APIs

2018-03-28 Thread Daniel P . Berrangé
Signed-off-by: Daniel P. Berrangé 
---
 src/remote/remote_daemon.h  |  1 +
 src/remote/remote_daemon_dispatch.c | 17 ++---
 src/rpc/gendispatch.pl  |  6 ++
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/src/remote/remote_daemon.h b/src/remote/remote_daemon.h
index 2b757d9cd6..2834da04a9 100644
--- a/src/remote/remote_daemon.h
+++ b/src/remote/remote_daemon.h
@@ -79,6 +79,7 @@ struct daemonClientPrivate {
 virConnectPtr nodedevConn;
 virConnectPtr nwfilterConn;
 virConnectPtr secretConn;
+virConnectPtr storageConn;
 
 daemonClientStreamPtr streams;
 };
diff --git a/src/remote/remote_daemon_dispatch.c 
b/src/remote/remote_daemon_dispatch.c
index 1a30d73049..10d9d73ff0 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -1750,6 +1750,8 @@ void remoteClientFree(void *data)
 virConnectClose(priv->nwfilterConn);
 if (priv->secretConn)
 virConnectClose(priv->secretConn);
+if (priv->storageConn)
+virConnectClose(priv->storageConn);
 
 VIR_FREE(priv);
 }
@@ -1829,6 +1831,7 @@ remoteDispatchConnectOpen(virNetServerPtr server 
ATTRIBUTE_UNUSED,
 priv->nodedevConn = virObjectRef(priv->conn);
 priv->nwfilterConn = virObjectRef(priv->conn);
 priv->secretConn = virObjectRef(priv->conn);
+priv->storageConn = virObjectRef(priv->conn);
 
 /* force update the @readonly attribute which was inherited from the
  * virNetServerService object - this is important for sockets that are RW
@@ -5847,7 +5850,7 @@ 
remoteDispatchConnectStoragePoolEventRegisterAny(virNetServerPtr server ATTRIBUT
 virNetServerClientGetPrivateData(client);
 virStoragePoolPtr  pool = NULL;
 
-if (!priv->conn) {
+if (!priv->storageConn) {
 virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
 goto cleanup;
 }
@@ -5855,7 +5858,7 @@ 
remoteDispatchConnectStoragePoolEventRegisterAny(virNetServerPtr server ATTRIBUT
 virMutexLock(>lock);
 
 if (args->pool &&
-!(pool = get_nonnull_storage_pool(priv->conn, *args->pool)))
+!(pool = get_nonnull_storage_pool(priv->storageConn, *args->pool)))
 goto cleanup;
 
 if (args->eventID >= VIR_STORAGE_POOL_EVENT_ID_LAST || args->eventID < 0) {
@@ -5881,7 +5884,7 @@ 
remoteDispatchConnectStoragePoolEventRegisterAny(virNetServerPtr server ATTRIBUT
callback) < 0)
 goto cleanup;
 
-if ((callbackID = virConnectStoragePoolEventRegisterAny(priv->conn,
+if ((callbackID = virConnectStoragePoolEventRegisterAny(priv->storageConn,
 pool,
 args->eventID,
 
storageEventCallbacks[args->eventID],
@@ -5919,7 +5922,7 @@ 
remoteDispatchConnectStoragePoolEventDeregisterAny(virNetServerPtr server ATTRIB
 struct daemonClientPrivate *priv =
 virNetServerClientGetPrivateData(client);
 
-if (!priv->conn) {
+if (!priv->storageConn) {
 virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
 goto cleanup;
 }
@@ -5937,7 +5940,7 @@ 
remoteDispatchConnectStoragePoolEventDeregisterAny(virNetServerPtr server ATTRIB
 goto cleanup;
 }
 
-if (virConnectStoragePoolEventDeregisterAny(priv->conn, args->callbackID) 
< 0)
+if (virConnectStoragePoolEventDeregisterAny(priv->storageConn, 
args->callbackID) < 0)
 goto cleanup;
 
 VIR_DELETE_ELEMENT(priv->storageEventCallbacks, i,
@@ -6911,12 +6914,12 @@ remoteDispatchStorageVolGetInfoFlags(virNetServerPtr 
server ATTRIBUTE_UNUSED,
 struct daemonClientPrivate *priv =
 virNetServerClientGetPrivateData(client);
 
-if (!priv->conn) {
+if (!priv->storageConn) {
 virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
 goto cleanup;
 }
 
-if (!(vol = get_nonnull_storage_vol(priv->conn, args->vol)))
+if (!(vol = get_nonnull_storage_vol(priv->storageConn, args->vol)))
 goto cleanup;
 
 if (virStorageVolGetInfoFlags(vol, , args->flags) < 0)
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index 58de379c8a..656f66f1b5 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -140,6 +140,9 @@ sub get_conn_arg {
 if ($type =~ /remote_nonnull_secret/) {
 return "priv->secretConn";
 }
+if ($type =~ /remote_nonnull_storage/) {
+return "priv->storageConn";
+}
 }
 
 # This is for the few virConnect APIs that
@@ -159,6 +162,9 @@ sub get_conn_arg {
 }
 if ($proc =~ /Connect.*Secret/) {
 return "priv->secretConn";
+} 
+if ($proc =~ /Connect.*Storage/) {
+return "priv->storageConn";
 }
 
 return "priv->conn";
-- 
2.14.3

--
libvir-list mailing list

[libvirt] [PATCH 0/7] Prepare for daemon split

2018-03-28 Thread Daniel P . Berrangé
When we split up the daemons, libvirtd will need to forward different
sets of APIs to different daemons. This means libvirtd is going to need
to have multiple virConnectPtr instances open.

This series prepares for that by introducing "separate" connections,
which are actually just an extra reference on the current single
connection. This will facilitate later changes.

Daniel P. Berrangé (7):
  rpc: refactor way connection object is generated for remote dispatch
  remote: use a separate connection for interface APIs
  remote: use a separate connection for network APIs
  remote: use a separate connection for nodedev APIs
  remote: use a separate connection for nwfilter APIs
  remote: use a separate connection for secret APIs
  remote: use a separate connection for storage APIs

 src/remote/remote_daemon.h  |  6 +++
 src/remote/remote_daemon_dispatch.c | 81 +++
 src/rpc/gendispatch.pl  | 95 -
 3 files changed, 128 insertions(+), 54 deletions(-)

-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH] remote: remove outdated comment about Solaris

2018-03-28 Thread Daniel P . Berrangé
When removing a conditional in:

  commit da1ade7a52e040192c5e9396c15ec9225a0a2c48
  Author: Daniel P. Berrangé 
  Date:   Fri Mar 23 10:50:59 2018 +

remote: remove some __sun conditionals

the corresponding comment was mistakenly left behind.

Signed-off-by: Daniel P. Berrangé 
---

Pushed as trivial fix.

 src/remote/remote_driver.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 34e5ced0a9..325ef3fa3d 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -1344,9 +1344,7 @@ remoteConnectOpen(virConnectPtr conn,
 
 /*
  * If URI is NULL, then do a UNIX connection possibly auto-spawning
- * unprivileged server and probe remote server for URI. On Solaris,
- * this isn't supported, but we may be privileged enough to connect
- * to the UNIX socket anyway.
+ * unprivileged server and probe remote server for URI.
  */
 if (!conn->uri) {
 VIR_DEBUG("Auto-probe remote URI");
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] snip my name and email

2018-03-28 Thread Daniel P . Berrangé
On Mon, Mar 26, 2018 at 10:29:06AM +0300, David Kiarie wrote:
> I'd like to snip my name and email from these files

Any particular reason why ?  

> ---
>  src/xenconfig/xen_xl.c | 1 -
>  src/xenconfig/xen_xl.h | 1 -
>  2 files changed, 2 deletions(-)

It is also mentioned in test/xlconfigtest.c.

NB, your name & email are still recorded in git history and email
archives for eternity

Your name, but not email, is also mentioned in the news files,
and that file isn't one we'd want to remove since its relevant
historical record.

> 
> diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
> index e1ec8e7..a3f8af1 100644
> --- a/src/xenconfig/xen_xl.c
> +++ b/src/xenconfig/xen_xl.c
> @@ -17,7 +17,6 @@
>   * License along with this library.  If not, see
>   * .
>   *
> - * Author: Kiarie Kahurani 
>   * Author: Jim Fehlig 
>   */
>  
> diff --git a/src/xenconfig/xen_xl.h b/src/xenconfig/xen_xl.h
> index dd96326..8342f53 100644
> --- a/src/xenconfig/xen_xl.h
> +++ b/src/xenconfig/xen_xl.h
> @@ -17,7 +17,6 @@
>   * License along with this library.  If not, see
>   * .
>   *
> - * Author: Kiarie Kahurani
>   */
>  
>  #ifndef __VIR_XEN_XL_H__
> -- 
> 2.16.2
> 

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 1/2] libxl: drop support for Xen < 4.6

2018-03-28 Thread Daniel P . Berrangé
On Wed, Mar 28, 2018 at 08:10:34AM -0600, Jim Fehlig wrote:
> On 03/28/2018 07:28 AM, Daniel P. Berrangé wrote:
> > On Wed, Mar 28, 2018 at 10:03:51AM +0100, Daniel P. Berrangé wrote:
> > > On Tue, Mar 27, 2018 at 04:31:29PM -0600, Jim Fehlig wrote:
> > > > Currently the libxl driver claims support for Xen >= 4.4, but
> > > > Xen 4.4 and 4.5 are no longer supported upstream. Let's increase
> > > > the minimum supported version to 4.6.
> > > 
> > > Generally libvirt would keep supporting things even if upstream
> > > drops support, if some relevant distro still ships and supports
> > > it. RHEL doesn't ship libxl though, so just Q of whether these
> > > libxl versions are relevant to any Suse or Debian distros that
> > > are actively used.
> > 
> > BTW, if we're willing to drop old versions of Xen wrt the libxl
> > driver, shouldn't we first drop the legacy Xen driver which is
> > used with even older versions of Xen < 4.2 ?
> 
> Touche :-). I have a dusty patchset to do that too. Time to brush it off and
> nuke the old driver first.

Great, I look forward to seeing that, because it will simplify some work
I'm trying todo to cleanup the virDrvConnectOpen method impls.

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 1/2] libxl: drop support for Xen < 4.6

2018-03-28 Thread Jim Fehlig

On 03/28/2018 07:28 AM, Daniel P. Berrangé wrote:

On Wed, Mar 28, 2018 at 10:03:51AM +0100, Daniel P. Berrangé wrote:

On Tue, Mar 27, 2018 at 04:31:29PM -0600, Jim Fehlig wrote:

Currently the libxl driver claims support for Xen >= 4.4, but
Xen 4.4 and 4.5 are no longer supported upstream. Let's increase
the minimum supported version to 4.6.


Generally libvirt would keep supporting things even if upstream
drops support, if some relevant distro still ships and supports
it. RHEL doesn't ship libxl though, so just Q of whether these
libxl versions are relevant to any Suse or Debian distros that
are actively used.


BTW, if we're willing to drop old versions of Xen wrt the libxl
driver, shouldn't we first drop the legacy Xen driver which is
used with even older versions of Xen < 4.2 ?


Touche :-). I have a dusty patchset to do that too. Time to brush it off and 
nuke the old driver first.


Regards,
Jim

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 05/11] qemu: Add QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE

2018-03-28 Thread Andrea Bolognani
This capability will be set when the pcie-pci-bridge device
is available in the QEMU binary.

Signed-off-by: Andrea Bolognani 
---
 src/qemu/qemu_capabilities.c   | 2 ++
 src/qemu/qemu_capabilities.h   | 1 +
 tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml | 1 +
 tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml  | 1 +
 4 files changed, 5 insertions(+)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index e54dde69ab..840f520370 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -466,6 +466,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
   /* 285 */
   "virtio-mouse-ccw",
   "virtio-tablet-ccw",
+  "pcie-pci-bridge",
 );
 
 
@@ -1705,6 +1706,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
 { "virtio-keyboard-ccw", QEMU_CAPS_DEVICE_VIRTIO_KEYBOARD_CCW },
 { "virtio-mouse-ccw", QEMU_CAPS_DEVICE_VIRTIO_MOUSE_CCW },
 { "virtio-tablet-ccw", QEMU_CAPS_DEVICE_VIRTIO_TABLET_CCW },
+{ "pcie-pci-bridge", QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE },
 };
 
 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBalloon[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 3f3c29f8fb..50f359857c 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -450,6 +450,7 @@ typedef enum {
 /* 285 */
 QEMU_CAPS_DEVICE_VIRTIO_MOUSE_CCW, /* -device virtio-mouse-ccw */
 QEMU_CAPS_DEVICE_VIRTIO_TABLET_CCW, /* -device virtio-tablet-ccw */
+QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE, /* -device pcie-pci-bridge */
 
 QEMU_CAPS_LAST /* this must always be the last item */
 } virQEMUCapsFlags;
diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml 
b/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml
index ff48293656..5a42f951dc 100644
--- a/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml
@@ -187,6 +187,7 @@
   
   
   
+  
   2011090
   0
   342346
diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml 
b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml
index 334296e213..800b250f3f 100644
--- a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml
@@ -225,6 +225,7 @@
   
   
   
+  
   2011090
   0
   390060
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 10/11] news: Add 4.3.0 release

2018-03-28 Thread Andrea Bolognani
Signed-off-by: Andrea Bolognani 
---
 docs/news.xml | 8 
 1 file changed, 8 insertions(+)

diff --git a/docs/news.xml b/docs/news.xml
index 1088895746..20524bf537 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -33,6 +33,14 @@
  -->
 
 
+  
+
+
+
+
+
+
+  
   
 
   
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 04/11] conf: Rename virDomainPCIAddressSet.areMultipleRootsSupported

2018-03-28 Thread Andrea Bolognani
We're going to add a similarly-named attribute later, and we'd
like to be consistent.

Signed-off-by: Andrea Bolognani 
---
 src/conf/domain_addr.c | 2 +-
 src/conf/domain_addr.h | 2 +-
 src/qemu/qemu_domain_address.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index 18b6f8d588..e02d7ac614 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -413,7 +413,7 @@ virDomainPCIAddressSetGrow(virDomainPCIAddressSetPtr addrs,
  */
 
 if (flags & VIR_PCI_CONNECT_TYPE_PCI_DEVICE) {
-if (addrs->multipleRootsSupported) {
+if (addrs->areMultipleRootsSupported) {
 /* Use a pci-root controller to expand the guest's PCI
  * topology if it supports having more than one */
 model = VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT;
diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
index d3541bab09..87986c2bb7 100644
--- a/src/conf/domain_addr.h
+++ b/src/conf/domain_addr.h
@@ -115,7 +115,7 @@ struct _virDomainPCIAddressSet {
 bool dryRun;  /* on a dry run, new buses are auto-added
  and addresses aren't saved in device infos */
 /* If true, the guest can have multiple pci-root controllers */
-bool multipleRootsSupported;
+bool areMultipleRootsSupported;
 };
 typedef struct _virDomainPCIAddressSet virDomainPCIAddressSet;
 typedef virDomainPCIAddressSet *virDomainPCIAddressSetPtr;
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 37473ebf13..40fb540adc 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -1353,7 +1353,7 @@ qemuDomainPCIAddressSetCreate(virDomainDefPtr def,
 
 /* pSeries domains support multiple pci-root controllers */
 if (qemuDomainIsPSeries(def))
-addrs->multipleRootsSupported = true;
+addrs->areMultipleRootsSupported = true;
 
 for (i = 0; i < def->ncontrollers; i++) {
 virDomainControllerDefPtr cont = def->controllers[i];
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 09/11] tests: Use pcie-to-pci-bridge for aarch64-traditional-pci

2018-03-28 Thread Andrea Bolognani
Now that support for the pcie-to-pci-bridge controller has
been implemented, adding the QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE
capability to the existing test is enough to cause the guest
to use pcie-to-pci-bridge instead of dmi-to-pci-bridge.

Signed-off-by: Andrea Bolognani 
---
 tests/qemuxml2argvdata/aarch64-traditional-pci.args  |  7 ---
 tests/qemuxml2argvtest.c |  1 +
 tests/qemuxml2xmloutdata/aarch64-traditional-pci.xml | 16 
 tests/qemuxml2xmltest.c  |  1 +
 4 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/tests/qemuxml2argvdata/aarch64-traditional-pci.args 
b/tests/qemuxml2argvdata/aarch64-traditional-pci.args
index f10252f729..7ddd03e9e1 100644
--- a/tests/qemuxml2argvdata/aarch64-traditional-pci.args
+++ b/tests/qemuxml2argvdata/aarch64-traditional-pci.args
@@ -19,8 +19,9 @@ server,nowait \
 -mon chardev=charmonitor,id=monitor,mode=readline \
 -no-acpi \
 -boot c \
--device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1 \
--device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \
--device pcie-root-port,port=0x10,chassis=3,id=pci.3,bus=pcie.0,addr=0x2 \
+-device 
pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\
+addr=0x1 \
+-device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
+-device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
 -chardev pty,id=charserial0 \
 -device pci-serial,chardev=charserial0,id=serial0,bus=pci.2,addr=0x1
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 9a0d01e4f4..94b82d82d3 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2711,6 +2711,7 @@ mymain(void)
 QEMU_CAPS_PCI_MULTIFUNCTION,
 QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE,
 QEMU_CAPS_DEVICE_PCI_BRIDGE,
 QEMU_CAPS_DEVICE_PCI_SERIAL);
 
diff --git a/tests/qemuxml2xmloutdata/aarch64-traditional-pci.xml 
b/tests/qemuxml2xmloutdata/aarch64-traditional-pci.xml
index 70664aa4f9..e0807308d9 100644
--- a/tests/qemuxml2xmloutdata/aarch64-traditional-pci.xml
+++ b/tests/qemuxml2xmloutdata/aarch64-traditional-pci.xml
@@ -18,19 +18,19 @@
   
 /usr/bin/qemu-system-aarch64
 
-
-  
-  
+
+  
+  
+  
 
-
-  
-  
+
+  
   
 
 
   
-  
-  
+  
+  
 
 
   
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 49b61d7647..3880c1d122 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1123,6 +1123,7 @@ mymain(void)
 QEMU_CAPS_PCI_MULTIFUNCTION,
 QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE,
 QEMU_CAPS_DEVICE_PCI_BRIDGE,
 QEMU_CAPS_DEVICE_PCI_SERIAL);
 DO_TEST("aarch64-video-default",
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 00/11] qemu: Implement pcie-to-pci-bridge controller

2018-03-28 Thread Andrea Bolognani
Patches 1-4 are cleanups and preparation. For more information,
take a peek at patch 8's commit message, which also includes a
link to the relevant Bugzilla entry.

Andrea Bolognani (11):
  docs: Tweak PCI controller model documentation
  tests: Add aarch64-traditional-pci test
  conf: Remove dubious code from virDomainPCIAddressSetGrow()
  conf: Rename virDomainPCIAddressSet.areMultipleRootsSupported
  qemu: Add QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE
  qemu: Implement pcie-to-pci-bridge controller
  conf: Add virDomainPCIAddressSet.isPCIeToPCIBridgeSupported
  conf: Prefer pcie-to-pci-bridge to dmi-to-pci-bridge
  tests: Use pcie-to-pci-bridge for aarch64-traditional-pci
  news: Add 4.3.0 release
  news: Update for pcie-to-pci-bridge support

 docs/formatdomain.html.in  | 21 ++---
 docs/news.xml  | 17 
 docs/schemas/domaincommon.rng  |  3 +
 src/conf/domain_addr.c | 95 --
 src/conf/domain_addr.h |  8 +-
 src/conf/domain_conf.c |  3 +
 src/conf/domain_conf.h |  2 +
 src/qemu/qemu_capabilities.c   |  2 +
 src/qemu/qemu_capabilities.h   |  1 +
 src/qemu/qemu_command.c|  1 +
 src/qemu/qemu_domain.c | 17 
 src/qemu/qemu_domain_address.c | 14 +++-
 tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml |  1 +
 tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml  |  1 +
 .../qemuxml2argvdata/aarch64-traditional-pci.args  | 27 ++
 tests/qemuxml2argvdata/aarch64-traditional-pci.xml | 19 +
 tests/qemuxml2argvtest.c   |  9 ++
 .../qemuxml2xmloutdata/aarch64-traditional-pci.xml | 43 ++
 tests/qemuxml2xmltest.c|  9 ++
 19 files changed, 251 insertions(+), 42 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/aarch64-traditional-pci.args
 create mode 100644 tests/qemuxml2argvdata/aarch64-traditional-pci.xml
 create mode 100644 tests/qemuxml2xmloutdata/aarch64-traditional-pci.xml

-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 11/11] news: Update for pcie-to-pci-bridge support

2018-03-28 Thread Andrea Bolognani
Signed-off-by: Andrea Bolognani 
---
 docs/news.xml | 9 +
 1 file changed, 9 insertions(+)

diff --git a/docs/news.xml b/docs/news.xml
index 20524bf537..f8b4584f70 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -35,6 +35,15 @@
 
   
 
+  
+
+  qemu: Add support for the pcie-to-pci-bridge controller
+
+
+  Pure PCIe guests such as x86_64/q35 and aarch64/virt will now
+  add this controller when traditional PCI devices are in use.
+
+  
 
 
 
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 07/11] conf: Add virDomainPCIAddressSet.isPCIeToPCIBridgeSupported

2018-03-28 Thread Andrea Bolognani
Just like the existing areMultipleRootsSupported, this will
allow us to change the results of the driver-agnostic PCI
address allocation logic based on whether the QEMU binary
supports certain features.

Signed-off-by: Andrea Bolognani 
---
 src/conf/domain_addr.h | 2 ++
 src/qemu/qemu_domain_address.c | 8 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
index 87248a4fb8..3236b7d6de 100644
--- a/src/conf/domain_addr.h
+++ b/src/conf/domain_addr.h
@@ -118,6 +118,8 @@ struct _virDomainPCIAddressSet {
  and addresses aren't saved in device infos */
 /* If true, the guest can have multiple pci-root controllers */
 bool areMultipleRootsSupported;
+/* If true, the guest can use the pcie-to-pci-bridge controller */
+bool isPCIeToPCIBridgeSupported;
 };
 typedef struct _virDomainPCIAddressSet virDomainPCIAddressSet;
 typedef virDomainPCIAddressSet *virDomainPCIAddressSetPtr;
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 86d9807908..7fe9d5926c 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -1338,6 +1338,7 @@ qemuDomainCollectPCIAddress(virDomainDefPtr def 
ATTRIBUTE_UNUSED,
 
 static virDomainPCIAddressSetPtr
 qemuDomainPCIAddressSetCreate(virDomainDefPtr def,
+  virQEMUCapsPtr qemuCaps,
   unsigned int nbuses,
   bool dryRun)
 {
@@ -1355,6 +1356,9 @@ qemuDomainPCIAddressSetCreate(virDomainDefPtr def,
 if (qemuDomainIsPSeries(def))
 addrs->areMultipleRootsSupported = true;
 
+if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE))
+addrs->isPCIeToPCIBridgeSupported = true;
+
 for (i = 0; i < def->ncontrollers; i++) {
 virDomainControllerDefPtr cont = def->controllers[i];
 size_t idx = cont->idx;
@@ -2361,7 +2365,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
 
 if (nbuses > 0) {
 /* 1st pass to figure out how many PCI bridges we need */
-if (!(addrs = qemuDomainPCIAddressSetCreate(def, nbuses, true)))
+if (!(addrs = qemuDomainPCIAddressSetCreate(def, qemuCaps, nbuses, 
true)))
 goto cleanup;
 
 if (qemuDomainValidateDevicePCISlotsChipsets(def, qemuCaps,
@@ -2491,7 +2495,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
 addrs = NULL;
 }
 
-if (!(addrs = qemuDomainPCIAddressSetCreate(def, nbuses, false)))
+if (!(addrs = qemuDomainPCIAddressSetCreate(def, qemuCaps, nbuses, false)))
 goto cleanup;
 
 if (qemuDomainSupportsPCI(def, qemuCaps)) {
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 06/11] qemu: Implement pcie-to-pci-bridge controller

2018-03-28 Thread Andrea Bolognani
The new controller will not yet be used automatically by
libvirt, but at this point it's already possible to configure
a guest to use it.

Signed-off-by: Andrea Bolognani 
---
 docs/formatdomain.html.in  |  3 ++-
 docs/schemas/domaincommon.rng  |  3 +++
 src/conf/domain_addr.c | 25 -
 src/conf/domain_addr.h |  4 +++-
 src/conf/domain_conf.c |  3 +++
 src/conf/domain_conf.h |  2 ++
 src/qemu/qemu_command.c|  1 +
 src/qemu/qemu_domain.c | 17 +
 src/qemu/qemu_domain_address.c |  4 
 9 files changed, 55 insertions(+), 7 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 299d7b9d42..fa5a0fff8a 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3942,7 +3942,8 @@
   pcie-root-port, pcie-switch-upstream-port and
   pcie-switch-downstream-port (since
   1.2.19), pci-expander-bus and
-  pcie-expander-bus (since 1.3.4).
+  pcie-expander-bus (since 1.3.4),
+  pcie-to-pci-bridge (since 4.3.0).
   The root controllers (pci-root
   and pcie-root) have an
   optional pcihole64 element specifying how big (in
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 8165e699d6..85ba95d5f6 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2102,6 +2102,8 @@
 pci-bridge
 
 i82801b11-bridge
+
+pcie-pci-bridge
 
 ioh3420
 pcie-root-port
@@ -2172,6 +2174,7 @@
   
 pci-bridge
 dmi-to-pci-bridge
+pcie-to-pci-bridge
 pcie-root-port
 pcie-switch-upstream-port
 pcie-switch-downstream-port
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index e02d7ac614..b0709f8295 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -62,6 +62,9 @@ 
virDomainPCIControllerModelToConnectType(virDomainControllerModelPCI model)
 case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE:
 return VIR_PCI_CONNECT_TYPE_DMI_TO_PCI_BRIDGE;
 
+case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_TO_PCI_BRIDGE:
+return VIR_PCI_CONNECT_TYPE_PCIE_TO_PCI_BRIDGE;
+
 case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
 return VIR_PCI_CONNECT_TYPE_PCIE_ROOT_PORT | 
VIR_PCI_CONNECT_AGGREGATE_SLOT;
 
@@ -160,6 +163,8 @@ virDomainPCIAddressFlagsCompatible(virPCIDeviceAddressPtr 
addr,
 connectStr = "pci-switch-downstream-port";
 } else if (devFlags & VIR_PCI_CONNECT_TYPE_DMI_TO_PCI_BRIDGE) {
 connectStr = "dmi-to-pci-bridge";
+} else if (devFlags & VIR_PCI_CONNECT_TYPE_PCIE_TO_PCI_BRIDGE) {
+connectStr = "pcie-to-pci-bridge";
 } else if (devFlags & VIR_PCI_CONNECT_TYPE_PCI_EXPANDER_BUS) {
 connectStr = "pci-expander-bus";
 } else if (devFlags & VIR_PCI_CONNECT_TYPE_PCIE_EXPANDER_BUS) {
@@ -316,14 +321,24 @@ virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr 
bus,
 bus->minSlot = 0;
 bus->maxSlot = VIR_PCI_ADDRESS_SLOT_LAST;
 break;
+case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_TO_PCI_BRIDGE:
+/* Same as pci-bridge: 32 hotpluggable traditional PCI slots (0-31),
+ * the first of which is not usable because of the SHPC */
+bus->flags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
+  VIR_PCI_CONNECT_TYPE_PCI_DEVICE |
+  VIR_PCI_CONNECT_TYPE_PCI_BRIDGE);
+bus->minSlot = 1;
+bus->maxSlot = VIR_PCI_ADDRESS_SLOT_LAST;
+break;
 case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
 case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT:
 /* provides one slot which is pcie, can be used by endpoint
- * devices and pcie-switch-upstream-ports, and is hotpluggable
- */
-bus->flags = VIR_PCI_CONNECT_TYPE_PCIE_DEVICE
-   | VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_UPSTREAM_PORT
-   | VIR_PCI_CONNECT_HOTPLUGGABLE;
+ * devices, pcie-switch-upstream-ports or pcie-to-pci-bridges,
+ * and is hotpluggable */
+bus->flags = (VIR_PCI_CONNECT_HOTPLUGGABLE |
+  VIR_PCI_CONNECT_TYPE_PCIE_DEVICE |
+  VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_UPSTREAM_PORT |
+  VIR_PCI_CONNECT_TYPE_PCIE_TO_PCI_BRIDGE);
 bus->minSlot = 0;
 bus->maxSlot = 0;
 break;
diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
index 87986c2bb7..87248a4fb8 100644
--- a/src/conf/domain_addr.h
+++ b/src/conf/domain_addr.h
@@ -49,6 +49,7 @@ typedef enum {
VIR_PCI_CONNECT_TYPE_PCI_EXPANDER_BUS = 1 << 8,
VIR_PCI_CONNECT_TYPE_PCIE_EXPANDER_BUS = 1 << 9,
VIR_PCI_CONNECT_TYPE_PCI_BRIDGE = 1 << 10,
+   

[libvirt] [PATCH 08/11] conf: Prefer pcie-to-pci-bridge to dmi-to-pci-bridge

2018-03-28 Thread Andrea Bolognani
Both pcie-to-pci-bridge and dmi-to-pci-bridge can be used to
create a traditional PCI topology in a pure PCIe guest such as
those using the x86_64/q35 or aarch64/virt machine type;
however, the former should be preferred, as it doesn't need to
obey limitation of real hardware and is completely
architecture-agnostic.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1520821

Signed-off-by: Andrea Bolognani 
---
 src/conf/domain_addr.c | 59 +-
 1 file changed, 49 insertions(+), 10 deletions(-)

diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index b0709f8295..8964973e03 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -416,6 +416,7 @@ virDomainPCIAddressSetGrow(virDomainPCIAddressSetPtr addrs,
 size_t i;
 int model;
 bool needDMIToPCIBridge = false;
+bool needPCIeToPCIBridge = false;
 
 add = addr->bus - addrs->nbuses + 1;
 if (add <= 0)
@@ -436,27 +437,41 @@ virDomainPCIAddressSetGrow(virDomainPCIAddressSetPtr 
addrs,
 model = VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE;
 
 /* if there aren't yet any buses that will accept a
- * pci-bridge, and the caller is asking for one, we'll need to
- * add a dmi-to-pci-bridge first.
+ * pci-bridge, but we need one for the device's PCI address
+ * to make sense, it means the guest only has a PCIe topology
+ * configured so far, and we need to create a traditional PCI
+ * topology to accomodate the new device.
  */
 needDMIToPCIBridge = true;
+needPCIeToPCIBridge = true;
 for (i = 0; i < addrs->nbuses; i++) {
 if (addrs->buses[i].flags & VIR_PCI_CONNECT_TYPE_PCI_BRIDGE) {
 needDMIToPCIBridge = false;
+needPCIeToPCIBridge = false;
 break;
 }
 }
-if (needDMIToPCIBridge && add == 1) {
+
+/* Prefer pcie-to-pci-bridge, fall back to dmi-to-pci-bridge */
+if (addrs->isPCIeToPCIBridgeSupported)
+needDMIToPCIBridge = false;
+else
+needPCIeToPCIBridge = false;
+
+if ((needDMIToPCIBridge || needPCIeToPCIBridge) && add == 1) {
 /* We need to add a single pci-bridge to provide the bus
  * our legacy PCI device will be plugged into; however, we
  * have also determined that there isn't yet any proper
- * place to connect that pci-bridge we're about to add (on
- * a system with pcie-root, that "proper place" would be a
- * dmi-to-pci-bridge". So, to give the pci-bridge a place
- * to connect, we increase the count of buses to add,
- * while also incrementing the bus number in the address
- * for the device (since the pci-bridge will now be at an
- * index 1 higher than the caller had anticipated).
+ * place to connect that pci-bridge we're about to add,
+ * which means we're dealing with a pure PCIe guest. We
+ * need to create a traditional PCI topology, and for that
+ * we have two options: dmi-to-pci-bridge + pci-bridge or
+ * pcie-root-port + pcie-to-pci-bridge (the latter of which
+ * is pretty much a pci-bridge as far as devices attached
+ * to it are concerned and as such makes the pci-bridge
+ * unnecessary). Either way, there's going to be one more
+ * controller than initially expected, and the 'bus' part
+ * of the device's address will need to be bumped.
  */
 add++;
 addr->bus++;
@@ -525,6 +540,30 @@ virDomainPCIAddressSetGrow(virDomainPCIAddressSetPtr addrs,
 }
 }
 
+if (needPCIeToPCIBridge) {
+/* We need a pcie-root-port to plug pcie-to-pci-bridge into; however,
+ * qemuDomainAssignPCIAddresses() will, in some cases, create a dummy
+ * PCIe device and reserve an address for it in order to leave the
+ * user with an empty pcie-root-port ready for hotplugging, and if
+ * we didn't do anything other than adding the pcie-root-port here
+ * it would be used for that, which we don't want. So we change the
+ * connect flags to make sure only the pcie-to-pci-bridge will be
+ * connected to the pcie-root-port we just added, and another one
+ * will be allocated for the dummy PCIe device later on.
+ */
+if (virDomainPCIAddressBusSetModel(>buses[i],
+   
VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT) < 0) {
+return -1;
+}
+addrs->buses[i].flags = VIR_PCI_CONNECT_TYPE_PCIE_TO_PCI_BRIDGE;
+

[libvirt] [PATCH 02/11] tests: Add aarch64-traditional-pci test

2018-03-28 Thread Andrea Bolognani
This test shows what happens when you add a traditional PCI
device such as pci-serial to a pure PCIe machine type such
as aarch64/virt.

Signed-off-by: Andrea Bolognani 
---
 .../qemuxml2argvdata/aarch64-traditional-pci.args  | 26 +
 tests/qemuxml2argvdata/aarch64-traditional-pci.xml | 19 ++
 tests/qemuxml2argvtest.c   |  8 
 .../qemuxml2xmloutdata/aarch64-traditional-pci.xml | 43 ++
 tests/qemuxml2xmltest.c|  8 
 5 files changed, 104 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/aarch64-traditional-pci.args
 create mode 100644 tests/qemuxml2argvdata/aarch64-traditional-pci.xml
 create mode 100644 tests/qemuxml2xmloutdata/aarch64-traditional-pci.xml

diff --git a/tests/qemuxml2argvdata/aarch64-traditional-pci.args 
b/tests/qemuxml2argvdata/aarch64-traditional-pci.args
new file mode 100644
index 00..f10252f729
--- /dev/null
+++ b/tests/qemuxml2argvdata/aarch64-traditional-pci.args
@@ -0,0 +1,26 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-aarch64 \
+-name guest \
+-S \
+-M virt \
+-m 1024 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 496d7ea8-9739-544b-4ebd-ef08be936e8b \
+-nographic \
+-nodefconfig \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-guest/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline \
+-no-acpi \
+-boot c \
+-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1 \
+-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \
+-device pcie-root-port,port=0x10,chassis=3,id=pci.3,bus=pcie.0,addr=0x2 \
+-chardev pty,id=charserial0 \
+-device pci-serial,chardev=charserial0,id=serial0,bus=pci.2,addr=0x1
diff --git a/tests/qemuxml2argvdata/aarch64-traditional-pci.xml 
b/tests/qemuxml2argvdata/aarch64-traditional-pci.xml
new file mode 100644
index 00..8c87a27f6e
--- /dev/null
+++ b/tests/qemuxml2argvdata/aarch64-traditional-pci.xml
@@ -0,0 +1,19 @@
+
+  guest
+  496d7ea8-9739-544b-4ebd-ef08be936e8b
+  1048576
+  1
+  
+hvm
+  
+  
+/usr/bin/qemu-system-aarch64
+
+
+
+  
+
+
+  
+
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 308d71f725..9a0d01e4f4 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2705,6 +2705,14 @@ mymain(void)
 QEMU_CAPS_DEVICE_PCI_BRIDGE,
 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
 QEMU_CAPS_DEVICE_PCIE_ROOT_PORT);
+DO_TEST("aarch64-traditional-pci",
+QEMU_CAPS_NODEFCONFIG,
+QEMU_CAPS_OBJECT_GPEX,
+QEMU_CAPS_PCI_MULTIFUNCTION,
+QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
+QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+QEMU_CAPS_DEVICE_PCI_BRIDGE,
+QEMU_CAPS_DEVICE_PCI_SERIAL);
 
 /* Make sure all combinations of ACPI and UEFI behave as expected */
 DO_TEST("aarch64-acpi-uefi", NONE);
diff --git a/tests/qemuxml2xmloutdata/aarch64-traditional-pci.xml 
b/tests/qemuxml2xmloutdata/aarch64-traditional-pci.xml
new file mode 100644
index 00..70664aa4f9
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/aarch64-traditional-pci.xml
@@ -0,0 +1,43 @@
+
+  guest
+  496d7ea8-9739-544b-4ebd-ef08be936e8b
+  1048576
+  1048576
+  1
+  
+hvm
+
+  
+  
+
+  
+  
+  destroy
+  restart
+  destroy
+  
+/usr/bin/qemu-system-aarch64
+
+
+  
+  
+
+
+  
+  
+  
+
+
+  
+  
+  
+
+
+  
+
+  
+  
+
+
+  
+
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 0f560290a0..49b61d7647 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1117,6 +1117,14 @@ mymain(void)
 QEMU_CAPS_DEVICE_PCI_BRIDGE,
 QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
 QEMU_CAPS_DEVICE_PCIE_ROOT_PORT);
+DO_TEST("aarch64-traditional-pci",
+QEMU_CAPS_NODEFCONFIG,
+QEMU_CAPS_OBJECT_GPEX,
+QEMU_CAPS_PCI_MULTIFUNCTION,
+QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
+QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+QEMU_CAPS_DEVICE_PCI_BRIDGE,
+QEMU_CAPS_DEVICE_PCI_SERIAL);
 DO_TEST("aarch64-video-default",
 QEMU_CAPS_NODEFCONFIG,
 QEMU_CAPS_OBJECT_GPEX,
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 01/11] docs: Tweak PCI controller model documentation

2018-03-28 Thread Andrea Bolognani
Instead of first listing the models on their own, and then
listing them again grouped by the libvirt release they were
introduced in, have a single list.

Signed-off-by: Andrea Bolognani 
---
 docs/formatdomain.html.in | 20 
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 08dc74b6b9..299d7b9d42 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3936,18 +3936,14 @@
 
 
   PCI controllers have an optional model attribute with
-  possible values pci-root, pcie-root,
-  pcie-root-port, pci-bridge,
-  dmi-to-pci-bridge, pcie-switch-upstream-port,
-  pcie-switch-downstream-port, pci-expander-bus,
-  or pcie-expander-bus.  (pci-root and
-  pci-bridge since 1.0.5, pcie-root and
-  dmi-to-pci-bridge since 1.1.2,
-  pcie-root-port, pcie-switch-upstream-port,
-  pcie-switch-downstream-port since
-  1.2.19, and pci-expander-bus and
-  pcie-expander-bus since 1.3.4) The
-  root controllers (pci-root
+  possible values pci-root and pci-bridge
+  (since 1.0.5), pcie-root and
+  dmi-to-pci-bridge (since 1.1.2),
+  pcie-root-port, pcie-switch-upstream-port and
+  pcie-switch-downstream-port (since
+  1.2.19), pci-expander-bus and
+  pcie-expander-bus (since 1.3.4).
+  The root controllers (pci-root
   and pcie-root) have an
   optional pcihole64 element specifying how big (in
   kilobytes, or in the unit specified by pcihole64's
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 03/11] conf: Remove dubious code from virDomainPCIAddressSetGrow()

2018-03-28 Thread Andrea Bolognani
I haven't been able to come up with a single scenario in which
the code in question would be executed; even if there was one,
it would be due to the user specifying a *partial* PCI topology
in the guest XML, which is of course entirely unsupportable and
thus providing even the slightest hint that doing so is in any
way a good idea is actively harmful.

Signed-off-by: Andrea Bolognani 
---
 src/conf/domain_addr.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index 0c914fe25c..18b6f8d588 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -447,15 +447,6 @@ virDomainPCIAddressSetGrow(virDomainPCIAddressSetPtr addrs,
 addr->bus++;
 }
 }
-} else if (flags & VIR_PCI_CONNECT_TYPE_PCI_BRIDGE &&
-   addrs->buses[0].model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) 
{
-/* NB: if the root bus is pci-root, and we couldn't find an
- * open place to connect a pci-bridge, then there is nothing
- * we can do (since the only way to gain a new slot that
- * accepts a pci-bridge is to add *a pci-bridge* (which is the
- * reason we're here in the first place!)
- */
-model = VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE;
 } else if (flags & (VIR_PCI_CONNECT_TYPE_PCIE_DEVICE |
 VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_UPSTREAM_PORT)) {
 model = VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT;
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] virNetSocketNewListenTCP tries just one address

2018-03-28 Thread Olaf Hering
On Tue, Mar 27, Ján Tomko wrote:

> It cannot, but the admin of the network should be able to control both.

The admin must not control my (test) host, nor must I control the DNS
server in the network. But there are likely cases where the admin for
DNS and libvirtd is the same person.

> How can libvirt tell whether this is a misconfiguration of DNS or host's
> interfaces?

By simply cycling through the 'runp' list to see if any bind() succeeds?

Olaf


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 1/2] libxl: drop support for Xen < 4.6

2018-03-28 Thread Daniel P . Berrangé
On Wed, Mar 28, 2018 at 10:03:51AM +0100, Daniel P. Berrangé wrote:
> On Tue, Mar 27, 2018 at 04:31:29PM -0600, Jim Fehlig wrote:
> > Currently the libxl driver claims support for Xen >= 4.4, but
> > Xen 4.4 and 4.5 are no longer supported upstream. Let's increase
> > the minimum supported version to 4.6.
> 
> Generally libvirt would keep supporting things even if upstream
> drops support, if some relevant distro still ships and supports
> it. RHEL doesn't ship libxl though, so just Q of whether these
> libxl versions are relevant to any Suse or Debian distros that
> are actively used.

BTW, if we're willing to drop old versions of Xen wrt the libxl
driver, shouldn't we first drop the legacy Xen driver which is
used with even older versions of Xen < 4.2 ?

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v2 0/3] Introduce hot plug support for mediated devices

2018-03-28 Thread Erik Skultety
On Wed, Mar 28, 2018 at 03:13:02PM +0200, Peter Krempa wrote:
> On Wed, Mar 28, 2018 at 15:02:33 +0200, Erik Skultety wrote:
> > Libvirt shouldn't forbid the operation as unsupported. In fact, from VFIO 
> > point
> > of view, mdevs have supported hot plug since the beginning. Then it's up to 
> > the
> > 3rd party vendor driver whether it can cope with this feature reliably or 
> > not.
> >
> > Since v1 [1]:
> > - dropped the original patch 1 as that adjustment can be done in a bigger 
> > scale
> > across multiple modules as part of a 'bite-sized' task
> > - reworded commit message for patches 2 and 3
> > - fixed the error path in patch 1 where I mistakenly tried to re-attach all 
> > host
> > devices for a domain if the hotplug of an mdev failed
>
> ACK series

Thanks, I'll merge this once 4.2 is out.
Erik


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH v2 0/3] Introduce hot plug support for mediated devices

2018-03-28 Thread Peter Krempa
On Wed, Mar 28, 2018 at 15:02:33 +0200, Erik Skultety wrote:
> Libvirt shouldn't forbid the operation as unsupported. In fact, from VFIO 
> point
> of view, mdevs have supported hot plug since the beginning. Then it's up to 
> the
> 3rd party vendor driver whether it can cope with this feature reliably or not.
> 
> Since v1 [1]:
> - dropped the original patch 1 as that adjustment can be done in a bigger 
> scale
> across multiple modules as part of a 'bite-sized' task
> - reworded commit message for patches 2 and 3
> - fixed the error path in patch 1 where I mistakenly tried to re-attach all 
> host
> devices for a domain if the hotplug of an mdev failed

ACK series


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH v2 2/3] qemu: hotplug: Introduce hot unplug for mediated devices

2018-03-28 Thread Erik Skultety
Mediated devices support hot-{plug,unplug} since their introduction in
kernel 4.10, however libvirt has still been missing support for this.

Signed-off-by: Erik Skultety 
---
 src/qemu/qemu_hotplug.c | 47 +++
 1 file changed, 47 insertions(+)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 92e4d1cc9..ea94f7d2b 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -4030,6 +4030,17 @@ qemuDomainRemoveSCSIVHostDevice(virQEMUDriverPtr driver,
 qemuHostdevReAttachSCSIVHostDevices(driver, vm->def->name, , 1);
 }
 
+
+static void
+qemuDomainRemoveMediatedDevice(virQEMUDriverPtr driver,
+   virDomainObjPtr vm,
+   virDomainHostdevDefPtr hostdev)
+{
+qemuHostdevReAttachMediatedDevices(driver, vm->def->name, , 1);
+qemuDomainReleaseDeviceAddress(vm, hostdev->info, NULL);
+}
+
+
 static int
 qemuDomainRemoveHostDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm,
@@ -4132,6 +4143,7 @@ qemuDomainRemoveHostDevice(virQEMUDriverPtr driver,
 qemuDomainRemoveSCSIVHostDevice(driver, vm, hostdev);
 break;
 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
+qemuDomainRemoveMediatedDevice(driver, vm, hostdev);
 break;
 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
 break;
@@ -5059,6 +5071,32 @@ qemuDomainDetachSCSIVHostDevice(virQEMUDriverPtr driver,
 return ret;
 }
 
+
+static int
+qemuDomainDetachMediatedDevice(virQEMUDriverPtr driver,
+   virDomainObjPtr vm,
+   virDomainHostdevDefPtr detach)
+{
+int ret = -1;
+qemuDomainObjPrivatePtr priv = vm->privateData;
+
+if (!detach->info->alias) {
+virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+   _("device cannot be detached without a device alias"));
+return -1;
+}
+
+qemuDomainMarkDeviceForRemoval(vm, detach->info);
+
+qemuDomainObjEnterMonitor(driver, vm);
+ret = qemuMonitorDelDevice(priv->mon, detach->info->alias);
+if (qemuDomainObjExitMonitor(driver, vm) < 0)
+ret = -1;
+
+return ret;
+}
+
+
 static int
 qemuDomainDetachThisHostDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm,
@@ -5082,6 +5120,9 @@ qemuDomainDetachThisHostDevice(virQEMUDriverPtr driver,
 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
 ret = qemuDomainDetachSCSIVHostDevice(driver, vm, detach);
 break;
+case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
+ret = qemuDomainDetachMediatedDevice(driver, vm, detach);
+break;
 default:
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("hot unplug is not supported for hostdev subsys type 
'%s'"),
@@ -5111,6 +5152,7 @@ int qemuDomainDetachHostDevice(virQEMUDriverPtr driver,
 virDomainHostdevSubsysUSBPtr usbsrc = >u.usb;
 virDomainHostdevSubsysPCIPtr pcisrc = >u.pci;
 virDomainHostdevSubsysSCSIPtr scsisrc = >u.scsi;
+virDomainHostdevSubsysMediatedDevPtr mdevsrc = >u.mdev;
 virDomainHostdevDefPtr detach = NULL;
 int idx;
 
@@ -5159,6 +5201,11 @@ int qemuDomainDetachHostDevice(virQEMUDriverPtr driver,
 }
 break;
 }
+case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
+virReportError(VIR_ERR_DEVICE_MISSING,
+   _("mediated device '%s' not found"),
+   mdevsrc->uuidstr);
+break;
 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
 break;
 default:
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v2 3/3] news: Update release news with mediated devices hot {plug, unplug}

2018-03-28 Thread Erik Skultety
Signed-off-by: Erik Skultety 
---
 docs/news.xml | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/docs/news.xml b/docs/news.xml
index 108889574..5f41208c2 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -92,6 +92,16 @@
   previously started domains to 256, or restart them.
 
   
+  
+
+  qemu: Support hot plug and hot unplug of mediated devices
+
+
+  Libvirt now allows mediated devices to be hot plugged and hot
+  unplugged from a guest rather than reporting an error that this isn't
+  supported. In fact, kernel has been supporting this since 4.10.
+
+  
 
 
 
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v2 1/3] qemu: hotplug: Introduce hot plug support for mediated devices

2018-03-28 Thread Erik Skultety
Mediated devices support hot-{plug,unplug} since their introduction in
kernel 4.10, however libvirt has still been missing support for this.

Signed-off-by: Erik Skultety 
---
 src/qemu/qemu_hotplug.c | 86 +
 1 file changed, 86 insertions(+)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 49af4d4ff..92e4d1cc9 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2567,6 +2567,88 @@ qemuDomainAttachSCSIVHostDevice(virQEMUDriverPtr driver,
 }
 
 
+static int
+qemuDomainAttachMediatedDevice(virQEMUDriverPtr driver,
+   virDomainObjPtr vm,
+   virDomainHostdevDefPtr hostdev)
+{
+int ret = -1;
+char *devstr = NULL;
+bool added = false;
+bool teardowncgroup = false;
+bool teardownlabel = false;
+bool teardowndevice = false;
+qemuDomainObjPrivatePtr priv = vm->privateData;
+virDomainDeviceDef dev = { VIR_DOMAIN_DEVICE_HOSTDEV,
+{ .hostdev = hostdev } };
+
+if (qemuDomainEnsurePCIAddress(vm, , driver) < 0)
+return -1;
+
+if (qemuHostdevPrepareMediatedDevices(driver,
+  vm->def->name,
+  ,
+  1) < 0)
+goto cleanup;
+added = true;
+
+if (qemuDomainNamespaceSetupHostdev(vm, hostdev) < 0)
+goto cleanup;
+teardowndevice = true;
+
+if (qemuSetupHostdevCgroup(vm, hostdev) < 0)
+goto cleanup;
+teardowncgroup = true;
+
+if (qemuSecuritySetHostdevLabel(driver, vm, hostdev) < 0)
+goto cleanup;
+teardownlabel = true;
+
+if (qemuAssignDeviceHostdevAlias(vm->def, >info->alias, -1) < 0)
+goto cleanup;
+
+if (!(devstr = qemuBuildHostdevMediatedDevStr(vm->def, hostdev,
+  priv->qemuCaps)))
+goto cleanup;
+
+if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0)
+goto cleanup;
+
+qemuDomainObjEnterMonitor(driver, vm);
+ret = qemuMonitorAddDevice(priv->mon, devstr);
+if (qemuDomainObjExitMonitor(driver, vm) < 0) {
+ret = -1;
+goto cleanup;
+}
+
+virDomainAuditHostdev(vm, hostdev, "attach", ret == 0);
+if (ret < 0)
+goto cleanup;
+
+VIR_APPEND_ELEMENT_INPLACE(vm->def->hostdevs, vm->def->nhostdevs, hostdev);
+ret = 0;
+ cleanup:
+if (ret < 0) {
+if (teardowncgroup && qemuTeardownHostdevCgroup(vm, hostdev) < 0)
+VIR_WARN("Unable to remove host device cgroup ACL on hotplug 
fail");
+if (teardownlabel &&
+qemuSecurityRestoreHostdevLabel(driver, vm, hostdev) < 0)
+VIR_WARN("Unable to restore host device labelling on hotplug 
fail");
+if (teardowndevice &&
+qemuDomainNamespaceTeardownHostdev(vm, hostdev) < 0)
+VIR_WARN("Unable to remove host device from /dev");
+if (added)
+qemuHostdevReAttachMediatedDevices(driver,
+   vm->def->name,
+   ,
+   1);
+qemuDomainReleaseDeviceAddress(vm, hostdev->info, NULL);
+}
+VIR_FREE(devstr);
+return ret;
+}
+
+
 int
 qemuDomainAttachHostDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm,
@@ -2602,6 +2684,10 @@ qemuDomainAttachHostDevice(virQEMUDriverPtr driver,
 if (qemuDomainAttachSCSIVHostDevice(driver, vm, hostdev) < 0)
 goto error;
 break;
+case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
+if (qemuDomainAttachMediatedDevice(driver, vm, hostdev) < 0)
+goto error;
+break;
 
 default:
 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v2 0/3] Introduce hot plug support for mediated devices

2018-03-28 Thread Erik Skultety
Libvirt shouldn't forbid the operation as unsupported. In fact, from VFIO point
of view, mdevs have supported hot plug since the beginning. Then it's up to the
3rd party vendor driver whether it can cope with this feature reliably or not.

Since v1 [1]:
- dropped the original patch 1 as that adjustment can be done in a bigger scale
across multiple modules as part of a 'bite-sized' task
- reworded commit message for patches 2 and 3
- fixed the error path in patch 1 where I mistakenly tried to re-attach all host
devices for a domain if the hotplug of an mdev failed

[1] https://www.redhat.com/archives/libvir-list/2018-March/msg01631.html

Erik Skultety (3):
  qemu: hotplug: Introduce hot plug support for mediated devices
  qemu: hotplug: Introduce hot unplug for mediated devices
  news: Update release news with mediated devices hot {plug,unplug}

 docs/news.xml   |  10 
 src/qemu/qemu_hotplug.c | 133 
 2 files changed, 143 insertions(+)

--
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] RFC: Extending UEFI XML specification

2018-03-28 Thread Peter Krempa
On Wed, Mar 28, 2018 at 17:55:59 +0530, Prerna wrote:
> On Wed, Mar 28, 2018 at 4:41 PM, Peter Krempa  wrote:
> > On Wed, Mar 28, 2018 at 16:15:50 +0530, Prerna wrote:

[...]

> > > 
> > > 
> > > 
> > >  
> > > 
> >
> > In addition to this we should also support the 'storage-source' like
> > definition for backing='file' too:
> >
> > 
> >   
> > 
> >
> >
> Yes, this would be required for uniformity. But this would inadvertantly
> break the existing XML description for local files. So I was not sure if
> this would be acceptable.

Not necessarily. You can always remember whether the parser has seen the
old description or the new one and the formatter will then format the
old or new one from the data according to the flag.

> > With that encryption of the image can be defined as well.
> >
> > >
> > > Note that 'template' attribute in NVRAM should be explicitly disallowed
> > for
> > > backing type "network". This is because libvirtd may not be able to
> > access
> > > the backing store to copy the contents of the template.
> >
> > This should be hypervisor-defined. While it will not be easy, you can
> > use qemu-img in the qemu driver to populate network disks via the
> > 'convert' command.
> >
> >
> You probably meant qemu-nbd? But other backends such as gluster/iSCSI may
> not just work with that.
> Were you describing some other scenario ?

No, I in fact meant qemu-img as a tool which can be used to copy the
template file while provisioning the  image. qemu-img's convert
functionality will copy the image to any destination that qemu supports.

I'm not saying it has to be implementer right away, I just used it as a
example that it depends on the implementation whether the template file
is supported for a given hypervisor/storage.



signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] RFC: Extending UEFI XML specification

2018-03-28 Thread Prerna
On Wed, Mar 28, 2018 at 4:41 PM, Peter Krempa  wrote:

> On Wed, Mar 28, 2018 at 16:15:50 +0530, Prerna wrote:
> > Hi Michal,
> > The , tags of os element in domain XML (
> > https://libvirt.org/formatdomain.html#elementsOSBIOS) currently expects
> > absolute path of the local file which would be used to back the the
> pflash
> > disk representing the non-volatile RAM:
> >
> >  > type='rom'>/usr/lib/xen/boot/hvmloader
> >  > template='/usr/share/OVMF/OVMF_VARS.fd'>/var/lib/
> libvirt/nvram/guest_VARS.fd
> >
> > However, given that for virtualized environments, it is possible that the
> > VM could be started on different hosts at various points in time, and so
> we
> > need to expose the firmware/nvram tuple over a network device so as to be
> > accessible from various hosts.
> > I propose extending of the existing config by adding a new element,
> > "backing". This could be one of :
> > - 'file': for local filesystem paths
> > - 'network': for network-attached storage.
>
> Since this is as any other storage volume for the hypervisor, you should
> treat it as a virStorageSource, including the 'block' and 'volume'
> types.
>
> >
> > As an example:
> >
> >  > 'file'>/usr/share/OVMF/OVMF_CODE.fd
> >  > template='/usr/share/OVMF/OVMF_VARS.fd'>/var/lib/
> libvirt/nvram/guest_VARS.fd
> >
> > For network-attached storage:
> >  > 'network'>/usr/share/OVMF/OVMF_CODE.fd
>
> I presume you wanted to add the  section here as well.
>
>
Agree, I'd missed it while writing up, but I intended  to cover
this.


> > 
> > 
> > 
> >  
> > 
>
> In addition to this we should also support the 'storage-source' like
> definition for backing='file' too:
>
> 
>   
> 
>
>
Yes, this would be required for uniformity. But this would inadvertantly
break the existing XML description for local files. So I was not sure if
this would be acceptable.



> With that encryption of the image can be defined as well.
>
> >
> > Note that 'template' attribute in NVRAM should be explicitly disallowed
> for
> > backing type "network". This is because libvirtd may not be able to
> access
> > the backing store to copy the contents of the template.
>
> This should be hypervisor-defined. While it will not be easy, you can
> use qemu-img in the qemu driver to populate network disks via the
> 'convert' command.
>
>
You probably meant qemu-nbd? But other backends such as gluster/iSCSI may
not just work with that.
Were you describing some other scenario ?


> > I would like to capture thoughts from the community to extend the current
> > firmware spec.
> >
> > Regards,
> > Prerna
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 0/4] vmx: allow more than 4 NICs (RHBZ#1560917)

2018-03-28 Thread Ján Tomko

On Wed, Mar 28, 2018 at 01:40:17PM +0200, Pino Toscano wrote:

Hi,

the VMX parser, used in the esx driver, has currently hardcoded 4 NICs
possible, ignoring extra more than that. The following series removes
this limitation, allowing to parse all the 10 NICs in the VMX of
RHBZ#1560917.

Thanks,

Pino Toscano (4):
 vmx: check for present/enabled devices earlier
 vmx: allocate space for network interfaces if needed
 internal: add STRCASEPREFIX
 vmx: convert any amount of NICs



ACK series

Jan


signature.asc
Description: Digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 3/4] internal: add STRCASEPREFIX

2018-03-28 Thread Pino Toscano
Simple macro to check the prefix of a string in a case-insensitive way.

Signed-off-by: Pino Toscano 
---
 src/internal.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/internal.h b/src/internal.h
index 589503041..1760e3b69 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -75,6 +75,7 @@
 # define STRNEQLEN(a, b, n) (strncmp(a, b, n) != 0)
 # define STRCASENEQLEN(a, b, n) (c_strncasecmp(a, b, n) != 0)
 # define STRPREFIX(a, b) (strncmp(a, b, strlen(b)) == 0)
+# define STRCASEPREFIX(a, b) (c_strncasecmp(a, b, strlen(b)) == 0)
 # define STRSKIP(a, b) (STRPREFIX(a, b) ? (a) + strlen(b) : NULL)
 
 # define STREQ_NULLABLE(a, b) \
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 0/4] vmx: allow more than 4 NICs (RHBZ#1560917)

2018-03-28 Thread Pino Toscano
Hi,

the VMX parser, used in the esx driver, has currently hardcoded 4 NICs
possible, ignoring extra more than that. The following series removes
this limitation, allowing to parse all the 10 NICs in the VMX of
RHBZ#1560917.

Thanks,

Pino Toscano (4):
  vmx: check for present/enabled devices earlier
  vmx: allocate space for network interfaces if needed
  internal: add STRCASEPREFIX
  vmx: convert any amount of NICs

 src/internal.h  |   1 +
 src/vmx/vmx.c   | 150 +++---
 tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.vmx | 163 
 tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml |  89 +
 tests/vmx2xmltest.c |   1 +
 5 files changed, 325 insertions(+), 79 deletions(-)
 create mode 100644 tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.vmx
 create mode 100644 tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml

-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 2/4] vmx: allocate space for network interfaces if needed

2018-03-28 Thread Pino Toscano
Dynamically grow the array of network interfaces for each interface
read, instead of using a single array of size 4.  This way, in the
future it will be easier to not limit the number of network interfaces
(which this patch still does not change).

Signed-off-by: Pino Toscano 
---
 src/vmx/vmx.c | 17 +++--
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index ba47a87b7..fd9b55950 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -1751,19 +1751,16 @@ virVMXParseConfig(virVMXContext *ctx,
 }
 
 /* def:nets */
-if (VIR_ALLOC_N(def->nets, 4) < 0)
-goto cleanup;
-
-def->nnets = 0;
-
 for (controller = 0; controller < 4; ++controller) {
-if (virVMXParseEthernet(conf, controller,
->nets[def->nnets]) < 0) {
+virDomainNetDefPtr net = NULL;
+if (virVMXParseEthernet(conf, controller, ) < 0)
 goto cleanup;
-}
 
-if (def->nets[def->nnets] != NULL)
-++def->nnets;
+if (!net)
+continue;
+
+if (VIR_APPEND_ELEMENT(def->nets, def->nnets, net) < 0)
+goto cleanup;
 }
 
 /* def:inputs */
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 1/4] vmx: check for present/enabled devices earlier

2018-03-28 Thread Pino Toscano
When parsing filesystems, network interfaces, serial ports, and
parallel ports, check earlier whether they are present/enabled, delaying
the allocation of the objects.

This is mostly a small optimization, with no behaviour change.

Signed-off-by: Pino Toscano 
---
 src/vmx/vmx.c | 92 +++
 1 file changed, 30 insertions(+), 62 deletions(-)

diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 3b0c16d5a..ba47a87b7 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -2439,11 +2439,6 @@ int virVMXParseFileSystem(virConfPtr conf, int number, 
virDomainFSDefPtr *def)
 return -1;
 }
 
-if (!(*def = virDomainFSDefNew()))
-return -1;
-
-(*def)->type = VIR_DOMAIN_FS_TYPE_MOUNT;
-
 snprintf(prefix, sizeof(prefix), "sharedFolder%d", number);
 
 VMX_BUILD_NAME(present);
@@ -2454,14 +2449,19 @@ int virVMXParseFileSystem(virConfPtr conf, int number, 
virDomainFSDefPtr *def)
 
 /* vmx:present */
 if (virVMXGetConfigBoolean(conf, present_name, , false, true) < 0)
-goto cleanup;
+return -1;
 
 /* vmx:enabled */
 if (virVMXGetConfigBoolean(conf, enabled_name, , false, true) < 0)
-goto cleanup;
+return -1;
 
 if (!(present && enabled))
-goto ignore;
+return 0;
+
+if (!(*def = virDomainFSDefNew()))
+return -1;
+
+(*def)->type = VIR_DOMAIN_FS_TYPE_MOUNT;
 
 /* vmx:hostPath */
 if (virVMXGetConfigString(conf, hostPath_name, , false) < 0)
@@ -2497,14 +2497,6 @@ int virVMXParseFileSystem(virConfPtr conf, int number, 
virDomainFSDefPtr *def)
 VIR_FREE(guestName);
 
 return result;
-
- ignore:
-virDomainFSDefFree(*def);
-*def = NULL;
-
-result = 0;
-
-goto cleanup;
 }
 
 
@@ -2557,9 +2549,6 @@ virVMXParseEthernet(virConfPtr conf, int controller, 
virDomainNetDefPtr *def)
 return -1;
 }
 
-if (VIR_ALLOC(*def) < 0)
-return -1;
-
 snprintf(prefix, sizeof(prefix), "ethernet%d", controller);
 
 VMX_BUILD_NAME(present);
@@ -2575,17 +2564,20 @@ virVMXParseEthernet(virConfPtr conf, int controller, 
virDomainNetDefPtr *def)
 
 /* vmx:present */
 if (virVMXGetConfigBoolean(conf, present_name, , false, true) < 0)
-goto cleanup;
+return -1;
 
 /* vmx:startConnected */
 if (virVMXGetConfigBoolean(conf, startConnected_name, ,
true, true) < 0) {
-goto cleanup;
+return -1;
 }
 
 /* FIXME: Need to distiguish between active and inactive domains here */
 if (! present/* && ! startConnected*/)
-goto ignore;
+return 0;
+
+if (VIR_ALLOC(*def) < 0)
+return -1;
 
 /* vmx:connectionType -> def:type */
 if (virVMXGetConfigString(conf, connectionType_name, ,
@@ -2726,14 +2718,6 @@ virVMXParseEthernet(virConfPtr conf, int controller, 
virDomainNetDefPtr *def)
 VIR_FREE(vnet);
 
 return result;
-
- ignore:
-virDomainNetDefFree(*def);
-*def = NULL;
-
-result = 0;
-
-goto cleanup;
 }
 
 
@@ -2773,11 +2757,6 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, 
int port,
 return -1;
 }
 
-if (!(*def = virDomainChrDefNew(NULL)))
-return -1;
-
-(*def)->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
-
 snprintf(prefix, sizeof(prefix), "serial%d", port);
 
 VMX_BUILD_NAME(present);
@@ -2788,17 +2767,22 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, 
int port,
 
 /* vmx:present */
 if (virVMXGetConfigBoolean(conf, present_name, , false, true) < 0)
-goto cleanup;
+return -1;
 
 /* vmx:startConnected */
 if (virVMXGetConfigBoolean(conf, startConnected_name, ,
true, true) < 0) {
-goto cleanup;
+return -1;
 }
 
 /* FIXME: Need to distiguish between active and inactive domains here */
 if (! present/* && ! startConnected*/)
-goto ignore;
+return 0;
+
+if (!(*def = virDomainChrDefNew(NULL)))
+return -1;
+
+(*def)->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
 
 /* vmx:fileType -> def:type */
 if (virVMXGetConfigString(conf, fileType_name, , true) < 0)
@@ -2919,14 +2903,6 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, 
int port,
 virURIFree(parsedUri);
 
 return result;
-
- ignore:
-virDomainChrDefFree(*def);
-*def = NULL;
-
-result = 0;
-
-goto cleanup;
 }
 
 
@@ -2961,11 +2937,6 @@ virVMXParseParallel(virVMXContext *ctx, virConfPtr conf, 
int port,
 return -1;
 }
 
-if (!(*def = virDomainChrDefNew(NULL)))
-return -1;
-
-(*def)->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL;
-
 snprintf(prefix, sizeof(prefix), "parallel%d", port);
 
 VMX_BUILD_NAME(present);
@@ -2975,17 +2946,22 @@ virVMXParseParallel(virVMXContext *ctx, virConfPtr 
conf, int port,
 
 /* vmx:present */
 if (virVMXGetConfigBoolean(conf, 

[libvirt] [PATCH 4/4] vmx: convert any amount of NICs

2018-03-28 Thread Pino Toscano
Scan the parsed VMX file, and gather the biggest index of the network
interfaces there: this way, it is possible to parse all the available
network interfaces, instead of just 4 maximum.

Add the VMX file attached to RHBZ#1560917 as testcase esx-in-the-wild-8.

https://bugzilla.redhat.com/show_bug.cgi?id=1560917

Signed-off-by: Pino Toscano 
---
 src/vmx/vmx.c   |  43 +--
 tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.vmx | 163 
 tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml |  89 +
 tests/vmx2xmltest.c |   1 +
 4 files changed, 288 insertions(+), 8 deletions(-)
 create mode 100644 tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.vmx
 create mode 100644 tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.xml

diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index fd9b55950..cd43d9c49 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -1286,6 +1286,36 @@ virVMXGatherSCSIControllers(virVMXContext *ctx, 
virDomainDefPtr def,
 return result;
 }
 
+struct virVMXConfigScanResults {
+int networks_max_index;
+};
+
+static int
+virVMXConfigScanResultsCollector(const char* name,
+ virConfValuePtr value ATTRIBUTE_UNUSED,
+ void *opaque)
+{
+struct virVMXConfigScanResults *results = opaque;
+
+if (STRCASEPREFIX(name, "ethernet")) {
+unsigned int idx;
+char *p;
+
+if (virStrToLong_uip(name + 8, , 10, ) < 0 ||
+*p != '.') {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _("failed to parse the index of the VMX key '%s'"),
+   name);
+return -1;
+}
+
+if ((int) idx > results->networks_max_index)
+results->networks_max_index = (int) idx;
+}
+
+return 0;
+}
+
 
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -1322,6 +1352,7 @@ virVMXParseConfig(virVMXContext *ctx,
 bool hgfs_disabled = true;
 long long sharedFolder_maxNum = 0;
 int cpumasklen;
+struct virVMXConfigScanResults results = { -1 };
 
 if (ctx->parseFileName == NULL) {
 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -1357,6 +1388,9 @@ virVMXParseConfig(virVMXContext *ctx,
 goto cleanup;
 }
 
+if (virConfWalk(conf, virVMXConfigScanResultsCollector, ) < 0)
+goto cleanup;
+
 /* Allocate domain def */
 if (!(def = virDomainDefNew()))
 goto cleanup;
@@ -1751,7 +1785,7 @@ virVMXParseConfig(virVMXContext *ctx,
 }
 
 /* def:nets */
-for (controller = 0; controller < 4; ++controller) {
+for (controller = 0; controller <= results.networks_max_index; 
++controller) {
 virDomainNetDefPtr net = NULL;
 if (virVMXParseEthernet(conf, controller, ) < 0)
 goto cleanup;
@@ -2539,13 +2573,6 @@ virVMXParseEthernet(virConfPtr conf, int controller, 
virDomainNetDefPtr *def)
 return -1;
 }
 
-if (controller < 0 || controller > 3) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _("Ethernet controller index %d out of [0..3] range"),
-   controller);
-return -1;
-}
-
 snprintf(prefix, sizeof(prefix), "ethernet%d", controller);
 
 VMX_BUILD_NAME(present);
diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.vmx 
b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.vmx
new file mode 100644
index 0..1e3dbf23c
--- /dev/null
+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-8.vmx
@@ -0,0 +1,163 @@
+.encoding = "UTF-8"
+config.version = "8"
+virtualHW.version = "11"
+vmci0.present = "TRUE"
+svga.vramSize = "8388608"
+memSize = "2048"
+sched.cpu.units = "mhz"
+tools.upgrade.policy = "manual"
+scsi0.virtualDev = "pvscsi"
+scsi0.present = "TRUE"
+sata0.present = "TRUE"
+sata0:0.deviceType = "cdrom-image"
+sata0:0.fileName = 
"/vmfs/volumes/692eb778-2d4937fe/CentOS-4.7.ServerCD-x86_64.iso"
+sata0:0.present = "TRUE"
+scsi0:0.deviceType = "scsi-hardDisk"
+scsi0:0.fileName = "RHEL7_6.vmdk"
+sched.scsi0:0.shares = "normal"
+scsi0:0.present = "TRUE"
+floppy0.startConnected = "FALSE"
+floppy0.clientDevice = "TRUE"
+floppy0.fileName = "vmware-null-remote-floppy"
+ethernet0.virtualDev = "vmxnet3"
+ethernet0.networkName = "VM Network"
+ethernet0.addressType = "static"
+ethernet0.address = "00:1a:4a:16:01:55"
+ethernet0.present = "TRUE"
+displayName = "RHEL7_10_NICs"
+guestOS = "rhel7-64"
+toolScripts.afterPowerOn = "TRUE"
+toolScripts.afterResume = "TRUE"
+toolScripts.beforeSuspend = "TRUE"
+toolScripts.beforePowerOff = "TRUE"
+tools.syncTime = "FALSE"
+messageBus.tunnelEnabled = "FALSE"
+uuid.bios = "42 35 94 20 99 dc 42 61-52 64 ba 58 dd ae 20 e4"
+vc.uuid = "50 35 1d e6 7d 56 29 ab-9d 72 c7 f9 ea 3f cf d0"
+sched.cpu.latencySensitivity = "normal"
+tools.guest.desktop.autolock = "FALSE"
+nvram = "RHEL7_6.nvram"
+pciBridge0.present = "TRUE"
+svga.present = 

Re: [libvirt] RFC: Extending UEFI XML specification

2018-03-28 Thread Peter Krempa
On Wed, Mar 28, 2018 at 16:15:50 +0530, Prerna wrote:
> Hi Michal,
> The , tags of os element in domain XML (
> https://libvirt.org/formatdomain.html#elementsOSBIOS) currently expects
> absolute path of the local file which would be used to back the the pflash
> disk representing the non-volatile RAM:
> 
>  type='rom'>/usr/lib/xen/boot/hvmloader
>  template='/usr/share/OVMF/OVMF_VARS.fd'>/var/lib/libvirt/nvram/guest_VARS.fd
> 
> However, given that for virtualized environments, it is possible that the
> VM could be started on different hosts at various points in time, and so we
> need to expose the firmware/nvram tuple over a network device so as to be
> accessible from various hosts.
> I propose extending of the existing config by adding a new element,
> "backing". This could be one of :
> - 'file': for local filesystem paths
> - 'network': for network-attached storage.

Since this is as any other storage volume for the hypervisor, you should
treat it as a virStorageSource, including the 'block' and 'volume'
types.

> 
> As an example:
> 
>  'file'>/usr/share/OVMF/OVMF_CODE.fd
>  template='/usr/share/OVMF/OVMF_VARS.fd'>/var/lib/libvirt/nvram/guest_VARS.fd
> 
> For network-attached storage:
>  'network'>/usr/share/OVMF/OVMF_CODE.fd

I presume you wanted to add the  section here as well.

> 
> 
> 
>  
> 

In addition to this we should also support the 'storage-source' like
definition for backing='file' too:


  


With that encryption of the image can be defined as well.

> 
> Note that 'template' attribute in NVRAM should be explicitly disallowed for
> backing type "network". This is because libvirtd may not be able to access
> the backing store to copy the contents of the template.

This should be hypervisor-defined. While it will not be easy, you can
use qemu-img in the qemu driver to populate network disks via the
'convert' command.

> I would like to capture thoughts from the community to extend the current
> firmware spec.
> 
> Regards,
> Prerna


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] RFC: Extending UEFI XML specification

2018-03-28 Thread Prerna
Hi Michal,
The , tags of os element in domain XML (
https://libvirt.org/formatdomain.html#elementsOSBIOS) currently expects
absolute path of the local file which would be used to back the the pflash
disk representing the non-volatile RAM:

/usr/lib/xen/boot/hvmloader
/var/lib/libvirt/nvram/guest_VARS.fd

However, given that for virtualized environments, it is possible that the
VM could be started on different hosts at various points in time, and so we
need to expose the firmware/nvram tuple over a network device so as to be
accessible from various hosts.
I propose extending of the existing config by adding a new element,
"backing". This could be one of :
- 'file': for local filesystem paths
- 'network': for network-attached storage.

As an example:

/usr/share/OVMF/OVMF_CODE.fd
/var/lib/libvirt/nvram/guest_VARS.fd

For network-attached storage:
/usr/share/OVMF/OVMF_CODE.fd



 


Note that 'template' attribute in NVRAM should be explicitly disallowed for
backing type "network". This is because libvirtd may not be able to access
the backing store to copy the contents of the template.

I would like to capture thoughts from the community to extend the current
firmware spec.

Regards,
Prerna
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v2 2/3] qemu: Handle device mapper targets properly

2018-03-28 Thread Michal Privoznik
On 03/27/2018 08:56 PM, Peter Krempa wrote:
> On Mon, Mar 26, 2018 at 17:22:01 +0200, Michal Privoznik wrote:
>> On 03/26/2018 05:17 PM, Peter Krempa wrote:
>>> On Mon, Mar 26, 2018 at 16:43:02 +0200, Michal Privoznik wrote:
 https://bugzilla.redhat.com/show_bug.cgi?id=1557769

 Problem with device mapper targets is that there can be several
 other devices 'hidden' behind them. For instance, /dev/dm-1 can
 consist of /dev/sda, /dev/sdb and /dev/sdc. Therefore, when
 setting up devices CGroup and namespaces we have to take this
 into account.

 Signed-off-by: Michal Privoznik 
 ---
> 
> [...]
> 
 +for (i = 0; i < nmaj; i++) {
 +if (virAsprintf(, "/dev/block/%u:%u", maj[i], min[i]) 
 < 0)
 +goto cleanup;
 +
 +if (qemuDomainCreateDevice(devPath, data, false) < 0)
 +goto cleanup;
>>>
>>> So now that I see this new version, this part starts looking suspicious
>>> to me. Since this did not care much that the path changed, is it really
>>> necessary to create the /dev/ entries in the container?
>>>
>>> Looks like even device mapper is returning them as the node
>>> specificator, so I'd presume it really does not matter if they are
>>> present.
>>>
>>> More specifically we can't really reverse engineer from the major:minor
>>> numbers which actual path the user used so it should not really be
>>> necessary for it to be present in the container.
>>
>> Yes, looks like I was too eager trying to fix this bug. I've rebuilt
>> libvirt without qemu_domain.c change (so only CGroup code was modified)
>> and the bug still did not reproduce. So I guess namespace changes are
>> not necessary after all. I'll drop them.
> 
> Okay. Apart from that I thought about this for a while and also tested
> various configurations. Unfortunately I was not able to reproduce the
> issue. 

Looks like this is a kernel bug after all. I've also done some testing
myself and fount that:

a) on upstream kernel I'm unable to reproduce (4.15.11-gentoo),
b) also 7.4 kenel works,
c) it's only 7.5 where this bug presents itself.

https://bugzilla.redhat.com/show_bug.cgi?id=1557769#c32

So I think we should ignore these patches for now until we have some
input from kernel team.

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 3/4] qemu: hotplug: Introduce hot unplug for mediated devices

2018-03-28 Thread Peter Krempa
On Wed, Mar 28, 2018 at 11:47:47 +0200, Erik Skultety wrote:
> On Tue, Mar 27, 2018 at 11:41:45AM +0200, Peter Krempa wrote:
> > On Tue, Mar 27, 2018 at 10:57:15 +0200, Erik Skultety wrote:
> > > Mediated devices support hot-{plug,unplug} since their introduction in
> > > kernel 4.10, however this feature has been missing in libvirt since
> > > commit ec783d7c introduced a hostdev type for mdevs.
> > >
> > > Signed-off-by: Erik Skultety 
> > > ---
> > >  src/qemu/qemu_hotplug.c | 47 
> > > +++
> > >  1 file changed, 47 insertions(+)
> > >
> > > diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> > > index 4abc7393b..ff77b47bc 100644
> > > --- a/src/qemu/qemu_hotplug.c
> > > +++ b/src/qemu/qemu_hotplug.c
> > > @@ -4030,6 +4030,17 @@ qemuDomainRemoveSCSIVHostDevice(virQEMUDriverPtr 
> > > driver,
> > >  qemuHostdevReAttachSCSIVHostDevices(driver, vm->def->name, , 
> > > 1);
> > >  }
> > >
> > > +
> > > +static void
> > > +qemuDomainRemoveMediatedDevice(virQEMUDriverPtr driver,
> > > +   virDomainObjPtr vm,
> > > +   virDomainHostdevDefPtr hostdev)
> > > +{
> > > +qemuHostdevReAttachMediatedDevices(driver, vm->def->name, , 
> > > 1);
> > > +qemuDomainReleaseDeviceAddress(vm, hostdev->info, NULL);
> >
> > Looks like you are missing teardown of the cgroups, and namespace
> > membership here.
> 
> I'm not, this is handled from qemuDomainRemoveHostDevice which is called from
> qemuDomainDetachThisHostDevice right after qemuDomainDetachMediatedDevice was
> called.

Okay, I did not notice that this was registered under the hostdev
removal function rather than the device removal function.

> > > +static int
> > > +qemuDomainDetachMediatedDevice(virQEMUDriverPtr driver,
> > > +   virDomainObjPtr vm,
> > > +   virDomainHostdevDefPtr detach)
> > > +{
> > > +int ret = -1;
> > > +qemuDomainObjPrivatePtr priv = vm->privateData;
> > > +
> > > +if (!detach->info->alias) {
> > > +virReportError(VIR_ERR_OPERATION_FAILED,
> > > +   "%s", _("device cannot be detached without a 
> > > device alias"));
> > > +return -1;
> > > +}
> > > +
> > > +qemuDomainMarkDeviceForRemoval(vm, detach->info);
> > > +
> > > +qemuDomainObjEnterMonitor(driver, vm);
> > > +ret = qemuMonitorDelDevice(priv->mon, detach->info->alias);
> > > +if (qemuDomainObjExitMonitor(driver, vm) < 0)
> > > +ret = -1;
> >
> > You need to wait for removal here and delete it inplace if the call
> > returns soon enough.. Also call to qemuDomainResetDeviceRemoval is
> > missing.
> 
> All of this is already done as part of qemuDomainDetachThisHostDevice, point 1
> being done right at the end of the function mentioned above
> (qemuDomainWaitForDeviceRemoval), point 2 being satisfied by the last call in
> the same function.

Fair enough, both points come from the fact that I've assumed that these
are generic device deletion functions as we have for other devices and
not hostdev-specific ones, called from the hostdev removal function.

The confusion originates from the fact that the hostdev-specific workers
use the same prefix as other device deletion fucntions rather than
having something like "hostdev" in the name.

ACK to this patch if you fix the very long line as suggested.


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 3/4] qemu: hotplug: Introduce hot unplug for mediated devices

2018-03-28 Thread Erik Skultety
On Tue, Mar 27, 2018 at 11:41:45AM +0200, Peter Krempa wrote:
> On Tue, Mar 27, 2018 at 10:57:15 +0200, Erik Skultety wrote:
> > Mediated devices support hot-{plug,unplug} since their introduction in
> > kernel 4.10, however this feature has been missing in libvirt since
> > commit ec783d7c introduced a hostdev type for mdevs.
> >
> > Signed-off-by: Erik Skultety 
> > ---
> >  src/qemu/qemu_hotplug.c | 47 
> > +++
> >  1 file changed, 47 insertions(+)
> >
> > diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> > index 4abc7393b..ff77b47bc 100644
> > --- a/src/qemu/qemu_hotplug.c
> > +++ b/src/qemu/qemu_hotplug.c
> > @@ -4030,6 +4030,17 @@ qemuDomainRemoveSCSIVHostDevice(virQEMUDriverPtr 
> > driver,
> >  qemuHostdevReAttachSCSIVHostDevices(driver, vm->def->name, , 
> > 1);
> >  }
> >
> > +
> > +static void
> > +qemuDomainRemoveMediatedDevice(virQEMUDriverPtr driver,
> > +   virDomainObjPtr vm,
> > +   virDomainHostdevDefPtr hostdev)
> > +{
> > +qemuHostdevReAttachMediatedDevices(driver, vm->def->name, , 1);
> > +qemuDomainReleaseDeviceAddress(vm, hostdev->info, NULL);
>
> Looks like you are missing teardown of the cgroups, and namespace
> membership here.

I'm not, this is handled from qemuDomainRemoveHostDevice which is called from
qemuDomainDetachThisHostDevice right after qemuDomainDetachMediatedDevice was
called.

...


> > +static int
> > +qemuDomainDetachMediatedDevice(virQEMUDriverPtr driver,
> > +   virDomainObjPtr vm,
> > +   virDomainHostdevDefPtr detach)
> > +{
> > +int ret = -1;
> > +qemuDomainObjPrivatePtr priv = vm->privateData;
> > +
> > +if (!detach->info->alias) {
> > +virReportError(VIR_ERR_OPERATION_FAILED,
> > +   "%s", _("device cannot be detached without a device 
> > alias"));
> > +return -1;
> > +}
> > +
> > +qemuDomainMarkDeviceForRemoval(vm, detach->info);
> > +
> > +qemuDomainObjEnterMonitor(driver, vm);
> > +ret = qemuMonitorDelDevice(priv->mon, detach->info->alias);
> > +if (qemuDomainObjExitMonitor(driver, vm) < 0)
> > +ret = -1;
>
> You need to wait for removal here and delete it inplace if the call
> returns soon enough.. Also call to qemuDomainResetDeviceRemoval is
> missing.

All of this is already done as part of qemuDomainDetachThisHostDevice, point 1
being done right at the end of the function mentioned above
(qemuDomainWaitForDeviceRemoval), point 2 being satisfied by the last call in
the same function.

Erik

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [[RFC] 0/8] Implement async QEMU event handling in libvirtd.

2018-03-28 Thread Prerna
Hi Marc,
Currently the block job handling needs to be sorted out before events can
assume independent handling from RPC contexts. Sorry, I have not been able
to revisit this in the past 2 months, but this is something I would very
much like to fix. I will try looking up the exact dependency of the block
layer so that this series could make some progress.

regards,
Prerna

On Wed, Mar 21, 2018 at 1:24 PM, Marc Hartmayer  wrote:

> On Tue, Oct 24, 2017 at 07:34 PM +0200, Prerna Saxena <
> saxenap@gmail.com> wrote:
> > As noted in
> > https://www.redhat.com/archives/libvir-list/2017-May/msg00016.html
> > libvirt-QEMU driver handles all async events from the main loop.
> > Each event handling needs the per-VM lock to make forward progress. In
> > the case where an async event is received for the same VM which has an
> > RPC running, the main loop is held up contending for the same lock.
> >
> > This impacts scalability, and should be addressed on priority.
> >
> > Note that libvirt does have a 2-step deferred handling for a few event
> > categories, but (1) That is insufficient since blockign happens before
> > the handler could disambiguate which one needs to be posted to this
> > other queue.
> > (2) There needs to be homogeniety.
> >
> > The current series builds a framework for recording and handling VM
> > events.
> > It initializes per-VM event queue, and a global event queue pointing to
> > events from all the VMs. Event handling is staggered in 2 stages:
> > - When an event is received, it is enqueued in the per-VM queue as well
> >   as the global queues.
> > - The global queue is built into the QEMU Driver as a threadpool
> >   (currently with a single thread).
> > - Enqueuing of a new event triggers the global event worker thread, which
> >   then attempts to take a lock for this event's VM.
> > - If the lock is available, the event worker runs the function
> handling
> >   this event type. Once done, it dequeues this event from the global
> >   as well as per-VM queues.
> > - If the lock is unavailable(ie taken by RPC thread), the event
> worker
> >   thread leaves this as-is and picks up the next event.
> > - Once the RPC thread completes, it looks for events pertaining to the
> >   VM in the per-VM event queue. It then processes the events serially
> >   (holding the VM lock) until there are no more events remaining for
> >   this VM. At this point, the per-VM lock is relinquished.
> >
> > Patch Series status:
> > Strictly RFC only. No compilation issues. I have not had a chance to
> > (stress) test it after rebase to latest master.
> > Note that documentation and test coverage is TBD, since a few open
> > points remain.
> >
> > Known issues/ caveats:
> > - RPC handling time will become non-deterministic.
> > - An event will only be "notified" to a client once the RPC for same VM
> completes.
> > - Needs careful consideration in all cases where a QMP event is used to
> >   "signal" an RPC thread, else will deadlock.
> >
> > Will be happy to drive more discussion in the community and completely
> > implement it.
> >
> > Prerna Saxena (8):
> >   Introduce virObjectTrylock()
> >   QEMU Event handling: Introduce async event helpers in qemu_event.[ch]
> >   Setup global and per-VM event queues. Also initialize per-VM queues
> > when libvirt reconnects to an existing VM.
> >   Events: Allow monitor to "enqueue" events to a queue. Also introduce a
> > framework of handlers for each event type, that can be called when
> > the handler is running an event.
> >   Events: Plumb event handling calls before a domain's APIs complete.
> >   Code refactor: Move helper functions of doCoreDump*, syncNicRxFilter*,
> > and qemuOpenFile* to qemu_process.[ch]
> >   Fold back the 2-stage event implementation for a few events :
> > Watchdog, Monitor EOF, Serial changed, Guest panic, Nic RX filter
> > changed .. into single level.
> >   Initialize the per-VM event queues in context of domain init.
> >
> >  src/Makefile.am  |1 +
> >  src/conf/domain_conf.h   |3 +
> >  src/libvirt_private.syms |1 +
> >  src/qemu/qemu_conf.h |4 +
> >  src/qemu/qemu_driver.c   | 1710 +++
> >  src/qemu/qemu_event.c|  317 +++
> >  src/qemu/qemu_event.h|  231 +
> >  src/qemu/qemu_monitor.c  |  592 ++--
> >  src/qemu/qemu_monitor.h  |   80 +-
> >  src/qemu/qemu_monitor_json.c |  291 +++---
> >  src/qemu/qemu_process.c  | 2031 ++
> 
> >  src/qemu/qemu_process.h  |   88 ++
> >  src/util/virobject.c |   26 +
> >  src/util/virobject.h |4 +
> >  src/util/virthread.c |5 +
> >  src/util/virthread.h |1 +
> >  tests/qemumonitortestutils.c |2 +-
> >  17 files changed, 3411 insertions(+), 1976 deletions(-)
> >  create mode 100644 src/qemu/qemu_event.c
> >  create mode 

Re: [libvirt] [jenkins-ci PATCH] Revert "local"

2018-03-28 Thread Daniel P . Berrangé
On Wed, Mar 28, 2018 at 10:42:51AM +0200, Andrea Bolognani wrote:
> On Tue, 2018-03-27 at 20:48 +0200, Peter Krempa wrote:
> > On Tue, Mar 27, 2018 at 18:19:43 +0200, Andrea Bolognani wrote:
> > > This reverts commit c190e17fb8f689a0591dedded33d10cecafe3e20.
> > > 
> > > As the original commit message so eloquently explains, the
> > > diff contains the tweaks I need for my local setup and it was,
> > > of course, never supposed to be pushed :/
> > > 
> > > Signed-off-by: Andrea Bolognani 
> > 
> > One of the actually useful things about the commit hook we have is that
> > if you don't sign-off the commit you can't push it. Thus you should not
> > sign-off commits which are not ready ...
> 
> Good point.
> 
> I've changed my setup to generate S-o-bs at format-patch time
> rather than commit time, so hopefully this won't happen again.

I wouldn't worry too much - accidents happen every now & then and there's
no foolproof way to avoid it. You don't want to uneccessarily complicate
your working dev workflow to avoid something that almost never happens.

Personally I try to avoid this kind of thing by never working on git
master, and using git stash for saving temporary hacks rather than
creating commits, or creating temporary throw away branches for quick
hacks

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [dbus PATCH] domain: remove G_GNUC_UNUSED for used attributes

2018-03-28 Thread Pavel Hrdina
On Tue, Mar 27, 2018 at 06:30:19PM +0200, Ján Tomko wrote:
> A few functions use the G_GNUC_UNUSED marker for objectPath,
> even though it's passed to virtDBusDomainGetVirDomain later.
> 
> Signed-off-by: Ján Tomko 
> ---
> Also passes the build with clang 5.0.1, once that lock issue is fixed:
> connect.c:59:29: error: unused variable 'lock' [-Werror,-Wunused-variable]
> g_autoptr(GMutexLocker) lock = g_mutex_locker_new(>lock);
> 
>  src/domain.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)

Thanks, I've pushed it together with the clang patch.  I didn't realize
that you would be able to push it as well.

Pavel


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [jenkins-ci PATCH] Revert "local"

2018-03-28 Thread Andrea Bolognani
On Wed, 2018-03-28 at 10:53 +0200, Peter Krempa wrote:
> > I've changed my setup to generate S-o-bs at format-patch time
> > rather than commit time, so hopefully this won't happen again.
> 
> And does that add the S-o-b to your local commits too? If it only
> signs-off the formatted mails, it's kind of useless, since you won't be
> able to push them until you add the signoffs locally.

Well, you have to go through the commits to pick up R-bs before
pushing anyway, so adding S-o-bs at the same time is zero extra
work.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 1/2] libxl: drop support for Xen < 4.6

2018-03-28 Thread Daniel P . Berrangé
On Tue, Mar 27, 2018 at 04:31:29PM -0600, Jim Fehlig wrote:
> Currently the libxl driver claims support for Xen >= 4.4, but
> Xen 4.4 and 4.5 are no longer supported upstream. Let's increase
> the minimum supported version to 4.6.

Generally libvirt would keep supporting things even if upstream
drops support, if some relevant distro still ships and supports
it. RHEL doesn't ship libxl though, so just Q of whether these
libxl versions are relevant to any Suse or Debian distros that
are actively used.

> 
> Signed-off-by: Jim Fehlig 
> ---
>  docs/drvxen.html.in | 11 +--
>  m4/virt-driver-libxl.m4 | 23 ++-
>  2 files changed, 7 insertions(+), 27 deletions(-)
> 
> diff --git a/docs/drvxen.html.in b/docs/drvxen.html.in
> index d30ed2a04..935677387 100644
> --- a/docs/drvxen.html.in
> +++ b/docs/drvxen.html.in
> @@ -56,12 +56,11 @@
>  any other non-config files in this directory.
>
>
> -libxl: Starting with Xen 4.2, the legacy XenD/xm
> -toolstack is deprecated in favor of libxl, also commonly called
> -libxenlight.  libvirt supports this new Xen toolstack via the
> -libxl driver.  If XenD is enabled, the legacy xen driver consisting
> -of the above mentioned channels will be used.  If XenD is disabled,
> -the libxl driver will be used.
> +libxl: Starting with Xen 4.5, the legacy xm/xend
> +toolstack was removed and replaced with the new xl/libxl toolstack,
> +also commonly called libxenlight.  libvirt has supported this new
> +Xen toolstack since its introduction in Xen 4.2 and currently
> +supports Xen >= 4.6.
>
>  
>  
> diff --git a/m4/virt-driver-libxl.m4 b/m4/virt-driver-libxl.m4
> index 2cc1c062d..48d2d7dfa 100644
> --- a/m4/virt-driver-libxl.m4
> +++ b/m4/virt-driver-libxl.m4
> @@ -29,33 +29,14 @@ AC_DEFUN([LIBVIRT_DRIVER_CHECK_LIBXL], [
>LIBXL_API_VERSION="-DLIBXL_API_VERSION=0x040400"
>  
>dnl search for libxl, aka libxenlight
> -  dnl Xen > 4.5 introduced a pkgconfig file, check for it first
> +  dnl Xen 4.6 introduced a pkgconfig file
>old_with_libxl="$with_libxl"
> -  LIBVIRT_CHECK_PKG([LIBXL], [xenlight], [4.4.0], [true])
> +  LIBVIRT_CHECK_PKG([LIBXL], [xenlight], [4.6.0])
>if test "x$with_libxl" = "xyes" ; then
>  LIBXL_FIRMWARE_DIR=$($PKG_CONFIG --variable xenfirmwaredir xenlight)
>  LIBXL_EXECBIN_DIR=$($PKG_CONFIG --variable libexec_bin xenlight)
>fi
>  
> -  dnl pkgconfig file not found, fallback to lib probe
> -  if test "x$with_libxl" = "xno" ; then
> -with_libxl="$old_with_libxl"
> -
> -dnl LIBXL_API_VERSION 4.4.0 introduced a new parameter to
> -dnl libxl_domain_create_restore for specifying restore parameters.
> -dnl The libxl driver will make use of this new parameter for specifying
> -dnl the Xen migration stream version. Specify LIBXL_API_VERSION to 
> trigger
> -dnl an error if there is too old xenlight
> -old_CFLAGS="$CFLAGS"
> -CFLAGS="$CFLAGS $LIBXL_API_VERSION"
> -LIBVIRT_CHECK_LIB([LIBXL], [xenlight], [libxl_ctx_alloc], [libxl.h], 
> [fail="1"])
> -CFLAGS="$old_CFLAGS"
> -
> -if test $fail = 1; then
> -  AC_MSG_ERROR([You must install the libxl Library from Xen >= 4.4 to 
> compile libxenlight driver with -lxl])
> -fi
> -  fi
> -
>if test "$with_libxl" = "yes"; then
>  old_LIBS="$LIBS"
>  old_CFLAGS="$CFLAGS"
> -- 
> 2.16.2
> 
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [jenkins-ci PATCH] Revert "local"

2018-03-28 Thread Peter Krempa
On Wed, Mar 28, 2018 at 10:42:51 +0200, Andrea Bolognani wrote:
> On Tue, 2018-03-27 at 20:48 +0200, Peter Krempa wrote:
> > On Tue, Mar 27, 2018 at 18:19:43 +0200, Andrea Bolognani wrote:
> > > This reverts commit c190e17fb8f689a0591dedded33d10cecafe3e20.
> > > 
> > > As the original commit message so eloquently explains, the
> > > diff contains the tweaks I need for my local setup and it was,
> > > of course, never supposed to be pushed :/
> > > 
> > > Signed-off-by: Andrea Bolognani 
> > 
> > One of the actually useful things about the commit hook we have is that
> > if you don't sign-off the commit you can't push it. Thus you should not
> > sign-off commits which are not ready ...
> 
> Good point.
> 
> I've changed my setup to generate S-o-bs at format-patch time
> rather than commit time, so hopefully this won't happen again.

And does that add the S-o-b to your local commits too? If it only
signs-off the formatted mails, it's kind of useless, since you won't be
able to push them until you add the signoffs locally.


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [jenkins-ci PATCH] Revert "local"

2018-03-28 Thread Andrea Bolognani
On Tue, 2018-03-27 at 20:48 +0200, Peter Krempa wrote:
> On Tue, Mar 27, 2018 at 18:19:43 +0200, Andrea Bolognani wrote:
> > This reverts commit c190e17fb8f689a0591dedded33d10cecafe3e20.
> > 
> > As the original commit message so eloquently explains, the
> > diff contains the tweaks I need for my local setup and it was,
> > of course, never supposed to be pushed :/
> > 
> > Signed-off-by: Andrea Bolognani 
> 
> One of the actually useful things about the commit hook we have is that
> if you don't sign-off the commit you can't push it. Thus you should not
> sign-off commits which are not ready ...

Good point.

I've changed my setup to generate S-o-bs at format-patch time
rather than commit time, so hopefully this won't happen again.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 1/4] qemu: hotplug: Provide a string of a subsystem type instead of an int

2018-03-28 Thread Erik Skultety
On Tue, Mar 27, 2018 at 02:46:49PM +0100, Daniel P. Berrangé wrote:
> On Tue, Mar 27, 2018 at 03:42:08PM +0200, Erik Skultety wrote:
> > On Tue, Mar 27, 2018 at 10:24:54AM +0100, Daniel P. Berrangé wrote:
> > > On Tue, Mar 27, 2018 at 11:17:51AM +0200, Peter Krempa wrote:
> > > > On Tue, Mar 27, 2018 at 10:57:13 +0200, Erik Skultety wrote:
> > > > > If one tries to detach a non-existent device, the error they get is:
> > > > > "Unexpected hostdev type ". Let's use ToString conversion, since
> > > > > the XML parser would have complained already if the type to be 
> > > > > unplugged
> > > > > was unknown to libvirt.
> > > > >
> > > > > Signed-off-by: Erik Skultety 
> > > > > ---
> > > > >  src/qemu/qemu_hotplug.c | 3 ++-
> > > > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
> > > > > index 49af4d4ff..6ec401e21 100644
> > > > > --- a/src/qemu/qemu_hotplug.c
> > > > > +++ b/src/qemu/qemu_hotplug.c
> > > > > @@ -5077,7 +5077,8 @@ int qemuDomainDetachHostDevice(virQEMUDriverPtr 
> > > > > driver,
> > > > >  break;
> > > > >  default:
> > > > >  virReportError(VIR_ERR_INTERNAL_ERROR,
> > > > > -   _("unexpected hostdev type %d"), 
> > > > > subsys->type);
> > > > > +   _("unexpected hostdev type '%s'"),
> > > > > +   
> > > > > virDomainHostdevSubsysTypeToString(subsys->type));
> > > >
> > > > If the type is out of range of the enum this will return NULL. So you
> > > > need to use NULLSTR()
> > > >
> > > > ACK with that tweak
> > >
> > > Actually any default: or _LAST: case should use virReportEnumRangeError().
> > > The virDomainHostdevSubsysTypeToString() methods should only be used in
> > > explicitly matched enums constants.
> >
> > I understand having this kind of safe guard, but we have a specific code 
> > path
> > here where the XML parser has already taken care of non-existent types and
> > we're left with only types which do not support or do not care about 
> > hotplug,
> > therefore an error like "Unexpected value  blah" doesn't IMHO make
> > sense and doesn't tell you anything, we should reformulate the whole
> > 'unexpected' part of the error, we expected it just fine, it's just there's 
> > no
> > such device in the domain and even if it was, we don't know whether we can 
> > do
> > hotplug on it, that's what you can read from the code as you follow the 
> > detach
> > procedure.
>
> The point is to be robust against mistakes in the XML parser, or code that
> runs after it. We've had cases in the code where we parsed the wrong enum
> into a field, so we would have ended up with unexpected values. Or something
> could mistakenly overwrite the type value after parsing but before calling
> this function.

Fair enough, I'm going to drop this patch for the time being and create a
bite-sized task to add virReportEnumRangeError to all the places where it's
missing.

Erik

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list