]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
5 years agocpu_x86: Use g_auto* in virCPUx86Baseline
Jiri Denemark [Wed, 25 Mar 2020 09:34:09 +0000 (10:34 +0100)]
cpu_x86: Use g_auto* in virCPUx86Baseline

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in virCPUx86GetHost
Jiri Denemark [Wed, 25 Mar 2020 09:33:48 +0000 (10:33 +0100)]
cpu_x86: Use g_auto* in virCPUx86GetHost

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in virCPUx86CheckFeature
Jiri Denemark [Wed, 25 Mar 2020 10:31:29 +0000 (11:31 +0100)]
cpu_x86: Use g_auto* in virCPUx86CheckFeature

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in x86Encode
Jiri Denemark [Wed, 25 Mar 2020 09:33:27 +0000 (10:33 +0100)]
cpu_x86: Use g_auto* in x86Encode

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in x86EncodePolicy
Jiri Denemark [Wed, 25 Mar 2020 10:30:43 +0000 (11:30 +0100)]
cpu_x86: Use g_auto* in x86EncodePolicy

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in x86Decode
Jiri Denemark [Wed, 25 Mar 2020 09:29:54 +0000 (10:29 +0100)]
cpu_x86: Use g_auto* in x86Decode

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in virCPUx86Compare
Jiri Denemark [Wed, 25 Mar 2020 10:30:24 +0000 (11:30 +0100)]
cpu_x86: Use g_auto* in virCPUx86Compare

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in x86Compute
Jiri Denemark [Wed, 25 Mar 2020 09:33:03 +0000 (10:33 +0100)]
cpu_x86: Use g_auto* in x86Compute

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in virCPUx86DataParse
Jiri Denemark [Wed, 25 Mar 2020 09:32:47 +0000 (10:32 +0100)]
cpu_x86: Use g_auto* in virCPUx86DataParse

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in virCPUx86LoadMap
Jiri Denemark [Wed, 25 Mar 2020 13:52:01 +0000 (14:52 +0100)]
cpu_x86: Use g_auto* in virCPUx86LoadMap

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in x86ModelParse
Jiri Denemark [Wed, 25 Mar 2020 10:29:36 +0000 (11:29 +0100)]
cpu_x86: Use g_auto* in x86ModelParse

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in x86ModelFromCPU
Jiri Denemark [Wed, 25 Mar 2020 10:29:14 +0000 (11:29 +0100)]
cpu_x86: Use g_auto* in x86ModelFromCPU

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in x86FeatureParse
Jiri Denemark [Wed, 25 Mar 2020 09:45:40 +0000 (10:45 +0100)]
cpu_x86: Use g_auto* in x86FeatureParse

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in x86VendorParse
Jiri Denemark [Wed, 25 Mar 2020 09:38:04 +0000 (10:38 +0100)]
cpu_x86: Use g_auto* in x86VendorParse

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use g_auto* in x86DataToCPU
Jiri Denemark [Wed, 25 Mar 2020 09:29:39 +0000 (10:29 +0100)]
cpu_x86: Use g_auto* in x86DataToCPU

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use glib allocation in virCPUx86GetModels
Jiri Denemark [Wed, 25 Mar 2020 17:41:48 +0000 (18:41 +0100)]
cpu_x86: Use glib allocation in virCPUx86GetModels

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use glib allocation for virCPUx86Map
Jiri Denemark [Wed, 25 Mar 2020 13:49:57 +0000 (14:49 +0100)]
cpu_x86: Use glib allocation for virCPUx86Map

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use glib allocation for virCPUx86Model
Jiri Denemark [Wed, 25 Mar 2020 10:28:13 +0000 (11:28 +0100)]
cpu_x86: Use glib allocation for virCPUx86Model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use glib allocation for virCPUx86Feature
Jiri Denemark [Wed, 25 Mar 2020 09:40:29 +0000 (10:40 +0100)]
cpu_x86: Use glib allocation for virCPUx86Feature

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use glib allocation for virCPUx86Vendor
Jiri Denemark [Wed, 25 Mar 2020 09:37:29 +0000 (10:37 +0100)]
cpu_x86: Use glib allocation for virCPUx86Vendor

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Use glib allocation for virCPU{,x86}Data
Jiri Denemark [Wed, 25 Mar 2020 09:28:26 +0000 (10:28 +0100)]
cpu_x86: Use glib allocation for virCPU{,x86}Data

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_x86: Drop noTSX hint for incompatible CPUs
Jiri Denemark [Tue, 24 Mar 2020 22:35:44 +0000 (23:35 +0100)]
cpu_x86: Drop noTSX hint for incompatible CPUs

The hint was introduced a long time ago when broken TSX implementation
was found in Haswell and Broadwell CPUs. Since then many more CPUs with
TSX were introduced and and disabled due to TAA vulnerability.

Thus the hint is not very useful and I think removing it is a better
choice then updating it to cover all current noTSX models.

This partially reverts:
commit 7f127ded657b24e0e55cd5f3539ef5b2dc935908
    cpu: Rework cpuCompare* APIs

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agodocs: documentation for virtio packed option
Bjoern Walk [Mon, 6 Apr 2020 13:13:27 +0000 (15:13 +0200)]
docs: documentation for virtio packed option

Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: command: support for virtio packed option
Bjoern Walk [Mon, 6 Apr 2020 13:13:26 +0000 (15:13 +0200)]
qemu: command: support for virtio packed option

Pass the packed option on the QEMU command line of the capability for
packed virtqueues is detected and the parameter is set explicitly.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoconf: domain: support for virtio packed option
Bjoern Walk [Mon, 6 Apr 2020 13:13:25 +0000 (15:13 +0200)]
conf: domain: support for virtio packed option

Expose the virtio parameter for packed virtqueues as an optional libvirt
XML attribute to virtio-backed devices, e.g.:

    <interface type='user'>
      <mac address='00:11:22:33:44:55'/>
      <model type='virtio'/>
      <driver packed='on'/>
    </interface>

If the attribute is omitted, the default value for this attribute is 'off' and
regular split virtqueues are used.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: capabilities: add 'packed' capability
Bjoern Walk [Mon, 6 Apr 2020 13:13:24 +0000 (15:13 +0200)]
qemu: capabilities: add 'packed' capability

Add the capability for QEMU's packed virtqueues for virtio that supposedly have
better cache utilization and performance compared to the default split queues.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: capabilities: update qemu-4.2 capabilities for s390x
Bjoern Walk [Tue, 24 Mar 2020 11:34:28 +0000 (12:34 +0100)]
qemu: capabilities: update qemu-4.2 capabilities for s390x

Update s390x capabilities for QEMU 4.2 with the actual GA version for
QEMU and on the latest z15 machine.

This picks up the new blockdev capability, so we need to refresh a bunch
of test cases as well.

Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: virdaemon: fix waiting for child processes
Rafael Fonseca [Wed, 8 Apr 2020 12:12:54 +0000 (14:12 +0200)]
util: virdaemon: fix waiting for child processes

Unlike `waitpid`, `virProcessWait` only returns -1 (error) or 0
(success), so comparing that to `pid` will always be false and the
parent will report failure with:

error : main:851 : Failed to fork as daemon: No such file or directory

even though the grandchild process is succesfully running. Note that the
errno message is misleading: it was last set when trying to find a
restart state file.

Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
Reported-by: Marcin Krol <hawk@tld-linux.org>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuDomainSnapshotPrepare: use local dom_disk variable
Yi Li [Tue, 7 Apr 2020 12:10:29 +0000 (20:10 +0800)]
qemuDomainSnapshotPrepare: use local dom_disk variable

Replace vm->def->disks[i] with dom_disk variable which is
initialized to the same disk.

Signed-off-by: Yi Li <yili@winhong.com>
Reviewed-by: Pavel Mores <pmores@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agodocs: Update hacking.rst
Andrea Bolognani [Mon, 6 Apr 2020 14:59:48 +0000 (16:59 +0200)]
docs: Update hacking.rst

This organizes the existing contents into sections, tweaks some parts
a bit and adds links to the pages where the contents that were ripped
out of hacking.rst now live, either inline or in the catch-all "further
reading" section depending on what makes more sense.

The result is that it's now possible to consume this page, which is
the entry point for new contributors, in just a few minutes, and then
drill down further based on factors such as the familiarity with the
open source development model or mail-based workflows.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: Add best-practices.rst
Andrea Bolognani [Mon, 6 Apr 2020 13:58:47 +0000 (15:58 +0200)]
docs: Add best-practices.rst

These guidelines should already be familiar to people who have
contributed to other open source projects, so it doesn't make much
sense for them to be so prominent. Move them to a separate page.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: Add submitting-patches.rst
Andrea Bolognani [Mon, 6 Apr 2020 13:42:17 +0000 (15:42 +0200)]
docs: Add submitting-patches.rst

This is a relatively lengthy part with lots of details, which many
people who are familiar with a mail-based development workflow will
already know and which will become obsolete once we move to GitLab.
Move the contents to a separate page.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: Add advanced-tests.rst
Andrea Bolognani [Mon, 6 Apr 2020 13:38:22 +0000 (15:38 +0200)]
docs: Add advanced-tests.rst

This part contains a lot of useful tips, but presenting all of them
at the same time obfuscated the central message which is, 'make check'
and 'make syntax-check' must pass after each patch in a series. Let's
move them to a separate page.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: Add committer-guidelines.rst
Andrea Bolognani [Mon, 6 Apr 2020 13:00:48 +0000 (15:00 +0200)]
docs: Add committer-guidelines.rst

While it's good to have these rules written down for reference, they
apply exclusively to committers, who by definition are familiar with
the project and probably work on it daily, so there's no need to have
them front and center when a separate page will do.

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

This part describes entirely optional tooling, so it makes sense not
to have it advertised too prominently. Move 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 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>