]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
5 years agoqemu: backup: Extract calculations of bitmaps to merge for incremental backup
Peter Krempa [Thu, 12 Dec 2019 14:20:48 +0000 (15:20 +0100)]
qemu: backup: Extract calculations of bitmaps to merge for incremental backup

Separate the for now incomplete code that collects the bitmaps to be
merged for an incremental backup into a separate function. This will
allow adding testing prior to the improvement of the algorithm to
include snapshots.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: backup: Return 'def' instead of 'obj' from qemuBackupBeginCollectIncrementalCh...
Peter Krempa [Mon, 9 Dec 2019 13:50:03 +0000 (14:50 +0100)]
qemu: backup: Return 'def' instead  of 'obj' from qemuBackupBeginCollectIncrementalCheckpoints

The object itself has no extra value and it would make testing the code
harder. Refactor it to remove just the definition pointer.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agotests: qemublock: Add test case for detecting bitmaps as we create snapshots
Peter Krempa [Thu, 12 Dec 2019 12:50:55 +0000 (13:50 +0100)]
tests: qemublock: Add test case for detecting bitmaps as we create snapshots

Add test data gathered from a run of qemu after creating bitmaps and
snapshots together in various combinations.

The following sequence of commands was used to achieve the
configuration:

virsh checkpoint-create-as VM --name a
virsh snapshot-create-as VM --disk-only
virsh snapshot-create-as VM --disk-only
virsh checkpoint-create-as VM --name b
virsh checkpoint-create-as VM --name c
virsh snapshot-create-as VM --disk-only
virsh checkpoint-create-as VM --name d
virsh snapshot-create-as VM --disk-only
virsh checkpoint-create-as VM --name current

Note that VM was restarted after these operations to allow renumbering
of the bitmaps in a more human-readable way.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: snapshot: Propagate active bitmaps through external snapshots
Peter Krempa [Thu, 28 Nov 2019 15:06:31 +0000 (16:06 +0100)]
qemu: snapshot: Propagate active bitmaps through external snapshots

Re-create any active persistent bitmap in the snapshot overlay image so
that tracking for a checkpoint is persisted. While this basically
duplicates data in the allocation map it's currently the only possible
way as qemu can't mirror the allocation map into a dirty bitmap if we'd
ever want to do a backup.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: monitor: Add 'granularity' parameter for block-dirty-bitmap-add
Peter Krempa [Thu, 28 Nov 2019 15:03:16 +0000 (16:03 +0100)]
qemu: monitor: Add 'granularity' parameter for block-dirty-bitmap-add

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: snapshot: Fold formatting of snapshot transaction into prepare func
Peter Krempa [Thu, 28 Nov 2019 14:01:14 +0000 (15:01 +0100)]
qemu: snapshot: Fold formatting of snapshot transaction into prepare func

qemuDomainSnapshotDiskPrepareOne is already called for each disk which
is member of the snapshot so we don't need to iterate through the
snapshot list again to generate members of the 'transaction' command for
each snapshot.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: Check for explicit failure of qemuBlockSnapshotAddBlockdev
Peter Krempa [Thu, 28 Nov 2019 13:58:55 +0000 (14:58 +0100)]
qemu: Check for explicit failure of qemuBlockSnapshotAddBlockdev

Check that the value is less than 0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agotests: qemublocktest: Add a synthetic test case for bitmap detection
Peter Krempa [Thu, 12 Dec 2019 12:47:40 +0000 (13:47 +0100)]
tests: qemublocktest: Add a synthetic test case for bitmap detection

The real data gathered for the 'basic' test case don't exercise some
fields. Add a copy with a few values modified manually.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agotests: qemublock: Add test for bitmap detection
Peter Krempa [Thu, 12 Dec 2019 12:37:01 +0000 (13:37 +0100)]
tests: qemublock: Add test for bitmap detection

Test the extraction of data about changed block tracking bitmaps. The
first test case adds a simple scenario of multiple bitmaps in one layer.

The test data will be also later reused for testing the code that
determines which bitmaps to merge for an incremental backup.

The sequence of bitmaps was created by the libvirt checkpoint API with
the following sequence of commands:

virsh checkpoint-create-as VM --name a
virsh checkpoint-create-as VM --name b
virsh checkpoint-create-as VM --name c
virsh checkpoint-create-as VM --name d
virsh checkpoint-create-as VM --name current

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: monitor: Extract internals of qemuMonitorJSONBlockGetNamedNodeData
Peter Krempa [Mon, 9 Dec 2019 06:46:53 +0000 (07:46 +0100)]
qemu: monitor: Extract internals of qemuMonitorJSONBlockGetNamedNodeData

For testing purposes it will be beneficial to be able to parse the data
from JSON directly rather than trying to simulate the monitor. Extract
the worker bits and export them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: monitor: Extract data about dirty-bimaps in qemuMonitorBlockGetNamedNodeData
Peter Krempa [Thu, 28 Nov 2019 13:27:00 +0000 (14:27 +0100)]
qemu: monitor: Extract data about dirty-bimaps in qemuMonitorBlockGetNamedNodeData

We will need to inspect the presence and attributes for dirty bitmaps.
Extract them when processing reply of query-named-block-nodes.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agogitlab: Move mips job to Debian 9
Andrea Bolognani [Fri, 13 Dec 2019 11:56:24 +0000 (12:56 +0100)]
gitlab: Move mips job to Debian 9

Support for the mips architecture has been dropped from Debian
sid. Move the mipsel job from Debian 9 to Debian sid at the same
time to keep things balanced.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: honour parseOpaque instead of refetching caps
Daniel P. Berrangé [Tue, 10 Dec 2019 11:35:43 +0000 (11:35 +0000)]
qemu: honour parseOpaque instead of refetching caps

The use of the parseOpaque parameter was mistakenly removed in

  commit 4a4132b4625778cf80acb9c92d06351b44468ac3
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Tue Dec 3 10:49:49 2019 +0000

    conf: don't use passed in caps in post parse method

causing the method to re-fetch qemuCaps that were already just
fetched and put into parseOpaque.

This is inefficient when parsing incoming XML, but for live
XML this is more serious as it means we use the capabilities
for the current QEMU binary on disk, rather than the running
QEMU.

That commit, however, did have a useful side effect of fixing
a crasher bug in the qemu post parse callback introduced by

  commit 5e939cea896fb3373a6f68f86e325c657429ed3d
  Author: Jiri Denemark <jdenemar@redhat.com>
  Date:   Thu Sep 26 18:42:02 2019 +0200

    qemu: Store default CPU in domain XML

The qemuDomainDefSetDefaultCPU() method in that patch did not
allow for the possibility that qemuCaps would be NULL and thus
resulted in a SEGV.

This shows a risk in letting each check in the post parse
callback look for qemuCaps == NULL. The safer option is to
check once upfront and immediately stop (postpone) further
validation.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: check os type / virt type / arch in validate callback
Daniel P. Berrangé [Wed, 11 Dec 2019 11:55:23 +0000 (11:55 +0000)]
qemu: check os type / virt type / arch in validate callback

Don't check os type / virt type / arch in the post-parse callback
because we can't assume qemuCaps is non-NULL at this point. It
also conceptually belongs to the validation callback.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agotests: add a domain ID to live status XML doc
Daniel P. Berrangé [Wed, 11 Dec 2019 11:53:43 +0000 (11:53 +0000)]
tests: add a domain ID to live status XML doc

The status XML represents a running VM, so we should always have an
ID present for the domain.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: remove use of qemuDomainObjBeginJobWithAgent()
Jonathon Jongsma [Thu, 5 Dec 2019 16:08:56 +0000 (10:08 -0600)]
qemu: remove use of qemuDomainObjBeginJobWithAgent()

This function will be removed in a future commit because it allows the
caller to acquire both monitor and agent jobs at the same time. Holding
both job types creates a vulnerability to denial of service from a
malicious guest agent.

qemuDomainSetVcpusFlags() always passes NONE for either the monitor job
or the agent job (and thus is not vulnerable to the DoS), so we can
simply replace this function with the functions for acquiring the
appropriate type of job.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu: don't hold monitor and agent job when setting time
Jonathon Jongsma [Thu, 5 Dec 2019 16:08:53 +0000 (10:08 -0600)]
qemu: don't hold monitor and agent job when setting time

We have to assume that the guest agent may be malicious so we don't want
to allow any agent queries to block any other libvirt API. By holding
a monitor job while we're querying the agent, we open ourselves up to a
DoS.

Split the function so that the portion issuing the agent command only
holds an agent job and the portion issuing the monitor command holds
only a monitor job.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu: don't hold both jobs for suspend
Jonathon Jongsma [Thu, 5 Dec 2019 16:08:52 +0000 (10:08 -0600)]
qemu: don't hold both jobs for suspend

We have to assume that the guest agent may be malicious so we don't want
to allow any agent queries to block any other libvirt API. By holding a
monitor job while we're querying the agent, we open ourselves up to a
DoS.

So split the function up a bit to only hold the monitor job while
querying qemu for whether the domain supports suspend. Then acquire only
an agent job while issuing the agent suspend command.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu: don't hold a monitor and agent job for reboot
Jonathon Jongsma [Thu, 5 Dec 2019 16:08:51 +0000 (10:08 -0600)]
qemu: don't hold a monitor and agent job for reboot

We have to assume that the guest agent may be malicious so we don't want
to allow any agent queries to block any other libvirt API. By holding
a monitor job while we're querying the agent, we open ourselves up to a
DoS.

Split the function so that we only hold the appropriate type of job
while rebooting.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu: don't take agent and monitor job for shutdown
Jonathon Jongsma [Thu, 5 Dec 2019 16:08:50 +0000 (10:08 -0600)]
qemu: don't take agent and monitor job for shutdown

We have to assume that the guest agent may be malicious so we don't want
to allow any agent queries to block any other libvirt API. By holding
a monitor job while we're querying the agent, we open ourselves up to a
DoS.  So split the function into separate parts: one that does the agent
shutdown and one that does the monitor shutdown. Each part holds only a
job of the appropriate type.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agodocs: hacking: document removal of VIR_STR(N)DUP
Ján Tomko [Thu, 24 Oct 2019 22:26:06 +0000 (00:26 +0200)]
docs: hacking: document removal of 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 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>