]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
5 years agodocs: Add programming-languages.rst
Andrea Bolognani [Mon, 6 Apr 2020 12:45:11 +0000 (14:45 +0200)]
docs: Add programming-languages.rst

Most new contributors are probably going to modify existing code rather
than introducing all-new programs and scripts, and even when the latter
happen they'll hopefully get a feel for which programming languages are
considered acceptable for the project by looking at what's already in
the repo. Make this part less prominent by moving it to a separate page.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: Add coding-style.rst
Andrea Bolognani [Mon, 6 Apr 2020 12:43:56 +0000 (14:43 +0200)]
docs: Add coding-style.rst

This part represents the biggest chunk of the existing hacking.rst, and
despite that its utility is very limited because 'make syntax-check'
already guarantees most of the rules are followed over time.

Until the glorious day we finally codify our coding style completely
into a configuration for a tool such as clang-format and thus no longer
need a plain English description of it, move this part to a separate
page.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: Add glib-adoption.rst
Andrea Bolognani [Mon, 6 Apr 2020 12:40:58 +0000 (14:40 +0200)]
docs: Add glib-adoption.rst

This part is very specific and doesn't quite fit into the "coding
style" section, so let's move it to its own page.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: Convert hacking.html to reStructuredText
Andrea Bolognani [Mon, 6 Apr 2020 10:30:17 +0000 (12:30 +0200)]
docs: Convert hacking.html to reStructuredText

The conversion has been performed by using pandoc as a first pass,
and then tweaking the result manually until it looked satisfactory.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agogithub: skip lockdown of old issues/prs
Daniel P. Berrangé [Tue, 7 Apr 2020 16:50:54 +0000 (17:50 +0100)]
github: skip lockdown of old issues/prs

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agogithub: enable lockdown of issues and merge requests
Daniel P. Berrangé [Fri, 3 Apr 2020 10:23:15 +0000 (11:23 +0100)]
github: enable lockdown of issues and merge requests

Libvirt uses GitHub as an automated read-only mirror. The goals were to
have a disaster recovery backup for libvirt.org, a way to make it easy
for people to clone their own private copy of libvirt Git, and finally
as a way to interact with apps like Travis.

The project description was set to a message telling people that we
don't respond to pull requests. This was quite a negative message to
potential contributors, and also did not give them any guidance about
the right way to submit to libvirt. Many also missed the description and
submitted issues or pull requests regardless.

It is possible to disable the issue tracker in GitHub, but there is no
way to disable merge requests. Disabling the issue tracker would also
leave the problem of users not being given any positive information
about where they should be reporting instead.

There is a fairly new 3rd party application built for GitHub that
provides a bot which auto-responds to both issues and merge requests,
closing and locking them, with a arbitrary comment:

   https://github.com/apps/repo-lockdown

This commit adds a suitable configuration file for libvirt, which
tries to give a positive response to user's issue/pullreq and guide
them to the desired contribution path on GitLab.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: Make auto dump path generation embed driver aware
Michal Privoznik [Tue, 24 Mar 2020 17:07:19 +0000 (18:07 +0100)]
qemu: Make auto dump path generation embed driver aware

So far, libvirt generates the following path for automatic dumps:

  $autoDumpPath/$id-$shortName-$timestamp

where $autoDumpPath is where libvirt stores dumps of guests (e.g.
/var/lib/libvirt/qemu/dump), $id is domain ID and $shortName is
shortened version of domain name. So for instance, the generated
path may look something like this:

  /var/lib/libvirt/qemu/dump/1-QEMUGuest-2020-03-25-10:40:50

While in case of embed driver the following path would be
generated by default:

  $root/lib/libvirt/qemu/dump/1-QEMUGuest-2020-03-25-10:40:50

which is not clashing with other embed drivers, we allow users to
override the default and have all embed drivers use the same
prefix. This can create clashing paths. Fortunately, we can reuse
the approach for machined name generation
(v6.1.0-178-gc9bd08ee35) and include part of hash of the root in
the generated path.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: Make memory path generation embed driver aware
Michal Privoznik [Mon, 23 Mar 2020 12:33:32 +0000 (13:33 +0100)]
qemu: Make memory path generation embed driver aware

So far, libvirt generates the following path for memory:

  $memoryBackingDir/$id-$shortName/ram-nodeN

where $memoryBackingDir is the path where QEMU mmaps() memory for
the guest (e.g. /var/lib/libvirt/qemu/ram), $id is domain ID
and $shortName is shortened version of domain name. So for
instance, the generated path may look something like this:

  /var/lib/libvirt/qemu/ram/1-QEMUGuest/ram-node0

While in case of embed driver the following path would be
generated by default:

  $root/lib/qemu/ram/1-QEMUGuest/ram-node0

which is not clashing with other embed drivers, we allow users to
override the default and have all embed drivers use the same
prefix. This can create clashing paths. Fortunately, we can reuse
the approach for machined name generation
(v6.1.0-178-gc9bd08ee35) and include part of hash of the root in
the generated path.

Note, the important change is in qemuGetMemoryBackingBasePath().
The rest is needed to pass driver around.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: Make hugepages path generation embed driver aware
Michal Privoznik [Fri, 20 Mar 2020 18:27:26 +0000 (19:27 +0100)]
qemu: Make hugepages path generation embed driver aware

So far, libvirt generates the following path for hugepages:

  $mnt/libvirt/qemu/$id-$shortName

where $mnt is the mount point of hugetlbfs corresponding to
hugepages of desired size (e.g. /dev/hugepages), $id is domain ID
and $shortName is shortened version of domain name. So for
instance, the generated path may look something like this:

  /dev/hugepages/libvirt/qemu/1-QEMUGuest

But this won't work with embed driver really, because if there
are two instances of embed driver, and they both want to start a
domain with the same name and with hugepages, both drivers will
generate the same path which is not desired. Fortunately, we can
reuse the approach for machined name generation
(v6.1.0-178-gc9bd08ee35) and include part of hash of the root in
the generated path.

Note, the important change is in qemuGetBaseHugepagePath(). The
rest is needed to pass driver around.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoRevert "qemu_conf: Track embed root dir"
Michal Privoznik [Mon, 23 Mar 2020 07:59:29 +0000 (08:59 +0100)]
Revert "qemu_conf: Track embed root dir"

This reverts commit 06a19921b6a522cd7b4d352c9320909752947de3.

What I haven't realized when writing this ^^ commit is that the
virQEMUDriver structure already stores the root directory path.
And since the pointer is immutable it can be accessed right from
the structure and thus there is no need to duplicate it in the
driver config.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemuDomainGetMachineName: Access embeddedRoot from driver rather than cfg
Michal Privoznik [Mon, 23 Mar 2020 07:48:38 +0000 (08:48 +0100)]
qemuDomainGetMachineName: Access embeddedRoot from driver rather than cfg

The cfg->root is going away, therefore get the info right from
the driver structure.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovirDomainDriverGenerateMachineName: Factor out embed path hashing
Michal Privoznik [Fri, 20 Mar 2020 18:52:32 +0000 (19:52 +0100)]
virDomainDriverGenerateMachineName: Factor out embed path hashing

The code that generates "qemu-embed-$hash" is going to be useful
in more places. Separate it out into a function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: Move virDomainGenerateMachineName to hypervisor/
Michal Privoznik [Fri, 20 Mar 2020 17:14:22 +0000 (18:14 +0100)]
conf: Move virDomainGenerateMachineName to hypervisor/

The virDomainGenerateMachineName() function doesn't belong in
src/conf/ really, because it has nothing to do with domain XML
parsing. It landed there because of lack of better place in the
past. But now that we have src/hypervisor/ the function should
live there. At the same time, the function name is changed to
match new location.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: Drop two layers of nesting of memoryBackingDir
Michal Privoznik [Thu, 26 Mar 2020 09:46:41 +0000 (10:46 +0100)]
qemu: Drop two layers of nesting of memoryBackingDir

Initially introduced in v3.10.0-rc1~172.

When generating a path for memory-backend-file or -mem-path, qemu
driver will use the following pattern:

  $memoryBackingDir/libvirt/qemu/$id-$shortName

where $memoryBackingDir defaults to /var/lib/libvirt/qemu/ram but
can be overridden in qemu.conf. Anyway, the "/libvirt/qemu/" part
looks redundant, because it's already contained in the default,
or creates unnecessary nesting if overridden in qemu.conf.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agoqemu: Drop virQEMUDriverIsPrivileged()
Michal Privoznik [Tue, 31 Mar 2020 15:42:43 +0000 (17:42 +0200)]
qemu: Drop virQEMUDriverIsPrivileged()

Introduced in v1.2.17-rc1~121, the assumption was that the
driver->privileged is immutable at the time but it might change
in the future. Well, it did not ever since. It is still immutable
variable. Drop the needless accessor then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agotests: Fix virQEMUDriverConfigNew() calling with respect to @root
Michal Privoznik [Mon, 23 Mar 2020 08:55:54 +0000 (09:55 +0100)]
tests: Fix virQEMUDriverConfigNew() calling with respect to @root

The virQEMUDriverConfigNew() accepts path to root directory for
embed mode as an argument. If the argument is not NULL it uses
the passed value as prefix for some internal paths (e.g.
cfg->libDir). If it is NULL though, it looks if the other
argument, @privileged is true or false and generates internal
paths accordingly. But when calling the function from the test
suite, instead of passing NULL for @root, an empty string is
passed. Fortunately, this doesn't create a problem because in
both problematic cases the generated paths are "fixed" to point
somewhere into build dir or the code which is tested doesn't
access them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agocpu: Use g_autoptr and g_autofree in cpu.c
Seeteena Thoufeek [Mon, 6 Apr 2020 13:24:06 +0000 (18:54 +0530)]
cpu: Use g_autoptr and g_autofree in cpu.c

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agolibxl: fix crash when initializing driver
Jim Fehlig [Fri, 3 Apr 2020 21:51:48 +0000 (15:51 -0600)]
libxl: fix crash when initializing driver

Commit 54a401af478 split out DriverConfigInit from DriverConfigNew, but
then called it a bit late from libxlStateInitialize. The cfg is used in
libxlDriverConfigLoadFile and when uninitialized results in a crash.
Calling DriverConfigInit immediately after DriverConfigNew fixes the
crash.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoformatdomain.html.in: fix 'sockets' info in topology element
Daniel Henrique Barboza [Wed, 1 Apr 2020 10:56:37 +0000 (07:56 -0300)]
formatdomain.html.in: fix 'sockets' info in topology element

In the 'topology' element it is mentioned, regarding the sockets
value, "They refer to the total number of CPU sockets".

This is not accurate. What we're doing is calculating the number
of sockets per NUMA node, which can be checked in the current
implementation of virHostCPUGetInfoPopulateLinux(). Calculating
the total number of sockets would break the topology sanity
check nodes*sockets*cores*threads=online_cpus.

This documentation fix is important to avoid user confusion when
seeing the output of 'virsh capabilities' and expecting it to be
equal to the output of 'lscpu'. E.g in a Power 9 host this 'lscpu'
output:

Architecture:        ppc64le
Byte Order:          Little Endian
CPU(s):              160
On-line CPU(s) list: 0-159
Thread(s) per core:  4
Core(s) per socket:  20
Socket(s):           2
NUMA node(s):        2
Model:               2.2 (pvr 004e 1202)
Model name:          POWER9, altivec supported

And this XML output from virsh capabilities:

    <cpu>
      <arch>ppc64le</arch>
      <model>POWER9</model>
      <vendor>IBM</vendor>
      <topology sockets='1' dies='1' cores='20' threads='4'/>
      (...)
    </cpu>

Both are correct, as long as we mention in the Libvirt documentation
that 'sockets' in the topology element represents the number of sockets
per NUMA node.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agotools: variables clean-up in libvirt-guests script
Prathamesh Chavan [Sun, 29 Mar 2020 10:44:43 +0000 (16:14 +0530)]
tools: variables clean-up in libvirt-guests script

Redeclared variables in script functions marked as local.
Variables `guest_running` and `guests_shutting_down` in the
functions 'guest_is_on` and `check_guests_shutdown` were
untouched, as the functions returned values in these
variables.

Signed-off-by: Prathamesh Chavan <pc44800@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu_cgroup.c: use VIR_AUTOSTRINGLIST, g_autofree and g_autoptr
Seeteena Thoufeek [Tue, 31 Mar 2020 15:44:07 +0000 (21:14 +0530)]
qemu_cgroup.c: use VIR_AUTOSTRINGLIST, g_autofree and g_autoptr

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu: add support for 'multidevs' option
Christian Schoenebeck [Mon, 30 Mar 2020 18:26:19 +0000 (20:26 +0200)]
qemu: add support for 'multidevs' option

This option prevents misbehaviours on guest if a qemu 9pfs export
contains multiple devices, due to the potential file ID collisions
this otherwise may cause.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoconf: add 'multidevs' option
Christian Schoenebeck [Mon, 30 Mar 2020 18:05:33 +0000 (20:05 +0200)]
conf: add 'multidevs' option

Introduce new 'multidevs' option for filesystem.

  <filesystem type='mount' accessmode='mapped' multidevs='remap'>
    <source dir='/path'/>
    <target dir='mount_tag'>
  </filesystem>

This option prevents misbehaviours on guest if a qemu 9pfs export
contains multiple devices, due to the potential file ID collisions
this otherwise may cause.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: capabilities: add QEMU_CAPS_FSDEV_MULTIDEVS
Christian Schoenebeck [Mon, 30 Mar 2020 18:04:47 +0000 (20:04 +0200)]
qemu: capabilities: add QEMU_CAPS_FSDEV_MULTIDEVS

The QEMU 9pfs 'multidevs' option exists since QEMU 4.2. Probe QEMU's
command line set though to check whether this option is really
available, and if yes enable this new QEMU_CAPS_FSDEV_MULTIDEVS
capability on libvirt side.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: move qemuValidateDomainDeviceDef() to qemu_validate.c
Daniel Henrique Barboza [Thu, 26 Mar 2020 21:31:25 +0000 (18:31 -0300)]
qemu: move qemuValidateDomainDeviceDef() to qemu_validate.c

Now that all its helper functions are in qemu_validate.c, we can
move the function itself. The helpers can become static again since
they're all in the same file.

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>
5 years agoqemu: move remaining qemuDomainDeviceDefValidate() helpers
Daniel Henrique Barboza [Thu, 26 Mar 2020 21:31:24 +0000 (18:31 -0300)]
qemu: move remaining qemuDomainDeviceDefValidate() helpers

This will allow to move qemuDomainDeviceDefValidate() itself in
the next patch in a cleaner way.

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>
5 years agoqemu: move qemuDomainDeviceDefValidateSound() to qemu_validate.c
Daniel Henrique Barboza [Thu, 26 Mar 2020 21:31:23 +0000 (18:31 -0300)]
qemu: move qemuDomainDeviceDefValidateSound() to qemu_validate.c

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>
5 years agoqemu: move qemuDomainDeviceDefValidateFS() to qemu_validate.c
Daniel Henrique Barboza [Thu, 26 Mar 2020 21:31:22 +0000 (18:31 -0300)]
qemu: move qemuDomainDeviceDefValidateFS() to qemu_validate.c

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>
5 years agoqemu: move qemuDomainDeviceDefValidateGraphics() to qemu_validate.c
Daniel Henrique Barboza [Thu, 26 Mar 2020 21:31:21 +0000 (18:31 -0300)]
qemu: move qemuDomainDeviceDefValidateGraphics() to qemu_validate.c

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>
5 years agoqemu: move qemuDomainDeviceDefValidateController() to qemu_validate.c
Daniel Henrique Barboza [Thu, 26 Mar 2020 21:31:20 +0000 (18:31 -0300)]
qemu: move qemuDomainDeviceDefValidateController() to qemu_validate.c

Move the function and all its static helper functions.

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>
5 years agoqemu: move qemuDomainDeviceDefValidateDisk() to qemu_validate.c
Daniel Henrique Barboza [Thu, 26 Mar 2020 21:31:19 +0000 (18:31 -0300)]
qemu: move qemuDomainDeviceDefValidateDisk() to qemu_validate.c

This function will remain public due to its usage in qemublocktest.c
even after moving qemuDomainDeviceDefValidate(). The position of its
header in qemu_validate.h is no accident.

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>
5 years agoqemu: move qemuDomainDeviceDefValidateVideo() to qemu_validate.c
Daniel Henrique Barboza [Thu, 26 Mar 2020 21:31:18 +0000 (18:31 -0300)]
qemu: move qemuDomainDeviceDefValidateVideo() to qemu_validate.c

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>
5 years agoqemu: move qemuDomainDeviceDefValidateHostdev() to qemu_validate.c
Daniel Henrique Barboza [Thu, 26 Mar 2020 21:31:17 +0000 (18:31 -0300)]
qemu: move qemuDomainDeviceDefValidateHostdev() to qemu_validate.c

This function alone requires other 3 static functions to be
moved as well, thus let's move it in its own patch.

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>
5 years agoqemu: move qemuDomainChrDefValidate() to qemu_validate.c
Daniel Henrique Barboza [Thu, 26 Mar 2020 21:31:16 +0000 (18:31 -0300)]
qemu: move qemuDomainChrDefValidate() to qemu_validate.c

qemuDomainChrDefValidate() has a lot of static helpers functions
that needed to be moved as well.

Other functions from qemuDomainDeviceDefValidate() that were
also moved:
- qemuValidateDomainSmartcardDef
- qemuValidateDomainRNGDef
- qemuValidateDomainRedirdevDef
- qemuValidateDomainWatchdogDef

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>
5 years agoqemu: move qemuDomainDeviceDefValidateNetwork() to qemu_validate.c
Daniel Henrique Barboza [Thu, 26 Mar 2020 21:31:15 +0000 (18:31 -0300)]
qemu: move qemuDomainDeviceDefValidateNetwork() to qemu_validate.c

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>
5 years agoqemu: move qemuDomainDeviceDefValidateAddress() to qemu_validate.c
Daniel Henrique Barboza [Thu, 26 Mar 2020 21:31:14 +0000 (18:31 -0300)]
qemu: move qemuDomainDeviceDefValidateAddress() to qemu_validate.c

The next big task is to move qemuDomainDeviceDefValidate() to
qemu_validation.c, which is a function that calls a lot of
other static helper functions. This patch starts it by moving
qemuDomainDeviceDefValidateAddress().

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>
5 years agoqemu: move qemuDomainValidateDef() to qemu_validate.c
Daniel Henrique Barboza [Thu, 26 Mar 2020 21:31:12 +0000 (18:31 -0300)]
qemu: move qemuDomainValidateDef() to qemu_validate.c

Move the static functions qemuDomainValidateDef() uses, as well as
qemuDomainValidateDef() itself to qemu_validate.

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>
5 years agoqemu: move qemuDomainDefValidateFeatures to qemu_validate.c
Daniel Henrique Barboza [Thu, 26 Mar 2020 21:31:11 +0000 (18:31 -0300)]
qemu: move qemuDomainDefValidateFeatures to qemu_validate.c

This patch introduces a new file to host domain validations from
the QEMU driver. And to get things started, let's move
qemuDomainDefValidateFeatures() to this new file.

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>
5 years agoschemas: rng: Add encryption and slices elements to domainsnapshot schema
Han Han [Wed, 1 Apr 2020 14:10:12 +0000 (22:10 +0800)]
schemas: rng: Add encryption and slices elements to domainsnapshot schema

Both <encryption> and <diskSourceCommon> were absent from the <source>
element defined in domainsnapshot.rng

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agoqemu_checkpoint.c: Use g_autofree in qemuCheckpointPrepare()
Seeteena Thoufeek [Fri, 3 Apr 2020 11:52:58 +0000 (17:22 +0530)]
qemu_checkpoint.c: Use g_autofree in qemuCheckpointPrepare()

This is the only instance of g_autofree change applicable for
qemu_checkpoint.c

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoremote: Drop KRB5_KTNAME override
Andrea Bolognani [Wed, 1 Apr 2020 18:46:37 +0000 (20:46 +0200)]
remote: Drop KRB5_KTNAME override

When the comment in libvirtd.sasl was last updated with

  commit fe772f24a6809b3d937ed6547cbaa9d820e514b6
  Author: Cole Robinson <crobinso@redhat.com>
  Date:   Sat Oct 20 14:10:03 2012 -0400

    daemon: Avoid 'Could not find keytab file' in syslog

it was noted that only old versions of kerberos would need the
environment variable to be set: that was more than seven years
ago, so it's safe to assume that none of our current target
platforms still requires that hack and setting the appropriate
key in the configuration file will be enough.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: Allow audio driver override in virtqemud
Andrea Bolognani [Wed, 1 Apr 2020 18:34:59 +0000 (20:34 +0200)]
qemu: Allow audio driver override in virtqemud

libvirtd supports this feature, and virtqemud ultimately calls to
the same code so it does as well: advertise it in the sysconf file
for the latter, as is already the case for the former.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agosystemd: Move timeout from service files to sysconf files
Andrea Bolognani [Thu, 2 Apr 2020 16:01:12 +0000 (18:01 +0200)]
systemd: Move timeout from service files to sysconf files

This follows the example set by libvirtd, and makes it easier for
the admin to tweak the timeout or disable it altogether.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agosystemd: Add sysconf files for all daemons
Andrea Bolognani [Wed, 1 Apr 2020 17:59:14 +0000 (19:59 +0200)]
systemd: Add sysconf files for all daemons

While not terribly useful in general, tweaking each daemon's
timeout (or disabling it off altogether) is a valid use case which
we can very easily support while being consistent with what already
happens for libvirtd. This is a first step in that direction.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agosystemd: Tweak existing sysconf files
Andrea Bolognani [Thu, 2 Apr 2020 16:20:08 +0000 (18:20 +0200)]
systemd: Tweak existing sysconf files

We're going to add many more later, so start by adjusting the
existing ones to more closely follow the example set by libvirtd.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodaemons: Support --timeout 0
Andrea Bolognani [Wed, 1 Apr 2020 16:53:57 +0000 (18:53 +0200)]
daemons: Support --timeout 0

When using systemd we want to take advantage of socket activation
instead of keeping daemons running all the time, so we default to
shutting them down after two minutes of inactivity.

At the same time, we want it to be possible for the admin to opt
out of this behavior and disable timeouts entirely. A very natural
way to do so would be to specify a zero-length timeout, but that's
currently not accepted by the command line parser. Address that.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovirDomainCheckpointRedefinePrep: Set 'current' checkpoint if there isn't any
Peter Krempa [Wed, 1 Apr 2020 12:34:15 +0000 (14:34 +0200)]
virDomainCheckpointRedefinePrep: Set 'current' checkpoint if there isn't any

When redefining checkpoints from scratch we'd not set the 'current'
checkpoint if there wasn't any. This meant that the code wasn't ever
able to set a 'current' checkpoint as any other one looks up if the
parent of the redefined checkpoint is current.

Since the backup code then requires the current checkpoint to start the
lookup we'd not be able to perform a backup after restoring the
checkpoint hierarchy.

Reported-by: Eyal Shenitzky <eshenitz@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: checkpoint: Allow checkpoint redefine for offline VMs
Peter Krempa [Wed, 1 Apr 2020 12:06:44 +0000 (14:06 +0200)]
qemu: checkpoint: Allow checkpoint redefine for offline VMs

Skip the liveness and capability checks when redefining checkpoints as
we don't need qemu interactions to update the metadata.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: capabilities: Update qemu-5.0.0 capabilities for x86_64 to rc1
Peter Krempa [Thu, 27 Feb 2020 15:11:31 +0000 (16:11 +0100)]
qemu: capabilities: Update qemu-5.0.0 capabilities for x86_64 to rc1

Now that v5.0.0-rc1 was tagged, update the capabilities to make sure
that everything works as expected.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agosyntax-check: Exempt tests/qemucapabilitiesdata from 'sc_prohibit_devname'
Peter Krempa [Wed, 1 Apr 2020 10:24:34 +0000 (12:24 +0200)]
syntax-check: Exempt tests/qemucapabilitiesdata from 'sc_prohibit_devname'

QEMU uses the 'devname' string in the QAPI schema so a bump would
trigger this check. Exempt all of the capabilities data from the check.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemumonitorjsontest: AddNetdev: Use real variant
Peter Krempa [Wed, 1 Apr 2020 10:24:45 +0000 (12:24 +0200)]
qemumonitorjsontest: AddNetdev: Use real variant

QEMU now formalized the arguments of netdev-add in the schema, so we
must use a real type to pass the schema validation once the schema is
updated.

The 'user' variant doesn't have any other mandatory fields.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuMonitorTestProcessCommandDefaultValidate: Output validator output to stderr
Peter Krempa [Wed, 1 Apr 2020 10:28:17 +0000 (12:28 +0200)]
qemuMonitorTestProcessCommandDefaultValidate: Output validator output to stderr

Trying to squeeze the validator output into the monitor reply message
doesn't make sense and doesn't work well as it's not well formed JSON:

54) qemuMonitorJSONAddNetdev                                          ... libvirt:  error : internal error: cannot parse json { "error":  { "desc": "failed to validate arguments of 'netdev_add' against QAPI schema: {
   ERROR: variant 'test' for discriminator 'type' not found
",    "class": "UnexpectedCommand" } }: lexical error: invalid character inside string.
          ev_add' against QAPI schema: {    ERROR: variant 'test' for
                     (right here) ------^
FAILED

Output it to stderr if requested and just note that schema validation
failed in the error message:

54) qemuMonitorJSONAddNetdev                                          ...
failed to validate arguments of 'netdev_add' against QAPI schema
args:
{
  "id": "net0",
  "type": "test"
}

validator output:
 {
   ERROR: variant 'test' for discriminator 'type' not found

libvirt: QEMU Driver error : internal error: unable to execute QEMU command 'netdev_add': failed to validate arguments of 'netdev_add' against QAPI schema (to see debug output use VIR_TEST_DEBUG=2)
FAILED

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemumonitorjsontest: Space out test name concatenation
Peter Krempa [Wed, 1 Apr 2020 10:37:48 +0000 (12:37 +0200)]
qemumonitorjsontest: Space out test name concatenation

The test name is concatenated from a prefix with the test name, but no
space was added so the output looked wrong.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuBlockJobRefreshJobs: Warn readers that 'job' may be invalid after update
Peter Krempa [Thu, 26 Mar 2020 12:31:05 +0000 (13:31 +0100)]
qemuBlockJobRefreshJobs: Warn readers that 'job' may be invalid after update

Add a comment noting that job update can cause the pointer to be invalid
and thus should not be accessed after.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Mores <pmores@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemuBlockJobUpdate: Remove return value
Peter Krempa [Thu, 26 Mar 2020 12:22:18 +0000 (13:22 +0100)]
qemuBlockJobUpdate: Remove return value

No callers use it any more. Additionally if qemuBlockJobUpdate was
called with the last reference of the job e.g. in
qemuBlockJobRefreshJobs, the reading of the job state would happen from
freed memory.

Reported-by: Pavel Mores <pmores@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Mores <pmores@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu: migration: Don't use return value of qemuBlockJobUpdate
Peter Krempa [Thu, 26 Mar 2020 12:14:12 +0000 (13:14 +0100)]
qemu: migration: Don't use return value of qemuBlockJobUpdate

Upcoming patch will remove it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Mores <pmores@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemuSecurityChownCallback: Don't initialize storage file subsystem for local file
Peter Krempa [Thu, 26 Mar 2020 09:49:11 +0000 (10:49 +0100)]
qemuSecurityChownCallback: Don't initialize storage file subsystem for local file

virStorageFileSupportsSecurityDriver ends up initializing the storage
file backend which after the recent changes to the daemon architecture
may end up dlopening of the backend modules.

Since this is required only for remote storage we can optimize the call
by moving the check whether the backend is supported to the branch which
deals with remote storage.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Mores <pmores@redhat.com>
5 years agoqemuSecurityChownCallback: Remove 'cleanup' section
Peter Krempa [Thu, 26 Mar 2020 11:08:59 +0000 (12:08 +0100)]
qemuSecurityChownCallback: Remove 'cleanup' section

Treat the shortcut for chowning local files as a stand-alone section
by returning success from it and refactor the rest so that the cleanup
section is inline.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Mores <pmores@redhat.com>
5 years agomaint: Post-release version bump to 6.3.0
Peter Krempa [Fri, 3 Apr 2020 07:20:07 +0000 (09:20 +0200)]
maint: Post-release version bump to 6.3.0

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
5 years agoRelease of libvirt 6.2.0
Daniel Veillard [Thu, 2 Apr 2020 19:12:19 +0000 (21:12 +0200)]
Release of libvirt 6.2.0

* docs/news.xml: update for the release

Signed-off-by: Daniel Veillard <veillard@redhat.com>
5 years agoRevert "logging: Use default timeout of 120 seconds for virtlogd"
Andrea Bolognani [Wed, 1 Apr 2020 16:57:27 +0000 (18:57 +0200)]
Revert "logging: Use default timeout of 120 seconds for virtlogd"

The same timeout as libvirtd can't be used for virtlogd: even with
socket activation in place, any message produced by QEMU on its
standard output/error between when virtlogd quits due to the timeout
and when it's started again due to socket activation will get lost.

This reverts commit 02b6005063d6e8b5c6c695ed1ffaf10ef45143b0

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuDomainSnapshotDiskPrepareOne: Fix logic of relative backing store update
Peter Krempa [Thu, 2 Apr 2020 05:29:58 +0000 (07:29 +0200)]
qemuDomainSnapshotDiskPrepareOne: Fix logic of relative backing store update

Commit 2ace7a87a8aced68c250 introduced a logic bug by an improperly
modified condition where we'd skip to the else branch when reusing of
external images was requested and blockdev is available.

The original intentions were to skip the backing store update with
blockdev.

Fix it by only asserting the boolean which was used to track whether we
support update of the backing store only when blockdev is not present
along with the appropriate rename.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agonews: Document recent dbus-vmstate changes
Michal Privoznik [Wed, 1 Apr 2020 16:22:54 +0000 (18:22 +0200)]
news: Document recent dbus-vmstate changes

Actual-Author-of-the-text: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agonews: Update for libvirt 6.2.0
Andrea Bolognani [Wed, 1 Apr 2020 15:03:56 +0000 (17:03 +0200)]
news: Update for libvirt 6.2.0

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: use QEMU_CAPS_STORAGE_WERROR for disk-error attributes
Ján Tomko [Wed, 1 Apr 2020 08:34:10 +0000 (10:34 +0200)]
qemu: use QEMU_CAPS_STORAGE_WERROR for disk-error attributes

When moving the formatting of this attributes from -drive
to -device, the QEMU_CAPS_USB_STORAGE_WERROR capability
was used, because usb-storage was the last device to gain
this capability.

However this lead to the assumption that QEMU binaries
without the usb-storage device do not support this,
leading to breakage on s390x with blockdev.

Fixes: bb4f3543bbf3ebbffa833ae7df55c298920243eb
https://bugzilla.redhat.com/show_bug.cgi?id=1819250

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 years agoqemu: add QEMU_CAPS_STORAGE_WERROR
Ján Tomko [Wed, 1 Apr 2020 08:22:30 +0000 (10:22 +0200)]
qemu: add QEMU_CAPS_STORAGE_WERROR

Detect the werror property on SCSI and virtio disks.
But clear it if the QEMU supports usb-storage device without it
also supporting this option for usb-storage.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 years agotests: qemu: add disk-error-policy tests for s390x
Ján Tomko [Tue, 31 Mar 2020 18:15:13 +0000 (20:15 +0200)]
tests: qemu: add disk-error-policy tests for s390x

To demonstrate the move of these attributes from -drive to -device.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 years agotravis: delete all Linux jobs
Daniel P. Berrangé [Mon, 30 Mar 2020 15:59:01 +0000 (16:59 +0100)]
travis: delete all Linux jobs

The Fedora rawhide job started failing with the latest container build.
Since we now have broad CI coverage on GitLab CI, there's not a strong
reason to continue using Travis for Linux jobs. Deleting the redundant
jobs is a better use of time than trying to debug the failure.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agotools: explain that '^' means 'Ctrl' for console escape sequence
Daniel P. Berrangé [Fri, 27 Mar 2020 15:10:44 +0000 (15:10 +0000)]
tools: explain that '^' means 'Ctrl' for console escape sequence

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: ensure domain event thread is always stopped
Daniel P. Berrangé [Fri, 20 Mar 2020 11:06:17 +0000 (11:06 +0000)]
qemu: ensure domain event thread is always stopped

In previous commit:

  commit e6afacb0feabd9bf58331aa0e5259a35378be74e
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Wed Feb 12 12:26:11 2020 +0000

    qemu: start/stop an event loop thread for domains

A bogus comment was added claiming we didn't need to shutdown the
event thread in the qemuProcessStop method, because this would be
done in the monitor EOF callback. This was wrong because the EOF
callback only runs in the case of a QEMU crash or a guest initiated
clean shutdown & poweroff.  In the case where the libvirt admin
calls virDomainDestroy, the EOF callback never fires because we
have already unregistered the event callbacks. We must thus always
attempt to stop the event thread in qemuProcessStop.

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reported-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovirStorageSourceParseBackingURI: Preserve query string of URI for http(s)
Peter Krempa [Fri, 27 Mar 2020 15:26:50 +0000 (16:26 +0100)]
virStorageSourceParseBackingURI: Preserve query string of URI for http(s)

For http/https URIs we need to preserve the query part as it may be
important to refer to the image.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuBlockStorageSourceGetURI: Pass through query component
Peter Krempa [Fri, 27 Mar 2020 15:34:37 +0000 (16:34 +0100)]
qemuBlockStorageSourceGetURI: Pass through query component

If the storage source has the query part set, format it in the output.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoconf: Add support for http(s) query strings
Peter Krempa [Mon, 30 Mar 2020 12:54:02 +0000 (14:54 +0200)]
conf: Add support for http(s) query strings

Add a new attribute for holding the query part for http(s) disks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agodocs: formatdomain: Mention missing protocols
Peter Krempa [Mon, 30 Mar 2020 12:46:04 +0000 (14:46 +0200)]
docs: formatdomain: Mention missing protocols

http, https, ftp, ftps, and tftp were not mentioned in the
documentation. Note that 'ssh' is still omitted as it's used only
internally.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuDomainSnapshotDiskPrepareOne: Don't load the relative path with blockdev
Peter Krempa [Mon, 30 Mar 2020 09:18:37 +0000 (11:18 +0200)]
qemuDomainSnapshotDiskPrepareOne: Don't load the relative path with blockdev

Since we are refreshing the relative paths when doing the blockjobs we
no longer need to load them upfront when doing the snapshot.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: block: Support VIR_DOMAIN_BLOCK_COMMIT/PULL/REBASE_RELATIVE with blockdev
Peter Krempa [Mon, 30 Mar 2020 09:18:32 +0000 (11:18 +0200)]
qemu: block: Support VIR_DOMAIN_BLOCK_COMMIT/PULL/REBASE_RELATIVE with blockdev

Preservation of the relative relationship requires us to load the
backing store strings from the disk images. With blockdev we stopped
detecting the backing chain if it's specified in the XML so the relative
links were not loaded at that point. To preserve the functionality from
the pre-blockdev without accessing the backing chain unnecessarily
during VM startup we must refresh the relative links when relative
block commit or block pull is requested.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agovirSecurityDeviceLabelDefNew: Avoid NULL dereference
Michal Privoznik [Mon, 30 Mar 2020 08:56:46 +0000 (10:56 +0200)]
virSecurityDeviceLabelDefNew: Avoid NULL dereference

While it is impossible for VIR_ALLOC() to return an error, we
should be consistent with the rest of the code and not continue
initializing the virSecurityDeviceLabelDef structure.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovirQEMUCapsNewBinary: Avoid NULL dereference
Michal Privoznik [Mon, 30 Mar 2020 08:56:08 +0000 (10:56 +0200)]
virQEMUCapsNewBinary: Avoid NULL dereference

Even with GLib it is still possible for virQEMUCapsNew() to
return NULL because it calls virQEMUCapsInitialize() which is a
wrapper over pthread_once() which may fail. At least, we still
check for its retval. If it so happens that the virQEMUCapsNew()
fails and returns NULL, we should not dereference it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoDon't pass NULL to yajl_free()
Michal Privoznik [Mon, 30 Mar 2020 08:37:09 +0000 (10:37 +0200)]
Don't pass NULL to yajl_free()

Unfortunately, yajl_free() is not NOP on NULL. It really does
expect a valid pointer. Therefore, check whether the pointer we
want to pass to it is NULL or not.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: Clarify semantics of model/@usable attribute in dom caps
Jiri Denemark [Fri, 27 Mar 2020 20:05:28 +0000 (21:05 +0100)]
docs: Clarify semantics of model/@usable attribute in dom caps

The documentation could confuse people to expect that CPU models with
usable='no' attribute are not usable at all on the current host. But
they cannot be only used without explicitly disabling some features.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agoutil: virdaemon: fix compilation on mingw
Rafael Fonseca [Fri, 27 Mar 2020 17:40:47 +0000 (18:40 +0100)]
util: virdaemon: fix compilation on mingw

The daemons are not supported on Win32 and therefore were not compiled
in that platform. However, with the daemon code sharing, all the code in
utils *is* compiled and it failed because `waitpid`, `fork`, and
`setsid` are not available. So, as before, let's not build them on
Win32 and make the code more portable by using existing vir* wrappers.

Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agogitlab: Add script_variables and define $MAKEFLAGS there
Andrea Bolognani [Fri, 27 Mar 2020 15:40:05 +0000 (16:40 +0100)]
gitlab: Add script_variables and define $MAKEFLAGS there

This new template provides a standardized place where environment
variables which are not static, but rather depend on the output of
some shell command, can be defined for later use. This pattern is
already used in libosinfo's GitLab CI integration.

Defining $MAKEFLAGS there means we don't need to call getconf over
and over, and the actual build steps don't end up drowned in the
noise.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: virtfs: add section separators
Christian Schoenebeck [Fri, 20 Mar 2020 16:46:38 +0000 (17:46 +0100)]
docs: virtfs: add section separators

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agosyntax-check.mk: Drop needless _src2 variable
Michal Privoznik [Fri, 27 Mar 2020 15:18:53 +0000 (16:18 +0100)]
syntax-check.mk: Drop needless _src2 variable

The aim was to break a long line, but it is not long anymore.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
5 years agosyntax-check: Disallow plain fork() in src/libvirt.c
Michal Privoznik [Fri, 27 Mar 2020 14:28:09 +0000 (15:28 +0100)]
syntax-check: Disallow plain fork() in src/libvirt.c

The last usage of plain fork() was removed in v0.9.7-rc1~50, but
we forgot to update the syntax-check exemption list accordingly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoremote: use shared daemon startup code
Rafael Fonseca [Thu, 26 Mar 2020 15:18:03 +0000 (16:18 +0100)]
remote: use shared daemon startup code

Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agologging: use shared daemon startup code
Rafael Fonseca [Thu, 26 Mar 2020 15:18:02 +0000 (16:18 +0100)]
logging: use shared daemon startup code

Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agolocking: use shared daemon startup code
Rafael Fonseca [Thu, 26 Mar 2020 15:18:01 +0000 (16:18 +0100)]
locking: use shared daemon startup code

Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoutil: introduce shared daemon startup code
Rafael Fonseca [Thu, 26 Mar 2020 15:18:00 +0000 (16:18 +0100)]
util: introduce shared daemon startup code

Several daemons have similar code around general daemon startup code.
Let's move it into a file and share it among them.

Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoscripts: avoid error in DCO check on empty branches
Daniel P. Berrangé [Fri, 27 Mar 2020 14:38:49 +0000 (14:38 +0000)]
scripts: avoid error in DCO check on empty branches

If the DCO check is run on an empty branch (ie one which has no commits
different from master), it throws an error due to trying to interpret
the empty string as a git commit SHA.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovirStorageSourceNetCookieValidate: Accept quoted cookie value
Peter Krempa [Wed, 25 Mar 2020 15:06:39 +0000 (16:06 +0100)]
virStorageSourceNetCookieValidate: Accept quoted cookie value

The quotes are forbidden only inside the value, but the value itself may
be enclosed in quotes. Fix the RNG schema and validator and add a test
case.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuxml2xmltest: Wire up 'disk-network-http' case
Peter Krempa [Wed, 25 Mar 2020 15:18:50 +0000 (16:18 +0100)]
qemuxml2xmltest: Wire up 'disk-network-http' case

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agogitlab: don't run the DCO check on git master
Daniel P. Berrangé [Fri, 27 Mar 2020 14:36:16 +0000 (14:36 +0000)]
gitlab: don't run the DCO check on git master

The "only: branches" does not in fact exclude "master", so it must be
excluded explicitly.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agogitlab: add explicit early job for syntax-check
Daniel P. Berrangé [Thu, 26 Mar 2020 12:07:34 +0000 (12:07 +0000)]
gitlab: add explicit early job for syntax-check

Running the code style syntax-check as part of the build jobs leads to
all jobs failing in the same way. Have a prebuild job for validating
syntax-check to catch code style problems upfront and thus avoid needing
to run all the build jobs.

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>a
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agogitlab: introduce a check for validate DCO sign-off
Daniel P. Berrangé [Thu, 26 Mar 2020 10:46:47 +0000 (10:46 +0000)]
gitlab: introduce a check for validate DCO sign-off

This introduces a CI job for validating DCO sign-off in every commit
message. The CI jobs are not provided any information on what the
baseline commit for the branch was. We can't compare against the forked
repo's master branch, as there's no guarantee the user is keeping master
up2date in their fork. Thus we add the master upstream repo as a git
remote and identify the common ancestor.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agogitlab: introduce use of ccache for speeding up rebuilds
Daniel P. Berrangé [Wed, 25 Mar 2020 15:01:43 +0000 (15:01 +0000)]
gitlab: introduce use of ccache for speeding up rebuilds

For any given job there is a high likelihood that ccache will be able to
reuse previously built object files. This will result in faster build
pipelines in later updates.

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agogitlab: add job for building latest potfile
Daniel P. Berrangé [Tue, 24 Mar 2020 14:42:14 +0000 (14:42 +0000)]
gitlab: add job for building latest potfile

Whenever there is a change to the translatable strings we need to push
a new libvirt.pot to weblate. This only needs to be done when code
merges into git master, so the job is restricted to that branch.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agogitlab: add x86_64 native CI jobs
Daniel P. Berrangé [Fri, 6 Mar 2020 16:29:03 +0000 (16:29 +0000)]
gitlab: add x86_64 native CI jobs

This patch adds x86_64 native CI jobs for all distros that we currently
build container images for. This is a superset of the Linux jobs run on
current Jenkins and Travis platforms.

The remaining missing platforms are FreeBSD and macOS, neither of which
can use the shared runner container based infrastructure.

We may add further native jobs in the future which are not x86_64 based,
if we get access to suitable hardware, thus the jobs all have an arch
prefix in their name, just like the cross-built jobs do.

As with the cross-arch builds, the native jobs are split into two
groups. One group is run in all situations, while the other group is
only run on the master branch, or branches with a name prefix
'ci-full-'. This avoids the build time getting too long when
developers are testing their code prior to submission, while keeping
full coverage of code that is merged.

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agogitlab: add mingw cross build CI jobs
Daniel P. Berrangé [Tue, 24 Mar 2020 14:23:27 +0000 (14:23 +0000)]
gitlab: add mingw cross build CI jobs

This pulls in the mingw cross build jobs using Fedora 30 as a base,
matching what is done on Jenkins and Travis.

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agogitlab: rename the cross build jobs
Daniel P. Berrangé [Fri, 6 Mar 2020 18:34:45 +0000 (18:34 +0000)]
gitlab: rename the cross build jobs

The pipeline UI will truncate the names of jobs after about 15
characters. As a result with the cross-builds, we truncate the
most important part of the job name. Putting the most important
part first is robust against truncation, and we can drop the
redundant "-cross" stub.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <skultety.erik@gmail.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>