]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
4 years agomeson: add -Wall and -Wextra explicitly
Pavel Hrdina [Tue, 1 Sep 2020 12:54:27 +0000 (14:54 +0200)] 
meson: add -Wall and -Wextra explicitly

If someone runs `meson setup --buildtype plain` meson ignores
warning_level=2 that is in our meson.build file. The implication is
that Meson will not automatically add -Wall which enables -Wformat.

This breaks building libvirt from git with the buildtype set to plain.

There is an issue reported [1] to not ignore warning_level silently
and the change to ignore it was done by upstream commit [2].

This change makes Meson print warnings about using warning_level which
as described above doesn't work for all build types.

[1] <https://github.com/mesonbuild/meson/issues/7399>
[2] <https://github.com/mesonbuild/meson/commit/8ee1c9a07a3a35e3ed262fbc358fd86c257a966e>

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoremote: use SocketMode=0600 when polkit is not compiled
Daniel P. Berrangé [Fri, 7 Aug 2020 12:37:05 +0000 (13:37 +0100)] 
remote: use SocketMode=0600 when polkit is not compiled

The systemd .socket unit files we ship for libvirt daemons use
SocketMode=0666 on the assumption that libvirt is built with
polkit which provides access control.

Some people, however, may have explicitly turned off polkit at
build time and not realize that leaves them insecure unless
they also change the SocketMode.  This addresses that problem
by making the SocketMode default to 0600 when polkit is
disabled at compile time.

Note we cannot automatically fix the case where the user
compiles polkit, but then overrides the libvirtd.conf defaults
to disable polkit. This is what lead to CVE-2020-15708 in
Ubuntu 20.10.  We can at least improve the inline comments
in the config file to give a clearer warning though, which
may have helped avoid the mistaken config.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agonews: qemu: Support TLS for NBD connections for pull mode backup
Yanqiu Zhang [Thu, 3 Sep 2020 02:56:48 +0000 (02:56 +0000)] 
news: qemu: Support TLS for NBD connections for pull mode backup

Signed-off-by: Yanqiu Zhang <yanqzhan@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agotests: change confusing macro agument names
Jonathon Jongsma [Wed, 2 Sep 2020 19:45:38 +0000 (14:45 -0500)] 
tests: change confusing macro agument names

Rather than use the names "fial" and "kep", use "fail" and "keep". In
the DO_TEST() macro, to prevent the preprocessor replacing the struct
member names during assignment, use the names "fail_" and "keep_"
instead.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agoqemu_validate: Only allow none address for watchdog ib700
Han Han [Tue, 1 Sep 2020 14:15:27 +0000 (22:15 +0800)] 
qemu_validate: Only allow none address for watchdog ib700

Since QEMU 1.5.3, the ib700 watchdog device has no options for address,
and not address in device tree:

$ /usr/libexec/qemu-kvm -version
QEMU emulator version 1.5.3 (qemu-kvm-1.5.3-175.el7), Copyright (c) 2003-2008 Fabrice Bellard
$ /usr/libexec/qemu-kvm -device ib700,\?
$ virsh qemu-monitor-command seabios --hmp info qtree|grep ib700 -A 2
        dev: ib700, id "watchdog0"
        dev: isa-serial, id "serial0"
          index = 0

So only allow it to use none address.

Fixes: 8a54cc1d08a333283c9cfc3fd7788be2642ca71a
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1509908

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: Fix domfsinfo for non-PCI device information from guest agent
Thomas Huth [Mon, 20 Jul 2020 10:22:33 +0000 (12:22 +0200)] 
qemu: Fix domfsinfo for non-PCI device information from guest agent

qemuAgentFSInfoToPublic() currently only sets the devAlias for PCI devices.
However, the QEMU guest agent could also provide the device name in the
"dev" field of the response for other devices instead (well, at least after
fixing another problem in the current QEMU guest agent...). So if creating
the devAlias from the PCI information failed, let's fall back to the name
provided by the guest agent. This helps to fix the empty "Target" fields
that occur when running "virsh domfsinfo" on s390x where CCW devices are
used for the guest instead of PCI devices.

Also add a proper debug message here in case we completely failed to set the
device alias, since this problem here was very hard to debug: The only two
error messages that I've seen were "Unable to get filesystem information"
and "Unable to encode message payload" - which only indicates that something
went wrong in the RPC call. No debug message indicated the real problem, so
I had to learn the hard way why the RPC call failed (it apparently does not
like devAlias left to be NULL) and where the real problem comes from.

Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1755075
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
4 years agoqemu: Do not silently allow non-available timers on non-x86 systems
Thomas Huth [Wed, 5 Aug 2020 10:22:26 +0000 (12:22 +0200)] 
qemu: Do not silently allow non-available timers on non-x86 systems

libvirt currently silently allows <timer name="kvmclock"/> and some
other timer tags in the guest XML definition for timers that do not
exist on non-x86 systems. We should not silently ignore these tags
since the users might not get what they expected otherwise.
Note: The error is only generated if the timer is marked with
present="yes" - otherwise we would suddenly refuse XML definitions
that worked without problems before.

Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1754887
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoAUTHORS: Remove Emacs file variables
Andrea Bolognani [Tue, 25 Aug 2020 16:07:01 +0000 (18:07 +0200)] 
AUTHORS: Remove Emacs file variables

vim seems to be able to process the file just fine without a
modeline, so it's probably fair to assume Emacs doesn't need
any extra help either.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoAUTHORS: Convert to reStructuredText
Andrea Bolognani [Tue, 25 Aug 2020 15:52:24 +0000 (17:52 +0200)] 
AUTHORS: Convert to reStructuredText

Now that we have moved to Meson, we are no longer required to
use a specific name for this file, and since the rest of our
documentation is in reStructuredText format and uses a matching
file extension, we can give the AUTHORS file the same treatment.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agolib: Prefer WITH_* prefix for #if conditionals
Michal Privoznik [Tue, 1 Sep 2020 11:27:44 +0000 (13:27 +0200)] 
lib: Prefer WITH_* prefix for #if conditionals

Currently, we are mixing: #if HAVE_BLAH with #if WITH_BLAH.
Things got way better with Pavel's work on meson, but apparently,
mixing these two lead to confusing and easy to miss bugs (see
31fb929eca for instance). While we were forced to use HAVE_
prefix with autotools, we are free to chose our own prefix with
meson and since WITH_ prefix appears to be more popular let's use
it everywhere.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agonss: Drop needless include of rpc/types.h
Michal Privoznik [Tue, 1 Sep 2020 12:30:42 +0000 (14:30 +0200)] 
nss: Drop needless include of rpc/types.h

In packet-libvirt.c in wireshark dissector we include rpc/types.h
but guard the include with a condition (that is supposed to be
true if we detected during configure phase that the host system
has the header file). Thing is, it looks like we were never doing
the configure check and thus the file was never included and yet,
the NSS plugin works. Drop the include then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agomeson: Drop checks for some functions and header files
Michal Privoznik [Tue, 1 Sep 2020 12:30:34 +0000 (14:30 +0200)] 
meson: Drop checks for some functions and header files

In meson.build, we check for presence of unshare() function
explicitly (even though there is the function usability check a
few hundred lines below), but never have any code depending on
HAVE_UNSHARE. The same applies to stdarg.h and sys/sysctl.h
header files - either we simply include them or guard their
include using different conditionals.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirfile.c: Remove some #endif comments
Michal Privoznik [Tue, 1 Sep 2020 12:23:32 +0000 (14:23 +0200)] 
virfile.c: Remove some #endif comments

There are couple of conditional #includes at the beginning of
virfile.c and they try to be nice and document #endifs. But they
are mostly wrong because either they have the condition in the
comment inverted or the comment refers to a different condition
than they belong to. Just remove the comments as these #includes
are single line mostly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoutil: Check for HAVE_NET_IF_H correctly
Michal Privoznik [Tue, 1 Sep 2020 12:21:41 +0000 (14:21 +0200)] 
util: Check for HAVE_NET_IF_H correctly

There are two places where we try to check whether the host
system has net/if.h before including it. But the check is missing
'_H' suffix.

Fixes: 7f3eb533f44742071366e07a35ab41070956707b
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: Add e1000e/vmxnet3 IFF_VNET_HDR support
Patrick Magauran [Sat, 8 Aug 2020 13:59:13 +0000 (09:59 -0400)] 
qemu: Add e1000e/vmxnet3 IFF_VNET_HDR support

Setting IFF_VNET_HDR for a tap device passes the whole packet to the
host, reducing emulation overhead and improving performance.

Libvirt bases its decision about applying IFF_VNET_HDR to the tap
interface on whether or not the model of the emulated network device
is virtio.  Originally, virtio was the only model to support
IFF_VNET_HDR in QEMU; however, the e1000e & vmxnet3 adapters have also
supported it since their introductions - QEMU commit
786fd2b0f87 for vmxnet3, and QEMU commit 6f3fbe4ed0 for e1000e, so it
should be set for those models too.

Signed-off-by: Patrick Magauran <patmagauran.j@gmail.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agotests/meson: fix mock library link on MacOS
Scott Shambarger [Fri, 28 Aug 2020 19:35:01 +0000 (12:35 -0700)] 
tests/meson: fix mock library link on MacOS

MacOS can not pre-load modules, so mock libraries must be built
as shared libraries (without asneeded striping, and undefined
symbols allowed).

Signed-off-by: Scott Shambarger <scott-libvirt@shambarger.net>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoconf: fix enum conversion
Ján Tomko [Tue, 1 Sep 2020 21:30:35 +0000 (23:30 +0200)] 
conf: fix enum conversion

../src/conf/domain_conf.c:8144:78: error: result of comparison of unsigned enum expression < 0 is always false [-Werror,-Wtautological-unsigned-enum-zero-compare]
        if ((def->writeFiltering = virTristateBoolTypeFromString(filtering)) < 0) {
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 9d15647dcb96831c93ac8c1d67c47265b5ed9072
4 years agotests: fix license blurb in virsh-undefine
Ján Tomko [Tue, 4 Aug 2020 14:40:34 +0000 (16:40 +0200)] 
tests: fix license blurb in virsh-undefine

Assume commit 0466ff28f2 used case-insensitive replace s/OUT/EXP/
by mistake and this file is still licensed under GPLv2.0+

Undo the change.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
FIxes: 0466ff28f23f4c430906efd5859f87672cf08782
Cc: Cole Robinson <crobinso@redhat.com>
Cc: Eric Blake <eblake@redhat.com>
Cc: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Pino Toscano <ptoscano@redhat.com>
4 years agoNews: Advertise support for writeFiltering attribute of PCI hostdevs
Jim Fehlig [Fri, 14 Aug 2020 21:30:17 +0000 (15:30 -0600)] 
News: Advertise support for writeFiltering attribute of PCI hostdevs

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoXen: Add support for writeFiltering in config converter
Jim Fehlig [Fri, 14 Aug 2020 20:47:09 +0000 (14:47 -0600)] 
Xen: Add support for writeFiltering in config converter

Add support for the writeFiltering attribute in the domXML to native
config converter. Also include a test.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoXen: Add writeFiltering option for PCI devices
Jim Fehlig [Fri, 14 Aug 2020 16:28:38 +0000 (10:28 -0600)] 
Xen: Add writeFiltering option for PCI devices

By default Xen only allows guests to write "known safe" values into PCI
configuration space, yet many devices require writes to other areas of
the configuration space in order to operate properly. To allow writing
any values Xen supports the 'permissive' setting, see xl.cfg(5) man page.

This change models Xen's permissive setting by adding a writeFiltering
attribute on the <source> element of a PCI hostdev. When writeFiltering
is set to 'no', the Xen permissive setting will be enabled and guests
will be able to write any values into the device's configuration space.
The permissive setting remains disabled in the absense of the
writeFiltering attribute, of if it is explicitly set to 'yes'.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Simon Gaiser <simon@invisiblethingslab.com>
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoqemu: Check for changes in qemu modules directory
Jim Fehlig [Thu, 20 Aug 2020 21:52:17 +0000 (15:52 -0600)] 
qemu: Check for changes in qemu modules directory

Add a configuration option for specifying location of the qemu modules
directory, defaulting to /usr/lib64/qemu. Then use this location to
check for changes in the directory, indicating that a qemu module has
changed and capabilities need to be reprobed.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoPrefer https: everywhere where possible
Ján Tomko [Tue, 25 Aug 2020 22:44:00 +0000 (00:44 +0200)] 
Prefer https: everywhere where possible

Use https: links for websites that support them.

The URIs which are used as namespace identifiers
are left alone.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agoPrefer https: for libguestfs.org links
Ján Tomko [Tue, 25 Aug 2020 22:52:40 +0000 (00:52 +0200)] 
Prefer https: for libguestfs.org links

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agoPrefer https: for Red Hat websites
Ján Tomko [Tue, 25 Aug 2020 22:49:31 +0000 (00:49 +0200)] 
Prefer https: for Red Hat websites

The list archives, people.redhat.com and bugzilla all support
https.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agoPrefer https: for Wikipedia links
Ján Tomko [Tue, 25 Aug 2020 22:46:53 +0000 (00:46 +0200)] 
Prefer https: for Wikipedia links

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agovbox: do not repeat the innotek namespace url
Ján Tomko [Tue, 25 Aug 2020 22:42:56 +0000 (00:42 +0200)] 
vbox: do not repeat the innotek namespace url

Also, remove the url from the translatable string,
reducing it to the generic message already used
by virXMLNamespaceRegister.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agotools: wireshark: fix link to wireshark repo
Ján Tomko [Wed, 26 Aug 2020 12:47:18 +0000 (14:47 +0200)] 
tools: wireshark: fix link to wireshark repo

It seems wireshark has migrated to gitlab in the meantime.
Point there instead of to the dead svn repo.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agodocs: tlscerts: fix link to certtool invocation
Ján Tomko [Wed, 26 Aug 2020 15:05:35 +0000 (17:05 +0200)] 
docs: tlscerts: fix link to certtool invocation

The docs have moved to gnutls.org.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agolibxl: do not include math.h
Ján Tomko [Tue, 25 Aug 2020 15:34:03 +0000 (17:34 +0200)] 
libxl: do not include math.h

The include was introduced by:
  commit 3d6fe99c5c3b862db1b345da3598a920f1079b6e
    Add vcpu functions to libxl driver
which used ceil() and floor(), but these were later
removed by:
  commit 3eb869a04bdeaddbe10e74568540e865fb79e412
    libxl: avoid compiler warning
which did not remove the include.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
4 years agoutil: assign tap device names using a monotonically increasing integer
Laine Stump [Mon, 24 Aug 2020 01:20:13 +0000 (21:20 -0400)] 
util: assign tap device names using a monotonically increasing integer

When creating a standard tap device, if provided with an ifname that
contains "%d", rather than taking that literally as the name to use
for the new device, the kernel will instead use that string as a
template, and search for the lowest number that could be put in place
of %d and produce an otherwise unused and unique name for the new
device. For example, if there is no tap device name given in the XML,
libvirt will always send "vnet%d" as the device name, and the kernel
will create new devices named "vnet0", "vnet1", etc. If one of those
devices is deleted, creating a "hole" in the name list, the kernel
will always attempt to reuse the name in the hole first before using a
name with a higher number (i.e. it finds the lowest possible unused
number).

The problem with this, as described in the previous patch dealing with
macvtap device naming, is that it makes "immediate reuse" of a newly
freed tap device name *much* more common, and in the aftermath of
deleting a tap device, there is some other necessary cleanup of things
which are named based on the device name (nwfilter rules, bandwidth
rules, OVS switch ports, to name a few) that could end up stomping
over the top of the setup of a new device of the same name for a
different guest.

Since the kernel "create a name based on a template" functionality for
tap devices doesn't exist for macvtap, this patch for standard tap
devices is a bit different from the previous patch for macvtap - in
particular there was no previous "bitmap ID reservation system" or
overly-complex retry loop that needed to be removed. We simply find
and unused name, and pass that name on to the kernel instead of
"vnet%d".

This counter is also wrapped when either it gets to INT_MAX or if the
full name would overflow IFNAMSIZ-1 characters. In the case of
"vnet%d" and a 32 bit int, we would reach INT_MAX first, but possibly
someday someone will change the name from vnet to something else.

(NB: It is still possible for a user to provide their own
parameterized template name (e.g. "mytap%d") in the XML, and libvirt
will just pass that through to the kernel as it always has.)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: replace macvtap name reservation bitmap with a simple counter
Laine Stump [Sun, 23 Aug 2020 18:57:19 +0000 (14:57 -0400)] 
util: replace macvtap name reservation bitmap with a simple counter

There have been some reports that, due to libvirt always trying to
assign the lowest numbered macvtap / tap device name possible, a new
guest would sometimes be started using the same tap device name as
previously used by another guest that is in the process of being
destroyed *as the new guest is starting.

In some cases this has led to, for example, the old guest's
qemuProcessStop() code deleting a port from an OVS switch that had
just been re-added by the new guest (because the port name is based on
only the device name using the port). Similar problems can happen (and
I believe have) with nwfilter rules and bandwidth rules (which are
both instantiated based on the name of the tap device).

A couple patches have been previously proposed to change the ordering
of startup and shutdown processing, or to put a mutex around
everything related to the tap/macvtap device name usage, but in the
end no matter what you do there will still be possible holes, because
the device could be deleted outside libvirt's control (for example,
regular tap devices are automatically deleted when the qemu process
terminates, and that isn't always initiated by libvirt but could
instead happen completely asynchronously - libvirt then has no control
over the ordering of shutdown operations, and no opportunity to
protect it with a mutex.)

But this only happens if a new device is created at the same time as
one is being deleted. We can effectively eliminate the chance of this
happening if we end the practice of always looking for the lowest
numbered available device name, and instead just keep an integer that
is incremented each time we need a new device name. At some point it
will need to wrap back around to 0 (in order to avoid the IFNAMSIZ 15
character limit if nothing else), and we can't guarantee that the new
name really will be the *least* recently used name, but "math"
suggests that it will be *much* less common that we'll try to re-use
the *most* recently used name.

This patch implements such a counter for macvtap/macvlan, replacing
the existing, and much more complicated, "ID reservation" system. The
counter is set according to whatever macvtap/macvlan devices are
already in use by guests when libvirtd is started, incremented each
time a new device name is needed, and wraps back to 0 when either
INT_MAX is reached, or when the resulting device name would be longer
than IFNAMSIZ-1 characters (which actually is what happens when the
template for the device name is "maccvtap%d"). The result is that no
macvtap name will be re-used until the host has created (and possibly
destroyed) 99,999,999 devices.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agomeson: link libm
Laine Stump [Wed, 26 Aug 2020 18:22:07 +0000 (14:22 -0400)] 
meson: link libm

On some platforms libm (needed for the pow() function) isn't being
linked in somehow. This patch adds the necessary bits to assure that
it's linked in when necessary.

Suggested-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 20a62b42ec001310a6329d7ee2021f0737d534ef)

4 years agomeson: Use @BASENAME@ more
Andrea Bolognani [Tue, 25 Aug 2020 16:30:57 +0000 (18:30 +0200)] 
meson: Use @BASENAME@ more

This patch takes care of just the obvious cases: there are
many more situations where the data we pass to configure_file()
could likely be obtained in a more effective way, but we can
address the low-hanging fruits as a first approximation.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agonss: Finish renaming of HAVE_BSD_NSS macro
Michal Privoznik [Tue, 1 Sep 2020 09:19:26 +0000 (11:19 +0200)] 
nss: Finish renaming of HAVE_BSD_NSS macro

When switching to meson, some of HAVE_* macros were renamed to
WITH_ because they did not reflect whether the build platform has
or doesn't have something, but whether we are building with some
functionality turned on or off. This is the case with
HAVE_BSD_NSS macro too. As a result, the NSS plugin built on BSD
did not expose nss_module_register() function which made the
plugin unusable:

https://www.redhat.com/archives/libvir-list/2020-September/msg00000.html

Fixes: c74268705557a6781788ba011492c15df2e3df11
Reported-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agorpm: Fix conditional for defining %_vpath_builddir for RHEL <= 7
Neal Gompa [Sun, 30 Aug 2020 00:09:18 +0000 (20:09 -0400)] 
rpm: Fix conditional for defining %_vpath_builddir for RHEL <= 7

The conditional was incorrectly overriding %_vpath_builddir when
%rhel is not defined, which led to surprising behavior when the
global %_vpath_builddir path is set on Fedora already.

Signed-off-by: Neal Gompa <ngompa13@gmail.com>
Message-Id: <20200830000918.11431-1-ngompa13@gmail.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoqemu: Validate memory hotplug in domainValidateCallback instead of cmd line generator
Michal Privoznik [Tue, 28 Jul 2020 08:51:32 +0000 (10:51 +0200)] 
qemu: Validate memory hotplug in domainValidateCallback instead of cmd line generator

When editing a domain with hotplug enabled, I removed the only
NUMA node it had and got no error. I got the error later though,
when starting the domain. This is not as user friendly as it can
be. Move the validation call out from command line generator and
into domain validator (which is called prior to starting cmd line
generation anyway).

When doing this, I had to remove memory-hotplug-nonuma xml2xml
test case because there is no way the test case can succeed,
obviously.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoPost-release version bump to 6.8.0
Jiri Denemark [Tue, 1 Sep 2020 07:10:30 +0000 (09:10 +0200)] 
Post-release version bump to 6.8.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoRelease of libvirt-6.7.0 v6.7.0
Jiri Denemark [Tue, 1 Sep 2020 07:08:47 +0000 (09:08 +0200)] 
Release of libvirt-6.7.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoRNG: Allow interleaving of /domain/cpu/numa/cell children
Michal Privoznik [Mon, 31 Aug 2020 09:35:47 +0000 (11:35 +0200)] 
RNG: Allow interleaving of /domain/cpu/numa/cell children

So far, the <cell/> element can have two types of children
elements: <distances/> and <cache/> (which can be repeated more
times). However, there is no reason to require specific order in
input XML. Allow elements to be interleaved.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agonews: mention removal of autogenerated macvtap names from migration XML
Laine Stump [Fri, 28 Aug 2020 17:40:40 +0000 (13:40 -0400)] 
news: mention removal of autogenerated macvtap names from migration XML

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodocs: Remove extraneous plus signs from virsh man page v6.7.0-rc2
Martin Kletzander [Fri, 28 Aug 2020 12:58:38 +0000 (14:58 +0200)] 
docs: Remove extraneous plus signs from virsh man page

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agonews: mention bhyve sound support
Roman Bogorodskiy [Thu, 27 Aug 2020 14:07:48 +0000 (18:07 +0400)] 
news: mention bhyve sound support

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoNEWS: Document improvements/bug fixes for upcoming release
Michal Privoznik [Fri, 28 Aug 2020 11:33:11 +0000 (13:33 +0200)] 
NEWS: Document improvements/bug fixes for upcoming release

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
4 years agonews: Document the `role` attribute for shmem device
Wang Xin [Fri, 21 Aug 2020 08:53:00 +0000 (16:53 +0800)] 
news: Document the `role` attribute for shmem device

Signed-off-by: Wang Xin <wangxinxin.wang@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoTranslated using Weblate (Ukrainian)
Yuri Chornoivan [Thu, 27 Aug 2020 08:44:15 +0000 (10:44 +0200)] 
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10366 of 10366 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/uk/

Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
4 years agoUpdate translation files
Weblate [Thu, 27 Aug 2020 08:44:11 +0000 (10:44 +0200)] 
Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/

Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
4 years agoTranslated using Weblate (Polish)
Piotr Drąg [Thu, 27 Aug 2020 08:44:05 +0000 (10:44 +0200)] 
Translated using Weblate (Polish)

Currently translated at 23.6% (2447 of 10349 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/pl/

Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
Translated using Weblate (Polish)

Currently translated at 23.6% (2447 of 10349 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/pl/

Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
4 years agoTranslated using Weblate (Polish)
Szymon Scholz [Thu, 27 Aug 2020 08:44:01 +0000 (10:44 +0200)] 
Translated using Weblate (Polish)

Currently translated at 23.6% (2445 of 10349 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/pl/

Signed-off-by: Szymon Scholz <szymonscholz@gmail.com>
Translated using Weblate (Polish)

Currently translated at 23.6% (2445 of 10349 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/pl/

Signed-off-by: Szymon Scholz <szymonscholz@gmail.com>
4 years agoTranslated using Weblate (Polish)
Piotr Drąg [Thu, 27 Aug 2020 08:43:58 +0000 (10:43 +0200)] 
Translated using Weblate (Polish)

Currently translated at 23.6% (2445 of 10349 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/pl/

Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
4 years agoTranslated using Weblate (Polish)
Szymon Scholz [Thu, 27 Aug 2020 08:43:53 +0000 (10:43 +0200)] 
Translated using Weblate (Polish)

Currently translated at 23.6% (2443 of 10349 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/pl/

Signed-off-by: Szymon Scholz <szymonscholz@gmail.com>
Translated using Weblate (Polish)

Currently translated at 23.6% (2443 of 10349 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/pl/

Signed-off-by: Szymon Scholz <szymonscholz@gmail.com>
4 years agoTranslated using Weblate (Polish)
Piotr Drąg [Thu, 27 Aug 2020 08:43:49 +0000 (10:43 +0200)] 
Translated using Weblate (Polish)

Currently translated at 23.6% (2443 of 10349 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/pl/

Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
4 years agoTranslated using Weblate (Polish)
Szymon Scholz [Thu, 27 Aug 2020 08:43:44 +0000 (10:43 +0200)] 
Translated using Weblate (Polish)

Currently translated at 23.5% (2437 of 10349 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/pl/

Signed-off-by: Szymon Scholz <szymonscholz@gmail.com>
4 years agodocs: add kbase entry for migrationinternals
Fangge Jin [Thu, 20 Aug 2020 10:09:24 +0000 (18:09 +0800)] 
docs: add kbase entry for migrationinternals

Commit c051e56d27 added migrationinternals.rst in kbase, but the
entry was missing.

Signed-off-by: Fangge Jin <fjin@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agodocs: formatdomain: fix `since` tag
Ján Tomko [Tue, 11 Aug 2020 23:05:03 +0000 (01:05 +0200)] 
docs: formatdomain: fix `since` tag

Fix the `since` tag for the disk target.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agomeson: don't install sysconf files unconditionally
Roman Bogorodskiy [Wed, 26 Aug 2020 13:47:14 +0000 (17:47 +0400)] 
meson: don't install sysconf files unconditionally

There's no need to install sysconf files when init script installation
was not requested, i.e. when configured with init_script=none.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agorpm: always disable ceph on 32-bit
Daniel P. Berrangé [Fri, 21 Aug 2020 11:29:02 +0000 (12:29 +0100)] 
rpm: always disable ceph on 32-bit

The logic to disable Ceph on 32-bit was protected by a Fedora
conditional. This is redundant as RHEL hasn't shipped any
32-bit platforms for years.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agopo: Refresh potfile for v6.7.0 v6.7.0-rc1
Jiri Denemark [Wed, 26 Aug 2020 09:18:25 +0000 (11:18 +0200)] 
po: Refresh potfile for v6.7.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoapparmor: allow libvirtd to call virtiofsd
Kevin Locke [Tue, 25 Aug 2020 13:31:27 +0000 (07:31 -0600)] 
apparmor: allow libvirtd to call virtiofsd

When using [virtiofs], libvirtd must launch [virtiofsd] to provide
filesystem access on the host.  When a guest is configured with
virtiofs, such as:

    <filesystem type='mount' accessmode='passthrough'>
      <driver type='virtiofs'/>
      <source dir='/path'/>
      <target dir='mount_tag'/>
    </filesystem>

Attempting to start the guest fails with:

    internal error: virtiofsd died unexpectedly

/var/log/libvirt/qemu/$name-fs0-virtiofsd.log contains (as a single
line, wrapped below):

    libvirt:  error : cannot execute binary /usr/lib/qemu/virtiofsd:
    Permission denied

dmesg contains (as a single line, wrapped below):

    audit: type=1400 audit(1598229295.959:73): apparmor="DENIED"
    operation="exec" profile="libvirtd" name="/usr/lib/qemu/virtiofsd"
    pid=46007 comm="rpc-worker" requested_mask="x" denied_mask="x"
    fsuid=0 ouid=0

To avoid this, allow execution of virtiofsd from the libvirtd AppArmor
profile.

[virtiofs]: https://libvirt.org/kbase/virtiofs.html
[virtiofsd]: https://www.qemu.org/docs/master/interop/virtiofsd.html

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
4 years agoutil: use host module suffix when loading drivers
Scott Shambarger [Tue, 25 Aug 2020 23:47:07 +0000 (16:47 -0700)] 
util: use host module suffix when loading drivers

Driver module loaders current hardcode ".so" as the file
extension.  On MacOS, meson uses ".dylib" as a module file extension.
This patch adds VIR_FILE_MODULE_EXT to virfile.h defined as the
hosts module extension, and updates driver module loaders to make
use of it.

Signed-off-by: Scott Shambarger <scott-libvirt@shambarger.net>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agodomaincapsmock: mock virHostCPUGetMicrocodeVersion()
Daniel Henrique Barboza [Mon, 24 Aug 2020 13:27:54 +0000 (10:27 -0300)] 
domaincapsmock: mock virHostCPUGetMicrocodeVersion()

Previous patch handled the runtime case where a non-x86 host is
fetching /proc/cpuinfo data for a microcode info that we know
it doesn't exist. This change alone speeded everything by a
bit for non-x86, but there is at least one major culprit left.

qemuxml2argvtest does several arch-specific tests, and a good
chunk of them are x86 exclusive. This means that 'hostArch'
will be seen as x86 for these tests, even when running in
non-x86 hosts. In a Power 9 server with 128 CPUs, qemuxml2argvtest
takes 298 seconds to complete in average, and 'perf record'
indicates that 95% of the time is spent in
virHostCPUGetMicrocodeVersion().

This patch mocks virHostCPUGetMicrocodeVersion() to always return
0 in the tests, avoiding /proc/cpuinfo reads. This will make all
tests behave arch-agnostic, and the microcode value being 0 has no
impact on any existing test.

This is a CI speed across the board for all archs, including x86,
given that we're not reading /proc/cpuinfo in the tests. For
a Thinkpad T480 laptop with 8 Intel i7 CPUs, qemuxml2argvtest
went from 15.50 sec to 12.50 seconds. The performance gain is even
more noticeable for huge servers with lots of CPUs. For the
Power 9 server mentioned above, this patch speeds qemuxml2argvtest
to 9 seconds, down from 298 sec.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirhostcpu.c: skip non x86 hosts in virHostCPUGetMicrocodeVersion()
Daniel Henrique Barboza [Mon, 24 Aug 2020 13:27:53 +0000 (10:27 -0300)] 
virhostcpu.c: skip non x86 hosts in virHostCPUGetMicrocodeVersion()

Non-x86 archs does not have a 'microcode' version like x86. This is
covered already inside the function - just return 0 if no microcode
is found. Regardless of that, a read of /proc/cpuinfo is always made.
Each read will invoke the kernel to fill in the CPU details every time.

Now let's consider a non-x86 host, like a Power 9 server with 128 CPUs.
Each /proc/cpuinfo read will need to fetch data for each CPU and it
won't even matter because we know beforehand that PowerPC chips don't
have microcode information.

We can do better for non-x86 hosts by skipping this process entirely.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirhostcpu.c: modernize virHostCPUGetMicrocodeVersion()
Daniel Henrique Barboza [Mon, 24 Aug 2020 13:27:52 +0000 (10:27 -0300)] 
virhostcpu.c: modernize virHostCPUGetMicrocodeVersion()

Use g_autofree and remove the cleanup label.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agobuild: add -Wdeclaration-after-statement
Ján Tomko [Mon, 27 Jul 2020 20:49:55 +0000 (22:49 +0200)] 
build: add -Wdeclaration-after-statement

Now that all the users have been converted or silenced,
let's enable this warning.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: use VIR_WARNINGS_NO_DECLARATION_AFTER_STATEMENT
Ján Tomko [Mon, 3 Aug 2020 15:32:22 +0000 (17:32 +0200)] 
tests: use VIR_WARNINGS_NO_DECLARATION_AFTER_STATEMENT

Some test rely too much on declaring variables in the middle
of the function. Use the macro to locally suppress the warning

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agosrc: internal: add VIR_WARNINGS_NO_DECLARATION_AFTER_STATEMENT
Ján Tomko [Mon, 3 Aug 2020 15:31:32 +0000 (17:31 +0200)] 
src: internal: add VIR_WARNINGS_NO_DECLARATION_AFTER_STATEMENT

Add a macro to suppress the warning.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoVIR_XPATH_NODE_AUTORESTORE: remove semicolon from users
Ján Tomko [Tue, 28 Jul 2020 19:47:48 +0000 (21:47 +0200)] 
VIR_XPATH_NODE_AUTORESTORE: remove semicolon from users

Since the macro no longer includes the 'ignore_value'
statement, stop putting another empty statement after it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: xml: use pragma in VIR_XPATH_NODE_AUTORESTORE
Ján Tomko [Tue, 28 Jul 2020 19:47:29 +0000 (21:47 +0200)] 
util: xml: use pragma in VIR_XPATH_NODE_AUTORESTORE

The VIR_XPATH_NODE_AUTORESTORE contains an ignore_value
statement to silence an unused variable warning on clang.

Use a pragma instead, which is not a statement.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: iscsitest: split out testISCSIScanTargetsTests
Ján Tomko [Tue, 28 Jul 2020 18:11:09 +0000 (20:11 +0200)] 
tests: iscsitest: split out testISCSIScanTargetsTests

The ScanTargets testing code declares some variables
in the middle of main.

Split it out into a separate function.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: cgroup: wrap BACKEND_CALL macro in a block
Ján Tomko [Tue, 28 Jul 2020 18:08:07 +0000 (20:08 +0200)] 
util: cgroup: wrap BACKEND_CALL macro in a block

VIR_CGROUP_BACKEND_CALL is exclusively used at the end
of a function, but it declares a variable.

Wrap it in a do..while block.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: authconfigtest: move declarations
Ján Tomko [Tue, 28 Jul 2020 18:11:01 +0000 (20:11 +0200)] 
tests: authconfigtest: move declarations

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: sockettest: move declarations
Ján Tomko [Tue, 28 Jul 2020 18:10:53 +0000 (20:10 +0200)] 
tests: sockettest: move declarations

Declare the structs: at the beginning of the block.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: virNetDevBridgeSet: split declarations
Ján Tomko [Tue, 28 Jul 2020 18:09:22 +0000 (20:09 +0200)] 
util: virNetDevBridgeSet: split declarations

Declare the variables at the beginning of the function,
then fill them up.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agosecurity: move chardevData declaration
Ján Tomko [Tue, 28 Jul 2020 17:59:54 +0000 (19:59 +0200)] 
security: move chardevData declaration

Declare it at the beginning of the function
instead of right before use.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agorpc: move lock after declaration
Ján Tomko [Tue, 28 Jul 2020 18:00:03 +0000 (20:00 +0200)] 
rpc: move lock after declaration

virNetClientRemoveStream starts by calling a lock.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoMove debug statements after declarations
Ján Tomko [Mon, 3 Aug 2020 15:28:06 +0000 (17:28 +0200)] 
Move debug statements after declarations

Many of our functions start with a DEBUG statement.
Move the statements after declarations to appease
our coding style.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoSplit declarations from initializations
Ján Tomko [Tue, 28 Jul 2020 17:50:28 +0000 (19:50 +0200)] 
Split declarations from initializations

Split those initializations that depend on a statement
above them.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoMove declarations before statements
Ján Tomko [Mon, 3 Aug 2020 15:27:58 +0000 (17:27 +0200)] 
Move declarations before statements

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: move declarations in virStorageFileChainLookup
Ján Tomko [Tue, 28 Jul 2020 18:09:40 +0000 (20:09 +0200)] 
util: move declarations in virStorageFileChainLookup

Use g_autofree and move the declarations to the beginning
of the block.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: virHostMem*Parameters: split out non-Linux stubs
Ján Tomko [Mon, 3 Aug 2020 15:58:03 +0000 (17:58 +0200)] 
util: virHostMem*Parameters: split out non-Linux stubs

Repeat the whole function header instead of mixing #ifdefs
in the code.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: virHostMemSetParameters: remove pointless variable
Ján Tomko [Mon, 3 Aug 2020 15:56:25 +0000 (17:56 +0200)] 
util: virHostMemSetParameters: remove pointless variable

It is only used inside the condition.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: virRandomInt: remove temporary variable
Ján Tomko [Tue, 28 Jul 2020 18:09:31 +0000 (20:09 +0200)] 
util: virRandomInt: remove temporary variable

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agonews: Mention support for device model commandline passthrough in Xen
Jim Fehlig [Fri, 31 Jul 2020 15:53:01 +0000 (09:53 -0600)] 
news: Mention support for device model commandline passthrough in Xen

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoXen: Add support for qemu commandline passthrough to config converter
Jim Fehlig [Fri, 31 Jul 2020 15:39:25 +0000 (09:39 -0600)] 
Xen: Add support for qemu commandline passthrough to config converter

Support qemu commandline passthrough in the domXML to native config
converter. Add tests to check the conversion.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoXen: Add support for qemu command-line passthrough
Jim Fehlig [Thu, 30 Jul 2020 19:25:20 +0000 (13:25 -0600)] 
Xen: Add support for qemu command-line passthrough

Xen supports passing arbitrary arguments to the QEMU device model via
the 'extra' member of the public libxl_domain_build_info structure.
This patch adds a 'xen' namespace extension, similar to the QEMU and
bhyve drivers, to map arbitrary arguments to the 'extra' member. Only
passthrough of arguments is supported. Passthrough of environment
variables or capabilities adjustments is not supported.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoNEWS.rst: update with NVDIMM auto-alignment removal for pSeries
Daniel Henrique Barboza [Mon, 24 Aug 2020 17:57:37 +0000 (14:57 -0300)] 
NEWS.rst: update with NVDIMM auto-alignment removal for pSeries

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agostorage_util: fix qemu-img sparse allocation
Pavel Hrdina [Tue, 25 Aug 2020 13:09:53 +0000 (15:09 +0200)] 
storage_util: fix qemu-img sparse allocation

Commit <c9ec7088c7a3f4cd26bb471f1f243931fff6f4f9> introduced a support
to fully allocate qcow2 images when <allocation> matches <capacity> but
it doesn't work as expected.

The issue is that info.size_arg is in KB but the info.allocation
introduced by the mentioned commit is in B. This results in using
"preallocation=falloc," in cases where "preallocation=metadata," should
be used.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirnetserver: fix some memory leaks in virNetTLSContextReloadForServer
Jin Yan [Thu, 13 Aug 2020 03:37:56 +0000 (11:37 +0800)] 
virnetserver: fix some memory leaks in virNetTLSContextReloadForServer

These leaks were introduced in commit 15d280fa97b0, use g_autofree for all
cert_path pointers.

Signed-off-by: Jin Yan <jinyan12@huawei.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoNEWS: Mention IQN setting for iSCSI hostdevs
Peter Krempa [Mon, 24 Aug 2020 15:11:05 +0000 (17:11 +0200)] 
NEWS: Mention IQN setting for iSCSI hostdevs

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agovirsh: Add source-initiator opt to build the initiator of pool XML
Han Han [Tue, 25 Aug 2020 03:50:33 +0000 (11:50 +0800)] 
virsh: Add source-initiator opt to build the initiator of pool XML

For iscsi-direct pool, the initiator is necessary for pool defining:
<pool type="iscsi-direct">
 ...
    <initiator>
      <iqn name="iqn.2013-06.com.example:iscsi-initiator"/>
    </initiator>
...
</pool>

Add --source-initiator to fill the initiator iqn for
pool-create-as/pool-define-as subcommands.

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

Signed-off-by: Han Han <hhan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMigrationCapsToJSON: Refactor capability object formatting
Peter Krempa [Mon, 24 Aug 2020 15:00:59 +0000 (17:00 +0200)] 
qemuMigrationCapsToJSON: Refactor capability object formatting

Use virJSONValueObjectCreate rather than creating the object
piece-by-piece and use new accessors for bitmap to simplify the code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agogitdm: add missing aliases
Pino Toscano [Mon, 24 Aug 2020 10:44:14 +0000 (12:44 +0200)] 
gitdm: add missing aliases

Consider a couple of misspelt emails in B-y tags.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agogitdm: move pld-linux.org to opensource
Pino Toscano [Mon, 24 Aug 2020 10:19:59 +0000 (12:19 +0200)] 
gitdm: move pld-linux.org to opensource

PLD Linux is a Linux distribution, so @pld-linux.org fits in the
opensource group with similar projects.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agodocs: formatdomain: document <audio> element
Roman Bogorodskiy [Fri, 7 Aug 2020 15:00:38 +0000 (19:00 +0400)] 
docs: formatdomain: document <audio> element

Document the new <audio> element which allows to specify
host audio backend for a guest <sound> device, and update
the <sound> element description with the new <audio>
sub-element which specifies the other end of the mapping.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agobhyve: allow to specify host sound device
Roman Bogorodskiy [Sat, 18 Jul 2020 11:23:28 +0000 (15:23 +0400)] 
bhyve: allow to specify host sound device

Allow to map sound playback and recording devices to host devices
using "<audio type='oss'/>" OSS audio backend.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoconf: allow to map sound device to host device
Roman Bogorodskiy [Sat, 18 Jul 2020 06:23:57 +0000 (10:23 +0400)] 
conf: allow to map sound device to host device

Introduce a new device element "<audio>" which allows
to map guest sound device specified using the "<sound>"
element to specific audio backend.

Example:

  <sound model='ich7'>
     <audio id='1'/>
  </sound>
  <audio id='1' type='oss'>
     <input dev='/dev/dsp0'/>
     <output dev='/dev/dsp0'/>
  </audio>

This block maps to OSS audio backend on the host using
/dev/dsp0 device for both input (recording)
and output (playback).

OSS is the only backend supported so far.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agobhyve: implement sound device support
Roman Bogorodskiy [Tue, 14 Jul 2020 14:44:13 +0000 (18:44 +0400)] 
bhyve: implement sound device support

bhyve supports intel hda sound devices that could be specified
on the command like using "-1:0,hda,play=$play_dev,rec=$rec_dev",
where "1:0" is a PCI address, and "$play_dev" and "$rec_dev"
point to the playback and recording device on the host respectively.
Currently, schema of the 'sound' element doesn't allow specifying
neither playback nor recording devices, so for now hardcode
/dev/dsp0, which is the first audio device on the host.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoconf: add 'ich7' sound model
Roman Bogorodskiy [Thu, 6 Aug 2020 14:40:37 +0000 (18:40 +0400)] 
conf: add 'ich7' sound model

Add 'ich7' sound model. This is a preparation for sound support in
bhyve, as 'ich7' is the only model it supports.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoconf: properly clear out autogenerated macvtap names when formatting/parsing
Laine Stump [Sun, 23 Aug 2020 03:42:52 +0000 (23:42 -0400)] 
conf: properly clear out autogenerated macvtap names when formatting/parsing

Back when macvtap support was added in commit 315baab9443 in Feb. 2010
(libvirt-0.7.7), it was setup to autogenerate a name for the device if
one wasn't supplied, in the pattern "macvtap%d" (or "macvlan%d"),
similar to the way an unspecified standard tap device name will lead
to an autogenerated "vnet%d".

As a matter of fact, in commit ca1b7cc8e45 added in May 2010, the code
was changed to *always* ignore a supplied device name for macvtap
interfaces by deleting *any* name immediately during the <interface>
parsing (this was intended to prevent one domain which had failed to
completely start from deleting the macvtap device of another domain
which had subsequently been provided the same device name (this will
seem mildly ironic later). This was later fixed to only clear the
device name when inactive XML was being parsed. HOWEVER - this was
only done if the xml was <interface type='direct'> - autogenerated
names were not cleared for <interface type='network'> (which could
also result in a macvtap device).

Although the names of "vnetX" tap devices had always been
automatically cleared when parsing <interface> (see commit d1304583d
from July 2008 (!)), at the time macvtap support was added, both vnetX
and macvtapX device names were always included when formatting the
XML.

Then in commit a8be259d0cc (July 2011, libvirt-0.9.4), <interface>
formatting was changed to also clear out "vnetX" device names during
XML formatting as well. However the same treatment wasn't given to
"macvtapX".

Now in 2020, there has been a report that a failed migration leads to
the macvtap device of some other unrelated guest on the destination
host losing its network connectivity. It was determined that this was
due to the domain XML in the migration containing a macvtap device
name, e.g. "macvtap0", that was already in use by the other guest on
the destination. Normally this wouldn't be a problem, because libvirt
would see that the device was already in use, and then find a
different unused name. But in this case, other external problems were
causing the migration to fail prior to selecting a macvtap device and
successfully opening it, and during error recovery, qemuProcessStop()
was called, which went through all def->nets objects and (if they were
macvtap) deleted the device specified in net->ifname; since libvirt
hadn't gotten to the point of replacing the incoming "macvtap0" with
the name of a device it actually created for this guest, that meant
that "macvtap0" was deleted, *even though it was currently in use by a
different guest*!

Whew!

So, it turns out that when formatting "migratable" XML, "vnetX"
devices are omitted, just as when formatting "inactive" XML. By making
the code in both interface parsing and formatting consistent for
"vnetX", "macvtapX", and "macvlanX", we can thus make sure that the
autogenerated (and unneeded / completely *not* wanted) macvtap device
name will not be sent with the migration XML. This way when a
migration fails, net->ifname will be NULL, and libvirt won't have any
device to try and (erroneously) delete.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoqemu: remove unreachable code in qemuProcessStart()
Laine Stump [Sat, 22 Aug 2020 21:43:24 +0000 (17:43 -0400)] 
qemu: remove unreachable code in qemuProcessStart()

Back when the original version of this chunk of code was added (commit
41b087198 in libvirt-0.8.1 in April 2010), we used virExecDaemonize()
to start the qemu process, and would continue on in the function
(which at that time was called qemudStartVMDaemon()) even if a -1 was
returned. So it was possible to get to this code with rv == -1 (it was
called "ret" in that version of the code).

In modern libvirt code, qemu is started with virCommandRun(); then we
call virPidFileReadPath(); those are the only two ways of setting "rv"
prior to this code being removed, and in either case if the new value
of rv < 0, then we immediately skip over the rest of the code to the
cleanup: label.

This means that the code being removed by this patch is
unreachable.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>