]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
5 years agoconf: pass netprefix in the domain parser config struct
Daniel P. Berrangé [Tue, 26 Nov 2019 16:44:40 +0000 (16:44 +0000)]
conf: pass netprefix in the domain parser config struct

Instead of using the virCapsPtr information, pass the driver specific
netprefix in the domain parser struct. This eliminates one more use of
virCapsPtr from the XML parsing/formatting code.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: don't use passed in caps in post parse method
Daniel P. Berrangé [Tue, 3 Dec 2019 10:49:49 +0000 (10:49 +0000)]
conf: don't use passed in caps in post parse method

To enable the virCapsPtr parameter to the post parse method to be
eliminated, the drivers must fetch the virCapsPtr from their own
driver via the opaque parameter, or use an alternative approach
to validate the parsed data.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: move virt type / os type / arch validation to post-parse
Daniel P. Berrangé [Tue, 26 Nov 2019 16:09:33 +0000 (16:09 +0000)]
conf: move virt type / os type / arch validation to post-parse

The XML parser currently calls virCapabilitiesDomainDataLookup during
parsing to find the domain capabilities matching the triple

  (virt type, os type, arch)

This is, however, bogus with the QEMU driver as it assumes that there
is an emulator known to the default driver capabilities that matches
this triple. It is entirely possible for the driver to be parsing an
XML file with a custom emulator path specified pointing to a binary
that doesn't exist in the default driver capabilities.  This will,
for example be the case on a RHEL host which only installs the host
native emulator to /usr/bin. The user can have built a custom QEMU
for non-native arches into $HOME and wish to use that.

Aside from validation, this call is also used to fill in a machine type
for the guest if not otherwise specified. Again, this data may be
incorrect for the QEMU driver because it is not taking account of
the emulator binary that is referenced.

To start fixing this, move the validation to the post-parse callbacks
where more intelligent driver specific logic can be applied.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: pass in default architecture via domain XML options
Daniel P. Berrangé [Wed, 27 Nov 2019 15:22:45 +0000 (15:22 +0000)]
conf: pass in default architecture via domain XML options

When parsing the guest XML we must fill in the default guest arch if it
is not already present because later parts of the parsing process need
this information.

If no arch is specified we lookup the first guest in the capabilities
data matching the os type and virt type. In most cases this will result
in picking the host architecture but there are some exceptions...

 - The test driver is hardcoded to always use i686 arch
 - The VMWare/ESX drivers will always place i686 guests ahead
   of x86_64 guests in capabilities, so effectively they always
   use i686
 - The QEMU driver can potentially return any arch at all
   depending on what combination of QEMU binaries are installed.

The domain XML hardware configurations are inherently architecture
specific in many places. As a result whomever/whatever created the
domain XML will have had a particular architecture in mind when
specifying the config. In pretty much any sensible case this arch
will have been the native host architecture. i686 on x86_64 is
the only sensible divergance because both these archs are
compatible from a domaain XML config POV.

IOW, although the QEMU driver can pick an almost arbitrary arch as its
default, in the real world no application or user is likely to be
relying on this default arch being anything other than native.

With all this in mind, it is reasonable to change the XML parser to
allow the default architecture to be passed via the domain XML options
struct. If no info is explicitly given then it is safe & sane to pick
the host native architecture as the default for the guest.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: sanitize virDomainObjFormat & virDomainDefFormat* APIs
Daniel P. Berrangé [Tue, 26 Nov 2019 19:40:46 +0000 (19:40 +0000)]
conf: sanitize virDomainObjFormat & virDomainDefFormat* APIs

Moving their instance parameter to be the first one, and give consistent
ordering of other parameters across all functions. Ensure that the xml
options are passed into both functions in prep for future work.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: sanitize virDomainSaveStatus & virDomainSaveConfig APIs
Daniel P. Berrangé [Tue, 26 Nov 2019 19:40:46 +0000 (19:40 +0000)]
conf: sanitize virDomainSaveStatus & virDomainSaveConfig APIs

Our normal practice is for the object type to be the name prefix, and
the object instance be the first parameter passed in.

Rename these to virDomainObjSave and virDomainDefSave moving their
primary parameter to be the first one. Ensure that the xml options
are passed into both functions in prep for future work.

Finally enforce checking of the return type and mark all parameters
as non-NULL.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: add machines & arch to fake test capabilities cache
Daniel P. Berrangé [Mon, 2 Dec 2019 12:19:44 +0000 (12:19 +0000)]
qemu: add machines & arch to fake test capabilities cache

Currently the virQEMUCapsPtr objects are just empty. Future patches are
going to expect them to contain real data. Start off by populating the
machine types and arch information.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: cache host arch separately from virCapsPtr
Daniel P. Berrangé [Tue, 26 Nov 2019 17:51:22 +0000 (17:51 +0000)]
qemu: cache host arch separately from virCapsPtr

As part of a goal to eliminate the need to use virCapsPtr for anything
other than the virConnectGetCapabilies() API impl, cache the host arch
against the QEMU driver struct and use that field directly.

In the tests we move virArchFromHost() globally in testutils.c so that
every test runs with a fixed default architecture reported.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovirsh: Add --tls-destination option for migrate command
Jiri Denemark [Tue, 3 Dec 2019 15:20:57 +0000 (16:20 +0100)]
virsh: Add --tls-destination option for migrate command

This option can be used to override the destination host name used for
TLS verification.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
5 years agoqemu: Implement VIR_MIGRATE_PARAM_TLS_DESTINATION
Jiri Denemark [Tue, 3 Dec 2019 15:20:35 +0000 (16:20 +0100)]
qemu: Implement VIR_MIGRATE_PARAM_TLS_DESTINATION

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
5 years agoIntroduce VIR_MIGRATE_PARAM_TLS_DESTINATION migration param
Jiri Denemark [Tue, 3 Dec 2019 15:12:41 +0000 (16:12 +0100)]
Introduce VIR_MIGRATE_PARAM_TLS_DESTINATION migration param

Normally the TLS certificate from the destination host must match the
host's name for TLS verification to succeed. When the certificate does
not match the destination hostname and the expected cetificate's
hostname is known, this parameter can be used to pass this expected
hostname when starting the migration.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
5 years agoqemu: Add support for setting string migration params
Jiri Denemark [Tue, 3 Dec 2019 13:58:32 +0000 (14:58 +0100)]
qemu: Add support for setting string migration params

The functions for converting migration typed parameters to QEMU
migration parameters and back were only implemented for integer types.
This patch adds support for string parameters.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
5 years agoqemu: migration: Properly setup mirror for blockdev configurations
Peter Krempa [Fri, 6 Dec 2019 17:50:46 +0000 (18:50 +0100)]
qemu: migration: Properly setup mirror for blockdev configurations

With blockdev we need to refer to the nodename of the disk source image
as the source argument for the blockdev-mirror operation while still
keeping the old job name. With blockdev we must also persist the job in
qemu.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: migration: Mention disk target rather than the drive name in debug msg
Peter Krempa [Fri, 6 Dec 2019 17:44:22 +0000 (18:44 +0100)]
qemu: migration: Mention disk target rather than the drive name in debug msg

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: migration: Split out setup of the migration target
Peter Krempa [Fri, 6 Dec 2019 16:47:46 +0000 (17:47 +0100)]
qemu: migration: Split out setup of the migration target

Separate out allocation of the virStorageSource corresponding to the
target NBD export of the migration.

As part of the splitout we allocate the export name explicitly as that
one must not change regardless whether blockdev is used or not to
provide compatibility.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: blockjob: Allow NULL 'mirror' for block copy jobs due to migration
Peter Krempa [Fri, 6 Dec 2019 16:46:29 +0000 (17:46 +0100)]
qemu: blockjob: Allow NULL 'mirror' for block copy jobs due to migration

The non-shared-storage migration tracks the storage source used
explicitly in the migration data so we must allow for processing of the
block job which has NULL mirror as the mirror will not be populated.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: migration: Simplify cleanup in qemuMigrationSrcNBDCopyCancelOne
Peter Krempa [Fri, 6 Dec 2019 16:26:01 +0000 (17:26 +0100)]
qemu: migration: Simplify cleanup in qemuMigrationSrcNBDCopyCancelOne

Now that the cleanup section does not exist remove the label.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: migration: Access job name from job struct
Peter Krempa [Fri, 6 Dec 2019 16:22:53 +0000 (17:22 +0100)]
qemu: migration: Access job name from job struct

qemuMigrationSrcNBDCopyCancelOne uses the block job data structure but
generated it's own job name rather than taking it from the block job
data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: migration: Properly export backend for NBD storage migration
Peter Krempa [Fri, 6 Dec 2019 16:02:33 +0000 (17:02 +0100)]
qemu: migration: Properly export backend for NBD storage migration

With -blockdev we must use the nodename as the export but we must keep
the name of the export as it was before to ensure compatiblity.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: migration: Simplify handling of 'diskAlias' when adding NBD exports
Peter Krempa [Fri, 6 Dec 2019 15:54:33 +0000 (16:54 +0100)]
qemu: migration: Simplify handling of 'diskAlias' when adding NBD exports

Declare the variable inside the loop with automatic clearing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: driver: Use appropriate job name when setting blockjob speed
Peter Krempa [Fri, 6 Dec 2019 13:06:55 +0000 (14:06 +0100)]
qemu: driver: Use appropriate job name when setting blockjob speed

qemuDomainBlockJobSetSpeed was not converted to get the job name from
the block job data. This means that after enabling blockdev the API call
would fail as we wouldn't use the appropriate name.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: driver: Use qemuDomainDiskByName instead of virDomainDiskByName
Peter Krempa [Fri, 6 Dec 2019 13:05:09 +0000 (14:05 +0100)]
qemu: driver: Use qemuDomainDiskByName instead of virDomainDiskByName

Where appropriate replace the open coded call with the qemu wrapper
which already reports the error.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: domain: Mention searched disk in error of qemuDomainDiskByName
Peter Krempa [Fri, 6 Dec 2019 12:59:17 +0000 (13:59 +0100)]
qemu: domain: Mention searched disk in error of qemuDomainDiskByName

Mention the argument used if the disk can't be located.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: cold-unplug of sound
Jidong Xia [Fri, 29 Nov 2019 09:40:46 +0000 (17:40 +0800)]
qemu: cold-unplug of sound

With this patch users can cold unplug some sound devices.
use "virsh detach-device vm sound.xml --config" command.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Jidong Xia <xiajidong@cmss.chinamobile.com>
5 years agoscripts: ignore remote protocol checks if pdwtags crashes
Daniel P. Berrangé [Fri, 6 Dec 2019 17:16:05 +0000 (17:16 +0000)]
scripts: ignore remote protocol checks if pdwtags crashes

On Debian 10, pdwtags reliably segfaults when parsing the libvirt remote
protocol files. This crash was previously ignored by 'make check'
because of the way we piped the pdwtags output to the perl
post-processing scripts. When this was converted to use python it
mistakenly started being a fatal error. We need to explicitly ignore
pdwtags output if it exited with non-zero return code.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: document some recent news items
Daniel P. Berrangé [Thu, 5 Dec 2019 10:35:56 +0000 (10:35 +0000)]
docs: document some recent news items

Document xz compression improvements, docutils build requirements,
and dropped python 2 support.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: remove nested branching to enhance readability
Pavel Mores [Fri, 6 Dec 2019 09:45:27 +0000 (10:45 +0100)]
qemu: remove nested branching to enhance readability

This is a follow-up to patch series posted in

https://www.redhat.com/archives/libvir-list/2019-November/msg01180.html

It implements a suggestion made by Cole in

https://www.redhat.com/archives/libvir-list/2019-November/msg01207.html

and discussed in follow-up messages as there were no objections to the
change.

The aim is to make the code more readable by replacing nested branching
with a flat structure.

Signed-off-by: Pavel Mores <pmores@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu_monitor_text: Drop unused variable and avoid crash
Michal Privoznik [Fri, 6 Dec 2019 09:27:08 +0000 (10:27 +0100)]
qemu_monitor_text: Drop unused variable and avoid crash

In v5.8.0-rc1~122 we've removed the only use of @safename in
qemuMonitorTextLoadSnapshot(). What we are left with is an
declared but not initialized variable that is passed to
VIR_FREE().

Caught by libvirt-php test suite.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
5 years agodocs: Update minimum QEMU version for kvm-hint-dedicated
Andrea Bolognani [Fri, 6 Dec 2019 08:29:05 +0000 (09:29 +0100)]
docs: Update minimum QEMU version for kvm-hint-dedicated

Same fix that was applied to release notes in a595c66a134d.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
5 years agonews: Update the qemu version that dedicated performance hint is from
Han Han [Fri, 6 Dec 2019 02:50:42 +0000 (10:50 +0800)]
news: Update the qemu version that dedicated performance hint is from

KVM dedicated performance hint is added since qemu version 2.10.0 not
2.10.1.

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agoqemuProcessStop: Remove image metadata only when allowed
Michal Privoznik [Wed, 4 Dec 2019 16:36:33 +0000 (17:36 +0100)]
qemuProcessStop: Remove image metadata only when allowed

In v5.9.0-370-g8fa0374c5b I've tried to fix a bug by removing
some stale XATTRs in qemuProcessStop(). However, I forgot to
do nothing when the VIR_QEMU_PROCESS_STOP_NO_RELABEL flag was
specified.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
5 years agoqemu: Convert aborting of a domain job to a switch statement
Peter Krempa [Thu, 5 Dec 2019 11:38:50 +0000 (12:38 +0100)]
qemu: Convert aborting of a domain job to a switch statement

Until now we only really aborted migration via qemuDomainAbortJob. This
will change with the upcoming addition of the backup job. Additionally
there were a bunch of if statements checking various aspects of the
current job.

To make it more obvious convert qemuDomainAbortJob to use a switch
statement and move the individual conditions to the appropriate job
type.

Every job type has now it's own case despite multiple job types just
plainly cancelling the job for clarity and future extension.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agoqemu: driver: Split out cancellation of migration from qemuDomainAbortJob
Peter Krempa [Thu, 5 Dec 2019 11:34:55 +0000 (12:34 +0100)]
qemu: driver: Split out cancellation of migration from qemuDomainAbortJob

Following patch will refactor qemuDomainAbortJob to use a per-job-type
switch where we will need to abort a migration job in various branches.

Save some code duplication by introducing a helper.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agonews: Introduce virConnectSetIdentity API in 5.8
Han Han [Mon, 11 Nov 2019 01:58:07 +0000 (09:58 +0800)]
news: Introduce virConnectSetIdentity API in 5.8

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agonews: Support vhost-user-gpu in 5.8
Han Han [Mon, 11 Nov 2019 01:58:06 +0000 (09:58 +0800)]
news: Support vhost-user-gpu in 5.8

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agonews: Support to run SLIRP in a separate process in 5.8
Han Han [Mon, 11 Nov 2019 01:58:05 +0000 (09:58 +0800)]
news: Support to run SLIRP in a separate process in 5.8

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agonews: Support for kvm dedicated performance hint in 5.7
Han Han [Mon, 11 Nov 2019 01:58:04 +0000 (09:58 +0800)]
news: Support for kvm dedicated performance hint in 5.7

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agodocs: add a kbase page about RPM packaging options
Daniel P. Berrangé [Thu, 10 Oct 2019 14:52:10 +0000 (15:52 +0100)]
docs: add a kbase page about RPM packaging options

The libvirt RPM packaging is quite fine grained but it is not obvious to
users which package is best to install. Add a kbase doc that describes
the different RPMs, and illustrates some example deployment use cases.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: convert kbase/locking-sanlock.html.in to RST
Daniel P. Berrangé [Wed, 20 Nov 2019 14:05:50 +0000 (14:05 +0000)]
docs: convert kbase/locking-sanlock.html.in to RST

This is a semi-automated conversion. The first conversion is done using
"pandoc -f html -t rst". The result is then editted manually to apply
the desired heading markup, and fix a few things that pandoc gets wrong.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: convert kbase/locking-lockd.html.in to RST
Daniel P. Berrangé [Wed, 20 Nov 2019 14:05:50 +0000 (14:05 +0000)]
docs: convert kbase/locking-lockd.html.in to RST

This is a semi-automated conversion. The first conversion is done using
"pandoc -f html -t rst". The result is then editted manually to apply
the desired heading markup, and fix a few things that pandoc gets wrong.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: convert kbase/locking.html.in to RST
Daniel P. Berrangé [Wed, 20 Nov 2019 14:05:50 +0000 (14:05 +0000)]
docs: convert kbase/locking.html.in to RST

This is a semi-automated conversion. The first conversion is done using
"pandoc -f html -t rst". The result is then editted manually to apply
the desired heading markup, and fix a few things that pandoc gets wrong.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: convert kbase/secureusage.html.in to RST
Daniel P. Berrangé [Wed, 20 Nov 2019 14:05:50 +0000 (14:05 +0000)]
docs: convert kbase/secureusage.html.in to RST

This is a semi-automated conversion. The first conversion is done using
"pandoc -f html -t rst". The result is then editted manually to apply
the desired heading markup, and fix a few things that pandoc gets wrong.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: convert kbase/launch_security_sev.html.in to RST
Daniel P. Berrangé [Wed, 20 Nov 2019 14:05:50 +0000 (14:05 +0000)]
docs: convert kbase/launch_security_sev.html.in to RST

This is a semi-automated conversion. The first conversion is done using
"pandoc -f html -t rst". The result is then editted manually to apply
the desired heading markup, and fix a few things that pandoc gets wrong.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: convert kbase/domainstatecapture.html.in to RST
Daniel P. Berrangé [Wed, 20 Nov 2019 14:05:50 +0000 (14:05 +0000)]
docs: convert kbase/domainstatecapture.html.in to RST

This is a semi-automated conversion. The first conversion is done using
"pandoc -f html -t rst". The result is then editted manually to apply
the desired heading markup, and fix a few things that pandoc gets wrong.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: add a minimal style guide for writing RST docs
Daniel P. Berrangé [Mon, 18 Nov 2019 18:37:09 +0000 (18:37 +0000)]
docs: add a minimal style guide for writing RST docs

Most importantly we document the required heading markup so that we get
consistency across the docs. Also mention that docs should have a table
of contents if they have headings & are likely longer than one page of
text.

The 3-space indent rule may sound wierd, but that's what python has
recommended and thus what tools like pandoc emit. Rather than try to
reindent things to 4-space, just accept this RST norm.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: add styling for <tt> element
Daniel P. Berrangé [Wed, 20 Nov 2019 17:44:38 +0000 (17:44 +0000)]
docs: add styling for <tt> element

Although <tt> is deprecated in HTML5, the rst2html command will still
emit it, in preference to <code> tags, so we must style it too.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: relax CSS context match for pretty tables
Daniel P. Berrangé [Mon, 11 Nov 2019 16:50:01 +0000 (16:50 +0000)]
docs: relax CSS context match for pretty tables

We currently only render pretty tables if they have the "top_table"
class set. All of our tables set this, except for the ACL & migration
doc tables, which should have set it, and the API reference which does
not want it.

Simplify life by rendering all tables in a pretty style and remove the
need for the "top_table" class entirely. A small rule turns off the
pretty style for the API reference where tables are a hack used to
render enums with horizontal alignment.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: generate permalinks correctly for rst2html output
Daniel P. Berrangé [Mon, 11 Nov 2019 15:53:02 +0000 (15:53 +0000)]
docs: generate permalinks correctly for rst2html output

The rst2html output generates the links for headings in a slightly
different way than we do for docs written in HTML, so we must match
another scenario when generating back links.

rst2html will also use <h1> tags for both the document title and
the first level of section titles, so we must expand the matching
to allow for this too.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: adapt filling of <head> section for rst2html output
Daniel P. Berrangé [Fri, 18 Oct 2019 14:58:56 +0000 (15:58 +0100)]
docs: adapt filling of <head> section for rst2html output

The HTML from rst2html doesn't have <h1> immediately under the <body>
tag, instead there is at least one <div> in between.

There are also many things added in the <head> section that we don't
want to have copied over, since our templating system already adds
suitable <head> elements.

We only need to copy the <script> to make index.html work.

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

The rst2html tool is provided by python docutils, and as the name
suggests, it converts RST documents into HTML.

Basic rules are added for integrating RST docs into the website
build process.

This enables us to start writing docs on our website in RST format
instead of HTML, without changing the rest of our website templating
system away from XSLT yet.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: move docs about remote driver URIs into URI docs
Daniel P. Berrangé [Tue, 8 Oct 2019 16:43:38 +0000 (17:43 +0100)]
docs: move docs about remote driver URIs into URI docs

The docs about remote URIs in uri.html are somewhat sparse with the full
docs being in remote.html. Move all the URI content from remote.html
into uri.html so the user only needs to look in one place for URI info.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: split TLS certificate setup into its own file
Daniel P. Berrangé [Tue, 8 Oct 2019 16:08:24 +0000 (17:08 +0100)]
docs: split TLS certificate setup into its own file

The generation and deployment of x509 certificates for TLS is complex
and verbose and thus deserves its own standalone page.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agotests: Make check-file-access.pl accept files through argv
Michal Privoznik [Wed, 4 Dec 2019 13:58:04 +0000 (14:58 +0100)]
tests: Make check-file-access.pl accept files through argv

The script needs two files to open:

  $(builddir)/test_file_access.txt, and
  $(srcdir)/file_access_whitelist.txt.

However, the script is opening the files from the $CWD which
won't work for a VPATH build. Make the script accept paths to the
files through @ARGV and tune the Makefile.am to pass them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agotests: rewrite test argv line wrapper in Python
Daniel P. Berrangé [Fri, 30 Aug 2019 12:22:54 +0000 (13:22 +0100)]
tests: rewrite test argv line wrapper in Python

As part of a goal to eliminate Perl from libvirt build tools,
rewrite the test-wrap-argv.pl tool in Python.

This was a straight conversion, manually going line-by-line to
change the syntax from Perl to Python. Thus the overall structure
of the file and approach is the same.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agosrc: rewrite remote protocol checker in Python
Daniel P. Berrangé [Fri, 30 Aug 2019 12:22:54 +0000 (13:22 +0100)]
src: rewrite remote protocol checker in Python

As part of a goal to eliminate Perl from libvirt build tools,
rewrite the pdwtags processing script in Python.

The original inline shell and perl code was completely
unintelligible. The new python code is a manual conversion
that attempts todo basically the same thing.

Tested-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobuild: only support python3 binary
Daniel P. Berrangé [Tue, 3 Dec 2019 16:29:12 +0000 (16:29 +0000)]
build: only support python3 binary

python2 will be end of life by the time of the next
libvirt release. All our supported build targets, including
CentOS7, have a python3 build available.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agorng: Extend the range of driveUnit
Han Han [Wed, 4 Dec 2019 09:35:39 +0000 (17:35 +0800)]
rng: Extend the range of driveUnit

Since the max unit of virtio scsi disk is 16383, update the range of
driveUnit to it.

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agorng: Separate virtio serial port and ccid slot from driveUnit
Han Han [Wed, 4 Dec 2019 09:35:38 +0000 (17:35 +0800)]
rng: Separate virtio serial port and ccid slot from driveUnit

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoconf: fix logic error for scsi units
Han Han [Wed, 4 Dec 2019 09:35:37 +0000 (17:35 +0800)]
conf: fix logic error for scsi units

Introduced in c8007fdc5d2, it should use 'greater than max' instead of
'equal or greater than max' for the condition of checking invalid scsi
unit.

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agotests: stop static linking to libvirt code in tests
Daniel P. Berrangé [Wed, 27 Nov 2019 17:11:20 +0000 (17:11 +0000)]
tests: stop static linking to libvirt code in tests

If we static link to libvirt_util.la then we can't override functions in
this file by simply implementing them in the test code. Any tests should
dynamic link to the main libvirt.la and ensure symbols are exported.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoscripts: fix list indexing when printing mis-ordered symbols
Daniel P. Berrangé [Tue, 3 Dec 2019 17:14:22 +0000 (17:14 +0000)]
scripts: fix list indexing when printing mis-ordered symbols

The python array slice syntax expects the first and last indexes,
not the first length and element count.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: move hyperv_wmi_generator.py to the scripts/ directory
Daniel P. Berrangé [Tue, 8 Oct 2019 10:19:30 +0000 (11:19 +0100)]
docs: move hyperv_wmi_generator.py to the scripts/ directory

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: move esx_vi_generator.py to the scripts/ directory
Daniel P. Berrangé [Tue, 8 Oct 2019 10:19:30 +0000 (11:19 +0100)]
docs: move esx_vi_generator.py to the scripts/ directory

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: move reformat-news.py to the scripts/ directory
Daniel P. Berrangé [Tue, 8 Oct 2019 10:19:30 +0000 (11:19 +0100)]
docs: move reformat-news.py to the scripts/ directory

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: move apibuild.py to the scripts/ directory
Daniel P. Berrangé [Tue, 8 Oct 2019 10:19:30 +0000 (11:19 +0100)]
docs: move apibuild.py to the scripts/ directory

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agotests: stop linking virt tests to secondary drivers
Daniel P. Berrangé [Tue, 3 Dec 2019 17:29:23 +0000 (17:29 +0000)]
tests: stop linking virt tests to secondary drivers

The hard dependancy between the virt drivers and the network
or storage drivers was removed quite a while back now, so
the tests no longer need to link to these drivers.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agospec: mingw: add deps for genprotocol.pl usage
Cole Robinson [Tue, 3 Dec 2019 15:50:05 +0000 (10:50 -0500)]
spec: mingw: add deps for genprotocol.pl usage

As of 0985a9597bb03 we no longer distribute generated files. mingw
needs to call genprotocol.pl itself, which means it needs rpcgen
and cpp installed.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agoqemu: process: Re-process qemu capability lockout in qemuProcessPrepareQEMUCaps
Peter Krempa [Mon, 25 Nov 2019 12:01:13 +0000 (13:01 +0100)]
qemu: process: Re-process qemu capability lockout in qemuProcessPrepareQEMUCaps

We clear some capabilities here so the lockouts need to be
re-evaluated.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoqemu: capabilities: Lock out incremental backup capability without blockdev
Peter Krempa [Mon, 25 Nov 2019 11:59:51 +0000 (12:59 +0100)]
qemu: capabilities: Lock out incremental backup capability without blockdev

Blockdev is required to do incremental backups properly. Add a helper
function for locking out capabilities and export it to allow re-doing
the processing if a different code path modifies capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoqemu: caps: Don't check capability before clearing it
Peter Krempa [Sun, 24 Nov 2019 08:55:42 +0000 (09:55 +0100)]
qemu: caps: Don't check capability before clearing it

Checking whether a qemu capability set right before clearing it without
any other logic doesn't make sense.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoqemu: process: Move handling of qemu capability overrides
Peter Krempa [Sun, 24 Nov 2019 08:48:30 +0000 (09:48 +0100)]
qemu: process: Move handling of qemu capability overrides

Do all post-processing of capabilities in qemuProcessPrepareQEMUCaps.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoqemu: process: Move clearing of QEMU_CAPS_CHARDEV_FD_PASS to qemuProcessPrepareQEMUCaps
Peter Krempa [Sun, 24 Nov 2019 08:41:49 +0000 (09:41 +0100)]
qemu: process: Move clearing of QEMU_CAPS_CHARDEV_FD_PASS to qemuProcessPrepareQEMUCaps

Move the post-processing of the QEMU_CAPS_CHARDEV_FD_PASS flag to the
new function.

The clearing of the capability is based on the presence of
VIR_QEMU_PROCESS_START_STANDALONE so we must also pass in the process
start flags.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoqemu: process: Move clearing of the BLOCKDEV capability to qemuProcessPrepareQEMUCaps
Peter Krempa [Sun, 24 Nov 2019 08:23:54 +0000 (09:23 +0100)]
qemu: process: Move clearing of the BLOCKDEV capability to qemuProcessPrepareQEMUCaps

Start aggregating all capability post-processing code in one place.

The comment was modified while moving it as it was mentioning floppies
which are no longer clearing the blockdev capability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Move and rename qemuDomainUpdateQEMUCaps
Peter Krempa [Sun, 24 Nov 2019 08:16:11 +0000 (09:16 +0100)]
qemu: Move and rename qemuDomainUpdateQEMUCaps

The function is now used only in qemu_process.c so move it there and
name it 'qemuProcessPrepareQEMUCaps' which is more appropriate to what
it's doing.

The reworded comment now mentions that it will also post-process the
caps for VM startup.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: process: Don't try to redetect missing qemuCaps on reconnect
Peter Krempa [Sun, 24 Nov 2019 07:35:59 +0000 (08:35 +0100)]
qemu: process: Don't try to redetect missing qemuCaps on reconnect

The redetection was originally added in 43c01d3838 as a way to recover
from libvirtd upgrade from the time when we didn't persist the qemu
capabilities in the status XML. Also this the oldest supported qemu by
more than two years.

Even if somebody would have a running VM running at least qemu 1.5 with
such an old libvirt we certainly wouldn't do the right thing by
redetecting the capabilities and then trying to communicate with qemu.

For now it will be the best to just stop considering this scenario any
more and error out for such VM.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: process: Make it obvious that virDomainDefPostParse is called with NULL opaque
Peter Krempa [Sat, 23 Nov 2019 08:43:35 +0000 (09:43 +0100)]
qemu: process: Make it obvious that virDomainDefPostParse is called with NULL opaque

Commit c90fb5a828a added explicit use of the private copy of the qemu
capabilities to various places. The change to qemuProcessInit was bogus
though as at the point where we re-initiate the post parse callbacks
priv->qemuCaps is still NULL as we clear it after shutdown of the VM and
don't initiate it until a later point.

Using the value from priv->qemuCaps might mislead readers of the code
into thinking that something useful is being passed at that point so go
with an explicit NULL instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Always reset @info in qemuDomainGetJobInfo
Peter Krempa [Fri, 22 Nov 2019 16:39:43 +0000 (17:39 +0100)]
qemu: Always reset @info in qemuDomainGetJobInfo

qemuDomainGetJobInfo didn't always reset the return data in @info.
Thankfully this wouldn't be a problem as the RPC layer does it but we
should do it anyways.

Since we reset the struct we don't have to set the type to
VIR_DOMAIN_JOB_NONE as the value is 0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoAPI: Introduce VIR_DOMAIN_JOB_SUCCESS field for virDomainGetJobStats
Peter Krempa [Thu, 21 Nov 2019 17:01:06 +0000 (18:01 +0100)]
API: Introduce VIR_DOMAIN_JOB_SUCCESS field for virDomainGetJobStats

The statistics fields are used in two places:

1) virDomainGetJobStats where the job type which ultimately holds
whether the job was successful or not is returned via a different
argument.

2) The virConnectDomainEventJobCompleted event where we report just the
statistics via typed parameters.

Since it might be useful to report the event also for jobs which
completed unsuccessfully and we don't have the means to transport the
state via a different variable with the event let's add a new field
which will hold the success state.

Since this is meant primarily for completed jobs a plain boolean is
sufficient to convey whether the job was successful or not.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agovirsh: domjobinfo: Add switch to print raw fields
Peter Krempa [Mon, 25 Nov 2019 14:06:17 +0000 (15:06 +0100)]
virsh: domjobinfo: Add switch to print raw fields

Introduce --rawstats which prints all statistics fields from the new API
similarly to how the virsh event handler prints them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agovirsh: domjobinfo: Allow printing stats also for failed and other jobs
Peter Krempa [Thu, 21 Nov 2019 16:44:00 +0000 (17:44 +0100)]
virsh: domjobinfo: Allow printing stats also for failed and other jobs

Introduce the --anystats flag which does not skip the printing of the
stats if the job was unsuccessful.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agovirsh: domjobinfo: Print also job operation for failed jobs
Peter Krempa [Thu, 21 Nov 2019 16:36:18 +0000 (17:36 +0100)]
virsh: domjobinfo: Print also job operation for failed jobs

Printing that a job failed is rather unhelpful. Print at least the
operation which failed.

Achieve this by moving the check whether to print stats later but
replace it with a check which will skip printing of the operation if
there's no job.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: Implement VIR_DOMAIN_JOB_STATS_KEEP_COMPLETED
Peter Krempa [Mon, 25 Nov 2019 13:19:10 +0000 (14:19 +0100)]
qemu: Implement VIR_DOMAIN_JOB_STATS_KEEP_COMPLETED

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agovirsh: Implement VIR_DOMAIN_JOB_STATS_KEEP_COMPLETED for 'domjobinfo'
Peter Krempa [Fri, 22 Nov 2019 13:26:56 +0000 (14:26 +0100)]
virsh: Implement VIR_DOMAIN_JOB_STATS_KEEP_COMPLETED for 'domjobinfo'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoapi: Allow keeping completed domain job stats when reading them
Peter Krempa [Fri, 22 Nov 2019 12:23:31 +0000 (13:23 +0100)]
api: Allow keeping completed domain job stats when reading them

virDomainGetJobStats destroys the completed statistics on the first
read. Give the user possibility to keep them around if they wish so.

Add a flag VIR_DOMAIN_JOB_STATS_KEEP_COMPLETED which will read the stats
without destroying them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agovirsh: domain: Extract the code converting domain job stats to virDomainJobInfo
Peter Krempa [Fri, 22 Nov 2019 14:06:08 +0000 (15:06 +0100)]
virsh: domain: Extract the code converting domain job stats to virDomainJobInfo

To simplify the stats printer code we convert the new statistics from
the typed parameter list into the old stats structure.

Extract this code since it takes a lot of space.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agotests: fix name of 32-bit x86 QEMU binary
Daniel P. Berrangé [Fri, 29 Nov 2019 16:33:37 +0000 (16:33 +0000)]
tests: fix name of 32-bit x86 QEMU binary

The 32-bit x86 binary is called qemu-system-i386, not
qemu-system-i686. This mistake across many test XML files was
not noticed because the mistake was also made in testutilsqemu.c
when mocking the capabilities.

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: make 'xz' image compression viable by using -3
Daniel P. Berrangé [Thu, 28 Nov 2019 12:07:04 +0000 (12:07 +0000)]
qemu: make 'xz' image compression viable by using -3

For managed save we can choose between various compression
methods. I randomly tested the 'xz' program on a 8 GB guest
and was surprised to have to wait > 50 minutes for it to
finish compressing, with 'xz' burning 100% cpu for the
entire time. Despite the impressive compression, this is
completely useless in the real world as it is far too long
to wait to save the VM.

The 'xz' binary defaults to '-6' optimization level which
aims for high compression, with moderate memory usage,
at the expense of speed.

This change switches it to use the '-3' optimization level
which is documented as being the one that optimizes speed
at expense of compression. Even with this, it will still
outperform all the other options in terms of compression
level. It is a little less than x4 faster than '-6' which
means it starts to be a viable choice to use 'xz' for
people who really want best compression.

The test results on a 1 GB, fairly freshly booted VM are
as follows

  format | save  | restore  size
  =======+=======+=============
  raw    |   05s |    1s  | 428 MB
  lzop   |   05s |    3s  | 160 MB
  gzip   |   29s |    5s  | 118 MB
  bz2    |   54s |   22s  | 114 MB
  xz     | 4m37s |   13s  |  86 MB
  xz -3  | 1m20s |   12s  |  95 MB

Based on this we can say

 * For moderate compression with no noticable loss in speed

       => use lzop

 * For high compression with moderate loss in speed

       => use gzip

 * For best compression with significant loss in speed

       => use xz

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agomaint: post-post-version-bump version bump to 6.0.0
Ján Tomko [Tue, 3 Dec 2019 11:59:01 +0000 (12:59 +0100)]
maint: post-post-version-bump version bump to 6.0.0

My commit 3bbe10205b79c8803e69c61897a0491d7a3f57c0 forgot
to update the news.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agospec: Fix printing test-suite.log when make check fails
Jiri Denemark [Tue, 3 Dec 2019 10:49:50 +0000 (11:49 +0100)]
spec: Fix printing test-suite.log when make check fails

Commit v5.7.0-248-g03449e2504 removed "cd tests" without updating the
patch to test-suite.log.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
5 years agomaint: post-version bump version bump to 6.0.0
Ján Tomko [Tue, 3 Dec 2019 11:42:28 +0000 (12:42 +0100)]
maint: post-version bump version bump to 6.0.0

Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agostorage: backend_disk: Implement the deletePool function
Erik Skultety [Thu, 28 Nov 2019 14:21:18 +0000 (15:21 +0100)]
storage: backend_disk: Implement the deletePool function

This is a very simple and straightforward implementation of the opposite
what buildPool does for the disk backend.
The background for this change comes from an existing test case in TCK
which does use the delete method for a pool of type disk, but it
truly could not have ever worked since the implementation simply
wasn't there for the pool of type disk.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoselinux: Drop needless getfilecon()-s
Michal Privoznik [Thu, 28 Nov 2019 08:37:22 +0000 (09:37 +0100)]
selinux: Drop needless getfilecon()-s

When SELinux support was first introduced the libselinux library
wasn't that advanced and setfilecon_raw() or fsetfilecon_raw()
could fail even when the target context was set. Looking at the
current code [1][2] this is no longer the case. We can drop our
workarounds.

1: https://github.com/SELinuxProject/selinux/blob/master/libselinux/src/setfilecon.c#L10
2: https://github.com/SELinuxProject/selinux/blob/master/libselinux/src/fsetfilecon.c#L10

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agomaint: Post-release version bump to 5.11.0
Jim Fehlig [Tue, 3 Dec 2019 04:20:37 +0000 (21:20 -0700)]
maint: Post-release version bump to 5.11.0

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
5 years agonews: Fix XML validation
Jim Fehlig [Tue, 3 Dec 2019 03:48:24 +0000 (20:48 -0700)]
news: Fix XML validation

The news schema requires two digits for both month and day in the date
attribute. s/2/02/ in the day value of date to fix the following
'make check' failure

2165) Checking ../docs/news.xml against ../news.rng                     ...
libvirt: XML Util error : XML document failed to validate against schema:
Unable to validate doc against /home/jfehlig/virt/upstream/libvirt/build/../docs/schemas/../news.rng
Element release failed to validate attributes

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
5 years agoRelease of libvirt-5.10.0
Daniel Veillard [Mon, 2 Dec 2019 19:15:08 +0000 (20:15 +0100)]
Release of libvirt-5.10.0

* docs/news.xml: updated for the release

Signed-off-by: Daniel Veillard <veillard@redhat.com>
5 years agoqemu: blockcopy: Fix conditions when virStorageSource should be initialized
Peter Krempa [Fri, 29 Nov 2019 13:33:05 +0000 (14:33 +0100)]
qemu: blockcopy: Fix conditions when virStorageSource should be initialized

Commit 4b58fdf280a which enabled block copy also for network
destinations needed to limit when the 'mirror' storage source is
initialized in cases when we e.g. don't have an appropriate backend.

Limiting it just to virStorageFileSupportsCreate is too restrictive as
for example we can't precreate block devices and thus wouldn't
initialize the 'mirror' but since it's a local source we'd try to
examine it. This would fail since it wouldn't be initialized.

Fix it by introducing a more granular check whether certain operations
are supported and fix the check interlocks.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: blockcopy: Report error on image format detection failure
Peter Krempa [Fri, 29 Nov 2019 12:25:47 +0000 (13:25 +0100)]
qemu: blockcopy: Report error on image format detection failure

We tolerate image format detection during block copy in very specific
circumstances, but the code didn't error out on failure of the format
detection.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agosrc: fix pkg-config path for API XML files
Daniel P. Berrangé [Mon, 2 Dec 2019 13:18:01 +0000 (13:18 +0000)]
src: fix pkg-config path for API XML files

The API XML files are generated files, so live in the build dir not the
source dir.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agospec: Disable gluster on i686 on RHEL-8
Jiri Denemark [Fri, 29 Nov 2019 13:58:01 +0000 (14:58 +0100)]
spec: Disable gluster on i686 on RHEL-8

Gluster 6.0 is not built on i686 for RHEL-8, which prevents libvirt from
building. Let's just disable gluster there as all we need are client
libraries anyway.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
5 years agoremote_daemon_stream: Hold an extra reference to stream in daemonStreamFilter
Michal Privoznik [Mon, 25 Nov 2019 14:13:17 +0000 (15:13 +0100)]
remote_daemon_stream: Hold an extra reference to stream in daemonStreamFilter

In v5.9.0-273-g8ecab214de I've tried to fix a lock ordering
problem, but introduced a crasher. Problem is that because the
client lock is unlocked (in order to honour lock ordering) the
stream we are currently checking in daemonStreamFilter() might be
freed and thus stream->priv might not even exist when the control
get to virMutexLock() call.

To resolve this, grab an extra reference to the stream and handle
its cleanup should the refcounter reach zero after the deref.
If that's the case and we are the only ones holding a reference
to the stream, we MUST return a positive value to make
virNetServerClientDispatchRead() break its loop where it iterates
over filters. The problem is, if we did not do so, then
"filter = filter->next" line will read from a memory that was
just freed (freeing a stream also unregisters its filter).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>