]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
6 years agoqemu: capabilities: Always assume disk snapshot caps
Peter Krempa [Tue, 5 Jun 2018 11:42:44 +0000 (13:42 +0200)]
qemu: capabilities: Always assume disk snapshot caps

'blockdev-snapshot-sync' is present in QEMU since v0.14.0-rc0 and
'transaction' since v1.1.0 (52e7c241ac766406f05fa)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: capabilities: Always assume QEMU_CAPS_DRIVE_MIRROR
Peter Krempa [Tue, 5 Jun 2018 11:42:44 +0000 (13:42 +0200)]
qemu: capabilities: Always assume QEMU_CAPS_DRIVE_MIRROR

qemu added the 'drive-mirror' command in v1.3.0 (d9b902db3fb71fdc)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: capabilities: Always assume QEMU_CAPS_BLOCK_COMMIT
Peter Krempa [Tue, 5 Jun 2018 11:42:44 +0000 (13:42 +0200)]
qemu: capabilities: Always assume QEMU_CAPS_BLOCK_COMMIT

qemu added the 'block-commit' command in v1.3.0 (ed61fc10e8c8d2)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: drop qemuDomainSupportsBlockJobs
Peter Krempa [Tue, 5 Jun 2018 11:53:46 +0000 (13:53 +0200)]
qemu: domain: drop qemuDomainSupportsBlockJobs

It always returns true.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: capabilities: Always assume QEMU_CAPS_BLOCKJOB_ASYNC
Peter Krempa [Tue, 5 Jun 2018 11:42:44 +0000 (13:42 +0200)]
qemu: capabilities: Always assume QEMU_CAPS_BLOCKJOB_ASYNC

This was detected by the presence of 'block-stream' which is present in
qemu since v1.1 (db58f9c0605fa151b8c4)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Add 'index' attribute for <disk><mirror><source>
Peter Krempa [Wed, 13 Mar 2019 16:42:37 +0000 (17:42 +0100)]
conf: Add 'index' attribute for <disk><mirror><source>

Similarly to the disk source we need to keep the disk index (which is in
the qemu driver used for identification of the source for block jobs)
for the <mirror> element so that when it's replaced as a disk source
after pivoting all the allocated data is present.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Parse and format 'backingStore' for disk <mirror>
Peter Krempa [Wed, 13 Mar 2019 15:08:13 +0000 (16:08 +0100)]
conf: Parse and format 'backingStore' for disk <mirror>

When the block copy operation is started with a reused external file in
incremental mode libvirt will need to open and insert the backing chain
for that file into qemu (in -blockdev mode). This means that we'll need
to track the backing chain and metadata such as node names for the full
chain of <mirror>.

This patch invokes the full backing chain formatter and parser for
<mirror> so that the chain can be kept with <mirror>.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Refactor virDomainDiskDefMirrorParse
Peter Krempa [Wed, 20 Mar 2019 16:33:29 +0000 (17:33 +0100)]
conf: Refactor virDomainDiskDefMirrorParse

Use virDomainStorageSourceParseBase and other tricks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Pass 'flags' to virDomainDiskSourceFormat in virDomainDiskDefFormatMirror
Peter Krempa [Thu, 21 Mar 2019 07:29:44 +0000 (08:29 +0100)]
conf: Pass 'flags' to virDomainDiskSourceFormat in virDomainDiskDefFormatMirror

We have the proper flags available so we can pass them to the fomatter.
The added bonus is that private data may be formatted into the status
XML.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: use virXMLFormatElement in virDomainDiskDefFormatMirror
Peter Krempa [Thu, 21 Mar 2019 07:28:35 +0000 (08:28 +0100)]
conf: use virXMLFormatElement in virDomainDiskDefFormatMirror

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Parse NBD storage source private data by virDomainStorageSourceParse
Peter Krempa [Wed, 20 Mar 2019 16:18:23 +0000 (17:18 +0100)]
qemu: Parse NBD storage source private data by virDomainStorageSourceParse

Drop the local call in favor of passing in xmlopt.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Use virDomainStorageSourceParseBase in qemuDomainObjPrivateXMLParseJobNBDSource
Peter Krempa [Wed, 20 Mar 2019 16:16:21 +0000 (17:16 +0100)]
qemu: Use virDomainStorageSourceParseBase in qemuDomainObjPrivateXMLParseJobNBDSource

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Remove cleanup in qemuDomainObjPrivateXMLParseJobNBDSource
Peter Krempa [Wed, 20 Mar 2019 16:10:11 +0000 (17:10 +0100)]
qemu: Remove cleanup in qemuDomainObjPrivateXMLParseJobNBDSource

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Use VIR_AUTOFREE in qemuDomainObjPrivateXMLParseJobNBDSource
Peter Krempa [Wed, 20 Mar 2019 16:08:42 +0000 (17:08 +0100)]
qemu: Use VIR_AUTOFREE in qemuDomainObjPrivateXMLParseJobNBDSource

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Modify arguments passed to virDomainDiskBackingStoreFormat
Peter Krempa [Thu, 21 Mar 2019 07:34:10 +0000 (08:34 +0100)]
conf: Modify arguments passed to virDomainDiskBackingStoreFormat

Pass in 'src' rather than the backing store of it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Document virDomainStorageSourceParse
Peter Krempa [Wed, 20 Mar 2019 15:58:20 +0000 (16:58 +0100)]
conf: Document virDomainStorageSourceParse

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Use virDomainStorageSourceParseBase in virDomainDiskBackingStoreParse
Peter Krempa [Wed, 20 Mar 2019 15:31:09 +0000 (16:31 +0100)]
conf: Use virDomainStorageSourceParseBase in virDomainDiskBackingStoreParse

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: introduce virDomainStorageSourceParseBase
Peter Krempa [Wed, 20 Mar 2019 15:12:45 +0000 (16:12 +0100)]
conf: introduce virDomainStorageSourceParseBase

The helper converts the 'type', 'format' and index values to enum
values/numbers and does validation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Replace virDomainDiskSourceParse by virDomainStorageSourceParse
Peter Krempa [Mon, 11 Mar 2019 09:47:53 +0000 (10:47 +0100)]
conf: Replace virDomainDiskSourceParse by virDomainStorageSourceParse

virDomainDiskSourceParse was now just a thin wrapper without any extra
value. Replace all usage of it by the function it calls and remove the
function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Document virDomainDiskSourceFormat
Peter Krempa [Wed, 20 Mar 2019 13:13:42 +0000 (14:13 +0100)]
conf: Document virDomainDiskSourceFormat

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Merge virDomainStorageSourceFormat into virDomainDiskSourceFormat
Peter Krempa [Wed, 20 Mar 2019 12:51:07 +0000 (13:51 +0100)]
conf: Merge virDomainStorageSourceFormat into virDomainDiskSourceFormat

There was only one caller, remove the unnecessary wrapper.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Use virXMLFormatElement in virDomainDiskBackingStoreFormat
Peter Krempa [Thu, 7 Mar 2019 17:00:03 +0000 (18:00 +0100)]
conf: Use virXMLFormatElement in virDomainDiskBackingStoreFormat

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Avoid temporary variable in virDomainDiskBackingStoreFormat
Peter Krempa [Thu, 7 Mar 2019 16:48:08 +0000 (17:48 +0100)]
conf: Avoid temporary variable in virDomainDiskBackingStoreFormat

Modify the check that the format is in range to be standalone and use
the convertor function directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Simplify control flow in virDomainDiskSourceFormat
Peter Krempa [Thu, 7 Mar 2019 16:35:04 +0000 (17:35 +0100)]
conf: Simplify control flow in virDomainDiskSourceFormat

Now that the cleanup is handled automatically it can be removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Unexport virDomainStorageSourceFormat
Peter Krempa [Thu, 7 Mar 2019 16:14:18 +0000 (17:14 +0100)]
conf: Unexport virDomainStorageSourceFormat

It's not used outside of src/conf/domain_conf.c

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Modify <migrationSource> to look like <disk>
Peter Krempa [Fri, 22 Mar 2019 15:48:54 +0000 (16:48 +0100)]
qemu: domain: Modify <migrationSource> to look like <disk>

When adding <migrationSource> I've used a slightly unusual approach. To
allow using the disk source XML parser and formatter convert
<migrationSource> to look like <disk>. This means that <source> will be
added as a subelement of <migrationSource> rather than being formatted
inline.

Conversion from the old format in the parser is very simple as it
involves only moving the XPath context current node slightly if the new
format is found.

The status XML to XML test shows that the upgrade is done correctly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: qemustatusxml2xml: Add separate output for migration-out-nbd-tls
Peter Krempa [Fri, 22 Mar 2019 15:45:06 +0000 (16:45 +0100)]
tests: qemustatusxml2xml: Add separate output for migration-out-nbd-tls

Upcomming change will modify some aspects. To allow testing upgrade path
add a separate output file so that we can see the conversion from old to
new config.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: qemustatusxml2xml: Add another disk to migration-out-nbd-tls case
Peter Krempa [Fri, 22 Mar 2019 15:45:06 +0000 (16:45 +0100)]
tests: qemustatusxml2xml: Add another disk to migration-out-nbd-tls case

Upcomming change will modify some aspects. To allow testing upgrade path
add another disk.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: qemuxml2xml: Use virdeterministichashmock.so
Peter Krempa [Thu, 21 Mar 2019 13:12:54 +0000 (14:12 +0100)]
tests: qemuxml2xml: Use virdeterministichashmock.so

Block job related data will be stored in a has table and formatted into
the status XML. Use the mock to guarantee stable tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Export virDomainDiskSourceFormat
Peter Krempa [Fri, 22 Mar 2019 15:35:03 +0000 (16:35 +0100)]
conf: Export virDomainDiskSourceFormat

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Merge virDomainDiskSourceFormatInternal into virDomainDiskSourceFormat
Peter Krempa [Wed, 20 Mar 2019 10:46:54 +0000 (11:46 +0100)]
conf: Merge virDomainDiskSourceFormatInternal into virDomainDiskSourceFormat

Remove the wrapper and fix callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Remove @seclabels from virDomainStorageSourceFormat
Peter Krempa [Wed, 20 Mar 2019 10:18:44 +0000 (11:18 +0100)]
conf: Remove @seclabels from virDomainStorageSourceFormat

All callers including transitive callers through
virDomainDiskSourceFormatInternal always pass true. Remove the argument.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoconf: Format seclabels for <backingStore>
Peter Krempa [Mon, 18 Mar 2019 14:31:28 +0000 (15:31 +0100)]
conf: Format seclabels for <backingStore>

We parse the seclabels and use them internally so omitting them when
formatting would be misleading. Additionally our schema actually allows
them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Forbid copy_on_read option also for floppies
Peter Krempa [Thu, 28 Mar 2019 16:06:20 +0000 (17:06 +0100)]
qemu: domain: Forbid copy_on_read option also for floppies

Using copy_on_read for removable disks is a hassle. It also does not
work for CDROMs at all as the image is supposed to be read-only and we
might ignore it for floppies when they are started as empty. Forbid it
for floppies completely rather than trying to support what probably
nobody is using.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: hotplug: Disallow media change while blockjob is active
Peter Krempa [Thu, 28 Mar 2019 11:23:43 +0000 (12:23 +0100)]
qemu: hotplug: Disallow media change while blockjob is active

Until the block job completes we can't change the disk chain. Removal
would fail as the block job still has reference to the chain.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: hotplug: Use VIR_AUTOUNREF for virQEMUDriverConfigPtr
Peter Krempa [Thu, 28 Mar 2019 11:51:13 +0000 (12:51 +0100)]
qemu: hotplug: Use VIR_AUTOUNREF for virQEMUDriverConfigPtr

Unref the config pointer automatically in code paths which get a local
copy.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: hotplug: Remove unused copies of virQEMUDriverConfigPtr
Peter Krempa [Thu, 28 Mar 2019 14:14:39 +0000 (15:14 +0100)]
qemu: hotplug: Remove unused copies of virQEMUDriverConfigPtr

qemuDomainChangeGraphicsPasswords and qemuDomainRemoveHostDevice
don't use 'cfg' any more since commits 4327df7eee75c5 and 802c59d4b9dcd
respectively.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Use VIR_AUTOFREE in qemuDomainObjPrivateXMLParseBlockjobs
Peter Krempa [Mon, 4 Mar 2019 15:34:54 +0000 (16:34 +0100)]
qemu: domain: Use VIR_AUTOFREE in qemuDomainObjPrivateXMLParseBlockjobs

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Remove cleanup section of virQEMUCapsInitQMPMonitorTCG
Peter Krempa [Tue, 2 Apr 2019 11:31:52 +0000 (13:31 +0200)]
qemu: Remove cleanup section of virQEMUCapsInitQMPMonitorTCG

There's nothing to clean up.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: Remove ATTRIBUTE_UNUSED from 'qemuCaps' of virQEMUCapsInitQMPMonitorTCG
Peter Krempa [Tue, 2 Apr 2019 11:29:18 +0000 (13:29 +0200)]
qemu: Remove ATTRIBUTE_UNUSED from 'qemuCaps' of virQEMUCapsInitQMPMonitorTCG

It's actually used.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: caps: Remove pointless debug message in virQEMUCapsInitQMPMonitor
Peter Krempa [Fri, 29 Mar 2019 08:28:56 +0000 (09:28 +0100)]
qemu: caps: Remove pointless debug message in virQEMUCapsInitQMPMonitor

Failure of qemuMonitorGetVersion is fatal now that we only support QMP
based qemus. Remove the debug message since we report an error already.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemu: caps: Remove cleanup section in virQEMUCapsInitQMPMonitor
Peter Krempa [Fri, 29 Mar 2019 08:25:21 +0000 (09:25 +0100)]
qemu: caps: Remove cleanup section in virQEMUCapsInitQMPMonitor

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemu: caps: Don't leak package name string in virQEMUCapsInitQMPMonitor
Peter Krempa [Fri, 29 Mar 2019 08:32:14 +0000 (09:32 +0100)]
qemu: caps: Don't leak package name string in virQEMUCapsInitQMPMonitor

If the detected qemu version is below our required version 'package'
would be leaked.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemu: Decide whether to query schema in virQEMUCapsProbeQMPSchemaCapabilities
Peter Krempa [Tue, 2 Apr 2019 10:31:31 +0000 (12:31 +0200)]
qemu: Decide whether to query schema in virQEMUCapsProbeQMPSchemaCapabilities

Move the check out of virQEMUCapsInitQMPMonitor similarly to other
functions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemu: Move SEV capability handling into virQEMUCapsProbeQMPSEVCapabilities
Peter Krempa [Tue, 2 Apr 2019 10:31:31 +0000 (12:31 +0200)]
qemu: Move SEV capability handling into virQEMUCapsProbeQMPSEVCapabilities

Move the code out of virQEMUCapsInitQMPMonitor similarly to other
functions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemu: Decide whether check GIC caps in virQEMUCapsProbeQMPGICCapabilities
Peter Krempa [Tue, 2 Apr 2019 10:31:31 +0000 (12:31 +0200)]
qemu: Decide whether check GIC caps in virQEMUCapsProbeQMPGICCapabilities

Move the check out of virQEMUCapsInitQMPMonitor similarly to other
functions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemu: caps: Aggregate all caps post-processing into a function
Peter Krempa [Fri, 29 Mar 2019 08:12:09 +0000 (09:12 +0100)]
qemu: caps: Aggregate all caps post-processing into a function

Some caps are cleared according to some more advanced logic after
detection. Split all that logic out into virQEMUCapsInitProcessCaps.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemu: caps: Separate capabilities based on qemu version
Peter Krempa [Fri, 29 Mar 2019 08:05:45 +0000 (09:05 +0100)]
qemu: caps: Separate capabilities based on qemu version

virQEMUCapsInitQMPMonitor is massive now since it collects calls to the
various probing functions and also version based capabilities. Split
out the version based caps into a separate function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agovirsh-completer: introduce virshPagesizeNodeToString
Ján Tomko [Fri, 29 Mar 2019 17:31:01 +0000 (18:31 +0100)]
virsh-completer: introduce virshPagesizeNodeToString

A helper function that takes a XML node with a "size"
and "unit" attributes and converts it into a human-readable string.

Reduce the size and number of variables in the parent function.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirsh-completer: remove excessive labels
Ján Tomko [Fri, 29 Mar 2019 15:46:54 +0000 (16:46 +0100)]
virsh-completer: remove excessive labels

Now that we have a shared cleanup section everywhere,
delete all the 'error' labels which all contain just 'goto cleanup'
anyway.

Also remove all the 'cleanup' labels that only 'return ret' - we
can simply return NULL instead of jumping to that label.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirsh-completer: use VIR_AUTOFREE for char* variables
Ján Tomko [Fri, 29 Mar 2019 14:22:46 +0000 (15:22 +0100)]
virsh-completer: use VIR_AUTOFREE for char* variables

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirsh-completer: use VIR_AUTOPTR for xml* variables
Ján Tomko [Fri, 29 Mar 2019 17:18:57 +0000 (18:18 +0100)]
virsh-completer: use VIR_AUTOPTR for xml* variables

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirsh-completer: use VIR_AUTOFREE for xmlNodePtr* variables
Ján Tomko [Fri, 29 Mar 2019 14:04:43 +0000 (15:04 +0100)]
virsh-completer: use VIR_AUTOFREE for xmlNodePtr* variables

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirsh-completer: use VIR_AUTOSTRINGLIST for tmp
Ján Tomko [Fri, 29 Mar 2019 13:36:57 +0000 (14:36 +0100)]
virsh-completer: use VIR_AUTOSTRINGLIST for tmp

We've been open-coding virStringListFreeCount for cleaning up
the completion list we're building. This had the advantage of
zeoring the pointer afterwards, which is no longer needed
now that we compile the list in 'tmp' instead of 'ret'.

Since all our lists are NULL-terminated anyway, switch to using
virStringListFree via the VIR_AUTOSTRINGLIST macro.

Fixes nearly impossible NULL dereferences in
  virshNWFilterBindingNameCompleter
  virshNWFilterNameCompleter
  virshNodeDeviceNameCompleter
  virshNetworkNameCompleter
  virshInterfaceNameCompleter
  virshStoragePoolNameCompleter
  virshDomainNameCompleter
which jumped on the error label after a failed allocation
and a possible one in
  virshStorageVolNameCompleter
which jumped there when we fail to fetch the list of volumes.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirsh-completer: unify cleanup of items in name completers
Ján Tomko [Thu, 28 Mar 2019 17:32:36 +0000 (18:32 +0100)]
virsh-completer: unify cleanup of items in name completers

Merge the cleanup of fetched items for the success and the error
paths.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirsh-completer: add a cleanup label everywhere
Ján Tomko [Thu, 28 Mar 2019 17:26:44 +0000 (18:26 +0100)]
virsh-completer: add a cleanup label everywhere

Unify the cleanup paths for error and success.
Now that 'ret' is only set (from tmp) on the success path,
it is safe to jump right before 'return ret' after processing
the error block.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirsh-completer: switch to using tmp instead of ret
Ján Tomko [Thu, 28 Mar 2019 17:03:30 +0000 (18:03 +0100)]
virsh-completer: switch to using tmp instead of ret

Construct the potential return value in an array called 'tmp'
and only assign it to 'ret' if we're going to return it.

This will allow us to unify the error and success paths.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirsh-completer: fix typo
Ján Tomko [Thu, 28 Mar 2019 16:42:23 +0000 (17:42 +0100)]
virsh-completer: fix typo

Use the posessive determiner instead of a contracted auxiliary.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirsh: fix indentation of info_managed_save_edit
Ján Tomko [Sun, 31 Mar 2019 18:16:29 +0000 (20:16 +0200)]
virsh: fix indentation of info_managed_save_edit

Use four spaces instead of three.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemuDomainDiskChangeSupported: use CHECK_STREQ_NULLABLE more
Ján Tomko [Thu, 28 Mar 2019 14:21:25 +0000 (15:21 +0100)]
qemuDomainDiskChangeSupported: use CHECK_STREQ_NULLABLE more

Convert the other string comparisons to use the macro.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org>
6 years agotests: Don't use canonical paths in virstoragetest
Andrea Bolognani [Tue, 12 Mar 2019 16:21:37 +0000 (17:21 +0100)]
tests: Don't use canonical paths in virstoragetest

The layout of my home directory is somewhat peculiar: I store
all git repositories in ~/src/upstream, but since I spend
almost all of my time hacking on libvirt, I also have a
convenience symlink ~/src/libvirt -> ~/src/upstream/libvirt
that I use to access that specific git repository.

The above setup has served me well for years; however, ever
since commit ca1471622dd9 dropped our own custom definitions
for abs_{,top_}{src,build}dir and started using the ones
provided by autotools, virstoragetest has started reliably
failing with errors such as

   2) Storage backing chain 2 ...
  Offset 0
  Expect [chain member: 0
  path:/home/abologna/src/upstream/libvirt/tests/virstoragedata/raw
  backingStoreRaw: <null>
  capacity: 0
  encryption: 0
  relPath:<null>
  type:1
  format:1
  protocol:none
  hostname:<null>
  ]
  Actual [chain member: 0
  path:/home/abologna/src/libvirt/tests/virstoragedata/raw
  backingStoreRaw: <null>
  capacity: 0
  encryption: 0
  relPath:<null>
  type:1
  format:1
  protocol:none
  hostname:<null>
  ]
                              ... FAILED

Using abolute paths instead of canonical ones in the tests makes
the problem go away.

Note that all tests that are specifically designed to test path
canonicalization via TEST_PATH_CANONICALIZE() were passing even
before this patch and are not touched by it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
6 years agomaint: Update references to ChangeLog*
Andrea Bolognani [Mon, 1 Apr 2019 16:44:52 +0000 (18:44 +0200)]
maint: Update references to ChangeLog*

The files no longer exist, at least not in their previous form,
so references to them need to be reworked to still make sense.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agomaint: Drop ChangeLog-old
Andrea Bolognani [Mon, 1 Apr 2019 15:34:03 +0000 (17:34 +0200)]
maint: Drop ChangeLog-old

This file contains the old school ChangeLog, which was manually
updated for every set of changes before the switch to git.

When libvirt was imported into git, however, *all* history was
preserved, including the changes documented in this file, and
can still be inspected using 'git log' just like more recent
changes: the format might be slightly different, but that's not
quite reason enough to treat this file any differently than the
git-generated ChangeLog we just dropped.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agomaint: Stop generating ChangeLog from git
Andrea Bolognani [Mon, 1 Apr 2019 15:33:03 +0000 (17:33 +0200)]
maint: Stop generating ChangeLog from git

Our ChangeLog is generated by basically redirecting the output
of 'git log' into it so, as can be expected, it has only gotten
bigger as development has progressed. As of today, its size has
reached pretty much comical levels:

  $ du -sk ChangeLog
  11328 ChangeLog

All of that for information *literally nobody* cares about: end
users and distro maintainers have proper release notes lovingly
compiled for them, while developers peruse the history either by
calling 'git log' directly or through their favorite $EDITOR's
git integration.

Replacing the generated ChangeLog with a short message pointing
interested parties to the git repository does not only reduce
the size of the unpacked sources from 259904 KiB to 248576 KiB
(~4% saving): from a quick test on my laptop, doing so reduces
the size of the *compressed* release archive from 15140 KiB to
12364 KiB (~18% saving) and also takes the time needed to run
'make distcheck' down from 4:44 to 4:21 (~8% saving).

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agomaint: Post-release version bump to 5.3.0
Andrea Bolognani [Wed, 3 Apr 2019 07:44:33 +0000 (09:44 +0200)]
maint: Post-release version bump to 5.3.0

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoRelease of libvirt-5.2.0
Daniel Veillard [Wed, 3 Apr 2019 07:35:40 +0000 (09:35 +0200)]
Release of libvirt-5.2.0

* docs/news.xml: updated for release date

Signed-off-by: Daniel Veillard <veillard@redhat.com>
6 years agoapparmor: support more QEMU architectures
intrigeri [Mon, 1 Apr 2019 07:41:02 +0000 (07:41 +0000)]
apparmor: support more QEMU architectures

Add hppa, nios2, or1k, riscv32 and riscv64 to the profile.

Fixes: https://bugs.debian.org/914940
Signed-off-by: intrigeri <intrigeri@boum.org>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoapps: remove VM Manager android app
Daniel P. Berrangé [Fri, 29 Mar 2019 14:11:00 +0000 (14:11 +0000)]
apps: remove VM Manager android app

The VM Manager app is no longer present on the Play store and while
Google shows a couple of hits they look like the typical untrustworthy
3rd party download redistributors rather than an official site.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoapps: drop link for zenoss software
Daniel P. Berrangé [Fri, 29 Mar 2019 14:08:27 +0000 (14:08 +0000)]
apps: drop link for zenoss software

The page we link to is a 404 and github repo hasn't been touched since
2012 so is clearly dead.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoapps: update link for buildbot
Daniel P. Berrangé [Fri, 29 Mar 2019 14:04:38 +0000 (14:04 +0000)]
apps: update link for buildbot

The libvirt specific page linked for buildbot is a 404. This replacement
link is the closest to what was originally linked.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoapps: remove dead archipel project
Daniel P. Berrangé [Fri, 29 Mar 2019 14:01:19 +0000 (14:01 +0000)]
apps: remove dead archipel project

The project website http://archipelproject.org/ is dead, reporting a
cloudflare error message

The git repo at https://github.com/ArchipelProject/Archipel/ hasn't
had a commit since Nov 2016, and the last release was a beta6 release
in 2013.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agonews: Update for 5.2.0 release
Andrea Bolognani [Fri, 29 Mar 2019 14:14:09 +0000 (15:14 +0100)]
news: Update for 5.2.0 release

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
6 years agotools: Tweak wording for iothreadset
John Ferlan [Wed, 27 Mar 2019 20:30:48 +0000 (16:30 -0400)]
tools: Tweak wording for iothreadset

Update the wording to note the values for polling are purely dynamic
and won't be saved across domain stop/(re)start or save/restore.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org>
6 years agoqemu: error out on attempt to change blkiotune group name
Ján Tomko [Thu, 28 Mar 2019 14:01:45 +0000 (15:01 +0100)]
qemu: error out on attempt to change blkiotune group name

Check that the attribute is the same in qemuDomainDiskChangeSupported
in case somebody tries to change it using the UpdateDevice API.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org>
6 years agoqemu: introduce CHECK_STREQ_NULLABLE in qemuDomainDiskChangeSupported
Ján Tomko [Thu, 28 Mar 2019 13:46:58 +0000 (14:46 +0100)]
qemu: introduce CHECK_STREQ_NULLABLE in qemuDomainDiskChangeSupported

A macro for comparing string fields of the disk.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org>
6 years agoRevert "qemu: emit error when trying to update blkiotune group_name in qemuDomainChan...
Ján Tomko [Thu, 28 Mar 2019 13:11:23 +0000 (14:11 +0100)]
Revert "qemu: emit error when trying to update blkiotune group_name in qemuDomainChangeDiskLive"

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

This reverts commit 047cfb05ee949325e77726531fd381820be8dc62
Using numeric comparison on strings means we reject every update
that does include the group name, even if it's unchanged.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org>
6 years agovirsh: Don't infloop on snapshot/storage_vol failure
Eric Blake [Thu, 28 Mar 2019 02:15:43 +0000 (21:15 -0500)]
virsh: Don't infloop on snapshot/storage_vol failure

Most of our completers used the pattern:
if ((nITEM = virITEMListAll()) < 0)
    return NULL;

but the virDomainSnapshot and virStorageVolume completers were instead
using goto error. If the ListAll fails with -1, the cleanup label was
running a loop of 'size_t i < int nITEM', which is an extreme waste of
CPU cycles. Broken since their introduction in v4.1.

Fixes: f81f8b62
Fixes: 4cb4b649
Reported-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agosnapshot: Improve logic of virDomainMomentMoveChildren
Eric Blake [Thu, 28 Mar 2019 14:00:59 +0000 (09:00 -0500)]
snapshot: Improve logic of virDomainMomentMoveChildren

Even though Coverity can prove that 'last' is always set if the prior
loop executed, gcc 8.0.1 cannot:

  CC       conf/libvirt_conf_la-virdomainmomentobjlist.lo
../../src/conf/virdomainmomentobjlist.c: In function 'virDomainMomentMoveChildren':
../../src/conf/virdomainmomentobjlist.c:178:19: error: 'last' may be used uninitialized in this function [-Werror=maybe-uninitialized]
         last->sibling = to->first_child;
         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~

Rewrite the loop to a form that should be easier for static analysis
to work with.

Fixes: ced0898f86bf
Reported-by: Bjoern Walk <bwalk@linux.ibm.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: suppress unimportant ovs-vsctl errors when getting interface stats
Laine Stump [Wed, 27 Mar 2019 18:58:45 +0000 (14:58 -0400)]
util: suppress unimportant ovs-vsctl errors when getting interface stats

commit edaf13565 modified the stats retrieval for OVS interfaces to
not fail when one of the fields was unrecognized by the ovs-vsctl
command, but ovs-vsctl was still returning an error, and libvirt was
cluttering the logs with these inconsequential error messages.

This patch modifies the GET_STAT macro to add "--if-exists" to the
ovs-vsctl command, which causes it to return an empty string (and exit
with success) if the requested statistic isn't in its database, thus
eliminating the ugly error messages from the log.

Resolves: https://bugzilla.redhat.com/1683175

Signed-off-by: Laine Stump <laine@laine.org>
6 years agoqemu: address: Stop reporting warning when USB address can't be released
Peter Krempa [Thu, 28 Mar 2019 12:25:28 +0000 (13:25 +0100)]
qemu: address: Stop reporting warning when USB address can't be released

The warning is reported at a code path which already reports a proper
error so it's pointless to add yet another line into logs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: Always use 'alias' in warning message when removing USB address
Peter Krempa [Thu, 28 Mar 2019 12:12:32 +0000 (13:12 +0100)]
qemu: Always use 'alias' in warning message when removing USB address

Avoid the extra parameter passing in the disk 'dst' parameter to be
reported instead of the device alias. Using 'dst' instead of alias does
not add much value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: hotplug: Don't release USB address twice when removing disk
Peter Krempa [Thu, 28 Mar 2019 12:19:59 +0000 (13:19 +0100)]
qemu: hotplug: Don't release USB address twice when removing disk

qemuDomainRemoveDiskDevice calls qemuDomainReleaseDeviceAddress which
already calls virDomainUSBAddressRelease so we don't need to call it
again.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemuxml2argvtest: Drop dependency between testInfoArgName and virQEMUCapsFlags enums
Michal Privoznik [Wed, 27 Mar 2019 16:30:44 +0000 (17:30 +0100)]
qemuxml2argvtest: Drop dependency between testInfoArgName and virQEMUCapsFlags enums

Introduced in fdf6c89ee7b, this dependency looks weird. It was
needed because of the way that while() loop was written - it
fetches next argument in every iteration. Therefore, our only
option was for ARG_END to have the same value as QEMU_CAPS_LAST.
This also meant that QEMU_CAPS_* could have been only at the end
of the __VA_ARGS__.

This commit reworks the while() loop and removes the dependency.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoqemu_capabilities; Drop virQEMUCapsSetVAList
Michal Privoznik [Wed, 27 Mar 2019 16:19:37 +0000 (17:19 +0100)]
qemu_capabilities; Drop virQEMUCapsSetVAList

There is one specific caller (testInfoSetArgs() in
qemuxml2argvtest.c) which expect the va_list argument to change
after returning from the virQEMUCapsSetVAList() function.
However, since we are passing plain va_list this is not
guaranteed. The man page of stdarg(3) says:

  If ap is passed to a function that uses va_arg(ap,type), then
  the value of ap is undefined after the return of that function.

(ap is a variable of type va_list)

I've seen this in action in fact: on i686 the qemuxml2argvtest
fails on the second test case because testInfoSetArgs() sees
ARG_QEMU_CAPS and calls virQEMUCapsSetVAList to process the
capabilities (in this case there's just one
QEMU_CAPS_SECCOMP_BLACKLIST). But since the changes are not
reflected in the caller, in the next iteration testInfoSetArgs()
sees the QEMU capability and not ARG_END.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agotests: don't abort in fopen(/proc/mounts)
Daniel P. Berrangé [Tue, 26 Mar 2019 14:55:36 +0000 (14:55 +0000)]
tests: don't abort in fopen(/proc/mounts)

The mock fopen() function will abort if "/proc/mounts" is
requested with "r" permissions and VIR_CGROUP_MOCK_FILENAME
env var is not set.

Unfortunately this is triggering by the libselinux library
constructor when it tries to read /proc/mounts to find out
if selinuxfs is mounted in an unusual place.

This, however, only affects libselinux in Debian as that
opens with "r", while in Fedora / RHEL it opens "re" and
thus luckily never triggered the abort(), instead getting
an EACCESS.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoRevert "snapshot: Allow NULL to virDomainSnapshotObjGetDef"
Eric Blake [Wed, 27 Mar 2019 14:19:31 +0000 (09:19 -0500)]
Revert "snapshot: Allow NULL to virDomainSnapshotObjGetDef"

This reverts commit 6b90a8473875eb34bae27856857cf6561e079089.

It turns out gcc -O2 is not happy with it, complaining:

/home/pipo/libvirt/src/qemu/qemu_driver.c: In function 'qemuDomainSnapshotCreateXML':
/home/pipo/libvirt/src/qemu/qemu_driver.c:15389:26: error: potential null pointer dereference [-Werror=null-dereference]
     bool memory = snapdef->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL;
                   ~~~~~~~^~~~~~~~
/home/pipo/libvirt/src/qemu/qemu_driver.c:15389:26: error: potential null pointer dereference [-Werror=null-dereference]
In file included from /home/pipo/libvirt/src/util/virbuffer.h:27,
                 from /home/pipo/libvirt/src/conf/capabilities.h:27,
                 from /home/pipo/libvirt/src/conf/domain_conf.h:32,
                 from /home/pipo/libvirt/src/qemu/qemu_agent.h:26,
                 from /home/pipo/libvirt/src/qemu/qemu_driver.c:40:
/home/pipo/libvirt/src/util/viralloc.h:125:34: error: potential null pointer dereference [-Werror=null-dereference]
 # define VIR_ALLOC_N(ptr, count) virAllocN(&(ptr), sizeof(*(ptr)), (count), true, \
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                            VIR_FROM_THIS, __FILE__, __FUNCTION__, __LINE__)
                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/pipo/libvirt/src/qemu/qemu_driver.c:15103:9: note: in expansion of macro 'VIR_ALLOC_N'
     if (VIR_ALLOC_N(ret, snapdef->ndisks) < 0)
         ^~~~~~~~~~~
/home/pipo/libvirt/src/qemu/qemu_driver.c:15798:45: error: null pointer dereference [-Werror=null-dereference]
             virDomainSnapshotObjGetDef(snap)->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) {
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~

As the patch simplified one or two callers at the risk of making
many other callers now candidates to trigger aggressive compiler
warnings, it isn't worth it.

Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agosnapshot: Refactor qemu to utilize virDomainMoment more
Eric Blake [Wed, 27 Mar 2019 07:12:37 +0000 (02:12 -0500)]
snapshot: Refactor qemu to utilize virDomainMoment more

Use the common base class virDomainMoment for iterator callbacks
related to snapshots from the qemu code, so that when checkpoint
operations are introduced, they can share the same callbacks.

Simplify the code for qemuDomainSnapshotCurrent by better utilizing
virDomainMoment helpers.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agosnapshot: Allow NULL to virDomainSnapshotObjGetDef
Eric Blake [Wed, 27 Mar 2019 09:24:38 +0000 (04:24 -0500)]
snapshot: Allow NULL to virDomainSnapshotObjGetDef

Doing so can simplify some callers.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agosnapshot: Drop pointless function virDomainMomentIsCurrentName
Eric Blake [Wed, 27 Mar 2019 08:17:46 +0000 (03:17 -0500)]
snapshot: Drop pointless function virDomainMomentIsCurrentName

The qemu driver already had a full-blown virDomainMomentObjPtr to
check against, and the test driver ought to have one since we get
better error checking that the user passed in a valid object. Removes
the need for a helper function added in commit commit 4819f54b.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agonews: Document parallel migration
Jiri Denemark [Wed, 27 Mar 2019 09:35:32 +0000 (10:35 +0100)]
news: Document parallel migration

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agospec: Move ldconfig calls from -client to -libs
Andrea Bolognani [Mon, 25 Mar 2019 09:51:05 +0000 (10:51 +0100)]
spec: Move ldconfig calls from -client to -libs

ldconfig needs to be called after installing or uninstalling
shared libraries.

For a very long time, libvirt didn't have a separate package
containing just the shared libraries, and so it shipped them
in the same one as the clients.

Since commit 70b4f0e719cd, however, shared libraries have been
moved from -client to their own -libs package; unfortunately,
the corresponding ldconfig calls were not moved at the same
time, which is what this commit takes care of.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 years agovirsh: Add options for parallel migration
Jiri Denemark [Tue, 24 Oct 2017 15:00:59 +0000 (17:00 +0200)]
virsh: Add options for parallel migration

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: Add support for parallel migration
Jiri Denemark [Wed, 6 Feb 2019 10:53:19 +0000 (11:53 +0100)]
qemu: Add support for parallel migration

The VIR_MIGRATE_PARALLEL flag is implemented using QEMU's multifd
migration capability and the corresponding multifd-channels migration
parameter.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoPublic API for parallel migration
Jiri Denemark [Wed, 6 Feb 2019 10:36:36 +0000 (11:36 +0100)]
Public API for parallel migration

This patch adds a new VIR_MIGRATE_PARALLEL flag for migration APIs which
will ask the hypervisor to use multiple parallel connections for
migrating a domain. The number of parallel connections can be set using
VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS typed parameter.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agobackup: Introduce virDomainCheckpointPtr
Eric Blake [Thu, 3 Jan 2019 01:55:25 +0000 (19:55 -0600)]
backup: Introduce virDomainCheckpointPtr

Prepare for introducing a bunch of new public APIs related to
backup checkpoints by first introducing a new internal type
and errors associated with that type.  Checkpoints are modeled
heavily after virDomainSnapshotPtr (both represent a point in
time of the guest), although a snapshot exists with the intent
of rolling back to that state, while a checkpoint exists to
make it possible to create an incremental backup at a later
time.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agosnapshot: Various doc tweaks
Eric Blake [Tue, 26 Mar 2019 05:20:04 +0000 (00:20 -0500)]
snapshot: Various doc tweaks

Since I was copying this text to form checkpoint XML and API
documentation, I might as well make improvements along the way. Most
of these changes are based on reviews of the checkpoint docs.

Among other things: grammar tweaks, point to a single source of
documentation rather than repeating verbosity, reword things for
easier legibility.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoRevert "snapshot: Add virDomainSnapshotObjListFormat"
Eric Blake [Mon, 25 Mar 2019 19:46:18 +0000 (14:46 -0500)]
Revert "snapshot: Add virDomainSnapshotObjListFormat"

This reverts commit 86c0ed6f70268dfa7c3bba95a0ba96fcfe2ab039, and
subsequent refactorings of the function into new files.  There are no
callers of this function - I had originally proposed it for
implementing a new bulk snapshot API, but that proved to be too
invasive given RPC limits. I also tried using it for streamlining how
the qemu driver stores snapshot state across libvirtd restarts
internally, but in the end, the risks of a new internal format
outweighed the benefits of one file per snapshot.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoRevert "snapshot: Add virDomainSnapshotObjListParse"
Eric Blake [Mon, 25 Mar 2019 19:36:44 +0000 (14:36 -0500)]
Revert "snapshot: Add virDomainSnapshotObjListParse"

This reverts commit 1b57269cbcfcfe998a065c0c9f0f8db408710d87, and
subsequent refactorings of the function into new files.  There are no
callers of this function - I had originally proposed it for
implementing a new bulk snapshot API, but that proved to be too
invasive given RPC limits. I also tried using it for streamlining how
the qemu driver stores snapshot state across libvirtd restarts
internally, but in the end, the risks of a new internal format
outweighed the benefits of one file per snapshot.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agom4: Add warning when running QEMU as root
Andrea Bolognani [Tue, 26 Mar 2019 15:58:30 +0000 (16:58 +0100)]
m4: Add warning when running QEMU as root

Running QEMU as root is a pretty bad idea, so try to make the
user aware of that as part of the configure summary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agom4: Run QEMU under a distro-specific user when possible
Andrea Bolognani [Tue, 26 Mar 2019 10:01:32 +0000 (11:01 +0100)]
m4: Run QEMU under a distro-specific user when possible

Our current defaults are root:wheel on FreeBSD and macOS, root:root
everywhere else.

Looking at what downstream distributions actually do, we can see that
these defaults are overriden the vast majority of the time, with a
number of variations showing up in the wild:

  * qemu:qemu -> Used by CentOS, Fedora, Gentoo, OpenSUSE, RHEL
                 and... As it turns out, our very own spec file :)

  * libvirt-qemu:libvirt-qemu -> Used by Debian.

  * libvirt-qemu:kvm -> Used by Ubuntu.

  * nobody:nobody -> Used by Arch Linux.

Based on this information, we can do a better job at integrating with
downstream packages: if the distro-specific user and group already
exist on the system then we use them, and if not (or we're building
on an unknown OS) we just use root:root as we would have before.

This change makes it less likely that people building from source
will end up running their guests as root, which is a very desiderable
outcome from the security point of view.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>