]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
5 years agoutil: remove VIR_STRDUP and VIR_STRNDUP
Ján Tomko [Thu, 24 Oct 2019 22:25:03 +0000 (00:25 +0200)]
util: remove VIR_STRDUP and VIR_STRNDUP

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agotests: delete tests for VIR_STR(N)DUP
Ján Tomko [Thu, 24 Oct 2019 22:12:49 +0000 (00:12 +0200)]
tests: delete tests for VIR_STR(N)DUP

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoRemove the rest of VIR_STRNDUP
Ján Tomko [Thu, 24 Oct 2019 21:34:40 +0000 (23:34 +0200)]
Remove the rest of VIR_STRNDUP

Replace all the uses passing a single parameter as the length.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoRemove all the uses that use subtraction in their length argument
Ján Tomko [Thu, 24 Oct 2019 17:41:34 +0000 (19:41 +0200)]
Remove all the uses that use subtraction in their length argument

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoRemove VIR_STRNDUP usage with checked pointers
Ján Tomko [Thu, 24 Oct 2019 17:34:57 +0000 (19:34 +0200)]
Remove VIR_STRNDUP usage with checked pointers

Remove the usage where sanity of the length argument is verified
by other conditions not matching the previous patches.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agovsh: remove vshErrorOOM
Ján Tomko [Wed, 11 Dec 2019 12:48:32 +0000 (13:48 +0100)]
vsh: remove vshErrorOOM

We abort on allocation errors now so there is no need to
have a function for it.

Replace the only use by return -1, chosen by fair dice roll.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoRemove VIR_STRDUP usage that sneaked in in the meantime
Ján Tomko [Wed, 11 Dec 2019 13:00:27 +0000 (14:00 +0100)]
Remove VIR_STRDUP usage that sneaked in in the meantime

My hesitation to remove VIR_STRDUP without VIR_STRNDUP resulted
in these being able to sneak in.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agodocs: stop using syntax highlighting for man page code blocks
Daniel P. Berrangé [Wed, 11 Dec 2019 18:05:37 +0000 (18:05 +0000)]
docs: stop using syntax highlighting for man page code blocks

Some versions of the rst2man convertor are buggy failing to
cope with syntax highlighting in code blocks.

This isn't something we really need for the man page code
blocks, so we can just delete the highlighting directive.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoRevert "qemu: directly create virResctrlInfo ignoring capabilities"
Daniel P. Berrangé [Tue, 10 Dec 2019 10:24:19 +0000 (10:24 +0000)]
Revert "qemu: directly create virResctrlInfo ignoring capabilities"

This reverts commit 7be5fe66cd024b9ffba7c52cdbf5effedeac2c0d.

This commit broke resctrl, because it missed the fact that the
virResctrlInfoGetCache() has side-effects causing it to actually
change the virResctrlInfo parameter, not merely get data from
it.

This code will need some refactoring before we can try separating
it from virCapabilities again.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoci: Fix VPATH builds
Andrea Bolognani [Thu, 12 Dec 2019 09:52:02 +0000 (10:52 +0100)]
ci: Fix VPATH builds

The CI build machinery is intentionally not handled by autotools,
so for VPATH builds - which are mandatory now - we need to make
sure we're looking into $(srcdir).

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: fix concurrency crash bug in snapshot revert
Pavel Mores [Tue, 10 Dec 2019 14:36:08 +0000 (15:36 +0100)]
qemu: fix concurrency crash bug in snapshot revert

This commit aims to fix

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

The cause was apparently incorrect handling of jobs in snapshot
revert code which allowed a thread executing snapshot delete to
begin job while snapshot revert was still running on another
thread. The snapshot delete thread then waited on a condition
variable in qemuMonitorSend() while the revert thread finished,
changing (and effectively corrupting) the qemuMonitor structure
under the delete thread which led to its crash.

The incorrect handling of jobs in revert code was due to the fact
that although qemuDomainRevertToSnapshot() correctly begins a job
at the start, the job was implicitly ended when qemuProcessStop()
was called because the job lives in the QEMU driver's private
data (qemuDomainObjPrivate) that was purged during
qemuProcessStop().

This fix prevents qemuProcessStop() from clearing jobs as the
idea of qemuProcessStop() clearing jobs seems wrong in the first
place. It was (inadvertently) introduced in commit
888aa4b6b9db65e3db273341e79846, which is effectively reverted by
the second hunk of this commit. To preserve the desired effects
of the faulty commit, the first hunk is included as suggested by
Michal.

Signed-off-by: Pavel Mores <pmores@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agodoc: vtpm only support secrets by UUID at this point
Marc-André Lureau [Tue, 10 Dec 2019 15:08:53 +0000 (19:08 +0400)]
doc: vtpm only support secrets by UUID at this point

Support by usage name can be considered separately (with a 'usage'
attribute?).

Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Christophe de Dinechin <dinechin@redhat.com>
Cc: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
5 years agotravis: Update name for Ubuntu 18.04 image
Andrea Bolognani [Wed, 11 Dec 2019 16:09:35 +0000 (17:09 +0100)]
travis: Update name for Ubuntu 18.04 image

The corresponding libvirt-jenkins-ci commit is f289e64a5fd9.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
5 years agoqemu: keep capabilities when running QEMU as root
Daniel P. Berrangé [Thu, 28 Nov 2019 14:27:54 +0000 (14:27 +0000)]
qemu: keep capabilities when running QEMU as root

When QEMU uid/gid is set to non-root this is pointless as if we just
used a regular setuid/setgid call, the process will have all its
capabilities cleared anyway by the kernel.

When QEMU uid/gid is set to root, this is almost (always?) never
what people actually want. People make QEMU run as root in order
to access some privileged resource that libvirt doesn't support
yet and this often requires capabilities. As a result they have
to go find the qemu.conf param to turn this off. This is not
viable for libguestfs - they want to control everything via the
XML security label to request running as root regardless of the
qemu.conf settings for user/group.

Clearing capabilities was implemented originally because there
was a proposal in Fedora to change permissions such that root,
with no capabilities would not be able to compromise the system.
ie a locked down root account. This never went anywhere though,
and as a result clearing capabilities when running as root does
not really get us any security benefit AFAICT. The root user
can easily do something like create a cronjob, which will then
faithfully be run with full capabilities, trivially bypassing
the restriction we place.

IOW, our clearing of capabilities is both useless from a security
POV, and breaks valid use cases when people need to run as root.

This removes the clear_emulator_capabilities configuration
option from qemu.conf, and always runs QEMU with capabilities
when root.  The behaviour when non-root is unchanged.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: remove build recipes related to pod2man usage
Daniel P. Berrangé [Fri, 6 Dec 2019 13:48:47 +0000 (13:48 +0000)]
docs: remove build recipes related to pod2man usage

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: convert virkeycode*/virkeyname* man pages from pod to rst
Daniel P. Berrangé [Fri, 18 Oct 2019 14:29:47 +0000 (15:29 +0100)]
docs: convert virkeycode*/virkeyname* man pages from pod to rst

The keycodemap tool is told to generate docs in rst format now
instead of pod.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: convert virsh man page from pod to rst
Daniel P. Berrangé [Fri, 18 Oct 2019 14:29:47 +0000 (15:29 +0100)]
docs: convert virsh man page from pod to rst

This was a semi-automated conversion. First it was run through pod2rst,
and then it was manually editted to use a rst structure that matches
expectations of rst2man.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: convert virt-admin man page from pod to rst
Daniel P. Berrangé [Fri, 18 Oct 2019 14:29:47 +0000 (15:29 +0100)]
docs: convert virt-admin man page from pod to rst

This was a semi-automated conversion. First it was run through pod2rst,
and then it was manually editted to use a rst structure that matches
expectations of rst2man.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: convert virt-login-shell man page from pod to rst
Daniel P. Berrangé [Fri, 18 Oct 2019 14:29:47 +0000 (15:29 +0100)]
docs: convert virt-login-shell man page from pod to rst

This was a semi-automated conversion. First it was run through pod2rst,
and then it was manually editted to use a rst structure that matches
expectations of rst2man.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: convert virt-sanlock-cleanup man page from pod to rst
Daniel P. Berrangé [Fri, 18 Oct 2019 14:29:47 +0000 (15:29 +0100)]
docs: convert virt-sanlock-cleanup man page from pod to rst

This was a semi-automated conversion. First it was run through pod2rst,
and then it was manually editted to use a rst structure that matches
expectations of rst2man.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: convert virt-xml-validate man page from pod to rst
Daniel P. Berrangé [Fri, 18 Oct 2019 14:29:47 +0000 (15:29 +0100)]
docs: convert virt-xml-validate man page from pod to rst

This was a semi-automated conversion. First it was run through pod2rst,
and then it was manually editted to use a rst structure that matches
expectations of rst2man.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: convert virt-pki-validate man page from pod to rst
Daniel P. Berrangé [Fri, 18 Oct 2019 14:29:47 +0000 (15:29 +0100)]
docs: convert virt-pki-validate man page from pod to rst

This was a semi-automated conversion. First it was run through pod2rst,
and then it was manually editted to use a rst structure that matches
expectations of rst2man.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: convert virt-host-validate man page from pod to rst
Daniel P. Berrangé [Fri, 18 Oct 2019 14:29:47 +0000 (15:29 +0100)]
docs: convert virt-host-validate man page from pod to rst

This was a semi-automated conversion. First it was run through pod2rst,
and then it was manually editted to use a rst structure that matches
expectations of rst2man.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: convert virtlogd man page from pod to rst
Daniel P. Berrangé [Fri, 18 Oct 2019 14:29:47 +0000 (15:29 +0100)]
docs: convert virtlogd man page from pod to rst

This was a semi-automated conversion. First it was run through pod2rst,
and then it was manually editted to use a rst structure that matches
expectations of rst2man.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: convert virtlockd man page from pod to rst
Daniel P. Berrangé [Fri, 18 Oct 2019 14:29:47 +0000 (15:29 +0100)]
docs: convert virtlockd man page from pod to rst

This was a semi-automated conversion. First it was run through pod2rst,
and then it was manually editted to use a rst structure that matches
expectations of rst2man.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: convert libvirtd man page from pod to rst
Daniel P. Berrangé [Fri, 18 Oct 2019 14:29:47 +0000 (15:29 +0100)]
docs: convert libvirtd man page from pod to rst

This was a semi-automated conversion. First it was run through pod2rst,
and then it was manually editted to use a rst structure that matches
expectations of rst2man.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: describe the basic RST structure for a man page
Daniel P. Berrangé [Thu, 5 Dec 2019 10:48:43 +0000 (10:48 +0000)]
docs: describe the basic RST structure for a man page

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: introduce rst2man as a mandatory tool for building docs
Daniel P. Berrangé [Fri, 18 Oct 2019 13:18:36 +0000 (14:18 +0100)]
docs: introduce rst2man as a mandatory tool for building docs

The rst2man tool is provided by python docutils, and as the name
suggests, it converts RST documents into man pages.

The intention is that our current POD docs will be converted to
RST format, allowing one more use of Perl to be eliminated from
libvirt.

The manual pages will now all be kept in the docs/manpages/ directory,
which enables us to include the man pages in the published website.
This is good for people searching for libvirt man pages online as it
makes it more likely google will send them to the libvirt.org instead
of some random third party man page site with outdated content.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agorpm: use python3-docutils as the direct dep
Daniel P. Berrangé [Fri, 6 Dec 2019 13:58:08 +0000 (13:58 +0000)]
rpm: use python3-docutils as the direct dep

We no longer support python2, so using a file based dep for rst2html
is not required. We do still have to do special casing for RHEL-7
though as the RPM is annoyingly different.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agorpm: move pod2man & rst2html deps outside the autotools conditional
Daniel P. Berrangé [Fri, 6 Dec 2019 13:56:22 +0000 (13:56 +0000)]
rpm: move pod2man & rst2html deps outside the autotools conditional

The generated man pages were previously bundled in the dist, so pod2man
was inside the autotools conditional. We no longer bundle any generated
files in the dist though, so pod2man must always be present.

rst2html then mistakenly just followed what pod2man did.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agosrc: update keycodemapdb submodule
Daniel P. Berrangé [Fri, 6 Dec 2019 13:21:03 +0000 (13:21 +0000)]
src: update keycodemapdb submodule

Pull in changes which support use of RST for docs output format
instead of POD.

The generator tool has changed its command line arg handling
so all args must be after the command name. The docs title and
subtitle must be specified separately too.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agospec: fix indentation fix
Ján Tomko [Wed, 11 Dec 2019 13:24:22 +0000 (14:24 +0100)]
spec: fix indentation fix

The RPM tags must not be indented.

Fixes: 6b8ab20f9b9b1a9383bd2cb9a075f57beb196c1c
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agospec: fix indentation
Ján Tomko [Wed, 11 Dec 2019 13:09:53 +0000 (14:09 +0100)]
spec: fix indentation

The recent specfile addition broke syntax-check:
cppi: ../libvirt.spec.in: line 338: not properly indented
cppi: ../libvirt.spec.in: line 341: not properly indented
cppi: ../libvirt.spec.in: line 344: not properly indented

Fixes: ac063cb2e76d64a907f96bf0b6a29da4eb484ebc
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agospec: Adjust librbd / librados dependency names
Fabiano Fidêncio [Sat, 7 Dec 2019 15:35:24 +0000 (16:35 +0100)]
spec: Adjust librbd / librados dependency names

librbd1-devel and librados2-devel have their package name changed to
librbd-devel and librados-devel on all the supported Fedora versions and
CentOS / RHEL 8.

For more info about this change, please, refer to the following page:
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/considerations_in_adopting_rhel_8/index

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agospec: Update Fedora minimum supported version
Fabiano Fidêncio [Sat, 7 Dec 2019 15:39:39 +0000 (16:39 +0100)]
spec: Update Fedora minimum supported version

Fedora 29 has reached its end of life on November 26th 2019.

For more info, please, refer to the following e-mail:
https://lists.fedoraproject.org/archives/list/devel-announce@lists.fedoraproject.org/thread/

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: prefer to use rst2html5 instead of rst2html
Daniel P. Berrangé [Fri, 6 Dec 2019 17:48:34 +0000 (17:48 +0000)]
docs: prefer to use rst2html5 instead of rst2html

Our website is written assuming HTML5 standard & doctype:

  commit b1c81567c7172bc9dcd701cf46ea3f87725d62c7
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Wed Jul 26 18:01:25 2017 +0100

    docs: switch to using HTML5 doctype declaration

so we want the RST conversion to also use HTML5. Ubuntu 16.04 still
only has the HTML4 generating tools though, so we have that as a
fallback.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: fix duplication variable name for rst files
Daniel P. Berrangé [Fri, 6 Dec 2019 17:26:18 +0000 (17:26 +0000)]
docs: fix duplication variable name for rst files

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: block: enable the snapshot image deletion feature
Pavel Mores [Tue, 10 Dec 2019 16:25:41 +0000 (17:25 +0100)]
qemu: block: enable the snapshot image deletion feature

With all plumbing in place, we can now enable the new functionality.

Signed-off-by: Pavel Mores <pmores@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 years agoqemu: block: store the delete flag in libvirtd's status XML
Pavel Mores [Tue, 10 Dec 2019 16:25:40 +0000 (17:25 +0100)]
qemu: block: store the delete flag in libvirtd's status XML

Since blockcommit is asynchronous, libvirtd can be restarted while the
operation runs.  To ensure the information necessary to finish up the job
is not lost, serialisation to and deserialisation from the status XML is
added.

To unittest this, the new element was only added to the active commit test,
the non-active commit test doesn't have the new element so as to test its
absence.

Signed-off-by: Pavel Mores <pmores@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 years agoqemu: block: use the delete flag to delete snapshot images if requested
Pavel Mores [Tue, 10 Dec 2019 16:25:39 +0000 (17:25 +0100)]
qemu: block: use the delete flag to delete snapshot images if requested

When blockcommit finishes successfully, one of the
qemuBlockJobProcessEventCompletedCommit() and
qemuBlockJobProcessEventCompletedActiveCommit() event handlers is called.
This is where the delete flag (stored in qemuBlockJobCommitData since the
previous commit) can actually be used to delete the committed snapshot
images if requested.

We use virFileRemove() instead of a simple unlink() to cover the case where
the image to be removed is on an NFS volume.

Signed-off-by: Pavel Mores <pmores@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 years agoqemu: block: propagate the delete flag to where it can actually be used
Pavel Mores [Tue, 10 Dec 2019 16:25:38 +0000 (17:25 +0100)]
qemu: block: propagate the delete flag to where it can actually be used

Propagate the delete flag from qemuDomainBlockCommit() (which was just
ignoring it until now) to qemuBlockJobDiskNewCommit() where it can be
stored in the qemuBlockJobCommitData structure which holds information
necessary to finish the job asynchronously.

In the actual qemuBlockJobDiskNewCommit() in this commit, we temporarily
pass a literal 'false' to preserve the current behaviour until the whole
implementation of the feature is in place.

Signed-off-by: Pavel Mores <pmores@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 years agosecurity: apparmor: Label externalDataStore
Cole Robinson [Tue, 8 Oct 2019 16:11:18 +0000 (12:11 -0400)]
security: apparmor: Label externalDataStore

Teach virt-aa-helper how to label a qcow2 data_file, tracked internally
as externalDataStore. It should be treated the same as its sibling
disk image

Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agolxc: Refresh capabilities if they have never been initalized
Cole Robinson [Mon, 9 Dec 2019 16:13:04 +0000 (11:13 -0500)]
lxc: Refresh capabilities if they have never been initalized

Adjust virLXCDriverGetCapabilities to fill in driver->caps if it is
empty, regardless of the passed 'refresh' value. This matches the
pattern used in virQEMUDriverGetCapabilities

This fixes LXC XML startup parsing for me

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agovirkeyfile: fix compilation error with clang
Pavel Hrdina [Tue, 10 Dec 2019 14:06:49 +0000 (15:06 +0100)]
virkeyfile: fix compilation error with clang

Clang complains about condition being always true:

src/util/virkeyfile.c:113:23: error: result of comparison of constant 128 with expression of type 'const char' is always true [-Werror,-Wtautological-constant-out-of-range-compare]
    while (!IS_EOF && IS_ASCII(CUR) && CUR != ']')
                      ^~~~~~~~~~~~~
src/util/virkeyfile.c:80:26: note: expanded from macro 'IS_ASCII'
                     ~~~ ^ ~~~

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agotests: use PYTHON detected from configure
Cole Robinson [Mon, 9 Dec 2019 14:30:10 +0000 (09:30 -0500)]
tests: use PYTHON detected from configure

Extend configure to pass the detect python binary to C code, and
use it in the test suite, rather than searching PATH

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agotests: fix REGENERATE test-wrap-argv.py usage
Cole Robinson [Mon, 9 Dec 2019 14:30:09 +0000 (09:30 -0500)]
tests: fix REGENERATE test-wrap-argv.py usage

The path needs to be adjusted for the new script location

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agoFix src/ pkg-config API XML paths
Cole Robinson [Mon, 9 Dec 2019 14:02:56 +0000 (09:02 -0500)]
Fix src/ pkg-config API XML paths

The .pc files in src/ are intended for use with the ./run script,
to ease building bindings against an uninstalled libvirt build.
The pointer to the API XML files is incorrect though, it needs to
point into the build tree.

This fixes use of the run script for building libvirt-python, ex:

  /path/to/libvirt.git/run ./setup.py build

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agobootstrap.conf: drop usage of c-strcase gnulib module
Pavel Hrdina [Tue, 10 Dec 2019 13:08:16 +0000 (14:08 +0100)]
bootstrap.conf: drop usage of c-strcase gnulib module

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agosyntax-check: update strcase check to refer to GLib
Pavel Hrdina [Wed, 20 Nov 2019 14:18:59 +0000 (15:18 +0100)]
syntax-check: update strcase check to refer to GLib

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agouse g_ascii_strncasecmp instead of c_strncasecmp from gnulib
Pavel Hrdina [Tue, 19 Nov 2019 14:00:50 +0000 (15:00 +0100)]
use g_ascii_strncasecmp instead of c_strncasecmp from gnulib

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agouse g_ascii_strcasecmp instead of c_strcasecmp from gnulib
Pavel Hrdina [Tue, 19 Nov 2019 14:00:08 +0000 (15:00 +0100)]
use g_ascii_strcasecmp instead of c_strcasecmp from gnulib

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agobootstrap.conf: drop usage of c-type gnulib module
Pavel Hrdina [Wed, 20 Nov 2019 12:46:31 +0000 (13:46 +0100)]
bootstrap.conf: drop usage of c-type gnulib module

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agosyntax-check: update c-type checks to refer to Glib
Pavel Hrdina [Mon, 18 Nov 2019 15:20:17 +0000 (16:20 +0100)]
syntax-check: update c-type checks to refer to Glib

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agouse g_ascii_toupper instead of c_toupper from gnulib
Pavel Hrdina [Mon, 18 Nov 2019 14:16:33 +0000 (15:16 +0100)]
use g_ascii_toupper instead of c_toupper from gnulib

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agouse g_ascii_tolower instead of c_tolower from gnulib
Pavel Hrdina [Mon, 18 Nov 2019 14:15:31 +0000 (15:15 +0100)]
use g_ascii_tolower instead of c_tolower from gnulib

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agouse g_ascii_isxdigit instead of c_isxdigit from gnulib
Pavel Hrdina [Mon, 18 Nov 2019 14:16:00 +0000 (15:16 +0100)]
use g_ascii_isxdigit instead of c_isxdigit from gnulib

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agouse g_ascii_isspace instead of c_isspace from gnulib
Pavel Hrdina [Mon, 18 Nov 2019 14:10:02 +0000 (15:10 +0100)]
use g_ascii_isspace instead of c_isspace from gnulib

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agouse g_ascii_isprint instead of c_isprint from gnulib
Pavel Hrdina [Mon, 18 Nov 2019 14:14:47 +0000 (15:14 +0100)]
use g_ascii_isprint instead of c_isprint from gnulib

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agouse g_ascii_islower instead of c_islower from gnulib
Pavel Hrdina [Mon, 18 Nov 2019 14:16:54 +0000 (15:16 +0100)]
use g_ascii_islower instead of c_islower from gnulib

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agouse g_ascii_isdigit instead of c_isdigit frum gnulib
Pavel Hrdina [Mon, 18 Nov 2019 14:13:11 +0000 (15:13 +0100)]
use g_ascii_isdigit instead of c_isdigit frum gnulib

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agouse g_ascii_iscntrl instead of c_iscntrl from gnulib
Pavel Hrdina [Mon, 18 Nov 2019 14:17:15 +0000 (15:17 +0100)]
use g_ascii_iscntrl instead of c_iscntrl from gnulib

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agouse g_ascii_isalpha instead of c_isalpha from gnulib
Pavel Hrdina [Mon, 18 Nov 2019 14:11:46 +0000 (15:11 +0100)]
use g_ascii_isalpha instead of c_isalpha from gnulib

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agouse g_ascii_isalnum instead of c_isalnum from gnulib
Pavel Hrdina [Mon, 18 Nov 2019 14:14:06 +0000 (15:14 +0100)]
use g_ascii_isalnum instead of c_isalnum from gnulib

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agovirkeyfile: define IS_ASCII instead c_isascii from gnulib
Pavel Hrdina [Wed, 20 Nov 2019 14:34:44 +0000 (15:34 +0100)]
virkeyfile: define IS_ASCII instead c_isascii from gnulib

GLib doesn't provide alternative to c_isascii and this is the only usage
of that macro so define a replacement ourselves.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoutil: define IS_BLANK instead of using c_isblank from gnulib
Pavel Hrdina [Mon, 18 Nov 2019 14:07:06 +0000 (15:07 +0100)]
util: define IS_BLANK instead of using c_isblank from gnulib

The same way how we have IS_EOL in two files where we actually need it
defince IS_BLANK so we can drop usage of c_isblank.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoqemu: Add support for VIR_DOMAIN_CAPS_FEATURE_BACKUP
Peter Krempa [Tue, 3 Dec 2019 16:38:13 +0000 (17:38 +0100)]
qemu: Add support for VIR_DOMAIN_CAPS_FEATURE_BACKUP

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoconf: domaincaps: Add 'backup' feature flag
Peter Krempa [Tue, 3 Dec 2019 16:36:35 +0000 (17:36 +0100)]
conf: domaincaps: Add 'backup' feature flag

This flag will allow figuring out whether the hypervisor supports the
incremental backup and checkpoint features.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: blockjob: Implement concluded blockjob handler for backup blockjobs
Peter Krempa [Fri, 4 Oct 2019 14:28:47 +0000 (16:28 +0200)]
qemu: blockjob: Implement concluded blockjob handler for backup blockjobs

After the individual sub-blockjobs of a backup libvirt job finish we
must detect it and notify the parent job, so that it can be properly
terminated.

Since we update job information to determine success of a blockjob we
can directly report back also statistics of the blockjob.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: driver: Allow cancellation of the backup job
Peter Krempa [Tue, 26 Nov 2019 17:26:30 +0000 (18:26 +0100)]
qemu: driver: Allow cancellation of the backup job

Use the helper which cancels all blockjobs to perform the backup job
cancellation in qemuDomainAbortJob.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: backup: Implement stats gathering while the job is running
Peter Krempa [Tue, 26 Nov 2019 17:25:49 +0000 (18:25 +0100)]
qemu: backup: Implement stats gathering while the job is running

We can use the output of 'query-jobs' to figure out some useful
information about a backup job. That is progress in case of a push job
and scratch file use in case of a pull job.

Add a worker which will total up the data and call it from
qemuDomainGetJobStatsInternal.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Implement backup job APIs and qemu handling
Peter Krempa [Wed, 18 Sep 2019 11:11:12 +0000 (13:11 +0200)]
qemu: Implement backup job APIs and qemu handling

This allows to start and manage the backup job.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agodoc: Document quirk of getting block job info for a 'backup' blockjob
Peter Krempa [Tue, 26 Nov 2019 21:21:22 +0000 (22:21 +0100)]
doc: Document quirk of getting block job info for a 'backup' blockjob

The stats reported for a blockjob which is member of a domain pull
backup refer to the utilization of the scratch file rather than the
progress of the backup as the progress of the backup depends on the
client. Note this quirk in the docs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoconf: backup: Add fields for tracking stats of completed sub-jobs
Peter Krempa [Tue, 26 Nov 2019 17:11:19 +0000 (18:11 +0100)]
conf: backup: Add fields for tracking stats of completed sub-jobs

We need a place to store stats of completed sub-jobs so that we can
later report accurate stats.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agotests: qemustatusxml2xml: Add test for 'pull' type backup job
Peter Krempa [Wed, 18 Sep 2019 10:45:31 +0000 (12:45 +0200)]
tests: qemustatusxml2xml: Add test for 'pull' type backup job

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: blockjob: Track internal data for 'backup' blockjob
Peter Krempa [Wed, 16 Oct 2019 07:39:32 +0000 (09:39 +0200)]
qemu: blockjob: Track internal data for 'backup' blockjob

A backup blockjob needs to be able to notify the parent backup job as
well as track all data to be able to clean up the bitmap and blockdev
used for the backup.

Add the data structure, job allocation function and status XML formatter
and parser.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: domain: Track backup job data in the status XML
Peter Krempa [Wed, 18 Sep 2019 09:27:05 +0000 (11:27 +0200)]
qemu: domain: Track backup job data in the status XML

Store the data of a backup job along with the index counter for new
backup jobs in the status XML. Currently we will support only one
backup job and thus there's no necessity to add arrays of jobs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: monitor: Add support for blockdev-backup via 'transaction'
Peter Krempa [Fri, 27 Sep 2019 15:28:48 +0000 (17:28 +0200)]
qemu: monitor: Add support for blockdev-backup via 'transaction'

Implement the transaction actions generator for blockdev-backup.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoAdd 'backup' block job type
Peter Krempa [Fri, 18 Oct 2019 13:10:33 +0000 (15:10 +0200)]
Add 'backup' block job type

A backup job may consist of many backup sub-blockjobs. Add the new
blockjob type and add all type converter strings.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: domain: Introduce QEMU_ASYNC_JOB_BACKUP async job type
Peter Krempa [Fri, 22 Nov 2019 16:19:49 +0000 (17:19 +0100)]
qemu: domain: Introduce QEMU_ASYNC_JOB_BACKUP async job type

We will want to use the async job infrastructure along with all the APIs
and event for the backup job so add the backup job as a new async job
type.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Add infrastructure for statistics of a backup job
Peter Krempa [Fri, 22 Nov 2019 16:30:05 +0000 (17:30 +0100)]
qemu: Add infrastructure for statistics of a backup job

Introduce QEMU_DOMAIN_JOB_STATS_TYPE_BACKUP and the convertors and other
plumbing to be able to report statistics for the backup job.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agobackup: Implement virsh support for backup
Eric Blake [Thu, 22 Aug 2019 01:42:45 +0000 (20:42 -0500)]
backup: Implement virsh support for backup

Introduce virsh commands for performing backup jobs.

Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agotests: genericxml2xml: Add testing of backup XML files
Peter Krempa [Tue, 3 Dec 2019 12:49:04 +0000 (13:49 +0100)]
tests: genericxml2xml: Add testing of backup XML files

Now that the parser and formatter are in place we can exercise it on
the test files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agobackup: Parse and output backup XML
Eric Blake [Thu, 22 Aug 2019 01:42:44 +0000 (20:42 -0500)]
backup: Parse and output backup XML

Accept XML describing a generic block job, and output it again as
needed. This may still need a few tweaks to match the documented XML
and RNG schema.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agobackup: Implement backup APIs for remote driver
Eric Blake [Thu, 22 Aug 2019 01:42:43 +0000 (20:42 -0500)]
backup: Implement backup APIs for remote driver

This one is fairly straightforward - the generator already does what
we need.

Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoAPI: Add domain job operation for backups
Peter Krempa [Fri, 22 Nov 2019 15:35:27 +0000 (16:35 +0100)]
API: Add domain job operation for backups

Introduce VIR_DOMAIN_JOB_OPERATION_BACKUP into virDomainJobOperation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agobackup: Introduce virDomainBackup APIs
Eric Blake [Thu, 22 Aug 2019 01:42:42 +0000 (20:42 -0500)]
backup: Introduce virDomainBackup APIs

Introduce a few new public APIs related to incremental backups.  This
builds on the previous notion of a checkpoint (without an existing
checkpoint, the new API is a full backup, differing from
virDomainBlockCopy in the point of time chosen and in operation on
multiple disks at once); and also allows creation of a new checkpoint
at the same time as starting the backup (after all, an incremental
backup is only useful if it covers the state since the previous
backup).

A backup job also affects filtering a listing of domains, as well as
adding event reporting for signaling when a push model backup
completes (where the hypervisor creates the backup); note that the
pull model does not have an event (starting the backup lets a third
party access the data, and only the third party knows when it is
finished).

The full list of new APIs:
        virDomainBackupBegin;
        virDomainBackupGetXMLDesc;

Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agobackup: Document new XML for backups
Eric Blake [Thu, 22 Aug 2019 01:42:41 +0000 (20:42 -0500)]
backup: Document new XML for backups

Prepare for new backup APIs by describing the XML that will represent
a backup.  The XML resembles snapshots and checkpoints in being able
to select actions for a set of disks, but has other differences.  It
can support both push model (the hypervisor does the backup directly
into the destination file) and pull model (the hypervisor exposes an
access port for a third party to grab what is necessary).  Add
testsuite coverage for some minimal uses of the XML.

The <disk> element within <domainbackup> tries to model the same
elements as a <disk> under <domain>, but sharing the RNG grammar
proved to be hairy. That is in part because while <domain> use
<source> to describe a host resource in use by the guest, a backup job
is using a host resource that is not visible to the guest: a push
backup action is instead describing a <target> (which ultimately could
be a remote network resource, but for simplicity the RNG just
validates a local file for now), and a pull backup action is instead
describing a temporary local file <scratch> (which probably should not
be a remote resource).  A future refactoring may thus introduce some
way to parameterize RNG to accept <disk type='FOO'>...</disk> so that
the name of the subelement can be <source> for domain, or <target> or
<scratch> as needed for backups. Future patches may improve this area
of code.

Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agovirsh: Implement VIR_DOMAIN_JOB_DISK_TEMP_(USED|TOTAL) in cmdDomjobinfo
Peter Krempa [Mon, 25 Nov 2019 16:24:42 +0000 (17:24 +0100)]
virsh: Implement VIR_DOMAIN_JOB_DISK_TEMP_(USED|TOTAL) in cmdDomjobinfo

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoAPI: Introduce field for reporting temporary disk space usage of a domain job
Peter Krempa [Mon, 25 Nov 2019 16:19:48 +0000 (17:19 +0100)]
API: Introduce field for reporting temporary disk space usage of a domain job

A pull mode backup job uses temporary disk images to hold the changed
parts of the disk while the client is copying the changes. Since usage
of the temporary space can be monitored but doesn't really fit any of
the existing stats fields introduce new fields for reporting this data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: domain: Export qemuDomainGetImageIds
Peter Krempa [Tue, 3 Dec 2019 14:17:23 +0000 (15:17 +0100)]
qemu: domain: Export qemuDomainGetImageIds

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: domain: raise an error when no emulator is found
Cole Robinson [Mon, 9 Dec 2019 16:34:45 +0000 (11:34 -0500)]
qemu: domain: raise an error when no emulator is found

$ cat f | grep -e arch -e emulator
    <type arch='mipsel'>hvm</type>
$ sudo virsh define f
error: Failed to define domain from f
error: An error occurred, but the cause is unknown

After:
$ sudo virsh define f
error: Failed to define domain from f
error: unsupported configuration: No emulator found for arch 'mipsel'

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agovz: drop virCapsPtr param from many API domain parse calls
Daniel P. Berrangé [Mon, 9 Dec 2019 14:43:15 +0000 (14:43 +0000)]
vz: drop virCapsPtr param from many API domain parse calls

This fixes commit bf9d812956100442a195d99773620e1795b8633d

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovz: declare missing driver variable
Daniel P. Berrangé [Mon, 9 Dec 2019 14:42:27 +0000 (14:42 +0000)]
vz: declare missing driver variable

This fixes commit 61bff77bf993ac782c850cfd1145e83c216e4a21

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovz: pass pointer to vz capabilities
Daniel P. Berrangé [Mon, 9 Dec 2019 14:41:13 +0000 (14:41 +0000)]
vz: pass pointer to vz capabilities

This fixes commit 4a4132b4625778cf80acb9c92d06351b44468ac3

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovz: pass virDomainXMLOptionPtr to virDomainVideoDefNew
Daniel P. Berrangé [Mon, 9 Dec 2019 14:39:20 +0000 (14:39 +0000)]
vz: pass virDomainXMLOptionPtr to virDomainVideoDefNew

The virDomainVideoDefNew requires the xml options to be
provided since

  commit 3dbf3941ad7202ec4426cfe965d8ba97ee8d49df
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   Mon Sep 23 14:44:35 2019 +0400

    conf: add privateData to virDomainVideoDef

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agotests: fix warning with old GCC about missing struct initializer
Daniel P. Berrangé [Mon, 9 Dec 2019 14:37:20 +0000 (14:37 +0000)]
tests: fix warning with old GCC about missing struct initializer

Old GCC isn't happy about the {0} initializer because the first
field in the struct is itself a struct.

../../tests/openvzutilstest.c: In function 'testReadNetworkConf':
../../tests/openvzutilstest.c:101:12: error: missing braces around initializer [-Werror=missing-braces]
     struct openvz_driver driver = {0};
            ^

This fixes commit 4a4132b4625778cf80acb9c92d06351b44468ac3

Signed-off-by: Daniel Berrange <berrange@localhost.localdomain>
5 years agoqemu: checkpoint: fix NULL dereference at create time
Cole Robinson [Sun, 8 Dec 2019 21:48:58 +0000 (16:48 -0500)]
qemu: checkpoint: fix NULL dereference at create time

'cfg' is never initialized here, which causes a crash
later in qemuCheckpointCreateFinalize

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agoqemu: snapshot: Mark file becoming backingStore as read-only
Peter Krempa [Mon, 9 Dec 2019 11:44:41 +0000 (12:44 +0100)]
qemu: snapshot: Mark file becoming backingStore as read-only

For any backing file we set 'read-only' to true, but didn't do this when
modifying the recorded backing store when creating external snapshots.

This meant that qemu would attempt to open the backing-file read-write.
This would fail for example when selinux is used as qemu doesn't have
write permission for the backing file.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoxen: Remove unused 'cfg'
Peter Krempa [Mon, 9 Dec 2019 13:05:29 +0000 (14:05 +0100)]
xen: Remove unused 'cfg'

Refactoring of the XML parser left few instances of the
libxlDriverConfig object unused. Remove them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
5 years agoqemu: stop creating capabilities at driver startup
Daniel P. Berrangé [Mon, 2 Dec 2019 13:04:26 +0000 (13:04 +0000)]
qemu: stop creating capabilities at driver startup

Now that nearly all internal APIs use the QEMU capabilities or other
QEMU driver data directly, there's no compelling benefit to create
virCapsPtr at driver startup.

Skipping this means we don't probe capabilities for all 30 system
emulator targets at startup, only those emulators which are referenced
by an XML doc. This massively improves libvirtd startup time when the
capabilities cache is not populated. It even improves startup time
when the cache is up to date, as we don't bother to load files from
the cache until we need them.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>