]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
2 years agoschemas: Update ref acpi for devices
Han Han [Tue, 19 Jul 2022 07:02:20 +0000 (15:02 +0800)]
schemas: Update ref acpi for devices

According to a9fe9569ab, the <acpi index='NNN'/> is only for PCI
devices. Remove the ref acpi from devices channel, smartcard, tpm,
redirdev, panic, hub because none of them has PCI address. And add the
ref acpi to iommu device.

Fixes: a9fe9569ab
Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agodomain_conf: rewrite if else condition
Kristina Hanicova [Wed, 20 Jul 2022 12:42:29 +0000 (14:42 +0200)]
domain_conf: rewrite if else condition

This patch prevents nesting of if conditions and makes the code
cleaner.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoCH: use virDomainJobObj
Kristina Hanicova [Tue, 19 Jul 2022 13:48:24 +0000 (15:48 +0200)]
CH: use virDomainJobObj

This patch replaces struct virCHDomainJobObj with generalized
virDomainJobObj.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agolibxl: use virDomainJobObj
Kristina Hanicova [Tue, 19 Jul 2022 13:48:23 +0000 (15:48 +0200)]
libxl: use virDomainJobObj

This patch replaces struct libxlDomainJobObj with generalized
virDomainJobObj.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoLXC: use virDomainJobObj
Kristina Hanicova [Tue, 19 Jul 2022 13:48:22 +0000 (15:48 +0200)]
LXC: use virDomainJobObj

This patch replaces struct virLXCDomainJobObj with generalized
virDomainJobObj.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agohypervisor: domain_job: rename members in virDomainObjPrivateJobCallbacks
Kristina Hanicova [Tue, 19 Jul 2022 13:48:21 +0000 (15:48 +0200)]
hypervisor: domain_job: rename members in virDomainObjPrivateJobCallbacks

This patch alters members of virDomainObjPrivateJobCallbacks to
make the code more consistent.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu & hypervisor: move job object into hypervisor
Kristina Hanicova [Tue, 19 Jul 2022 13:48:20 +0000 (15:48 +0200)]
qemu & hypervisor: move job object into hypervisor

This patch moves qemuDomainJobObj into hypervisor/ as generalized
virDomainJobObj along with generalized private job callbacks as
virDomainObjPrivateJobCallbacks.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agohypervisor: domain_job: add and edit description
Kristina Hanicova [Tue, 19 Jul 2022 12:52:01 +0000 (14:52 +0200)]
hypervisor: domain_job: add and edit description

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: domainjob: remove async variable from qemuDomainObjBeginJobInternal()
Kristina Hanicova [Tue, 19 Jul 2022 12:47:28 +0000 (14:47 +0200)]
qemu: domainjob: remove async variable from qemuDomainObjBeginJobInternal()

This patch removes variable 'async', which is used only once, and
replaces it with direct comparison with an enum member.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoconf: add missing break on a switch case
Jonathon Jongsma [Fri, 15 Jul 2022 17:56:59 +0000 (12:56 -0500)]
conf: add missing break on a switch case

This was not causing any problems because all cases below were empty,
but in order to avoid future misbehavior, add a break to this case.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodomain_conf: Switch to virBufferAddLit for literal strings
Michal Privoznik [Tue, 19 Jul 2022 12:02:52 +0000 (14:02 +0200)]
domain_conf: Switch to virBufferAddLit for literal strings

There's no need to use virBufferAddStr() for literal strings
without any newline character as it's more expensive than
virBufferAddLit().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2 years agoqemu_capabilities: Indent <cpudata/> properly
Michal Privoznik [Tue, 19 Jul 2022 11:58:53 +0000 (13:58 +0200)]
qemu_capabilities: Indent <cpudata/> properly

When formatting qemuCaps XML, the <cpudata/> element is
misaligned. This is because it contains multiple lines and
virBufferAsprintf() does not expect that. Switch to
virBufferAddStr() which does.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2 years agolib: Use G_NO_INLINE instead of G_GNUC_NO_INLINE
Michal Privoznik [Mon, 18 Jul 2022 11:02:19 +0000 (13:02 +0200)]
lib: Use G_NO_INLINE instead of G_GNUC_NO_INLINE

The G_GNUC_NO_INLINE macro will eventually be marked as
deprecated [1] and we are recommended to use G_NO_INLINE instead.
Do the switch now, rather than waiting for compile time warning
to occur.

1: https://gitlab.gnome.org/GNOME/glib/-/commit/15cd0f04612c90292792c4d123ebe84bf4bf93a6
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agoglibcompat: Provide implementation for G_GNUC_NO_INLINE
Michal Privoznik [Mon, 18 Jul 2022 10:48:32 +0000 (12:48 +0200)]
glibcompat: Provide implementation for G_GNUC_NO_INLINE

Currently, we require glib-2.56.0 at minimum (because of RHEL-8)
but we use G_GNUC_NO_INLINE which was introduced in 2.58.0. While
we provide an implementation for older versions, where the macro
does not exists, it's a bit more tricky than that. Since we
define GLIB_VERSION_MAX_ALLOWED we would get a compile time error
when trying to use something too new, except for G_GNUC_NO_INLINE
which was intentionally not marked as
GLIB_AVAILABLE_MACRO_IN_2_58. But this is about to change with
glib-2.73.2 (which contains commit [1]).

At the same time, we can't just bump glib and thus we have to
provide an alternative implementation without the version
annotation.

1: https://gitlab.gnome.org/GNOME/glib/-/commit/a6f8fe071e44b0145619c21f3bfbc90c56ab805e
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agodocs: Fix typos
Tim Wiederhake [Mon, 18 Jul 2022 09:10:55 +0000 (11:10 +0200)]
docs: Fix typos

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
2 years agoutil: remove virObjectUnref() adapters
Jonathon Jongsma [Wed, 13 Jul 2022 20:26:51 +0000 (15:26 -0500)]
util: remove virObjectUnref() adapters

These wrapper functions were used to adapt the virObjectUnref() function
signature for different callbacks. But in commit 0d184072, the
virObjectUnref() function was changed to return a void instead of a
bool, so these adapters are no longer necessary.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2 years agoqemu: monitor: Remove unused migration property getters/setters
Peter Krempa [Fri, 15 Jul 2022 12:27:41 +0000 (14:27 +0200)]
qemu: monitor: Remove unused migration property getters/setters

The getters/setters for individual properties of migration
speed/downtime/cache size are unused once we switched to setting them
purely via migration parameters. Remove the unused helpers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: capabilities: Retire QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE
Peter Krempa [Fri, 15 Jul 2022 12:19:15 +0000 (14:19 +0200)]
qemu: capabilities: Retire QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Always assume support for QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE
Peter Krempa [Fri, 15 Jul 2022 12:16:54 +0000 (14:16 +0200)]
qemu: Always assume support for QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE

The 'xbzrle-cache-size' parameter was added in qemu-2.11 thus all
supported qemu versions now use the new code path.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: capabilties: Retire QEMU_CAPS_MIGRATION_PARAM_DOWNTIME
Peter Krempa [Fri, 15 Jul 2022 12:13:41 +0000 (14:13 +0200)]
qemu: capabilties: Retire QEMU_CAPS_MIGRATION_PARAM_DOWNTIME

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: driver: Always assume support for QEMU_CAPS_MIGRATION_PARAM_DOWNTIME
Peter Krempa [Fri, 15 Jul 2022 12:12:28 +0000 (14:12 +0200)]
qemu: driver: Always assume support for QEMU_CAPS_MIGRATION_PARAM_DOWNTIME

The 'downtime-limit' field of 'migrate-set-parameters' was introduced in
qemu-2.8, thus all qemu versions supported by libvirt use the new code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: capabilities: Retire QEMU_CAPS_MIGRATION_PARAM_BANDWIDTH
Peter Krempa [Fri, 15 Jul 2022 12:10:38 +0000 (14:10 +0200)]
qemu: capabilities: Retire QEMU_CAPS_MIGRATION_PARAM_BANDWIDTH

The parameter is supported since qemu-2.8.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Always assume support for QEMU_CAPS_MIGRATION_PARAM_BANDWIDTH
Peter Krempa [Fri, 15 Jul 2022 12:07:59 +0000 (14:07 +0200)]
qemu: Always assume support for QEMU_CAPS_MIGRATION_PARAM_BANDWIDTH

The 'max-bandwidth' field was added as argument of
'migrate-set-parameters' in qemu-2.8, thus all qemu version supported by
libvirt already use the new code path.

This patch assumes the presence and removes the legacy code paths.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agodocs: ci: Add a brief section on how to run the CI workload locally
Erik Skultety [Tue, 12 Jul 2022 11:44:53 +0000 (13:44 +0200)]
docs: ci: Add a brief section on how to run the CI workload locally

This is just a glue to the testing article introduced in previous
commits.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: ci: Add a section on how to add a new platform to libvirt CI
Erik Skultety [Tue, 12 Jul 2022 11:44:26 +0000 (13:44 +0200)]
docs: ci: Add a section on how to add a new platform to libvirt CI

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: ci: Add info about the two major types of jobs our CI runs
Erik Skultety [Tue, 12 Jul 2022 11:19:14 +0000 (13:19 +0200)]
docs: ci: Add info about the two major types of jobs our CI runs

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: Change the CI headline from "CI Testing" to "CI"
Erik Skultety [Tue, 12 Jul 2022 11:40:59 +0000 (13:40 +0200)]
docs: Change the CI headline from "CI Testing" to "CI"

It's not just strategy the master CI article talks (or will talk in the
future) about.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: Drop the testsuites article
Erik Skultety [Tue, 12 Jul 2022 11:40:13 +0000 (13:40 +0200)]
docs: Drop the testsuites article

The article was replaced with a new one in previous commit, so we don't
need this one anymore.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: Replace testsuites article with the new 'testing' article
Erik Skultety [Tue, 12 Jul 2022 11:39:06 +0000 (13:39 +0200)]
docs: Replace testsuites article with the new 'testing' article

The new article provides more in-depth information on testing options
in libvirt.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: Provide an article on testing
Erik Skultety [Tue, 12 Jul 2022 11:32:58 +0000 (13:32 +0200)]
docs: Provide an article on testing

Currently we don't have much information on how testing is done in
libvirt and the little we have is scattered among multiple files. This
patch creates a common landing page containing all important bits about
testing in libvirt, providing links to respective sections which
deserve their own articles.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: Provide an article on how to add a custom runner to the project
Erik Skultety [Mon, 21 Mar 2022 14:11:35 +0000 (15:11 +0100)]
docs: Provide an article on how to add a custom runner to the project

Since running our functional test suite in GitLab cannot make use of
the shared resources it makes sense to document the process of adding
own HW to run the custom libvirt executor that powers the integration
suite. This article will likely make even more sense in the future with
GitLab severely cutting down on shared CI resources.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: Provide more information about the TCK test suite
Erik Skultety [Tue, 12 Jul 2022 11:33:11 +0000 (13:33 +0200)]
docs: Provide more information about the TCK test suite

Most importantly, how to get it, how install dependencies and how
to run it.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: Move the CI dashboard to its own RST module
Erik Skultety [Tue, 12 Jul 2022 11:15:07 +0000 (13:15 +0200)]
docs: Move the CI dashboard to its own RST module

The dashboard itself simply takes away focus from everything else that
makes sense to have in the CI article, so move it to it's own article
and link it from the main CI article.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Sun, 10 Jul 2022 09:19:05 +0000 (11:19 +0200)]
Translated using Weblate (Swedish)

Currently translated at 39.4% (4141 of 10491 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2 years agoTranslated using Weblate (Polish)
Piotr Drąg [Sun, 10 Jul 2022 09:19:05 +0000 (11:19 +0200)]
Translated using Weblate (Polish)

Currently translated at 22.2% (2328 of 10472 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/pl/

Co-authored-by: Piotr Drąg <piotrdrag@gmail.com>
Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
2 years agoqemu: Generate cmd line for guestReset
Michal Privoznik [Thu, 7 Jul 2022 13:26:35 +0000 (15:26 +0200)]
qemu: Generate cmd line for guestReset

QEMU offers two attributes for handling reset requests of an USB
host device: guest-reset and guest-resets-all. When combined they
act as follows:

1) guest-reset=false
   The guest is not allowed to reset the physical USB device.

2) guest-reset=true,guest-resets-all=false
   The guest is allowed to reset the device when it is not yet
   initialized (aka no USB bus address assigned). Usually this results
   in one guest reset being allowed. This is the default behavior.

3) guest-reset=true,guest-resets-all=true
   The guest is allowed to reset the device as it pleases.

Now, there's a clear 1:1 mapping with our representation of
guestReset, so generating cmd line is trivial.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_validate: Validate that QEMU's capable of guestReset
Michal Privoznik [Tue, 12 Jul 2022 10:27:20 +0000 (12:27 +0200)]
qemu_validate: Validate that QEMU's capable of guestReset

Now that we have a capability, validate that the QEMU we are
talking to has everything we need for guestReset.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_capabilities: Track usb-host.guest-resets-all capability
Michal Privoznik [Tue, 12 Jul 2022 10:19:37 +0000 (12:19 +0200)]
qemu_capabilities: Track usb-host.guest-resets-all capability

We will need two attributes of usb-host device to set:
guest-reset and guest-resets-all. The former was introduced in
QEMU v4.0.0-rc0~56^2 and the other in v4.2.0-rc1~9^2. Hence,
track the latter only as it's only starting from that commit when
QEMU has both attributes.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: Introduce @guestReset to hostdev's <source/>
Michal Privoznik [Thu, 7 Jul 2022 11:11:06 +0000 (13:11 +0200)]
conf: Introduce @guestReset to hostdev's <source/>

Some USB devices have a buggy firmware that either crashes on
device reset, or make the device unusable in some other way.
Fortunately, QEMU offers a way to skip device reset either
completely, or if device is not initialized yet. Expose this
ability to users under:

    <hostdev mode='subsystem' type='usb'>
      <source guestReset='off'/>
    </hostdev>

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: Fix qemu replies wrt usb-host properties
Michal Privoznik [Wed, 13 Jul 2022 10:17:37 +0000 (12:17 +0200)]
tests: Fix qemu replies wrt usb-host properties

My commit of v6.9.0-rc1~457 was a bit too harsh. While it served
its purpose (adding usb-host.hostdevice capability) it has a side
effect: because I copied reply from qemu-5.1.0 to older .replies
files one might now think that say qemu-3.1.0 supports both
.guest-reset and .guest-resets-all properties. But in fact it
doesn't. There are three problematic properties:

1) guest-reset, introduced in v4.0.0-rc0~56^2
2) guest-resets-all introduced in v4.2.0-rc1~9^2
3) suppress-remote-wake introduced in v5.0.0-rc0~148^2~4

Remove these properties from versions that could not have had
them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: Update hostdev-usb-* hostdev-pci-* xml2xml and xml2argv tests
Michal Privoznik [Tue, 12 Jul 2022 11:00:33 +0000 (13:00 +0200)]
tests: Update hostdev-usb-* hostdev-pci-* xml2xml and xml2argv tests

Currently, we have bunch of PCI/USB tests cases for
qemuxml2argvtest and qemuxml2xmltest but all of them run without
any capabilities. This makes is needlessly complicated when
trying to extend them. Switch to DO_TEST_CAPS_LATEST().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodocs: replace ARRAY_CARDINALITY with G_N_ELEMENTS
Daniel P. Berrangé [Tue, 24 May 2022 12:25:55 +0000 (13:25 +0100)]
docs: replace ARRAY_CARDINALITY with G_N_ELEMENTS

Fix docs illustrating call with an obsolete macro.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: add info about factors affecting CPU compatibility
Daniel P. Berrangé [Tue, 12 Jul 2022 15:30:17 +0000 (16:30 +0100)]
docs: add info about factors affecting CPU compatibility

While libvirt solves most of the problem of ensuring compatibility, when
there is incompatibility it can be hard for users to track down the
cause. Everything knows to check the physical CPU model, but there are a
surprisingly large number of other factors influencing compatibility.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agovirsh: Implement --config for iothreadset
Michal Privoznik [Thu, 7 Jul 2022 15:44:32 +0000 (17:44 +0200)]
virsh: Implement --config for iothreadset

Our man page already documents that iothreadset has --config
argument. Well, it doesn't really. Normally, I'd just fix the man
page, but with recent work on the API it's possible to tweak
values for inactive XML too. Therefore, implement the --config
argument for the command.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuDomainSetIOThreadParams: Accept VIR_DOMAIN_AFFECT_CONFIG flag
Michal Privoznik [Fri, 8 Jul 2022 07:35:39 +0000 (09:35 +0200)]
qemuDomainSetIOThreadParams: Accept VIR_DOMAIN_AFFECT_CONFIG flag

It was always possible to modify the inactive XML, because
VIR_DOMAIN_AFFECT_CURRENT (= 0) is accepted implicitly. But now
that the logic when changing both config and live XMLs is more
robust we can accept VIR_DOMAIN_AFFECT_CONFIG flag too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Make IOThread changing more robust
Michal Privoznik [Thu, 7 Jul 2022 15:37:46 +0000 (17:37 +0200)]
qemu: Make IOThread changing more robust

There are three APIs that allow changing IOThreads:

  virDomainAddIOThread()
  virDomainDelIOThread()
  virDomainSetIOThreadParams()

In case of QEMU driver these are handled by
qemuDomainChgIOThread() which attempts to be versatile enough to
work on both inactive and live domain definitions at the same
time. However, it's a bit clumsy - when a change to live
definition succeeds but fails in inactive definition then there's
no rollback. And somewhat rightfully so - changes to live
definition are in general harder to roll back. Therefore, do what
we do elsewhere (qemuDomainAttachDeviceLiveAndConfig(),
qemuDomainDetachDeviceAliasLiveAndConfig(), ...):

  1) do the change to inactive XML first,
  2) in fact, do the change to a copy of inactive XML,
  3) swap inactive XML and its copy only after everything
     succeeded.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodomain_conf: Format iothread IDs more often
Michal Privoznik [Thu, 7 Jul 2022 14:29:33 +0000 (16:29 +0200)]
domain_conf: Format iothread IDs more often

When formatting IOThreads (in virDomainDefIOThreadsFormat()), we
may only output the number of IOThreads, or the full list of IOThreads too:

  <iothreads>4</iothreads>
  <iothreadids>
    <iothread id='1' thread_pool_max='10'/>
    <iothread id='2' thread_pool_min='2' thread_pool_max='10'/>
    <iothread id='3'/>
    <iothread id='4'/>
  </iothreadids>

Now, the deciding factor here is whether those individual
IOThreads were so called 'autofill-ed' or user provided. Well, we
need to take another factor in: if an IOThread has pool size
limit set, then we ought to format the full list.

But how can we get into a situation when a thread is autofilled
(i.e. not provided by user in the XML) and yet it has pool size
limit set? virDomainSetIOThreadParams() is the answer.

Sure, we could also unset the autofill flag whenever a pool size
limit is being set. But this approach allows us to not format
anything if the limits are reset (we don't lose the autofill
information).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodomain_conf: Format <defaultiothread/> more often
Michal Privoznik [Thu, 7 Jul 2022 14:29:18 +0000 (16:29 +0200)]
domain_conf: Format <defaultiothread/> more often

The <defaultiothread/> element is formatted inside
virDomainDefaultIOThreadDefFormat() which is called only from
virDomainDefIOThreadsFormat() (so that IOThread related stuff is
formatted calling one function). However, when there are no
<iothreadids/> defined (or only autoallocated ones are present),
then the outer formatting function exits early never calling the
<defaultiothread/> formatter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Report supported TPM version in domcaps
Michal Privoznik [Tue, 12 Jul 2022 13:58:17 +0000 (15:58 +0200)]
qemu: Report supported TPM version in domcaps

Now that we have everything prepared, we can start detecting
supported TPM versions and setting corresponding values in
backendModel struct.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/340
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103119
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agodomcaps: Introduce TPM backendVersion
Michal Privoznik [Tue, 12 Jul 2022 13:58:12 +0000 (15:58 +0200)]
domcaps: Introduce TPM backendVersion

We accept TPM version in the domain XML. However, supported
version depends on the host (swtpm_setup binary) and thus it may
be tricky for users (or mgmt applications) chose a version.
Introduce machinery for reporting supported version in domain
capabilities.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agovirtpm: Introduce TPM-1.2 and TPM-2.0 capabilieis
Michal Privoznik [Tue, 12 Jul 2022 13:46:50 +0000 (15:46 +0200)]
virtpm: Introduce TPM-1.2 and TPM-2.0 capabilieis

These new capabilities will be used only to track whether
swtpm_setup is capable of TPM-1.2 and/or TPM-2.0.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agodocs: Document TPM portion of domcaps
Michal Privoznik [Tue, 12 Jul 2022 14:10:08 +0000 (16:10 +0200)]
docs: Document TPM portion of domcaps

Surprisingly, we don't document TPM part of domain capabilities.
Fortunately, the information exposed is pretty much self
explanatory, but we should document it regardless.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoremote: conf: Mention that 'virtproxyd' doesn't require the '--listen' flag
Peter Krempa [Tue, 12 Jul 2022 10:45:52 +0000 (12:45 +0200)]
remote: conf: Mention that 'virtproxyd' doesn't require the '--listen' flag

'virtproxyd' doesn't have the '--listen' parameter and it's enough just
to enable the corresponding option in the config.

The config file is generic for all the daemons and we just omit/adjust
some sections. Adding a separate mechanism to omit the note about the
'--listen' parameter would be overkill so mention explicitly that it's
required only for libvirtd and not virtproxyd.

The section is omitted for other daemons.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2094641
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agoqemuxml2*test: Add 'startupPolicy' fields to aio-io_uring case
Peter Krempa [Tue, 14 Jun 2022 14:47:51 +0000 (16:47 +0200)]
qemuxml2*test: Add 'startupPolicy' fields to aio-io_uring case

Extend the test for io_uring to also test startup policy.

Since the actual logic for dropping disks is in the host preparation
phase, thus skipped for tests we can use any file path.

Add a case also for 'file' backing to have all cases covered.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodocs: formatstorage: Format XML namespace definition as code block
Peter Krempa [Tue, 12 Jul 2022 09:22:34 +0000 (11:22 +0200)]
docs: formatstorage: Format XML namespace definition as code block

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2 years agovircpi: Add PCIe 5.0 and 6.0 link speeds
Michal Privoznik [Fri, 8 Jul 2022 12:29:32 +0000 (14:29 +0200)]
vircpi: Add PCIe 5.0 and 6.0 link speeds

The PCIe 5.0 and PCIe 6.0 standards define new link speeds:
32GT/s and 64GT/s, respectively. Update our internal enum to
include these new speeds. Otherwise we format incorrect XML:

  <pci-express>
    <link validity='cap' port='0' speed='(null)' width='16'/>
    <link validity='sta' speed='16' width='16'/>
  </pci-express>

Like all "good" specifications, these are also locked behind a
login portal. But we can look at pciutils' source code: [1] and
[2].

1: https://git.kernel.org/pub/scm/utils/pciutils/pciutils.git/commit/ls-caps.c?id=caca31a0eea41c7b051705704c1158fddc02fbd2
2: https://git.kernel.org/pub/scm/utils/pciutils/pciutils.git/commit/ls-caps.c?id=5bdf63b6b1bc35b59c4b3f47f7ca83ca1868155b

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2105231
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoci: Regenerate files with new lcitool
Peter Krempa [Mon, 11 Jul 2022 11:47:02 +0000 (13:47 +0200)]
ci: Regenerate files with new lcitool

Apart from other changes this fixes failures with builds on FreeBSD.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoqemucapabilitiestest: Fake proper version for 'caps_4.2.0.aarch64' case
Peter Krempa [Wed, 22 Jun 2022 13:28:49 +0000 (15:28 +0200)]
qemucapabilitiestest: Fake proper version for 'caps_4.2.0.aarch64' case

The capabilities for that version were not updated from the development
version and thus would fail our upcoming minimum version change. Fake
the data to report 4.2.0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemucapabilitiestest: Fake proper version for 'caps_4.2.0.ppc64' case
Peter Krempa [Wed, 22 Jun 2022 13:28:49 +0000 (15:28 +0200)]
qemucapabilitiestest: Fake proper version for 'caps_4.2.0.ppc64' case

The capabilities for that version were not updated from the development
version and thus would fail our upcoming minimum version change. Fake
the data to report 4.2.0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Remove qemu-4.0 version of 'cpu-translation' test case
Peter Krempa [Wed, 22 Jun 2022 13:07:22 +0000 (15:07 +0200)]
qemu: Remove qemu-4.0 version of 'cpu-translation' test case

The cpu commandline is identical with the '-latest' version so there's
no need for a separate case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Move real-caps versions of cpu-host tests out of the block setting...
Peter Krempa [Wed, 22 Jun 2022 11:30:18 +0000 (13:30 +0200)]
qemuxml2argvtest: Move real-caps versions of cpu-host tests out of the block setting fake host cpu

Make it obvious that the fake cpu does not apply to the test cases based
on real capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Make 'qemu-ns' test case more stable
Peter Krempa [Wed, 22 Jun 2022 11:07:53 +0000 (13:07 +0200)]
qemuxml2argvtest: Make 'qemu-ns' test case more stable

The test was showing that the 'blockdev' capability is properly added
although we didn't detect it yet. Unfortunately this test can't be
carried over once we bump minimum qemu version to qemu-4.2.

Make the test case future-proof by removing the qemu-4.0.0 version which
would become pointless and use only already deprecated capability flags
so that the test output does not change.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Convert 'net-user' case to _LATEST
Peter Krempa [Wed, 22 Jun 2022 11:03:24 +0000 (13:03 +0200)]
qemuxml2argvtest: Convert 'net-user' case to _LATEST

The tested net device has the same syntax with latest qemu so there's no
need to have a version-locked test for it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Remove qemu-4.0 versions of cpu feature test cases
Peter Krempa [Tue, 21 Jun 2022 14:54:01 +0000 (16:54 +0200)]
qemuxml2argvtest: Remove qemu-4.0 versions of cpu feature test cases

The cpu feature formatting doesn't change between the versions thus we
can just keep the '-latest' versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Convert 'cpu-eoi-(disabled|enabled)' cases to VIR_TEST_CAPS_LATEST
Peter Krempa [Tue, 21 Jun 2022 15:07:51 +0000 (17:07 +0200)]
qemuxml2argvtest: Convert 'cpu-eoi-(disabled|enabled)' cases to VIR_TEST_CAPS_LATEST

The tested feature doesn't change across versions so we can use the
modern testing infrastructure.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Drop 'qemu-4.1' versions of hyperv tests
Peter Krempa [Tue, 21 Jun 2022 14:43:16 +0000 (16:43 +0200)]
qemuxml2argvtest: Drop 'qemu-4.1' versions of hyperv tests

The version-locked version of the test data is identical to the 'latest'
version so we can remove them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2(argv|xml)test: Drop qemu-3.1 version of 'cpu-Icelake-Server-pconfig'
Peter Krempa [Tue, 21 Jun 2022 13:48:06 +0000 (15:48 +0200)]
qemuxml2(argv|xml)test: Drop qemu-3.1 version of 'cpu-Icelake-Server-pconfig'

Prior to qemu-3.2 we'd have to disable the 'pconfig' feature explicitly
which is no longer needed with new qemu. Remove the version locked to
qemu-3.1 as the 'latest' case sufficiently handles what we want to test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotest: domaincaps: Remove old test data
Peter Krempa [Tue, 21 Jun 2022 13:37:51 +0000 (15:37 +0200)]
test: domaincaps: Remove old test data

Remove the test data for qemu-2.11, qemu-2.12 and qemu-3.0 which are no
longer supported.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_monitor_json: Implement logic for setting iothread.thread-pool-{min,max}
Michal Privoznik [Thu, 30 Jun 2022 11:44:58 +0000 (13:44 +0200)]
qemu_monitor_json: Implement logic for setting iothread.thread-pool-{min,max}

When virDomainSetIOThreadParams() API is called, well its QEMU
impl: qemuDomainSetIOThreadParams() then typed params are parsed
by qemuDomainIOThreadParseParams() into this
qemuMonitorIOThreadInfo struct. In the struct we have a <int,
bool> pair for every IOThread attribute we can tune through
monitor. The struct is then passed to
qemuMonitorJSONSetIOThread() which looks at the bool and if set
then the corresponding attribute is set to given value. Each
attribute is thus changed in a separate call. While this works
for attributes independent of each other ("poll-max-ns",
"poll-grow", "poll-shrink"), it does not always work for the
other attributes ("thread-pool-min" and "thread-pool-max").

The limitation here is that the lower boundary (minimum) has to
be lower (or equal to) the upper boundary (maximum) at all times.

This means, that in some cases we might need to set attributes in
reversed order to meet the constraint.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/339
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Thu, 7 Jul 2022 10:33:55 +0000 (12:33 +0200)]
Translated using Weblate (Swedish)

Currently translated at 39.0% (4101 of 10491 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Translated using Weblate (Swedish)

Currently translated at 38.7% (4062 of 10491 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2 years agokbase: debuglogs: Add a note about auto-shutdown of daemons
Peter Krempa [Mon, 13 Jun 2022 13:48:51 +0000 (15:48 +0200)]
kbase: debuglogs: Add a note about auto-shutdown of daemons

When using runtime setting of logging with 'virt-admin' it can be
confusing that the settings are discarded when the shutdown timeout of a
daemon is reached.

Add a note about this behaviour along with a suggestion to use
virt-admin to disable the behaviour if needed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agovirt-admin: Introduce 'daemon-timeout'
Peter Krempa [Mon, 13 Jun 2022 13:27:27 +0000 (15:27 +0200)]
virt-admin: Introduce 'daemon-timeout'

Add a simple command to drive the new 'virAdmConnectSetDaemonTimeout'
API.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoadmin: Introduce virAdmConnectSetDaemonTimeout
Peter Krempa [Mon, 13 Jun 2022 11:02:09 +0000 (13:02 +0200)]
admin: Introduce virAdmConnectSetDaemonTimeout

Use of the admin APIs to modify logging temporarily has a rather serious
deficiency when the daemon whose config is being changed is using
auto-shutdown (default with socket-activated deployments) as the
configuration is discarded if there is no client or VM/other object
blocking auto shutdown.

This API allows users to disable/postpone shutdown timeout so that the
configuration doesn't change under their hands.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoscripts: apibuild: Improve error when API is missing from symbol file
Peter Krempa [Mon, 13 Jun 2022 12:44:08 +0000 (14:44 +0200)]
scripts: apibuild: Improve error when API is missing from symbol file

Improve:

 KeyError: 'virAdmConnectSetDaemonTimeout'

to

 Exception: Missing symbol file entry for 'virAdmConnectSetDaemonTimeout'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agovirNetDaemonAutoShutdown: Allow live update of shutdown timeout
Peter Krempa [Mon, 13 Jun 2022 12:25:06 +0000 (14:25 +0200)]
virNetDaemonAutoShutdown: Allow live update of shutdown timeout

Modify the code so that calling 'virNetDaemonAutoShutdown' will update
the auto shutdown timeout also for running daemons.

This involves changing the logic when to do the update of the timer so
that it can be called from both when the daemon is not yet runnign and
when doing a live update.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agovirnetdaemon: Extract autoShutdownTimer operations from virNetDaemonRun
Peter Krempa [Mon, 13 Jun 2022 11:58:13 +0000 (13:58 +0200)]
virnetdaemon: Extract autoShutdownTimer operations from virNetDaemonRun

Introduce 'virNetDaemonShutdownTimerRegister' and
'virNetDaemonShutdownTimerUpdate' to aggregate the code to deal with the
auto-shutdown timer.

The code is also placed so that it can be called from
'virNetDaemonAutoShutdown' which involved the move of
'virNetDaemonAutoShutdownTimer'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agodomain_postparse: Move error messages onto single line
Michal Privoznik [Thu, 7 Jul 2022 08:44:13 +0000 (10:44 +0200)]
domain_postparse: Move error messages onto single line

Our coding style suggests 80 chars per line with error messages
being exception (for easier git-grep). Apply this exception onto
the newly created domain_postparse.c file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: Separate domain post parse code into domain_postparse.c
Michal Privoznik [Thu, 7 Jul 2022 08:03:33 +0000 (10:03 +0200)]
conf: Separate domain post parse code into domain_postparse.c

The domain post parse functions currently live in domain_conf.c
which thus grows always larger. Mimic what we've done for the
validation code and move the post parse code into a separate
file: domain_postparse.c.

I've started by moving every function with PostParse in its name
into the new file and then compile hunting for helper functions
only to move them as well.

In the end, I've moved virDomainDefPostParse symbol in
libvirt_private.syms into a new section. And while
virDomainDeviceDefPostParseOne() is made 'public' in
domain_postparse.h too, I'm not exporting it because it has no
caller outside src/conf/ and it's unlikely it ever will.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodomain_conf: Unexport virDomainDefPostParseDeviceIteratorData
Michal Privoznik [Thu, 7 Jul 2022 08:09:27 +0000 (10:09 +0200)]
domain_conf: Unexport virDomainDefPostParseDeviceIteratorData

The virDomainDefPostParseDeviceIteratorData struct is exported in
domain_conf.h because it's used in both domain_conf.c and
domain_validate.c. However, the latter usage is not warranted,
it's just a shortcut so that we don't have to introduce a similar
struct just for domain_validate.c. Well, do the extra step and
introduce a separate structure for domain_validate.c. This allows
us to move post parse code later on.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirt-xml-validate: Fix incorrect wildcards for XML roots
Han Han [Wed, 6 Jul 2022 02:02:52 +0000 (10:02 +0800)]
virt-xml-validate: Fix incorrect wildcards for XML roots

To match the XML roots domainCapabilities and storagepoolCapabilities,
the wildcards should be *domainCap* and *storagepoolCap*.

Fixes: 7b0e2e4a558da6ea7e450d5a1a30d1557abc5aae
Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoschemas: rng: Make secret optional in storage vol
Han Han [Wed, 6 Jul 2022 02:42:02 +0000 (10:42 +0800)]
schemas: rng: Make secret optional in storage vol

For a qcow2 storage volume with luks encryption created by qemu-img, its
dumped storage vol XML has no secret element in encryption:
<volume type='file'>
    ...
    <encryption format='luks'>
    </encryption>
    ...
</volume>

That will cause a failure in rng validation. Fix that validation failure.

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agodocs: Fix syntax error in defaultiothread example
Han Han [Wed, 6 Jul 2022 06:20:30 +0000 (14:20 +0800)]
docs: Fix syntax error in defaultiothread example

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agodomain_validate: Properly terminate switch() in virDomainIOMMUDefValidate()
Michal Privoznik [Mon, 4 Jul 2022 13:32:35 +0000 (15:32 +0200)]
domain_validate: Properly terminate switch() in virDomainIOMMUDefValidate()

In my previous commit I've introduced virDomainIOMMUDefValidate()
function with a switch() statement. However, two cases in it,
though empty, were not terminated with a break statement which
made compiler complain.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2 years agodomain_validate: Disallow non-virtio IOMMU with an <address/>
Michal Privoznik [Mon, 4 Jul 2022 09:10:31 +0000 (11:10 +0200)]
domain_validate: Disallow non-virtio IOMMU with an <address/>

Per v8.3.0-rc1~199 it's only a virtio IOMMU that can have
<address/>. The rest (Intel and SMMUv3) are system devices and
thus have no address associated with them. However, this
assumption is never checked for.

Fixes: b0eb1e193f5db033d0fbbf91ff71a121066ad77c
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodocs: Document <address/> for IOMMU device
Michal Privoznik [Mon, 4 Jul 2022 09:10:09 +0000 (11:10 +0200)]
docs: Document <address/> for IOMMU device

The commit v8.3.0-rc1~199 introduced <address/> to <iommu/>
device. And while it updated the RNG it forgot to update the
docs. Fix that.

Fixes: b0eb1e193f5db033d0fbbf91ff71a121066ad77c
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_domain_address: Drop needless virDomainIOMMUModel typecast
Michal Privoznik [Mon, 4 Jul 2022 09:09:46 +0000 (11:09 +0200)]
qemu_domain_address: Drop needless virDomainIOMMUModel typecast

There are two places where the @model member of
_virDomainIOMMUDef struct is typecasted to virDomainIOMMUModel
which is completely unnecessary because the struct already
defines the member of that type.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoTranslated using Weblate (Russian)
Sergey A [Mon, 4 Jul 2022 01:18:58 +0000 (03:18 +0200)]
Translated using Weblate (Russian)

Currently translated at 91.3% (9567 of 10472 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/ru/

Co-authored-by: Sergey A <sw@atrus.ru>
Signed-off-by: Sergey A. <sw@atrus.ru>
2 years agoFix spelling
Tim Wiederhake [Mon, 4 Jul 2022 08:07:47 +0000 (10:07 +0200)]
Fix spelling

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
2 years agoTranslated using Weblate (Korean)
김인수 [Sat, 2 Jul 2022 01:18:53 +0000 (03:18 +0200)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10472 of 10472 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/ko/

Co-authored-by: 김인수 <simmon@nplob.com>
Signed-off-by: 김인수 <simmon@nplob.com>
2 years agoconf: fix error message for wrong thread_pool_size
Ján Tomko [Fri, 1 Jul 2022 14:13:23 +0000 (16:13 +0200)]
conf: fix error message for wrong thread_pool_size

Fix the copy-and-paste error by referring to the correct variable.

Fixes: 0df2e7df80452f81edbfeb0ee355235b533346a9
https://bugzilla.redhat.com/show_bug.cgi?id=2103132

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2 years agostoragepoolxml2argvtest: Fix output data for 'pool-netfs-protocol-ver'
Peter Krempa [Fri, 1 Jul 2022 14:53:08 +0000 (16:53 +0200)]
storagepoolxml2argvtest: Fix output data for 'pool-netfs-protocol-ver'

The storage pool tests have host-specific versions which I neglected to
update in commit c44930d932203b4a58dccbbeaa814fff6cea8216 thus breaking
the test-suite on non-linux OSes.

Fixes: c44930d932203b4a58dccbbeaa814fff6cea8216
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2 years agostorage: pool: Allow more intricate nfs protocol versions
Peter Krempa [Thu, 23 Jun 2022 15:17:06 +0000 (17:17 +0200)]
storage: pool: Allow more intricate nfs protocol versions

Treat the 'protocolVer' field as a string so that e.g. '4.1' can be
used. Forbid only ',' in the string as it's a separator of arguments for
mount options.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoNEWS: Document improvements to firmware autoselection
Andrea Bolognani [Thu, 23 Jun 2022 13:26:00 +0000 (15:26 +0200)]
NEWS: Document improvements to firmware autoselection

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agodocs: Add kbase page for Secure Boot
Andrea Bolognani [Wed, 22 Jun 2022 10:08:04 +0000 (12:08 +0200)]
docs: Add kbase page for Secure Boot

Provide simple recipes for the most common high-level tasks.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu_firmware: enrolled-keys requires secure-boot
Andrea Bolognani [Thu, 9 Jun 2022 17:02:15 +0000 (19:02 +0200)]
qemu_firmware: enrolled-keys requires secure-boot

No sane firmware build will fail this check, but just to be on
the safe side let's check anyway.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu_firmware: Enable loader.secure when requires-smm
Andrea Bolognani [Thu, 9 Jun 2022 15:59:33 +0000 (17:59 +0200)]
qemu_firmware: Enable loader.secure when requires-smm

Currently, a firmware configuration such as

  <os firmware='efi'>
    <firmware>
      <feature enabled='yes' name='enrolled-keys'/>
    </firmware>
  </os>

will correctly pick a firmware that implements the Secure Boot
feature and initialize the NVRAM file so that it contains the
keys necessary to enforce the signing requirements. However, the
lack of a

  <loader secure='yes'/>

element makes it possible for pflash writes to happen outside
of SMM mode. This means that the authenticated UEFI variables
where the keys are stored could potentially be overwritten by
malicious code running in the guest, thus making it possible to
circumvent Secure Boot.

To prevent that from happening, automatically turn on the
loader.secure feature whenever a firmware that implements Secure
Boot is chosen by the firmware autoselection logic. This is
identical to the way we already automatically enable SMM in such
a scenario.

Note that, while this is technically a guest-visible change, it
will not affect migration of existings VMs and will not prevent
legitimate guest code from running.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoconf: Reject features when using manual firmware selection
Andrea Bolognani [Mon, 20 Jun 2022 15:44:31 +0000 (17:44 +0200)]
conf: Reject features when using manual firmware selection

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoconf: Always parse firmware features
Andrea Bolognani [Mon, 20 Jun 2022 15:44:17 +0000 (17:44 +0200)]
conf: Always parse firmware features

Regardless of whether firmware autoselection is in use, we
still want to parse the list of requested features. Doing this
will allow us to produce better error messages.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoconf: Validate firmware configuration more thoroughly
Andrea Bolognani [Wed, 15 Jun 2022 10:00:58 +0000 (12:00 +0200)]
conf: Validate firmware configuration more thoroughly

Generally speaking, when firmware autoselection is in use we
don't want any information to be provided manually. There are
two exceptions:

  * we still want the path to the NVRAM file to be customizable;

  * using <loader secure='yes'/> was how you would ask for a
    firmware that implements the Secure Boot feature in the
    original approach to firmware autoselection, so we want to
    keep that working.

Anything else should result in a descriptive error.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/327
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoconf: Refactor virDomainDefOSValidate()
Andrea Bolognani [Thu, 16 Jun 2022 09:30:30 +0000 (11:30 +0200)]
conf: Refactor virDomainDefOSValidate()

This makes it explicit that there are two possible scenarios
(whether or not firmware autoselection is in use) and will make
upcoming changes cleaner to implement.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>