]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
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>
5 years agogitlab: reduce number of cross build jobs run by default
Daniel P. Berrangé [Wed, 25 Mar 2020 13:14:57 +0000 (13:14 +0000)]
gitlab: reduce number of cross build jobs run by default

Currently we have nine different cross build jobs, but as we introduce
more native jobs this is going to result in a very long CI execution
time. For developers testing their personal branches under development
it is generally sufficient to just look at a couple of interesting
scenarios, namely 32-bit and big endian.

This splits the cross build jobs so that by default only the armv7
and s390x archs are built. The remainining archs are setup so that they
are only built for code on the master branch, which will have the effect
of doing post-merge testing. Developers can opt-in to full testing of
their pre-merge code by pushing it to a branch with a name prefix of
"ci-full-".

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: use CI for building website contents
Daniel P. Berrangé [Fri, 6 Mar 2020 14:56:42 +0000 (14:56 +0000)]
gitlab: use CI for building website contents

Run the bare minimum build that is possible to create the docs, avoiding
compiling code which other jobs will deal with.

The generated website is published as an artifact and thus is browsable
by developers on build completion and can be downloaded as a zip file.

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: create an explicit stage for cross build jobs
Daniel P. Berrangé [Fri, 6 Mar 2020 15:38:36 +0000 (15:38 +0000)]
gitlab: create an explicit stage for cross build jobs

As we introduce more build jobs, it will be useful to have a grouping of
jobs to more easily visualize the results and potentially control build
ordering.

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: restrict git history to 100 commits
Daniel P. Berrangé [Tue, 24 Mar 2020 12:04:08 +0000 (12:04 +0000)]
gitlab: restrict git history to 100 commits

We don't need the full git history when running CI jobs. From a code POV
we only need the most recent commit, but we want to be able to run
checks on the commits too. In particular to validate the DCO signoff for
each commit.

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 variable for make command name
Daniel P. Berrangé [Tue, 24 Mar 2020 11:01:12 +0000 (11:01 +0000)]
gitlab: add variable for make command name

To facilitate future jobs that will use FreeBSD

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 agoqemu_domain.c: remove unneeded size check in NVDIMM alignment
Daniel Henrique Barboza [Wed, 25 Mar 2020 14:15:14 +0000 (11:15 -0300)]
qemu_domain.c: remove unneeded size check in NVDIMM alignment

Commit 5540acb9a2b added a minimum size verification for the target
size of ppc64 NVDIMMs but forgot to remove a MAX() size check that
was being used in earlier reviews of that commit. The size
verification makes this check unneeded since we're making sure
that guestArea will always be at least equal to ppc64AlignSize.

Fixes: 5540acb9a2bd33fb97a7446a610b602c9e8629a3
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu_agent.c: Use g_autofree in qemu_agent.c
Seeteena Thoufeek [Fri, 27 Mar 2020 05:25:55 +0000 (10:55 +0530)]
qemu_agent.c: Use g_autofree in qemu_agent.c

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

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agobhyve: fix typo in struct field accessor
Daniel P. Berrangé [Thu, 26 Mar 2020 17:29:16 +0000 (17:29 +0000)]
bhyve: fix typo in struct field accessor

This fixes a FreeBSD build error from

  commit a11a0e6e8473fec6127b263a33f892135097648f
  Author: Rafael Fonseca <r4f4rfs@gmail.com>
  Date:   Tue Mar 24 17:14:30 2020 +0100

    bhyve: move video default logic to driver

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemuCheckpointCreateXML: Check VM liveness first
Peter Krempa [Thu, 26 Mar 2020 14:20:44 +0000 (15:20 +0100)]
qemuCheckpointCreateXML: Check VM liveness first

Move the liveness check prior to the capability check. If the VM is
offline the capabilities are not initialized and thus we'd report the
wrong error.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemuBackupBegin: Fix monitor access when rolling back due to failure
Peter Krempa [Thu, 26 Mar 2020 14:37:44 +0000 (15:37 +0100)]
qemuBackupBegin: Fix monitor access when rolling back due to failure

The code attempting to clean up after a failed pull mode backup job
wrongly entered monitor but didn't clean up nor exit monitor due to a
logic bug. Fix the condition.

Introduced in a1521f84a53

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemuCheckpointDelete: Check VM liveness first
Peter Krempa [Thu, 26 Mar 2020 14:20:44 +0000 (15:20 +0100)]
qemuCheckpointDelete: Check VM liveness first

Move the liveness check prior to the capability check. If the VM is
offline the capabilities are not initialized and thus we'd report the
wrong error.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoschemas: rng: Use interleave in the disk source element
Han Han [Thu, 26 Mar 2020 02:44:23 +0000 (10:44 +0800)]
schemas: rng: Use interleave in the disk source element

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agocpu_map: Don't use new noTSX models for host-model CPUs
Jiri Denemark [Tue, 17 Mar 2020 21:32:16 +0000 (22:32 +0100)]
cpu_map: Don't use new noTSX models for host-model CPUs

Host-model CPU definitions (and domain capabilities) will use the
original CPU models (without noTSX in their name) and explicitly disable
hle and rtm features. This way domains with host-model CPUs will be
migratable even to older versions of libvirt which do not support the
noTSX model variants.

The new models will be advertised in host capabilities and they may
be used explicitly with custom CPUs.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Tested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
5 years agocpu_x86: Honor CPU models' <decode> element
Jiri Denemark [Tue, 17 Mar 2020 21:27:49 +0000 (22:27 +0100)]
cpu_x86: Honor CPU models' <decode> element

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Tested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
5 years agocpu_map: Add <decode> element to x86 CPU model definitions
Jiri Denemark [Thu, 12 Mar 2020 16:39:37 +0000 (17:39 +0100)]
cpu_map: Add <decode> element to x86 CPU model definitions

The element specifies whether a particular CPU model can be used when
creating a CPU definition from raw CPUID/MSR data. The @host attribute
determines whether the CPU model can be used (host='on') for creating
CPU definition for host capabilities. Usability of the model for domain
capabilities and host-model CPU definitions is controlled by the @guest
attribute.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Tested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
5 years agocpu_map: Add more -noTSX x86 CPU models
Christian Ehrhardt [Tue, 10 Mar 2020 10:48:06 +0000 (11:48 +0100)]
cpu_map: Add more -noTSX x86 CPU models

One of the mitigation methods for TAA[1] is to disable TSX
support on the host system.  Linux added a mechanism to disable
TSX globally through the kernel command line, and many Linux
distributions now default to tsx=off.  This makes existing CPU
models that have HLE and RTM enabled not usable anymore.

Add new versions of all CPU models that have the HLE and RTM
features enabled, that can be used when TSX is disabled in the
host system.

On systems disabling the features without those types defined
in cpu-maps users end up without modern CPU types in the list
of usable CPUs to use in the likes of virsh domcapabilities
or tools higher in the stack like virt-manager.

This adds:
-Cascadelake-Server-noTSX
-Icelake-Client-noTSX
-Icelake-Server-noTSX
-Skylake-Server-noTSX-IBRS
-Skylake-Client-noTSX-IBRS

Introduced in QEMU by commit v4.2.0-rc2-3-g9ab2237f19 (function)
                  and commit v4.2.0-rc2-4-g02fa60d101 (names)

References:

    [1] TAA, TSX asynchronous Abort:
        https://software.intel.com/security-software-guidance/insights/deep-dive-intel-transactional-synchronization-extensions-intel-tsx-asynchronous-abort
        https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/tsx_async_abort.html

Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1853200
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Message-Id: <20200310104806.2723-2-christian.ehrhardt@canonical.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agoqemu: allow PMU feature to be enabled for ppc64 guests
Daniel Henrique Barboza [Tue, 24 Mar 2020 17:33:24 +0000 (14:33 -0300)]
qemu: allow PMU feature to be enabled for ppc64 guests

The PMU feature is enabled by default in ppc64 guests and can't
be disabled via Libvirt or QEMU [1]. The current PMU feature
implementation does not allow PMU to enabled or disabled in the
ppc64 guest. Declaring the PMU feature will make the 'pmu'
property to be passed on to QEMU, but this property isn't
available for ppc64:

qemu-kvm: can't apply global host-powerpc64-cpu.pmu=on: Property '.pmu' not found

A similar error is thrown when trying to disable the PMU.

This patch standardizes the PMU handling for ppc64 guests by:

- throwing an error if the user attempts to set the feature to
'off', given that this feature can't be turned off at all;

- allowing the feature to be declared as 'on' in the domain XML.
This is done by skipping ppc64 guests when creating the command
line for this feature.

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

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agoqemu: make Hyperv settings exclusive to x86 and aarch64
Daniel Henrique Barboza [Tue, 24 Mar 2020 17:33:23 +0000 (14:33 -0300)]
qemu: make Hyperv settings exclusive to x86 and aarch64

Hyperv features are supported by both x86 and aarch64. The <hyperv/>
declaration in the XML by itself is benign to other architectures,
but any of its 14 current features will break QEMU with an error
like this (from ppc64):

qemu-kvm: Expected key=value format, found hv_relaxed

This is a more extreme case than the one for apic eoi because we
would need an extra 'switch' statement, with all current Hyperv
features in the body of qemuDomainDefValidateFeatures(), to
check if the user attempted to activate any of them. It's easier to
simply fail to launch with any 'hyperv' declaration in the XML for
every arch which is not x86 and aarch64.

A fair disclaimer about Windows and PowerPC: the last Windows version
that ran in the architecture is the hall of famer Windows NT 4.0,
launched in 1996 and with end of extended support for the Server
version in 2004 [1]. I am acknowledging that there might be Windows
NT 4.0 users running in PowerPC, but not enough people running it
under KVM/QEMU to justify Libvirt allowing 'hyperv' to exist in the
domain XML of ppc64 domains.

[1] https://en.wikipedia.org/wiki/Windows_NT_4.0

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agoqemu: avoid launching non-x86 guests with 'pvspinlock' setting
Daniel Henrique Barboza [Tue, 24 Mar 2020 17:33:22 +0000 (14:33 -0300)]
qemu: avoid launching non-x86 guests with 'pvspinlock' setting

The 'pvspinlock' feature is x86 only. The "<pvspinlock/>" declaration
will always have a value 'on' or 'off', and both will break QEMU when
launching non-x86 guests. This is the error message for
"<pvspinlock state='on'/>" when running a ppc64 guest:

qemu-kvm: Expected key=value format, found +kvm_pv_unhalt

A similar error message is thrown for "<pvspinlock state='off'/>".

This patch prevents non-x86 guests from launching with any
pvspinlock setting with a more informative error message:

error: unsupported configuration: The 'pvspinlock' feature is not
supported for architecture 'ppc64' or machine type 'pseries'

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agoqemu: avoid launching non-x86 guests with APIC-EOI setting
Daniel Henrique Barboza [Tue, 24 Mar 2020 17:33:21 +0000 (14:33 -0300)]
qemu: avoid launching non-x86 guests with APIC-EOI setting

The "<apic/>" feature, although it's available only for x86 guests,
can be declared in the domain XML of other archs without errors.
But setting its 'eoi' attribute will break QEMU. For "<apic eoi='on'/>",
in a ppc64 guest:

qemu-kvm: Expected key=value format, found +kvm_pv_eoi

A similar error happens with eoi='off'.

One can argue that it's better to simply forbid launching non-x86
guests with "<apic/>" declared in the XML - it is a feature that
the architecture doesn't support and this would make it clearer
about it. This is sensible, but there are non-x86 guests that are
running with "<apic/>" declared in the domain (and A LOT of guests
running with "<acpi/>" for that matter, probably reminiscent of x86
templates that were reused for other archs) that will stop working if we
go this route.

A more subtle approach is to detect if the 'eoi' element is being set
for non-x86 guests and warn the user about it with a better error
message than the one QEMU provides. This is the new error message
when any value is set for the 'eoi' element in a ppc64 XML:

error: unsupported configuration: The 'eoi' attribute of the 'apic'
feature is not supported for architecture 'ppc64' or machine type
'pseries'.

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

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agoqemuDomainGetGuestInfo: Suppress non-fatal errors
Peter Krempa [Mon, 16 Mar 2020 08:04:53 +0000 (09:04 +0100)]
qemuDomainGetGuestInfo: Suppress non-fatal errors

Don't report cases when the guest information is not requested
explicitly and not present either.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuAgentGetFSInfo: expose 'report_unsupported' argument
Peter Krempa [Mon, 16 Mar 2020 07:37:13 +0000 (08:37 +0100)]
qemuAgentGetFSInfo: expose 'report_unsupported' argument

Use qemuAgentCommandFull so that callers of qemuAgentGetFSInfo can
suppress error reports if the function is not supported by the guest
agent.

Since this patch removes the last use of
qemuAgentErrorCommandUnsupported the whole function is deleted as well.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuAgentGetTimezone: expose 'report_unsupported' argument
Peter Krempa [Mon, 16 Mar 2020 07:37:13 +0000 (08:37 +0100)]
qemuAgentGetTimezone: expose 'report_unsupported' argument

Use qemuAgentCommandFull so that callers of qemuAgentGetTimezone can
suppress error reports if the function is not supported by the guest
agent.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuAgentGetOSInfo: expose 'report_unsupported' argument
Peter Krempa [Mon, 16 Mar 2020 07:37:13 +0000 (08:37 +0100)]
qemuAgentGetOSInfo: expose 'report_unsupported' argument

Use qemuAgentCommandFull so that callers of qemuAgentGetOSInfo can
suppress error reports if the function is not supported by the guest
agent.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuAgentGetUsers: expose 'report_unsupported' argument
Peter Krempa [Mon, 16 Mar 2020 07:37:13 +0000 (08:37 +0100)]
qemuAgentGetUsers: expose 'report_unsupported' argument

Use qemuAgentCommandFull so that callers of qemuAgentGetUsers can
suppress error reports if the function is not supported by the guest
agent.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuAgentGetHostname: expose 'report_unsupported' argument
Peter Krempa [Mon, 16 Mar 2020 07:26:34 +0000 (08:26 +0100)]
qemuAgentGetHostname: expose 'report_unsupported' argument

Use qemuAgentCommandFull in qemuAgentGetHostname so that we can suppress
error reports if the caller will not require them. Callers for now
always require error reporting but will be fixed later.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuAgentGetHostname: Refactor to remove cleanup section
Peter Krempa [Fri, 13 Mar 2020 09:55:22 +0000 (10:55 +0100)]
qemuAgentGetHostname: Refactor to remove cleanup section

Use g_autoptr instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuAgentGetUsers: Fix return value on success
Peter Krempa [Fri, 13 Mar 2020 09:02:48 +0000 (10:02 +0100)]
qemuAgentGetUsers: Fix return value on success

Return 0 on success to match the documentation. The callers only check
for negative values.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuAgentCommand: Wire up suppressing of error reporting for unsupported commands
Peter Krempa [Fri, 13 Mar 2020 08:49:35 +0000 (09:49 +0100)]
qemuAgentCommand: Wire up suppressing of error reporting for unsupported commands

In some cases we don't want to log errors if an agent command is
unsupported. Wire it up into qemuAgentCheckError via qemuAgentCommandFull
and provide a thin wrapper (qemuAgentCommand) to prevent having to fix
all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuAgentCheckError: use g_autofree
Peter Krempa [Fri, 13 Mar 2020 08:43:10 +0000 (09:43 +0100)]
qemuAgentCheckError: use g_autofree

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemuDomainGetGuestInfo: Validate supported information types
Peter Krempa [Fri, 13 Mar 2020 08:05:48 +0000 (09:05 +0100)]
qemuDomainGetGuestInfo: Validate supported information types

'qemuDomainGetGuestInfoCheckSupport' despite its name was not checking
whether the info types are supported. Convert the function to return
integers and include the check.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoconf: domain_conf: remove virDomainVideoDefaultType
Rafael Fonseca [Tue, 24 Mar 2020 16:14:36 +0000 (17:14 +0100)]
conf: domain_conf: remove virDomainVideoDefaultType

The logic has been moved to the individual drivers.

Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agovbox: move video default logic to driver
Rafael Fonseca [Tue, 24 Mar 2020 16:14:35 +0000 (17:14 +0100)]
vbox: move video default logic to driver

The logic setting a device default should be in the post parse function
of individual driver code.

Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agotest: move video default logic to driver
Rafael Fonseca [Tue, 24 Mar 2020 16:14:34 +0000 (17:14 +0100)]
test: move video default logic to driver

The logic setting a device default should be in the post parse function
of individual driver code.

Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agovmx: vmware: move video default logic to driver
Rafael Fonseca [Tue, 24 Mar 2020 16:14:33 +0000 (17:14 +0100)]
vmx: vmware: move video default logic to driver

The logic setting a device default should be in the post parse function
of individual driver code.

Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agovz: openvz: move video default logic to driver
Rafael Fonseca [Tue, 24 Mar 2020 16:14:32 +0000 (17:14 +0100)]
vz: openvz: move video default logic to driver

The logic setting a device default should be in the post parse function
of individual driver code.

Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agolibxl: move video default logic to driver
Rafael Fonseca [Tue, 24 Mar 2020 16:14:31 +0000 (17:14 +0100)]
libxl: move video default logic to driver

The logic setting a device default should be in the post parse function
of individual driver code.

Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agobhyve: move video default logic to driver
Rafael Fonseca [Tue, 24 Mar 2020 16:14:30 +0000 (17:14 +0100)]
bhyve: move video default logic to driver

The logic setting a device default should be in the post parse function
of individual driver code.

Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoutil: keep the pidfile locked
Marc-André Lureau [Tue, 24 Mar 2020 23:58:00 +0000 (00:58 +0100)]
util: keep the pidfile locked

Unfortunately, advisory record locking lose the lock if any fd refering
to the file is closed. There doesn't seem to be a way to preserve the
lock atomically. We could eventually retake the lock if low pidfilefd
is required.

This fixes processes being leaked, as they are not killed in
virPidFileForceCleanupPath() if the lock can be taken. Here also, we may
consider this is not good enough, as a process may leak by simply
closing the pidfilefd.

Fixes commit d146105f1e4a9e0ab179f0b78c070ea38b9d5334 ("virCommand:
Actually acquire pidfile instead of just writing it")

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agodocs: news: fix typo
Ján Tomko [Tue, 24 Mar 2020 17:22:11 +0000 (18:22 +0100)]
docs: news: fix typo

s/ommited/omitted/

Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoWIP: qemu-slirp: update to follow current spec
Marc-André Lureau [Tue, 25 Feb 2020 09:55:13 +0000 (10:55 +0100)]
WIP: qemu-slirp: update to follow current spec

The WIP specification is hosted on slirp wiki at this point:
https://gitlab.freedesktop.org/slirp/libslirp/-/wikis/Slirp-Helper

We would need more feedback from various parties (including libvirt,
podman, and other developpers) before declaring a frozen version.

So for now, follow it, and feedback welcome!

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu-slirp: register helper for migration
Marc-André Lureau [Tue, 25 Feb 2020 09:55:12 +0000 (10:55 +0100)]
qemu-slirp: register helper for migration

When the helper supports DBus, connect it to the bus and set its ID.

If the helper supports migration, register its ID to the list of
dbus-vmstate ID to migrate, and specify --dbus-incoming when
restoring the VM.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu: add dbus-vmstate helper migration support
Marc-André Lureau [Tue, 25 Feb 2020 09:55:11 +0000 (10:55 +0100)]
qemu: add dbus-vmstate helper migration support

Helper processes may have their state migrated with QEMU data stream
thanks to the QEMU "dbus-vmstate".

libvirt maintains the list of helpers to be migrated. The
"dbus-vmstate" is added when required, and given the list of helper
Ids that must be migrated, on save & load sides.

See also:
https://git.qemu.org/?p=qemu.git;a=blob;f=docs/interop/dbus-vmstate.rst

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu: prepare and stop the dbus daemon
Marc-André Lureau [Tue, 25 Feb 2020 09:55:10 +0000 (10:55 +0100)]
qemu: prepare and stop the dbus daemon

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agodomain: save/restore the state of dbus-daemon running
Marc-André Lureau [Tue, 25 Feb 2020 09:55:09 +0000 (10:55 +0100)]
domain: save/restore the state of dbus-daemon running

This avoids trying to start a dbus-daemon when its already running.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu: add a DBus daemon helper unit
Marc-André Lureau [Tue, 25 Feb 2020 09:55:08 +0000 (10:55 +0100)]
qemu: add a DBus daemon helper unit

Add a unit to start & stop a private dbus-daemon.

The daemon is meant to be started on demand, and associated with a
QEMU process. It should be stopped when the QEMU process is stopped.

The current policy is permissive like a session bus. Stricter
policies can be added later, following recommendations from:
https://git.qemu.org/?p=qemu.git;a=blob;f=docs/interop/dbus.rst

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu-conf: add dbusStateDir
Marc-André Lureau [Tue, 25 Feb 2020 09:55:07 +0000 (10:55 +0100)]
qemu-conf: add dbusStateDir

Location of DBus daemon state configuration, socket, pid...

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu-conf: add configurable dbus-daemon location
Marc-André Lureau [Tue, 25 Feb 2020 09:55:06 +0000 (10:55 +0100)]
qemu-conf: add configurable dbus-daemon location

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu: remove dbus-vmstate code
Marc-André Lureau [Tue, 25 Feb 2020 09:55:05 +0000 (10:55 +0100)]
qemu: remove dbus-vmstate code

This code was based on a per-helper instance and peer-to-peer
connections. The code that landed in qemu master for v5.0 is relying
on a single instance and DBus bus.

Instead of trying to adapt the existing dbus-vmstate code, let's
remove it and resubmit. That should make reviewing easier.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agobridge_driver: Replace and drop networkKillDaemon
Michal Privoznik [Fri, 13 Mar 2020 16:06:19 +0000 (17:06 +0100)]
bridge_driver: Replace and drop networkKillDaemon

In the network driver code there's networkKillDaemon() which is
the same as virProcessKillPainfully(). Replace the former with
the later and drop what becomes unused function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
5 years agoqemuVirtioFSStop: Simplify daemon kill
Michal Privoznik [Fri, 13 Mar 2020 16:03:10 +0000 (17:03 +0100)]
qemuVirtioFSStop: Simplify daemon kill

Now, that we know that the virtiofsd will have the pidfile open
and locked we can use virPidFileForceCleanupPath() to kill it and
unlink the pidfile.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
5 years agoqemuSlirpStop: Simplify helper kill
Michal Privoznik [Fri, 13 Mar 2020 15:12:59 +0000 (16:12 +0100)]
qemuSlirpStop: Simplify helper kill

Now, that we know that the slirp helper will have the pidfile
open and locked we can use virPidFileForceCleanupPath() to kill
it and unlink the pidfile.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
5 years agoqemuProcessStartManagedPRDaemon: Don't pass -f pidfile to the daemon
Michal Privoznik [Fri, 13 Mar 2020 14:57:24 +0000 (15:57 +0100)]
qemuProcessStartManagedPRDaemon: Don't pass -f pidfile to the daemon

Now, that our virCommandSetPidFile() is more intelligent we don't
need to rely on the daemon to create and lock the pidfile and use
virCommandSetPidFile() at the same time.

NOTE that as advertised in the previous commit, this was
temporarily broken, because both virCommand and
qemuProcessStartManagedPRDaemon() would try to lock the pidfile.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
5 years agovirCommand: Actually acquire pidfile instead of just writing it
Michal Privoznik [Fri, 13 Mar 2020 12:12:49 +0000 (13:12 +0100)]
virCommand: Actually acquire pidfile instead of just writing it

Our virCommand module allows us to set a pidfile for commands we
want to spawn. The caller constructs the string of pidfile path
and then uses virCommandSetPidFile() to tell the module to write
the pidfile once the command is ran. This usually works, but has
two flaws:

1) the child process does not hold the pidfile open & locked.
Therefore, the caller (or anybody else) can't use our fancy
virPidFileForceCleanupPath() function to kill the command
afterwards. Also, for everybody else on the system it's
needlessly harder to check if the pid from the pidfile is still
alive or not.

2) if the caller ever makes a mistake and passes the same pidfile
path for two different commands, the start of the second command
will overwrite the pidfile even though the first command might
still be running.

NOTE that this temporarily renders some command spawning
unusable, specifically those code patterns where both
virCommandSetPidFile() is used together with instructing spawned
command to acquire pidfile itself. Fortunately, there is only one
occurrence of such pattern and it is in
qemuProcessStartManagedPRDaemon(). This is fixed in next commit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
5 years agoqemu_monitor_text.c: Use g_autofree
Seeteena Thoufeek [Tue, 24 Mar 2020 12:44:46 +0000 (18:14 +0530)]
qemu_monitor_text.c: Use g_autofree

Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agocommandtest: Fix test28 error detection
Michal Privoznik [Tue, 24 Mar 2020 12:48:58 +0000 (13:48 +0100)]
commandtest: Fix test28 error detection

As a part of c799d150d5e9dae I've introduced a test case that
tests whether passing error object between processes works. The
test spawns a child which reports a system error, parent process
then reads the error and compares with expected output. Problem
with this approach is that error message contains stringified
errno which is not portable. FreeBSD has generally different
messages than Linux. Therefore, use g_strerror() to do the errno
to string translation for us.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agostorage: Parse 'nvme' disk source properties from json:{} pseudo-uri
Peter Krempa [Mon, 23 Mar 2020 17:06:56 +0000 (18:06 +0100)]
storage: Parse 'nvme' disk source properties from json:{} pseudo-uri

Our code allows snapshots of NVMe based disks which means we create
overlay file with a 'json:{}' pseudo-uri refering to the NVME device.
Our parser code doesn't handle them though. Add the parser and test it
via the XML->json->XML round-trip and reference data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemuBlockGetBackingStoreString: Properly handle 'http/s' with cookies and others
Peter Krempa [Mon, 23 Mar 2020 15:36:22 +0000 (16:36 +0100)]
qemuBlockGetBackingStoreString: Properly handle 'http/s' with cookies and others

Format cookies into the backing store string without encryption as they
will not be visible on the command line when formatting a 'target' only
string. In cases when cookies or other options are used we must use the
JSON format rather than pure URI.

Add tests to validate the scenario.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu: block: Extract formatting of cookie string
Peter Krempa [Mon, 23 Mar 2020 15:31:19 +0000 (16:31 +0100)]
qemu: block: Extract formatting of cookie string

Introduce qemuBlockStorageSourceGetCookieString which does the
concatenation so that we can reuse it later.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>