]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
5 years agocpu: add CLZERO CPUID support for AMD platforms
Ani Sinha [Tue, 3 Dec 2019 11:09:12 +0000 (03:09 -0800)]
cpu: add CLZERO CPUID support for AMD platforms

Qemu commit e900135dcfb67 ("i386: Add CPUID bit for CLZERO and XSAVEERPTR")
adds support for CLZERO CPUID bit.
This commit extends support for this CPUID bit into libvirt.

Signed-off-by: Ani Sinha <ani.sinha@nutanix.com>
Message-Id: <1575371352-99055-1-git-send-email-ani.sinha@nutanix.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agotools: do not loop in libvirt-guests test_connect
Christian Ehrhardt [Mon, 16 Dec 2019 07:20:59 +0000 (08:20 +0100)]
tools: do not loop in libvirt-guests test_connect

These days libvirt is pretty reliable and even remote connections
(not the default for libvirt-guests anyway) either work or fail but are
uncommon to be flaky.

On the other hand users might have disabled the service and while we are
After=libvirtd for ordering we are not Requiring it. Adding that or any
harder dependency might break our ordering. But if people have disabled
libvirt they will do a full retry loop until timeout.

Lets drop the loop to be much faster if a remote is not reachable.

Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1854653
This reverts

  commit 4e7fc8305a53676ba2362bfaa8ca05c4851b7e12
  Author: Michal Prívozník <mprivozn@redhat.com>
  Date:   Fri Feb 21 12:46:08 2014 +0100

    libvirt-guests: Wait for libvirtd to initialize

The race described in that commit no longer exists using systemd as
we now have socket activation. If not using systemd, then it is also
safe if using the libvirtd --daemon flag, since the parent process
won't return to the caller until the child is accepting connections.

Reported-by: Doug Smythies <dsmythies@telus.net>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
5 years agonews: Document init scripts
Michal Privoznik [Tue, 26 Nov 2019 13:55:15 +0000 (14:55 +0100)]
news: Document init scripts

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconfigure: Provide OpenRC scripts for sub-daemons
Michal Privoznik [Thu, 31 Oct 2019 17:59:19 +0000 (18:59 +0100)]
configure: Provide OpenRC scripts for sub-daemons

There is plenty of distributions that haven't switched to
systemd nor they force their users to (Gentoo, Alpine Linux to
name a few). With the daemon split merged their only option is to
still use the monolithic daemon which will go away eventually.
Provide init scripts for these distros too.

For now, I'm not introducing config files which would correspond
to the init files except for libvirtd and virtproxyd init scripts
where it might be desirable to tweak the command line of
corresponding daemons.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovirsh.pod: Mention iscsi-direct is supported in find-storage-pool-sources
Han Han [Wed, 4 Dec 2019 09:19:05 +0000 (17:19 +0800)]
virsh.pod: Mention iscsi-direct is supported in find-storage-pool-sources

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Han Han <hhan@redhat.com>
5 years agoremote: shrink the critical sections
Marc Hartmayer [Thu, 14 Nov 2019 17:44:24 +0000 (18:44 +0100)]
remote: shrink the critical sections

To free the structs and save the error, it is not necessary to hold @priv->lock,
therefore move these parts after the mutex unlock.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
5 years agorpc: Introduce virNetServerGetProgramLocked helper function
Marc Hartmayer [Thu, 14 Nov 2019 17:44:23 +0000 (18:44 +0100)]
rpc: Introduce virNetServerGetProgramLocked helper function

This patch introduces virNetServerGetProgramLocked. It's a function to
determine which program has to be used for a given @msg. This function
will be reused in the next patch.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
5 years agoremote: Save reference to program in daemonClientEventCallback
Marc Hartmayer [Thu, 14 Nov 2019 17:44:21 +0000 (18:44 +0100)]
remote: Save reference to program in daemonClientEventCallback

As a result, you can later determine during the callback which program
was used. This makes it easier to refactor the code in the future and
is less prone to error.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
5 years agorpc: use the return value of virObjectRef directly
Marc Hartmayer [Thu, 14 Nov 2019 17:44:19 +0000 (18:44 +0100)]
rpc: use the return value of virObjectRef directly

Use the return value of virObjectRef directly. This way, it's easier
for another reader to identify the reason why the additional reference
is required.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
5 years agotests: fix typo in emulator arch name i686 -> i386
Daniel P. Berrangé [Fri, 13 Dec 2019 17:52:10 +0000 (17:52 +0000)]
tests: fix typo in emulator arch name i686 -> i386

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: create memory bandwidth monitor.
Huaqiang [Fri, 13 Dec 2019 15:34:10 +0000 (15:34 +0000)]
conf: create memory bandwidth monitor.

Following domain configuration changes create two memory bandwidth
monitors: one is monitoring the bandwidth consumed by vCPU 0,
another is for vCPU 5.

```
               <cputune>
                 <memorytune vcpus='0-4'>
                   <node id='0' bandwidth='20'/>
                   <node id='1' bandwidth='30'/>
       +           <monitor vcpus='0'/>
                 </memorytune>
       +         <memorytune vcpus='5'>
       +           <monitor vcpus='5'/>
       +         </memorytune>

               </cputune>
    ```

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Huaqiang <huaqiang.wang@intel.com>
5 years agocachetune schema: a looser check for the order of <cache> and <monitor> element
Huaqiang [Wed, 13 Nov 2019 17:08:21 +0000 (01:08 +0800)]
cachetune schema: a looser check for the order of <cache> and <monitor> element

Originally, inside <cputune/cachetune>, it requires the <cache> element to
be in the position before <monitor>, and following configuration is not
permitted by schema, but it is better to let it be valid.

  <cputune>
    <cachetune vcpus='0-1'>
      <monitor level='3' vcpus='0-1'/>
            ^
            |__ Not permitted originally because it is in the place
                before <cache> element.

      <cache id='0' level='3' type='both' size='3' unit='MiB'/>
      <cache id='1' level='3' type='both' size='3' unit='MiB'/>
    </cachetune>
    ...
  </cputune>

And, let schema do more strict check by identifying following configuration to
be invalid, due to <cachetune> should contain at least one <cache> or <monitor>
element.

  <cputune>
    <cachetune vcpus='0-1'>
        ^
        |__ a <cachetune> SHOULD contain at least one <cache> or <monitor>

    </cachetune>
    ...
  </cputune>

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Huaqiang <huaqiang.wang@intel.com>
5 years agoconf: showing cache/memoryBW monitor features in capabilities
Huaqiang [Wed, 13 Nov 2019 17:08:20 +0000 (01:08 +0800)]
conf: showing cache/memoryBW monitor features in capabilities

We learned that the hardware features of CAT, CMT, MBA and MBM
are orthogonal ones, if CAT or MBA is not supported in system,
but CMT or MBM are supported, then the cache monitor or
memoryBW monitor features may not be correctly displayed in
host capabilities through command 'virsh capabilites'.

Showing the cache/memoryBW monitor capabilities even there is
no support of cache allocation or memoryBW allocation features.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Huaqiang <huaqiang.wang@intel.com>
5 years agoRemove redundant usage of WITH_YAJL
Ján Tomko [Thu, 12 Dec 2019 17:17:08 +0000 (18:17 +0100)]
Remove redundant usage of WITH_YAJL

As of commit 2a00ef6e71f30241f9ca6288da984d75f3cef957 which
was released in v5.2.0, we require YAJL to build the QEMU driver.

Remove the checks from code that requires the QEMU driver
or checks that also check for WITH_QEMU.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agodocs: remove link to virsh cmd ref & app dev guide
Daniel P. Berrangé [Fri, 13 Dec 2019 10:04:18 +0000 (10:04 +0000)]
docs: remove link to virsh cmd ref & app dev guide

Both the application developer guide and virsh command
reference are unmaintained for best part of 8 years, and
so horrifically out of date. This does not give a good
impression to people reading the docs. Now that we are
publishing the man pages online, those are a better
doc to read for virsh.  We can also highlight the API
reference instead of the app dev guide.

The virsh command reference & app dev guide will
still exist on the web root, but will not be linked
to.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agocputest: Add CPUID data for Hygon Dhyana 7185 32-core Processor
Yingle Hou [Thu, 12 Dec 2019 02:58:20 +0000 (10:58 +0800)]
cputest: Add CPUID data for Hygon Dhyana 7185 32-core Processor

Add Hygon Dhyana CPU data test case related files.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Yingle Hou <houyingle@hygon.cn>
5 years agocpu: Add new Dhyana CPU model
Yingle Hou [Thu, 12 Dec 2019 02:58:19 +0000 (10:58 +0800)]
cpu: Add new Dhyana CPU model

Add Hygon Dhyana CPU model to the processor model.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Yingle Hou <houyingle@hygon.cn>
5 years agocpu: Remove the verification conditions of the model in the x86 signatures
Yingle Hou [Thu, 12 Dec 2019 02:58:18 +0000 (10:58 +0800)]
cpu: Remove the verification conditions of the model in the x86 signatures

The x86ModelParseSignatures function makes an assumption that CPU signature
model equals 0 as an invalid case. While in Hygon processor definition, A1
version (model 0, stepping 1) is mass production version, to support Hygon
Dhyana A1 version, we have removed CPU signature model zero checking condition.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Yingle Hou <houyingle@hygon.cn>
5 years agocpu_map: Add TSX_CTRL bit for IA32_ARCH_CAPABILITIES MSR
Jiri Denemark [Thu, 12 Dec 2019 14:12:05 +0000 (15:12 +0100)]
cpu_map: Add TSX_CTRL bit for IA32_ARCH_CAPABILITIES MSR

CVE-2019-11135

When TSX_CTRL bit of IA32_ARCH_CAPABILITIES MSR is set to 1, the CPU
supports IA32_TSX_CTRL MSR which can be used to disable and/or mask TSX.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agocpu_map: Add TAA_NO bit for IA32_ARCH_CAPABILITIES MSR
Jiri Denemark [Thu, 12 Dec 2019 14:12:05 +0000 (15:12 +0100)]
cpu_map: Add TAA_NO bit for IA32_ARCH_CAPABILITIES MSR

CVE-2019-11135

CPUs with TAA_NO bit of IA32_ARCH_CAPABILITIES MSR set to 1 are not
vulnerable to TSX Asynchronous Abort and passing this bit to a guest
may avoid unnecessary mitigations.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agotests: qemublock: Add tests for cross-snapshot incremental backups
Peter Krempa [Thu, 12 Dec 2019 15:03:22 +0000 (16:03 +0100)]
tests: qemublock: Add tests for cross-snapshot incremental backups

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: backup: Merge bitmaps accross the backing chain
Peter Krempa [Wed, 4 Dec 2019 16:39:16 +0000 (17:39 +0100)]
qemu: backup: Merge bitmaps accross the backing chain

To allow backups work across external snapshots we need to improve the
algorithm which calculates which bitmaps to merge.

The algorithm must look for appropriately named bitmaps in the image and
possibly descend into a backing image if the current image does not have
the bitmap.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: block: Introduce qemuBlockNamedNodeDataGetBitmapByName
Peter Krempa [Thu, 5 Dec 2019 14:57:30 +0000 (15:57 +0100)]
qemu: block: Introduce qemuBlockNamedNodeDataGetBitmapByName

This function looks up a named bitmap for a virStorageSource in the data
returned from query-named-block-nodes.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agotests: qemublock: Add testing of bitmap merging for incremental backups
Peter Krempa [Thu, 12 Dec 2019 15:01:22 +0000 (16:01 +0100)]
tests: qemublock: Add testing of bitmap merging for incremental backups

Add test code which will crawl a fake internal list of checkpoints and
generate the list of bitmaps for merging to gather the final bitmap for
the backup.

The initial tests cover the basic case of all bitmaps being present in
the top layer of the backing chain.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: backup: Export qemuBackupDiskPrepareOneBitmapsChain for tests
Peter Krempa [Thu, 12 Dec 2019 15:15:18 +0000 (16:15 +0100)]
qemu: backup: Export qemuBackupDiskPrepareOneBitmapsChain for tests

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: backup: Propagate bitmap metadata into qemuBackupDiskPrepareOneBitmapsChain
Peter Krempa [Thu, 12 Dec 2019 14:46:19 +0000 (15:46 +0100)]
qemu: backup: Propagate bitmap metadata into qemuBackupDiskPrepareOneBitmapsChain

The function will require the bitmap topology for the full
implementation. To facilitate testing, add the propagation of the
necessary data beforehand so that the test code can stay unchanged
during the changes.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
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>