Commit Graph

37783 Commits

Author SHA1 Message Date
Michal Privoznik
30dd4aed3c news: Document HMAT addition
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-07-08 12:05:24 +02:00
Michal Privoznik
aeecbc87b7 qemu: Build HMAT command line
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1786303

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-07-08 12:05:24 +02:00
Michal Privoznik
c2f15f1b18 qemu: Introduce QEMU_CAPS_NUMA_HMAT capability
This capability tracks whether QEMU is capable of defining HMAT
ACPI table for the guest.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-07-08 12:05:24 +02:00
Michal Privoznik
11d8ca9794 numa: expose HMAT APIs
These APIs will be used by QEMU driver when building the command
line.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-07-08 12:05:24 +02:00
Michal Privoznik
f0611fe883 conf: Validate NUMA HMAT configuration
There are several restrictions, for instance @initiator and
@target have to refer to existing NUMA nodes (daa), @cache has to
refer to a defined cache level and so on.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-07-08 12:05:24 +02:00
Michal Privoznik
a89bbbac86 conf: Parse and format HMAT
To cite ACPI specification:

  Heterogeneous Memory Attribute Table describes the memory
  attributes, such as memory side cache attributes and bandwidth
  and latency details, related to the System Physical Address
  (SPA) Memory Ranges. The software is expected to use this
  information as hint for optimization.

According to our upstream discussion [1] this is exposed under
<numa/> as <cache/> under NUMA <cell/> and <latency> or
<bandwidth/> under numa/latencies.

1: https://www.redhat.com/archives/libvir-list/2020-January/msg00422.html

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-07-08 12:05:24 +02:00
Michal Privoznik
a26f61ee0c Allow NUMA nodes without vCPUs
QEMU allows creating NUMA nodes that have memory only.
These are somehow important for HMAT.

With check done in qemuValidateDomainDef() for QEMU 2.7 or newer
(checked via QEMU_CAPS_NUMA), we can be sure that the vCPUs are
fully assigned to NUMA nodes in domain XML.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-07-08 12:05:24 +02:00
Michal Privoznik
1050c6beb1 numa_conf: Make virDomainNumaSetNodeCpumask() return void
There is only one caller of virDomainNumaSetNodeCpumask() which
checks for the return value but because the function will return
NULL iff the @cpumask was NULL in the first place. But in that
place @cpumask can't be NULL because it was just allocated by
virBitmapParse().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-07-08 12:05:24 +02:00
Michal Privoznik
fe43b3a5a5 qemuBuildMachineCommandLine: Drop needless check
The machine can not be NULL at this point -
qemuDomainDefPostParse() makes sure it isn't.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-07-08 12:05:24 +02:00
Michal Privoznik
8ba1792785 qemu_command: Rename qemuBuildNumaArgStr()
The function doesn't just build the argument for -numa. Since the
-numa can be repeated multiple times, it also puts -numa onto the
cmd line. Also, the rest of the functions has 'Command' infix.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-07-08 12:05:24 +02:00
Michal Privoznik
68c5b0183c numa_conf: Drop CPU from name of two functions
There are two functions virDomainNumaDefCPUFormatXML() and
virDomainNumaDefCPUParseXML() which format and parse domain's
<numa/>. There is nothing CPU specific about them. Drop the
infix.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-07-08 12:05:24 +02:00
Michal Privoznik
04bd77a19f conf: Move and rename virDomainParseScaledValue()
There is nothing domain specific about the function, thus it
should not have virDomain prefix. Also, the fact that it is a
static function makes it impossible to use from other files.
Move the function to virxml.c and drop the 'Domain' infix.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-07-08 12:05:24 +02:00
Michal Privoznik
afb1ea6776 qemuxml2xmltest: Add "numatune-distance" test case
This test case checks that expanding NUMA distance works. On
input we accept if only distance from A to B is specified. On the
output we format the B to A distance too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-07-08 12:05:24 +02:00
Peter Krempa
e95da4e5bf qemuBuildMemoryBackendProps: Use boolean type for 'pmem' property
Commit 82576d8f35 used a string "on" to enable the 'pmem' property.
This is okay for the command line visitor, but the property is declared
as boolean in qemu and thus it will not work when using QMP.

Modify the type to boolean. This changes the command line, but
fortunately the command line visitor in qemu parses both 'yes' and 'on'
as true for the property.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-07-08 11:40:18 +02:00
Erik Skultety
bc33b8c639 qemu: capabilities: Drop the virQEMUCapsCacheLookupByArch function
Previous commit removed the last usage of the function. Drop
virQEMUCapsCompareArch as well since virQEMUCapsCacheLookupByArch was
its only caller.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-07-08 10:55:07 +02:00
Erik Skultety
f3d838237d qemu: Use virQEMUCapsCacheLookupDefault instead of lookup by arch
Firstly, SEV is present only on AMD, so we can safely assume x86.
Secondly, the problem with looking up capabilities in the cache by arch
is that it's using virHashSearch with a callback to find the right
capabilities and get the binary name from it as well, but since the
cache is empty, it will return NULL and we won't get the corresponding
binary name out of the lookup either. Then, during the cache validation
we try to create a new cache entry for the emulator, but since we don't
have the binary name, nothing gets created.
Therefore, virQEMUCapsCacheLookupDefault is used to fix this issue,
because it doesn't rely on the capabilities cache to construct the
emulator binary name.

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-07-08 10:55:07 +02:00
Jianan Gao
049846b9fd docs: index: Add knowledge base link and description to the index page
Add link and description of libvirt knowledge base to make it easier for
users and testers to understand libvirt.

Signed-off-by: Jianan Gao <jgao@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-07-08 10:21:20 +02:00
Peter Krempa
7e5b993d3b backup: Allow configuring incremental backup per-disk individually
The semantics of the backup operation don't strictly require that all
disks being backed up are part of the same incremental part (when a disk
was checkpointed/backed up separately or in a different VM), or even
they may not have a previous checkpoint at all (e.g. when the disk
was freshly hotplugged to the vm).

In such cases we can still create a common checkpoint for all of them
and backup differences according to configuration.

This patch adds a per-disk configuration of the checkpoint to do the
incremental backup from via the 'incremental' attribute and allows
perform full backups via the 'backupmode' attribute.

Note that no changes to the qemu driver are necessary to take advantage
of this as we already obey the per-disk 'incremental' field.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-08 08:40:30 +02:00
Peter Krempa
6f33e441e2 backupxml2xmltest: Call 'virDomainBackupAlignDisks' before formatting output
Call the post-processing function so that we can validate that it does
the correct thing.

virDomainBackupAlignDisks requires disk definitions to be present so
let's fake them by copying disks from the backup definition and add one
extra disk 'vdextradisk'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-08 08:40:30 +02:00
Peter Krempa
1a7ce56ae1 virDomainBackupDiskDefFormat: Format internal disk state only when valid
Format the disk state only when it isn't _NONE.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-08 08:40:30 +02:00
Peter Krempa
5c08a3739b backupxml2xmltest: Remove output symlink of 'backup-pull-internal-invalid'
Replace the output by a copy of the input file for further changes once
we start testing virDomainBackupAlignDisks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-08 08:40:30 +02:00
Andrea Bolognani
26daf37623 docs: Point to pkg.go.dev instead of godoc.org
The former is the new recommended frontend for browsing Go API
documentation online.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-07-07 14:07:33 +02:00
Andrea Bolognani
6a79c7fa88 docs: Use libvirt.org namespace for Go bindings
Fixes: 193ad36406
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-07-07 14:07:24 +02:00
Peter Krempa
423576679a qemu: backup: Setup TLS environment for pull-mode backup jobs
Use the configured TLS env to setup encryption of the TLS transport.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:19 +02:00
Peter Krempa
fc6aaf6a19 conf: backup: Add 'tls' attribute for 'server' element
Allow enabling TLS for the NBD server used to do pull-mode backups. Note
that documentation already mentions 'tls', so this just implements the
schema and XML bits.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:19 +02:00
Peter Krempa
d37a2cd5ed qemu: conf: Add configuration of TLS environment for NBD transport of pull-backups
TLS is required to transport backed-up data securely when using
pull-mode backups.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:19 +02:00
Peter Krempa
fffc147ba2 conf: backup: Store 'tlsAlias' and 'tlsSecretAlias' as internals of a backup
Add fields for storing the aliases necessary to clean up the TLS env for
a backup job after it finishes.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:19 +02:00
Peter Krempa
bfd9721671 testCompareBackupXML: Add infrastructure for testing internal fields
There are few internal fields of the backup XML. Propagate the
'internal' flag so that the test can verify the XML infrastructure.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:19 +02:00
Peter Krempa
eafd3b3a21 checkpoint: Mention that VIR_DOMAIN_CHECKPOINT_XML_SIZE is expensive and stale
Data is valid only when queried as guest writes may increase the backup
size.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:19 +02:00
Peter Krempa
b9c24236fa qemu: checkpoint: Implement VIR_DOMAIN_CHECKPOINT_XML_SIZE
Introduce code which merges the appropriate bitmaps and queries the
final size of the backup, so that we can print the XML with size
information.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:19 +02:00
Peter Krempa
a94997c476 conf: checkpoint: Add a flag storing whether disk 'size' is valid
Avoid printing '0' size in case when we weren't able to determine the
backup size by adding a flag whether the size is valid and interlock
printing of the field according to the flag.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:19 +02:00
Peter Krempa
459a60823e docs: checkpoint: Convert XML documentation to RST
Switch to the new format for easier extension.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:19 +02:00
Peter Krempa
7b2163c8bf qemu: backup: integrate with blockpull
Merge the bitmaps when finalizing a block pull job so that backups work
properly afterwards.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:19 +02:00
Peter Krempa
3927880e9a docs: backup: Convert XML documentation to RST
Switch to the new format for easier extension.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:19 +02:00
Peter Krempa
981222b682 conf: backup: Don't explicitly forbid backup of read-only disk
Users may want to use this to create a full backup or even incremental
if the checkpoints are pre-existing. We still will not allow to create a
checkpoint on a read-only disk as that makes no sense.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:19 +02:00
Peter Krempa
ab7b3167b3 tests: qemuxml2argv: Test encrypted TLS key for nbd/vxhs disks
Add a dummy secret so that we see what command line is generated.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:19 +02:00
Peter Krempa
423711aef2 qemu: domain: Setup secret for TLS key for nbd/vxhs disks
Setup the TLS secret when preparing a virStorageSource for use.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:19 +02:00
Peter Krempa
470d322e0c qemu: conf: Add configuration of TLS key encryption for 'vxhs' and 'nbd' disks
Until now libvirt didn't allow using encrypted TLS key for disk clients.

Add fields for configuring the secret and propagate defaults.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:19 +02:00
Peter Krempa
7fa772bfd7 qemu block: Add internals for handling 'secret' corresponding to TLS key
Add infrastructure for hot- and cold-plug of the secret object holding
decryption key for the TLS key.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:19 +02:00
Peter Krempa
a3cbbc5afb qemu: domain: Add infrastructure passing in TLS key's decryption key via 'secret'
Store the required data in the private data of a storage source and
ensure that the 'alias' of the secret is formatted in the status XML.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:18 +02:00
Peter Krempa
cd0dc1c19f virQEMUDriverConfigLoadSpecificTLSEntry: Split up fetching of server-only config options
The '*_tls_x509_verify' options are relevant only when we are going to
expose a server socket as client sockets always enable verification.

Split up the macro to separate the common bits from the server bits so
that when we'll later extend support of 'nbd' and 'vxhs' disks which are
client only we can reuse the existing macros.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:18 +02:00
Peter Krempa
94b5e9ebf6 virQEMUDriverConfigLoadSpecificTLSEntry: Move fetching of 'chardev_tls' above macro
Move the extraction of the config value so that it makes more sense
after upcoming refactors.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:18 +02:00
Peter Krempa
473b97abac qemu: conf: Move 'nbd' and 'vxhs' tls config variables together with rest of tls setup
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:18 +02:00
Peter Krempa
72fdba7ffd qemu.conf: Remove misleading mention of 'migrate_tls'
There's no such parameter. Reword the sentence to account for enabling
TLS-encrypted migration using API flags.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:18 +02:00
Peter Krempa
7bfb85cf1d qemuDomainDiskHasEncryptionSecret: unexport
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:18 +02:00
Peter Krempa
47be725719 qemu: domain: Introduce helper for always fetching virStorageSource private data
Add a helper which will always return the storage source private data
even if it was not allocated before.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2020-07-07 12:58:18 +02:00
Laine Stump
852ee1950a util: remove OOM error log from virGetHostnameImpl()
The strings allocated in virGetHostnameImpl() are all allocated via
g_strdup(), which will exit on OOM anyway, so the call to
virReportOOMError() is redundant, and removing it allows slight
modification to the code, in particular the cleanup label can be
eliminated.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-07-05 00:01:07 -04:00
Laine Stump
59afd0b0bc conf: eliminate useless error label in virDomainFeaturesDefParse()
The error: label in this function just does "return -1", so replace
all the "goto error" in the function with "return -1".

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-07-04 23:58:53 -04:00
Laine Stump
ab9fd53823 network: use proper arg type when calling virNetDevSetOnline()
The 2nd arg to this function is a bool, not an int.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-07-04 23:54:28 -04:00
Laine Stump
e95dd7aacd network: make networkDnsmasqXmlNsDef private to bridge_driver.c
This struct isn't used anywhere else.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-07-04 23:53:48 -04:00