]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
5 years agoxen: Remove unused 'cfg'
Peter Krempa [Mon, 9 Dec 2019 13:05:29 +0000 (14:05 +0100)]
xen: Remove unused 'cfg'

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

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

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

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

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: directly create virResctrlInfo ignoring capabilities
Daniel P. Berrangé [Fri, 29 Nov 2019 14:04:01 +0000 (14:04 +0000)]
qemu: directly create virResctrlInfo ignoring capabilities

We always refresh the capabilities object when using virResctrlInfo
during process startup. This is undesirable overhead, because we can
just directly create a virResctrlInfo instead.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: use host CPU object directly
Daniel P. Berrangé [Fri, 29 Nov 2019 10:40:39 +0000 (10:40 +0000)]
qemu: use host CPU object directly

Avoid grabbing the whole virCapsPtr object when we only need the
host CPU information.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: make virCPUDef into a ref counted struct
Daniel P. Berrangé [Fri, 29 Nov 2019 11:00:26 +0000 (11:00 +0000)]
conf: make virCPUDef into a ref counted struct

Annoyingly there was no existing constructor, and identifying all the
places which do a VIR_ALLOC(cpu) is a bit error prone. Hopefully this
has found & converted them all.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: use NUMA capabilities object directly
Daniel P. Berrangé [Fri, 29 Nov 2019 10:40:39 +0000 (10:40 +0000)]
qemu: use NUMA capabilities object directly

Avoid grabbing the whole virCapsPtr object when we only need the
NUMA information.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: move NUMA capabilities into self contained object
Daniel P. Berrangé [Fri, 29 Nov 2019 09:55:59 +0000 (09:55 +0000)]
conf: move NUMA capabilities into self contained object

The NUMA cells are stored directly in the virCapsHostPtr
struct. This moves them into their own struct allowing
them to be stored independantly of the rest of the host
capabilities. The change is used as an excuse to switch
the representation to use a GPtrArray too.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: drop virCapsPtr param & vars from many APIs
Daniel P. Berrangé [Wed, 27 Nov 2019 13:19:09 +0000 (13:19 +0000)]
qemu: drop virCapsPtr param & vars from many APIs

Now that the domain XML APIs don't use virCapsPtr we can stop passing it
around many QEMU driver methods.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: drop virCapsPtr param from snapshot & checkpoint APIs
Daniel P. Berrangé [Wed, 27 Nov 2019 13:10:21 +0000 (13:10 +0000)]
conf: drop virCapsPtr param from snapshot & checkpoint APIs

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: drop virCapsPtr param from domain obj list APIs
Daniel P. Berrangé [Wed, 27 Nov 2019 12:58:57 +0000 (12:58 +0000)]
conf: drop virCapsPtr param from domain obj list APIs

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: drop virCapsPtr param from APIs for saving domains
Daniel P. Berrangé [Wed, 27 Nov 2019 12:53:10 +0000 (12:53 +0000)]
conf: drop virCapsPtr param from APIs for saving domains

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: drop virCapsPtr param from domain APIs for copying config
Daniel P. Berrangé [Wed, 27 Nov 2019 12:41:59 +0000 (12:41 +0000)]
conf: drop virCapsPtr param from domain APIs for copying config

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: drop virCapsPtr param from domain parse APIs
Daniel P. Berrangé [Wed, 27 Nov 2019 12:29:21 +0000 (12:29 +0000)]
conf: drop virCapsPtr param from domain parse APIs

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: drop virCapsPtr param from domain post parse & validate APIs
Daniel P. Berrangé [Wed, 27 Nov 2019 12:08:10 +0000 (12:08 +0000)]
conf: drop virCapsPtr param from domain post parse & validate APIs

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: drop virCapsPtr param from domain formatting APIs
Daniel P. Berrangé [Wed, 27 Nov 2019 11:57:34 +0000 (11:57 +0000)]
conf: drop virCapsPtr param from domain formatting APIs

This parameter is now unused and can be removed entirely.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: drop virCapsPtr param from domain validate callback
Daniel P. Berrangé [Tue, 26 Nov 2019 16:53:53 +0000 (16:53 +0000)]
conf: drop virCapsPtr param from domain validate callback

None of the impls of this callback require the virCapsPtr param.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: drop virCapsPtr param from device post parse callback
Daniel P. Berrangé [Tue, 26 Nov 2019 16:53:53 +0000 (16:53 +0000)]
conf: drop virCapsPtr param from device post parse callback

None of the impls of this callback require the virCapsPtr param.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: drop virCapsPtr param from post parse callback
Daniel P. Berrangé [Tue, 26 Nov 2019 16:53:53 +0000 (16:53 +0000)]
conf: drop virCapsPtr param from post parse callback

No impl of this callback requires the virCapsPtr anymore.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: drop virCapsPtr param from post parse data alloc callback
Daniel P. Berrangé [Tue, 26 Nov 2019 16:53:53 +0000 (16:53 +0000)]
conf: drop virCapsPtr param from post parse data alloc callback

The only user of this callback did not require the virCapsPtr parameter.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: drop virCapsPtr param from basic post parse callback
Daniel P. Berrangé [Tue, 26 Nov 2019 16:53:53 +0000 (16:53 +0000)]
conf: drop virCapsPtr param from basic post parse callback

The QEMU impl of the callback can directly use the QEMU capabilities
cache to resolve the emulator binary name, allowing virCapsPtr to be
dropped.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: drop virCapsPtr param from assign addresses callback
Daniel P. Berrangé [Tue, 26 Nov 2019 16:53:53 +0000 (16:53 +0000)]
conf: drop virCapsPtr param from assign addresses callback

The virCapsPtr param is not used by any of the virt drivers providing
this callback.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: pass default sec model in parser config
Daniel P. Berrangé [Tue, 26 Nov 2019 18:57:30 +0000 (18:57 +0000)]
conf: pass default sec model in parser config

Instead of using the virCapsPtr to get the default security model,
pass this in via the parser config.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: move seclabel validation into post-parse phase
Daniel P. Berrangé [Tue, 26 Nov 2019 18:42:56 +0000 (18:42 +0000)]
conf: move seclabel validation into post-parse phase

Currently the disk and chardev seclabels are validated immediately at
the time their data is parsed. This forces the parser to fill in the
top level secmodel at time of parsing which is an undesirable thing.
This validation conceptually should be done in the post-parse phase
instead.

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