]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
2 years agoqemu: capabilities: Introduce virQEMUCapsMachineSupportsACPI
Peter Krempa [Mon, 27 Feb 2023 14:44:57 +0000 (15:44 +0100)] 
qemu: capabilities: Introduce virQEMUCapsMachineSupportsACPI

The helper returns the 'acpi' flag for a given machine type.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Extract whether machine type supports ACPI
Peter Krempa [Mon, 27 Feb 2023 13:45:47 +0000 (14:45 +0100)] 
qemu: capabilities: Extract whether machine type supports ACPI

The return data from 'query-machines' now contains an 'acpi' field. If
the field is present we can use it to decide how to handle user's
setting of '<acpi/>' domain feature.

Add logic to extract the 'acpi' field and store it in machine type list
along with other properties.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Refactor XML parsing in virQEMUCapsLoadMachines
Peter Krempa [Mon, 27 Feb 2023 13:45:06 +0000 (14:45 +0100)] 
qemu: capabilities: Refactor XML parsing in virQEMUCapsLoadMachines

Use the appropriate virXMLProp* helpers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: qemucapabilitiesdata: Update capabilities for the qemu-8.0 dev cycle on x86_64
Peter Krempa [Wed, 1 Mar 2023 11:57:17 +0000 (12:57 +0100)] 
tests: qemucapabilitiesdata: Update capabilities for the qemu-8.0 dev cycle on x86_64

Update to v7.2.0-2146-g2946e1af27

Notable changes:

 - 'acpi' field in 'query-machines' added
 - 'SapphireRapids(-v1)' cpu model added
 - 'fsrs', 'fsrc', 'fzrm' cpu features added and available via TCG
 - 'fsrm' feature can be now emulated by qemu
 - 'smm-enabled' property added to 'ICH9-LPC' device
 - 'luks-any' encryption type for RBD blockdev backend and way to
    specify encryption options for parent image via 'parent'
 - 'xen-event-inject', 'xen-event-list' commands added
 - 'xen-xenstore', 'xen-gnttab', 'xen-evtchn', 'xen-overlay',
   'xen-platform'
 - 'i2c-echo' device added

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Retire unused QEMU_CAPS_IOTHREAD_POLLING
Peter Krempa [Thu, 23 Feb 2023 09:13:20 +0000 (10:13 +0100)] 
qemu: capabilities: Retire unused QEMU_CAPS_IOTHREAD_POLLING

We now always assume support for polling mode of iothreads.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Always assume support for QEMU_CAPS_IOTHREAD_POLLING
Peter Krempa [Thu, 23 Feb 2023 09:09:46 +0000 (10:09 +0100)] 
qemu: Always assume support for QEMU_CAPS_IOTHREAD_POLLING

iothread polling mode and the corresponding properties were added in
qemu-2.9 ( 0d9d86fb4df4882b ). We can always assume that qemu supports
them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Retire unused QEMU_CAPS_OBJECT_IOTHREAD
Peter Krempa [Thu, 23 Feb 2023 08:57:24 +0000 (09:57 +0100)] 
qemu: capabilities: Retire unused QEMU_CAPS_OBJECT_IOTHREAD

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Always assume support for iothreads
Peter Krempa [Thu, 23 Feb 2023 08:28:25 +0000 (09:28 +0100)] 
qemu: Always assume support for iothreads

iothreads were introduced in qemu-2.0 and can't be compiled out thus we
can always assume qemu supports them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: qemuxml2argvdata: Remove irrelevant <disk> from 'iothread-*' cases
Peter Krempa [Tue, 28 Feb 2023 14:35:12 +0000 (15:35 +0100)] 
tests: qemuxml2argvdata: Remove irrelevant <disk> from 'iothread-*' cases

Remove disks which are not necessary to demonstrate iothread config.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Modernize negative cputune-* cases
Peter Krempa [Thu, 23 Feb 2023 08:21:41 +0000 (09:21 +0100)] 
qemuxml2argvtest: Modernize negative cputune-* cases

Use latest caps for the tests even though the original test case didn't
need any capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2(argv|xmltest): Simplify testing of scheduler settings
Peter Krempa [Thu, 23 Feb 2023 08:07:50 +0000 (09:07 +0100)] 
qemuxml2(argv|xmltest): Simplify testing of scheduler settings

Remove the cputune-iothreads, cputune-iothreadsched-zeropriority,
cputune-iothreadsched test files by moving the relevant elements into
the cputune case as we can setup scheduler settings for multiple objects
and thus test everything in one go.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2(argv|xml)test: Modernize 'cputune' test cases
Peter Krempa [Wed, 22 Feb 2023 14:57:47 +0000 (15:57 +0100)] 
qemuxml2(argv|xml)test: Modernize 'cputune' test cases

Use DO_TEST_CAPS_LATEST for cputune-numatune, cputune-zero-shares,
cputune, and vcpu-placement-static cases. Do the necessary tweaks to
work with actual data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2xmltest: Modernize iothread CWW/SCSI test cases
Peter Krempa [Wed, 22 Feb 2023 14:37:52 +0000 (15:37 +0100)] 
qemuxml2xmltest: Modernize iothread CWW/SCSI test cases

The argv counterparts are already modernized.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Modernize the rest of 'iohtreads-*'
Peter Krempa [Wed, 22 Feb 2023 14:23:04 +0000 (15:23 +0100)] 
qemuxml2argvtest: Modernize the rest of 'iohtreads-*'

Use DO_TEST_CAPS_LATEST for the basic tests. The emulator needed to be
tweaked to work with the real caps data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2(argv|xml)test: Remove 'iothreads' case
Peter Krempa [Wed, 22 Feb 2023 14:16:24 +0000 (15:16 +0100)] 
qemuxml2(argv|xml)test: Remove 'iothreads' case

'iothreads-disk' covers everything that 'iothreads' did in addition to
actually using the iothread.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Remove 'iothreads-nocap'
Peter Krempa [Wed, 22 Feb 2023 14:10:07 +0000 (15:10 +0100)] 
qemuxml2argvtest: Remove 'iothreads-nocap'

All supported QEMU versions now support iothreads thus upcoming patches
will be removing the capability checks. Remove the 'iothreads-nocap'
case which will become invalid.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: virDomainDiskDefDriverParseXML: Drop unused XPath infrastructure
Peter Krempa [Thu, 23 Feb 2023 15:05:42 +0000 (16:05 +0100)] 
conf: virDomainDiskDefDriverParseXML: Drop unused XPath infrastructure

The function doesn't use XPath at all. Don't pass the context to it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agogendispatch: Drop 'aclapi' mode
Peter Krempa [Tue, 21 Feb 2023 14:57:01 +0000 (15:57 +0100)] 
gendispatch: Drop 'aclapi' mode

The separate API perms XML is no longer used. Remove the support for
generating it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodocs|access: Don't build the ACL flags into a separate XML
Peter Krempa [Tue, 21 Feb 2023 14:54:36 +0000 (15:54 +0100)] 
docs|access: Don't build the ACL flags into a separate XML

Since we now build it into the libvirt-api.xml or equivalents we don't
need the extra XML files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodocs/newapi.xsl: Take API flag data from libvirt-api.xml rather than access/libvirt...
Peter Krempa [Tue, 21 Feb 2023 14:05:44 +0000 (15:05 +0100)] 
docs/newapi.xsl: Take API flag data from libvirt-api.xml rather than access/libvirt-access.xml

Since now we embed the data in the libvirt API we don't need to source
it from the extra document.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoscripts/apibuild: Extract and format API ACLs
Peter Krempa [Tue, 21 Feb 2023 13:20:09 +0000 (14:20 +0100)] 
scripts/apibuild: Extract and format API ACLs

As an additional step before processing the API parse the protocol file
and extract all ACL definitions. This way we can distribute them for any
user of the libvirt API XML files. We will be also able to avoid another
call to gendispatch, which generates all this data into a standalone
XML.

The remote procedure to API name is inspired by what rpcgen does.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoapibuild: Add infrastructure for generating ACL flag info into function docs
Peter Krempa [Tue, 21 Feb 2023 13:06:02 +0000 (14:06 +0100)] 
apibuild: Add infrastructure for generating ACL flag info into function docs

If the user of the 'docBuilder' class provides a dict (key is API name,
value is a tuple of arrays (acls, aclfilters), use the dict to generate
ACL definitions into the function definition.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoremote_protocol: Fix list of supported ACL object names
Peter Krempa [Tue, 21 Feb 2023 13:04:54 +0000 (14:04 +0100)] 
remote_protocol: Fix list of supported ACL object names

Add missing and fix spelling of existing ones.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agosrc: Document virDomainInterfaceStats() limitation
Michal Privoznik [Mon, 6 Mar 2023 08:56:52 +0000 (09:56 +0100)] 
src: Document virDomainInterfaceStats() limitation

For unmanaged ethernet <interface/>, it is user's responsibility
to set up the interface. And as such it can be just anything.
Therefore, it's (almost) impossible for the
virDomainInterfaceStats() API to tell whether RX/TX values need
to be swapped or copied verbatim into the return structure.
Document this limitation.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoconf: Make macvtap ethernet share host view
Michal Privoznik [Wed, 1 Mar 2023 10:05:49 +0000 (11:05 +0100)] 
conf: Make macvtap ethernet share host view

When fetching stats for a domain's <interface/>, or when setting
up its QoS, we can face two situations:

1) the device "shares" the host view, meaning each packet
   sent/received on the interface by a domain is accounted for in
   the same category on the host, or

2) the device is at the other side, and a packet send by a
   domain, is in fact packet received on the host.

This fact affects whether we need to swap RX/TX values when
fetching stats, or setting up QoS. We have this convenient helper
function (virDomainNetTypeSharesHostView()), which returns to
which category given interface type falls into.

Now, for unmanaged type='ethernet' our options are quite limited,
because it's user's responsibility to set up the host side of the
interface. And it can be just anything. Fortunately, we have
another convenience function (virNetDevMacVLanIsMacvtap()), which
determines whether given interface is a macvtap (which is
notoriously known for falling into the first category).
Let's use it to help virDomainNetTypeSharesHostView() determine
the view more accurately.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2175449
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu: Remove duplicate user/group lookup
Andrea Bolognani [Wed, 1 Mar 2023 17:57:29 +0000 (18:57 +0100)] 
qemu: Remove duplicate user/group lookup

Commit 068efae5b1a9 created a copy of this code instead of
simply moving it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agotests: Print fakerootdir when it's preserved
Andrea Bolognani [Wed, 1 Mar 2023 10:11:23 +0000 (11:11 +0100)] 
tests: Print fakerootdir when it's preserved

Setting the LIBVIRT_SKIP_CLEANUP environment variable results
in the contents of fakerootdir being preserved for inspection.
Be more helpful towards the developer and print out the path
in this case.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agotests: Move fakerootdir handling to common logic
Andrea Bolognani [Wed, 1 Mar 2023 10:06:14 +0000 (11:06 +0100)] 
tests: Move fakerootdir handling to common logic

Instead of having each test manually initialize and cleanup
its own fakerootdir, do that as part of the common test
initialization logic in virTestMain().

In most cases we can simply drop the relevant code from the
test program, but scsihosttest uses the value of fakerootdir
as a starting point to build another path, so we need to do
things slightly differently. In order to keep things working,
we retrieve the value from the LIBVIRT_FAKE_ROOT_DIR
environment variable, same as all the mock libraries are
already doing.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agotests: Adopt fakerootdir helpers
Andrea Bolognani [Wed, 1 Mar 2023 09:52:14 +0000 (10:52 +0100)] 
tests: Adopt fakerootdir helpers

Most replacements are completely straightforward but
vircgrouptest requires slightly different handling because,
instead of initializing a single fakerootdir at the start of
the test program and cleaning it up at the end, it creates
multiple different ones one after the other.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agotests: Introduce helpers for fakerootdir handling
Andrea Bolognani [Wed, 1 Mar 2023 09:39:44 +0000 (10:39 +0100)] 
tests: Introduce helpers for fakerootdir handling

We have this logic open-coded all over the test suite. Provide
proper helpers implementing it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agonews: Document support for QCOW2 format firmware
Andrea Bolognani [Tue, 14 Feb 2023 16:40:49 +0000 (17:40 +0100)] 
news: Document support for QCOW2 format firmware

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agonews: Document changes to firmware autoselection
Andrea Bolognani [Tue, 14 Feb 2023 16:46:11 +0000 (17:46 +0100)] 
news: Document changes to firmware autoselection

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agodocs: Document firmware format attribute
Andrea Bolognani [Tue, 14 Feb 2023 16:38:10 +0000 (17:38 +0100)] 
docs: Document firmware format attribute

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agotests: Add more firmware tests
Andrea Bolognani [Wed, 8 Feb 2023 17:47:39 +0000 (18:47 +0100)] 
tests: Add more firmware tests

These cover various scenarios related to firmware formats,
specifically ensuring that all the ways in which the user can
ask for a non-default format to be used work correctly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Add support for QCOW2 format firmware
Andrea Bolognani [Tue, 7 Feb 2023 17:59:00 +0000 (18:59 +0100)] 
qemu: Add support for QCOW2 format firmware

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoconf: Accept QCOW2 firmware format
Andrea Bolognani [Fri, 27 Jan 2023 18:12:33 +0000 (19:12 +0100)] 
conf: Accept QCOW2 firmware format

All of the drivers will reject this value, at least for now.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Propagate firmware format
Andrea Bolognani [Tue, 31 Jan 2023 18:16:18 +0000 (19:16 +0100)] 
qemu: Propagate firmware format

Take the information from the descriptor and store it in the
domain definition. Various things, such as the arguments passed
to -blockdev and the path generated for the NVRAM file, will
then be based on it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Filter firmwares based on format
Andrea Bolognani [Tue, 31 Jan 2023 16:46:58 +0000 (17:46 +0100)] 
qemu: Filter firmwares based on format

If the user has requested a specific firmware format, then
all firmware builds that are not in that format should be
ignored while looking for matches.

The legacy hardcoded firmware list predates firmware
descriptors and their "format" field, so we can safely
assume that all builds listed in there are in raw format.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agodrivers: Reject unsupported firmware formats
Andrea Bolognani [Tue, 7 Feb 2023 18:12:44 +0000 (19:12 +0100)] 
drivers: Reject unsupported firmware formats

This ensures that, as we add support for more formats at the
domain XML level, we don't accidentally cause drivers to
misbehave or users to get confused.

All existing drivers support the raw format, and supporting
additional formats will require explicit opt-in on the
driver's part.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoconf: Parse firmware format
Andrea Bolognani [Mon, 13 Feb 2023 17:13:23 +0000 (18:13 +0100)] 
conf: Parse firmware format

The default is raw, which corresponds to the historical
behavior and is also the only accepted value, at least for
now.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoconf: Change handling for empty NVRAM path
Andrea Bolognani [Tue, 31 Jan 2023 13:35:28 +0000 (14:35 +0100)] 
conf: Change handling for empty NVRAM path

Right now, this results in loader->nvram being NULL, which is
reasonable: loader->nvramTemplate is stored separately, so if
the <nvram> element doesn't contain a path there is really no
useful information inside it.

However, this is about to change, so we will find ourselves
needing to hold on to loader->nvram even when no path is
present. Change the firmware handling code so that such a
scenario is dealt with appropriately.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Introduce qemuFirmwareEnsureNVRAM()
Andrea Bolognani [Fri, 3 Feb 2023 18:21:03 +0000 (19:21 +0100)] 
qemu: Introduce qemuFirmwareEnsureNVRAM()

This helper replaces qemuDomainNVRAMPathFormat() and also
incorporates some common operations that all callers of that
helper needed.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Move qemuDomainNVRAMPathFormat() to qemu_firmware
Andrea Bolognani [Fri, 27 Jan 2023 14:49:36 +0000 (15:49 +0100)] 
qemu: Move qemuDomainNVRAMPathFormat() to qemu_firmware

There are no other callers remaining.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Move firmware selection from startup to postparse
Andrea Bolognani [Tue, 24 Jan 2023 16:01:48 +0000 (17:01 +0100)] 
qemu: Move firmware selection from startup to postparse

Currently, firmware selection is performed as part of the
domain startup process. This mostly works fine, but there's a
significant downside to this approach: since the process is
affected by factors outside of libvirt's control, specifically
the contents of the various JSON firmware descriptors and
their names, it's pretty much impossible to guarantee that the
outcome is always going to be the same. It would only take an
edk2 update, or a change made by the local admin, to render a
domain unbootable or downgrade its boot security.

To avoid this, move firmware selection to the postparse phase.
This way it will only be performed once, when the domain is
first defined; subsequent boots will not need to go through
the process again, as all the paths that were picked during
firmware selection are recorded in the domain XML.

Care is taken to ensure that existing domains are handled
correctly, even if their firmware configuration can't be
successfully resolved. Failure to complete the firmware
selection process is only considered fatal when defining a
new domain; in all other cases the error will be reported
during startup, as is already the case today.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoconf: Export virDomainDefOSValidate()
Andrea Bolognani [Thu, 26 Jan 2023 15:36:34 +0000 (16:36 +0100)] 
conf: Export virDomainDefOSValidate()

We're going to need it elsewhere very soon.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agotests: Add descriptors for QCOW2 format firmware builds
Andrea Bolognani [Fri, 27 Jan 2023 16:48:43 +0000 (17:48 +0100)] 
tests: Add descriptors for QCOW2 format firmware builds

Now that we ignore all firmwares that are not in raw format
while performing autoselection, we can have descriptors for
firmware builds in QCOW2 format without breaking anything.

Note that the descriptors are arranged so that they have the
highest priority on aarch64, but the lowest one on x86_64.
This matches the expectation that QCOW2 will quickly be
adopted as the default on aarch64, where its use produces
significant benefits in terms of memory usage, while x86_64
will likely stick with raw for the foreseeable future.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Don't pick firmware with unsupported format
Andrea Bolognani [Fri, 27 Jan 2023 16:39:25 +0000 (17:39 +0100)] 
qemu: Don't pick firmware with unsupported format

Right now, if the descriptor with the highest priority happens
to describe a firmware in a format other than raw, no domain
that uses autoselection will be able to start.

A better approach is to filter out descriptors that advertise
unsupported formats during autoselection.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Don't pick firmware that requires SMM when smm=off
Andrea Bolognani [Fri, 27 Jan 2023 16:22:24 +0000 (17:22 +0100)] 
qemu: Don't pick firmware that requires SMM when smm=off

At the moment, if SMM is explicitly disabled in the domain XML
but a firmware descriptor that requires SMM to be enabled has
the highest priority and otherwise matches the requirements,
we pick that firmware only to error out later, when the domain
is started.

A better approach is to take into account the fact that SMM is
disabled while performing autoselection, and ignore all
descriptors that advertise the requires-smm feature.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Clear os.firmwareFeatures after autoselection
Andrea Bolognani [Tue, 24 Jan 2023 18:38:37 +0000 (19:38 +0100)] 
qemu: Clear os.firmwareFeatures after autoselection

We already clear os.firmware, so it doesn't make sense to keep
the list of features around.

Moreover, our validation routines will reject an XML that
contains a list of firmware features but disables firmware
autoselection, so not clearing these means that the live XML
for a domain that uses feature-based autoselection can't be
fed back into libvirt.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Only fill nvramTemplate for local sources
Andrea Bolognani [Fri, 10 Feb 2023 18:43:53 +0000 (19:43 +0100)] 
qemu: Only fill nvramTemplate for local sources

It doesn't make sense for non-local sources, since we can't
create or reset the corresponding NVRAM file.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Add convenience local variables
Andrea Bolognani [Fri, 27 Jan 2023 16:35:30 +0000 (17:35 +0100)] 
qemu: Add convenience local variables

This makes the code more compact and less awkward.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoconf: Introduce virDomainLoaderDefNew()
Andrea Bolognani [Tue, 31 Jan 2023 16:05:44 +0000 (17:05 +0100)] 
conf: Introduce virDomainLoaderDefNew()

For now we just allocate the object, so the only advantage is
that invocations are shorter and look a bit nicer.

Later on, its introduction will pay off by letting us change
things in a single spot instead of all over the library.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoconf: Introduce virDomainLoaderDefParseXMLLoader()
Andrea Bolognani [Fri, 10 Feb 2023 15:42:11 +0000 (16:42 +0100)] 
conf: Introduce virDomainLoaderDefParseXMLLoader()

We already handle the <nvram> element in a separate helper,
which is cleaner than having all the logic in the top-level
virDomainLoaderDefParseXML() function.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Introduce qemuDomainDefBootPostParse()
Andrea Bolognani [Fri, 20 Jan 2023 16:13:00 +0000 (17:13 +0100)] 
qemu: Introduce qemuDomainDefBootPostParse()

Move all the boot related parts of qemuDomainDefPostParse()
to a separate helper.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Introduce qemuDomainDefMachinePostParse()
Andrea Bolognani [Fri, 20 Jan 2023 16:04:28 +0000 (17:04 +0100)] 
qemu: Introduce qemuDomainDefMachinePostParse()

Move all the machine type related parts of
qemuDomainDefPostParse() to a separate helper.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agotests: Add more firmware tests
Andrea Bolognani [Fri, 10 Feb 2023 16:40:29 +0000 (17:40 +0100)] 
tests: Add more firmware tests

These cover scenarios such as using the new, more verbose
format of the <nvram> element to point to a local path, mixing
firmware autoselection with non-local NVRAM files, and
explicitly disabling SMM when using firmware autoselection.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agotests: Enable qemuxml2xml for more firmware tests
Andrea Bolognani [Wed, 8 Feb 2023 18:15:55 +0000 (19:15 +0100)] 
tests: Enable qemuxml2xml for more firmware tests

Some of the test cases had only been added to the xml2argv
test program and not to the xml2xml one.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agotests: Unify input files for firmware tests
Andrea Bolognani [Wed, 8 Feb 2023 18:28:05 +0000 (19:28 +0100)] 
tests: Unify input files for firmware tests

Most of the differences, such as those in the domain name or
amount of memory, are fairly harmless, but they still make it
more cumbersome than necessary to directly compare different
input (and output) files.

More importantly, the use of unversioned machine types in some
of the test cases results in the descriptor-based autoselection
logic being effectively skipped, because the compatible machine
types as listed in them are only the versioned variants.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agotests: Move firmware tests to CAPS_LATEST
Andrea Bolognani [Wed, 8 Feb 2023 18:10:48 +0000 (19:10 +0100)] 
tests: Move firmware tests to CAPS_LATEST

This is already the case for the vast majority, but a few are
using explicit capabilities lists.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agotests: Use x86_64 for all x86 firmware tests
Andrea Bolognani [Wed, 8 Feb 2023 18:24:51 +0000 (19:24 +0100)] 
tests: Use x86_64 for all x86 firmware tests

Most test cases are on 64-bit architectures already, but there
are a couple of exceptions.

Right now this works, but it will no longer fly after some
upcoming changes. Prepare for those by switching away from
32-bit architectures.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agotests: Rename firmware-manual-efi-rw* tests
Andrea Bolognani [Thu, 26 Jan 2023 14:23:38 +0000 (15:23 +0100)] 
tests: Rename firmware-manual-efi-rw* tests

These test cases deal with EFI, not BIOS.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agotests: Set nvramDir in qemuxml2xmltest
Andrea Bolognani [Thu, 26 Jan 2023 17:33:22 +0000 (18:33 +0100)] 
tests: Set nvramDir in qemuxml2xmltest

We already do this in qemuxml2argvtest.

Right now setting this doesn't change anything, but it will
become relevant later.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agodocs: Fix documentation for loader.stateless attribute
Andrea Bolognani [Fri, 27 Jan 2023 15:44:43 +0000 (16:44 +0100)] 
docs: Fix documentation for loader.stateless attribute

It works exactly the other way around.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Let virCommand module translate exitstatus
Michal Privoznik [Mon, 13 Feb 2023 11:35:28 +0000 (12:35 +0100)] 
qemu: Let virCommand module translate exitstatus

When starting (some) external helpers, callers of
qemuSecurityCommandRun() pass &exitstatus variable, to learn the
exit code of helper process (with qemuTPMEmulatorStart() being
the only exception). Then, if the status wasn't zero they produce
a generic error message, like:

  "Starting of helper process failed. exitstatus=%d"

or, in case of qemuPasstStart():

  "Could not start 'passt': %s"

This is needless as virCommandRun() (that's called under the
hood), can do both for us, if NULL was passed instead of
@exitstatus. Not only it appends exit status, it also reads
stderr of failed command producing comprehensive error message:

  Child process (${args}) unexpected exit status ${exitstatus}: ${stderr}

Therefore, pass NULL everywhere. But in contrast with one of
previous commits which removed @cmdret argument, there could be a
sensible caller which might want to process exit code. So keep
the argument for now and just pass NULL.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Drop @cmdret argument from qemuSecurityCommandRun()
Michal Privoznik [Mon, 13 Feb 2023 11:27:49 +0000 (12:27 +0100)] 
qemu: Drop @cmdret argument from qemuSecurityCommandRun()

Every single caller of qemuSecurityCommandRun() calls the
function as:

  if (qemuSecurityCommandRun(..., &cmdret) < 0)
      goto cleanup;

  if (cmdret < 0)
      goto cleanup;

(modulo @exitstatus shenanigans)

Well, there's no need for such complication. There isn't a single
caller (and probably will never be (TM)), that would need to
distinguish the reason for the failure. Therefore,
qemuSecurityCommandRun() can be made to pass the retval of
virCommandRun() called under the hood.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Don't overwrite error from qemuSecurityCommandRun()
Michal Privoznik [Mon, 13 Feb 2023 11:18:02 +0000 (12:18 +0100)] 
qemu: Don't overwrite error from qemuSecurityCommandRun()

The usual pattern when starting a helper daemon is:

  if (qemuSecurityCommandRun(..., &exitstatus, &cmdret) < 0)
      goto cleanup;

  if (cmdret < 0 || exitstatus != 0) {
      virReportError();
      goto cleanup;
  }

The only problem with this pattern is that if virCommandRun()
fails (i.e. cmdret < 0), then proper error was already reported.
But in this pattern we overwrite it (usually with less specific)
error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_slirp: Don't set errfd when starting slirp helper
Michal Privoznik [Mon, 20 Feb 2023 09:49:34 +0000 (10:49 +0100)] 
qemu_slirp: Don't set errfd when starting slirp helper

Way back, in v6.2.0-rc1~67 we removed the code that reads slirp's
stderr on failed startup. However, we forgot to remove
corresponding virCommandSetErrorFD() call and variable
declaration. Do that now.

While this may seem like a step in wrong direction (we should be
reading stderr as it may contain reason for failed start), this
is going to be handled in more general way in next commits.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agosecurity: Add support for SUSE edk2 firmware paths
Jim Fehlig [Thu, 23 Feb 2023 18:02:46 +0000 (11:02 -0700)] 
security: Add support for SUSE edk2 firmware paths

SUSE installs edk2 firmwares for both x86_64 and aarch64 in /usr/share/qemu.
Add support for this path in virt-aa-helper and allow locking files within
the path in the libvirt qemu abstraction.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemu: domain: Unexport qemuDomainObjTaintMsg
Peter Krempa [Wed, 1 Mar 2023 16:03:56 +0000 (17:03 +0100)] 
qemu: domain: Unexport qemuDomainObjTaintMsg

The function is used only inside qemu_domain.c, unexport it and move it
above its user.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoqemu: domain: Fix logic when tainting domain
Peter Krempa [Wed, 1 Mar 2023 16:09:42 +0000 (17:09 +0100)] 
qemu: domain: Fix logic when tainting domain

Originally the code was skipping all repeated taints with the same taint
flag but a logic bug introduced in commit 30626ed15b239c424ae inverted
the condition. This caused that actually the first occurence was NOT
logged but any subsequent was.

This was noticed when going through oVirt logs as they use custom guest
agent commands and the logs are totally spammed with this message.

Fixes: 30626ed15b239c424ae891f096057a696eadd715
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoconf: domain: Add comment for 'virDomainObjTaint'
Peter Krempa [Wed, 1 Mar 2023 16:08:42 +0000 (17:08 +0100)] 
conf: domain: Add comment for 'virDomainObjTaint'

Outline what the function does, especially the return value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoqemu: agent: Make fetching of 'can-offline' member from 'guest-query-vcpus' optional
Peter Krempa [Wed, 1 Mar 2023 15:51:42 +0000 (16:51 +0100)] 
qemu: agent: Make fetching of 'can-offline' member from 'guest-query-vcpus' optional

The 'can-offline' member is optional according to agent's schema and in
fact in certain cases it's not returned. Libvirt then spams the logs
if something is polling the bulk guest stats API.

Noticed when going through oVirt logs which appears to call the bulk
stats API repeatedly.

Instead of requiring it we simply reply that the vCPU can't be offlined.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoqemu: Align arguments correctly
Andrea Bolognani [Wed, 1 Mar 2023 17:48:43 +0000 (18:48 +0100)] 
qemu: Align arguments correctly

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2 years agoci: Regenerate gitlab CI config with latest lcitool
Peter Krempa [Mon, 27 Feb 2023 11:34:47 +0000 (12:34 +0100)] 
ci: Regenerate gitlab CI config with latest lcitool

The latest 'lcitool' now generates the CI config in a way which
allows users to kick off pipelines with the upstream projects container
environment rather than building a throwaway updated environment each
time and enables a gitlab feature to time individual script lines.
Pull it into libvirt.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2 years agoqemu_monitor: Decouple switch()-es in qemuMonitorJSONGetMemoryDeviceInfo()
Michal Privoznik [Mon, 27 Feb 2023 09:22:28 +0000 (10:22 +0100)] 
qemu_monitor: Decouple switch()-es in qemuMonitorJSONGetMemoryDeviceInfo()

There are two switch() statements over the same variable inside
of qemuMonitorJSONGetMemoryDeviceInfo(). Join them together into
one switch.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agoqemu_monitor: Switch to virDomainMemoryModel enum in qemuMonitorJSONGetMemoryDeviceInfo()
Michal Privoznik [Mon, 27 Feb 2023 09:58:27 +0000 (10:58 +0100)] 
qemu_monitor: Switch to virDomainMemoryModel enum in qemuMonitorJSONGetMemoryDeviceInfo()

When processing memory devices (as a reply from QEMU), a bunch of
STREQ()-s is used. Fortunately, the set of strings we process is
the same as virDomainMemoryModel enum. Therefore, we can use
virDomainMemoryModelTypeFromString() and then use integer
comparison (well, switch()). This has an upside: introducing a
new memory model lets us see what places need adjusting
immediately at compile time.

NB, this is in contrast with cmd line generator
(qemuBuildMemoryDeviceProps()), where more specific models are
generated (e.g. "pc-dimm", "virtio-mem-pci", etc.). But QEMU
reports back the parent model, instead of specific child
instance.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agolibvirt_private.syms: Export virDomainMemoryModelTypeFromString()
Michal Privoznik [Mon, 27 Feb 2023 09:31:43 +0000 (10:31 +0100)] 
libvirt_private.syms: Export virDomainMemoryModelTypeFromString()

The virDomainMemoryModelTypeFromString() is not exported, though
the enum translation functions are declared in
src/conf/domain_conf.h.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agokbase: virtiofs: Add a note that virtiofs is not migratable
Peter Krempa [Mon, 27 Feb 2023 08:10:08 +0000 (09:10 +0100)] 
kbase: virtiofs: Add a note that virtiofs is not migratable

Note that certain operations will not work.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/452
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoci: Regenerate gitlab config with latest lcitool
Peter Krempa [Mon, 27 Feb 2023 10:00:34 +0000 (11:00 +0100)] 
ci: Regenerate gitlab config with latest lcitool

The 'cirrus-run' and 'check-dco' containers are now exported as
':latest' instead of ':master'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoPost-release version bump to 9.2.0
Jiri Denemark [Wed, 1 Mar 2023 10:15:06 +0000 (11:15 +0100)] 
Post-release version bump to 9.2.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2 years agoRelease of libvirt-9.1.0 v9.1.0
Jiri Denemark [Wed, 1 Mar 2023 10:10:41 +0000 (11:10 +0100)] 
Release of libvirt-9.1.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2 years agoNEWS: Document my contributions for upcoming release
Michal Privoznik [Wed, 1 Mar 2023 08:38:29 +0000 (09:38 +0100)] 
NEWS: Document my contributions for upcoming release

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2 years agoNEWS: Clarify limitations of passt support
Andrea Bolognani [Tue, 28 Feb 2023 21:32:35 +0000 (22:32 +0100)] 
NEWS: Clarify limitations of passt support

Let users know that we're working on lifting the limitations
and that they should not use the feature in production until
then.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agoNEWS: Mention two user-visible bug fixes
Peter Krempa [Tue, 28 Feb 2023 16:22:32 +0000 (17:22 +0100)] 
NEWS: Mention two user-visible bug fixes

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoNEWS: note new passt feature & bugfix for 9.1.0 release
Laine Stump [Mon, 27 Feb 2023 18:01:57 +0000 (13:01 -0500)] 
NEWS: note new passt feature & bugfix for 9.1.0 release

This also adds a sentence pointing out that SELinux must be disabled
in order for passt support to work. I didn't think to put that info in
the NEWS file last month when reporting the addition of passt support.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoTranslated using Weblate (Russian)
Sergey A [Mon, 27 Feb 2023 14:20:28 +0000 (15:20 +0100)] 
Translated using Weblate (Russian)

Currently translated at 89.6% (9338 of 10416 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 agoTranslated using Weblate (Korean)
김인수 [Mon, 27 Feb 2023 14:20:28 +0000 (15:20 +0100)] 
Translated using Weblate (Korean)

Currently translated at 100.0% (10416 of 10416 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 agoqemu: Don't error out on 'unknown' memory model in qemuMonitorJSONGetMemoryDeviceInfo() v9.1.0-rc2
Michal Privoznik [Mon, 27 Feb 2023 09:23:12 +0000 (10:23 +0100)] 
qemu: Don't error out on 'unknown' memory model in qemuMonitorJSONGetMemoryDeviceInfo()

When starting QEMU (or when reconnecting to a running one),
qemuMonitorJSONGetMemoryDeviceInfo() is called to refresh info on
memory devices. In here, query-memory-devices is called which
returns info on all memory devices. The result is then iterated
over and for some memory models runtime information is updated.
The rest is to be ignored. Except, when introducing SGX support,
this was turned into an error leaving us unable to start any
domain with virtio-pmem memory device (as virtio-pmem is to be
ignored).

Fixes: ddb1bc051959eef4ad7ed6ac47b57056632bdb5e
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agoTranslated using Weblate (Georgian)
Temuri Doghonadze [Sat, 25 Feb 2023 10:20:29 +0000 (11:20 +0100)] 
Translated using Weblate (Georgian)

Currently translated at 3.6% (376 of 10416 strings)

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

Co-authored-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
Signed-off-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
2 years agoTranslated using Weblate (Ukrainian)
Yuri Chornoivan [Thu, 23 Feb 2023 17:20:29 +0000 (18:20 +0100)] 
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10416 of 10416 strings)

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

Co-authored-by: Yuri Chornoivan <yurchor@ukr.net>
Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
2 years agoUpdate translation files
Weblate [Wed, 22 Feb 2023 14:22:29 +0000 (15:22 +0100)] 
Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

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

Co-authored-by: Weblate <noreply@weblate.org>
Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
2 years agopo: Refresh potfile for v9.1.0 v9.1.0-rc1
Jiri Denemark [Wed, 22 Feb 2023 14:16:26 +0000 (15:16 +0100)] 
po: Refresh potfile for v9.1.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2 years agodocs/kbase: fix example for SEV validation
Daniel P. Berrangé [Thu, 16 Feb 2023 15:51:03 +0000 (15:51 +0000)] 
docs/kbase: fix example for SEV validation

The offline validation example needs to include the firmware path,
and is also missing line continuation markers.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agorpm: add missing deps for the virt-qemu-sev-validate
Daniel P. Berrangé [Thu, 16 Feb 2023 14:57:56 +0000 (14:57 +0000)] 
rpm: add missing deps for the virt-qemu-sev-validate

The RPM automatic deps generator for python does not pick these up

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agodocs: refer to --firmware instead of --loader
Daniel P. Berrangé [Thu, 16 Feb 2023 14:55:11 +0000 (14:55 +0000)] 
docs: refer to --firmware instead of --loader

The --loader syntax was left over from an earlier version of the code
before it was renamed to --firmware.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoqemu: respond to NETDEV_STREAM_DISCONNECTED event
Laine Stump [Tue, 21 Feb 2023 06:16:04 +0000 (01:16 -0500)] 
qemu: respond to NETDEV_STREAM_DISCONNECTED event

When a QEMU netdev is of type "stream", if the socket it uses for
connectivity to the host network gets closed, then QEMU will send a
NETDEV_STREAM_DISCONNECTED event. We know that any stream netdev we've
created is backed by a passt process, and if the socket was closed,
that means the passt process has disappeared.

When we receive this event, we can respond by starting a new passt
process with the same options (including socket path) we originally
used. If we have previously created the stream netdev device with a
"reconnect" option, then QEMU will automatically reconnect to this new
passt process. (If we hadn't used "reconnect", then QEMU will never
try to reconnect to the new passt process, so there's no point in
starting it.)

Note that NETDEV_STREAM_DISCONNECTED is an event sent for the netdev
(ie "host side") of the network device, and so it sends the
"netdev-id" to specify which device was disconnected. But libvirt's
virDomainNetDef (the object used to keep track of network devices) is
the internal representation of both the host-side "netdev", and the
guest side device, and virDomainNetDef doesn't directly keep track of
the netdev-id, only of the device's "alias" (which is the "id"
parameter of the *guest* side of the device). Fortunately, by convention
libvirt always names the host-side of devices as "host" + alias, so in
order to search for the affected NetDef, all we need to do is trim the
1st 4 characters from the netdev-id and look for the NetDef having
that resulting trimmed string as its alias. (Contrast this to
NIC_RX_FILTER_CHANGED, which is an event received for the guest side
of the device, and so directly contains the device alias.)

Resolves: https://bugzilla.redhat.com/2172098
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: add reconnect=5 to passt qemu commandline options when available
Laine Stump [Mon, 20 Feb 2023 23:26:51 +0000 (18:26 -0500)] 
qemu: add reconnect=5 to passt qemu commandline options when available

QEMU's "reconnect" option of "-netdev stream" tells QEMU to
periodically (period is given in seconds as an argument to the option)
attempt to reconnect to the same passt socket to which it had
originally connected to. This is useful in cases where the passt
process terminates, and libvirtd starts a new passt process in its
place (which doesn't happen yet, but will happen automatically after
an upcoming patch in this series).

Since there is no real hueristic for determining the "best" value of
the reconnect interval, rather than clutter up config with a knob that
nobody knows how to properly twiddle, we just set the reconnect timer
to 5 seconds.

"-netdev stream" first appeared in QEMU 7.2.0, but the reconnect
option won't be available until QEMU 8.0.0, so we need to check QEMU
capabilities just in case someone is using QEMU 7.2.0 (and thus can
support passt backend, but not reconnect)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: capabilities: Introduce QEMU_CAPS_NETDEV_STREAM_RECONNECT
Peter Krempa [Mon, 20 Feb 2023 16:25:08 +0000 (17:25 +0100)] 
qemu: capabilities: Introduce QEMU_CAPS_NETDEV_STREAM_RECONNECT

Detect that the 'stream' netdev backend supports reconnecting.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: remove extraneous error log when qemuPasstStart() fails during hotplug
Laine Stump [Tue, 21 Feb 2023 06:09:04 +0000 (01:09 -0500)] 
qemu: remove extraneous error log when qemuPasstStart() fails during hotplug

qemuPasstStart() already logs any error that occurs, so having the
caller log a generic error message only serves to obscure the actual
problem.

Fixes: a56f0168d576fa01cec204dc3c67d4d63ab8487f
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: add check for QEMU_CAPS_NETDEV_STREAM during validation
Laine Stump [Mon, 20 Feb 2023 20:14:23 +0000 (15:14 -0500)] 
qemu: add check for QEMU_CAPS_NETDEV_STREAM during validation

In commit 5af6134e I had added a new capability that is true if QEMU
allows "-netdev stream", but somehow neglected to actually check it in
commit a56f0168d when hooking up passt support to qemu. This isn't
catastrophic, since QEMU itself will still report an error, but that
error isn't as easy to understand as a libvirt-generated error.

Fixes: a56f0168d576fa01cec204dc3c67d4d63ab8487f
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>