]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
15 months agoqemu: Retire QEMU_CAPS_OBJECT_GPEX
Andrea Bolognani [Tue, 16 Jan 2024 15:36:58 +0000 (16:36 +0100)]
qemu: Retire QEMU_CAPS_OBJECT_GPEX

It's no longer used anywhere.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemu: Stop checking QEMU_CAPS_OBJECT_GPEX
Andrea Bolognani [Tue, 16 Jan 2024 15:36:46 +0000 (16:36 +0100)]
qemu: Stop checking QEMU_CAPS_OBJECT_GPEX

For all versions of QEMU that we support, the virt machine type
has a hard dependency on this device, so we can stop checking
whether the capability is present and just use it unconditionally.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agotests: Request virtio-mmio for balloon-mmio-deflate
Andrea Bolognani [Tue, 16 Jan 2024 14:44:44 +0000 (15:44 +0100)]
tests: Request virtio-mmio for balloon-mmio-deflate

For all supported QEMU version, the virt machine type has a hard
dependency on PCI support, so if we want to test virtio-balloon
together with virtio-mmio we have to either request that
explicitly or trick libvirt by masking capabilities. Do the
former instead of the latter.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agotests: Simplify balloon-mmio-deflate
Andrea Bolognani [Tue, 16 Jan 2024 14:45:53 +0000 (15:45 +0100)]
tests: Simplify balloon-mmio-deflate

Drop everything that's not directly related to the scenario
being tested.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agotests: Drop various redundant tests
Andrea Bolognani [Tue, 16 Jan 2024 14:52:52 +0000 (15:52 +0100)]
tests: Drop various redundant tests

All of these are either a subset of other tests, or provide
coverage for scenarios that are not really possible: for all
versions of QEMU that we support, the virt machine type has a
hard dependency on the generic PCIe controller, which means
that we will never need to fall back to virtio-mmio.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agotests: Add {aarch64,riscv64}-virt-headless-mmio
Andrea Bolognani [Tue, 16 Jan 2024 14:51:31 +0000 (15:51 +0100)]
tests: Add {aarch64,riscv64}-virt-headless-mmio

Even though virtio-mmio is no longer the default on either
architecture, and likely nobody is using it at this point, we
still provide a way to opt into virtio-mmio usage and want to
keep existing guests working. Add explicit test suite coverage
for this scenario.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agotests: Drop aarch64-virtio-pci-default
Andrea Bolognani [Tue, 16 Jan 2024 15:21:52 +0000 (16:21 +0100)]
tests: Drop aarch64-virtio-pci-default

After commit 1d8454639f40 (libvirt 3.0.0), the default address
type for aarch64/virt guests is PCI. These tests are then
pointless, as they are just a subset of other tests, and the
comment attached to them inaccurate.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemu: Fix handling of user aliases for default PHB
Andrea Bolognani [Tue, 16 Jan 2024 16:19:15 +0000 (17:19 +0100)]
qemu: Fix handling of user aliases for default PHB

The bus name for the default PHB is always "pci.0".

Fixes: 937f319536723fec57ad472b002a159d0f67a77c
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agotests: Add pseries-phb-user-alias
Andrea Bolognani [Tue, 16 Jan 2024 16:05:07 +0000 (17:05 +0100)]
tests: Add pseries-phb-user-alias

This is the same as the existing pseries-phb-simple, except that
each of the controllers is given a user alias. If we tried to
start the resulting guest, we'd get an error:

  Bus 'ua-phb0' not found

This is because, at the QEMU command line level, the default PHB
is not represented and so it can't be given a custom alias. We're
going to address this issue in a follow-up commit.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agotests: Add devices to pseries-phb-simple
Andrea Bolognani [Tue, 16 Jan 2024 16:08:49 +0000 (17:08 +0100)]
tests: Add devices to pseries-phb-simple

We want to make sure that not only the controllers themselves
are added correctly, but also that devices attached to them
get assigned the expected bus value. In order to do that add
some devices, one per controller.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemuxml2conftest: Test re-parsing of formatted XML
Peter Krempa [Mon, 18 Dec 2023 15:38:46 +0000 (16:38 +0100)]
qemuxml2conftest: Test re-parsing of formatted XML

Re-parse and re-format the output XML to validate that the auto-added
bits and the formatter always agree. There's no way to specify an
alternative output file as a libvirt-formatted XML must be reformatted
identically.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agovirDomainDefAddConsoleCompat: Fix numbering of console targets after modification
Peter Krempa [Mon, 18 Dec 2023 15:41:01 +0000 (16:41 +0100)]
virDomainDefAddConsoleCompat: Fix numbering of console targets after modification

The XML parser for consoles sets the 'port=' attribute of '<target' to
be always the index of the console.

Thus when the "really crazy backcompat stuff for consoles" function
modifies the order of consoles by inserting the default one for a serial
port it must re-number the ports to ensure that the value will not
change on subsequent parse.

This luckily didn't cause any visible changes to the VM as the port
number isn't used for anything.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemuDomainAssignPCIAddresses: Assign extension addresses when auto-assigning PCI...
Peter Krempa [Mon, 18 Dec 2023 21:23:35 +0000 (22:23 +0100)]
qemuDomainAssignPCIAddresses: Assign extension addresses when auto-assigning PCI address

Assigning a PCI address needs to also assign any extension addresses
right away. Otherwise they'd be assigned only after subsequent
format->parse cycle and thus be potentially missing on first run after
defining the VM and thus could change.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemu: Move 'shmem' device size validation to qemu_validate
Peter Krempa [Mon, 18 Dec 2023 23:16:29 +0000 (00:16 +0100)]
qemu: Move 'shmem' device size validation to qemu_validate

The 'size' of a 'shmem' device is parsed and formatted as a "scaled"
value, stored in bytes, but the formatting scale is mebibytes. This
precission loss combined with the fact that the value was validated only
when starting and the size is formatted only when non-zero meant that
on first parse a value < 1 MiB would be accepted, but would be formatted
to the XML as 0 MiB as it was non-zero but truncated and a subsequent
parse would parse of such XML would parse it as 0 bytes, which in turn
would be interpreted as 'default' size.

Fix the issue by moving the validator, which ensures that the number is
a power of two and more than 1 MiB to the validator code so that it'll
be rejected at XML parsing time.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agovirDomainAssignControllerIndexes: Ensure controller ordering after assigning indexes
Peter Krempa [Mon, 18 Dec 2023 21:10:35 +0000 (22:10 +0100)]
virDomainAssignControllerIndexes: Ensure controller ordering after assigning indexes

Similarly to auto-adding of controllers, the assignment of indexes can
cause them to be considered in different ordering according to the logic
in 'virDomainControllerInsert' than they currently are.

To prevent changes in commandline between first run after defining a VM
xml and any subsequent run or restart of the daemon, we need to reorder
them when assigning the index.

The simplest method is to assign indexes and then create a new list of
controllers and re-instert them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoconf: domain: Insert auto-added controllers in same order as in XML parser
Peter Krempa [Mon, 18 Dec 2023 17:32:57 +0000 (18:32 +0100)]
conf: domain: Insert auto-added controllers in same order as in XML parser

'virDomainDefAddController' which is used in code-paths which auto-add
controllers to the definition such as 'virDomainDefMaybeAddController',
'virDomainDefAddUSBController', 'qemuDomainDefAddDefaultDevices' was
adding the controller at the end of the list. However that is not how
the XML parser would order the controller in the list as it uses
virDomainControllerInsert grouping them by type and additional
properties.

This would cause that auto-added controllers would re-order:
 - between first and any subsequent run of the VM (even on commandline)
 - after a libvirtd/virtqemud restart
 - after any update of the definition based on the 'define' operation
   (e.g. virsh edit)

To ensure that the ordering of controllers is identical always use
virDomainControllerInsert.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agovirDomainDefMaybeAddVirtioSerialController: Reformat hard to read linebreaks
Peter Krempa [Tue, 19 Dec 2023 21:51:41 +0000 (22:51 +0100)]
virDomainDefMaybeAddVirtioSerialController: Reformat hard to read linebreaks

Format the code the usual way despite having more than 80 columns so
that it's easier to read.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agotests: Rename 'qemuxml2argvtest' to 'qemuxmlconftest'
Peter Krempa [Mon, 18 Dec 2023 15:21:40 +0000 (16:21 +0100)]
tests: Rename 'qemuxml2argvtest' to 'qemuxmlconftest'

Since this tests inactive/config XML files rename it accordingly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agomeson: tests: Allow 'timeout' override for all tests
Peter Krempa [Mon, 8 Jan 2024 15:48:15 +0000 (16:48 +0100)]
meson: tests: Allow 'timeout' override for all tests

Don't special-case qemuxml2argvtest's handling of timeout but rather
allow each test array entry to have it's own.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemuxml2argvtest: Populate all outstanding def->xml cases
Peter Krempa [Sat, 16 Dec 2023 16:26:37 +0000 (17:26 +0100)]
qemuxml2argvtest: Populate all outstanding def->xml cases

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agotests: Remove qemuxml2xmltest
Peter Krempa [Sat, 16 Dec 2023 19:12:05 +0000 (20:12 +0100)]
tests: Remove qemuxml2xmltest

The full functionality was merged into qemuxmlconftest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemuxml2argvtest: Test (inactive) def -> xml conversion
Peter Krempa [Sat, 16 Dec 2023 16:13:35 +0000 (17:13 +0100)]
qemuxml2argvtest: Test (inactive) def -> xml conversion

This is an intermediate step to merge qemuxml2xmltest into this common
helper. This eliminates double setup/parsing of the input data as well
as will ensure that all input XMLs are tested both for ARGV as well as
XML output. For now we skip tests that don't have an output XML to show
that the this does everything that qemuxml2xmltest does.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemuxml2argvtest: Add parsing of the input XML as separate test
Peter Krempa [Mon, 18 Dec 2023 15:02:33 +0000 (16:02 +0100)]
qemuxml2argvtest: Add parsing of the input XML as separate test

Get clean separation between the parsing and argv conversion so that
it's obvious in the test output:

2409) QEMU XML def parse s390-async-teardown.s390x-6.0.0                ... libvirt: QEMU Driver error : unsupported configuration: asynchronous teardown is not available with this QEMU binary
OK
2410) QEMU XML def -> ARGV s390-async-teardown.s390x-6.0.0              ... SKIP

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemuxml2argvtest: Extract setup/parse step
Peter Krempa [Sat, 16 Dec 2023 15:30:57 +0000 (16:30 +0100)]
qemuxml2argvtest: Extract setup/parse step

Extract the common setup and parsing of the input XML into a separate
helper testQemuConfXMLCommon(). The helper has semantics which will
allow us to call it from multiple places so that VIR_TEST_RANGE will
still work properly even when we'll add multiple steps reusing the
prepared data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemuxml2argvtest: Setup fake driver only once
Peter Krempa [Sat, 16 Dec 2023 07:48:21 +0000 (08:48 +0100)]
qemuxml2argvtest: Setup fake driver only once

Move the setup of the fake driver from testCompareXMLToArgv to 'mymain'.
With this we also won't need to reset the fake drivers which was done
only partially.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemuxml2argvtest: Use virDomainDefParseFile instead of virXMLParse+virDomainDefParseNode
Peter Krempa [Sat, 16 Dec 2023 08:05:09 +0000 (09:05 +0100)]
qemuxml2argvtest: Use virDomainDefParseFile instead of virXMLParse+virDomainDefParseNode

As we don't do any additional parsing of the input file in
qemuxml2argvtest we can simplify the code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemuxml2argvtest: Remove unused separate parsing of arch
Peter Krempa [Sat, 16 Dec 2023 07:58:55 +0000 (08:58 +0100)]
qemuxml2argvtest: Remove unused separate parsing of arch

Prior to all tests being converted to "DO_TEST_CAPS*" invocation the
fake-caps tests required knowing the architecture, which was pre-parsed
in qemuxml2argvtest. This code was now removed, but the arch parser was
forgotten.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemuxml2xmltest: Remove pointless inactive->active testing
Peter Krempa [Fri, 15 Dec 2023 21:51:48 +0000 (22:51 +0100)]
qemuxml2xmltest: Remove pointless inactive->active testing

'virDomainDefFormatInternalSetRootName' which is the top level XML
formatter function has the following condition as the very first thing:

     if (def->id == -1)
         flags |= VIR_DOMAIN_DEF_FORMAT_INACTIVE;

This makes it pointless to separately do inactive->active and
inactive->inactive XML -> XML testing as both will be in the end treated
as inactive->inactive.

This patch adds a warning to virDomainDefFormatInternalSetRootName and
removes the second pointless invocation of the test from
qemuxml2xmtest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemuxml2*test: Remove FLAG_SKIP_CONFIG_ACTIVE flag
Peter Krempa [Tue, 5 Dec 2023 09:12:41 +0000 (10:12 +0100)]
qemuxml2*test: Remove FLAG_SKIP_CONFIG_ACTIVE flag

Neither qemuxml2argvtest nor qemuxml2xmltest now test configs parsed as
active, thus this flag is no longer needed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemuxml2xmltest: Parse all input files as inactive
Peter Krempa [Fri, 15 Dec 2023 15:30:32 +0000 (16:30 +0100)]
qemuxml2xmltest: Parse all input files as inactive

In previous patches we've added testing of XML's explicitly parsed as
active (ensuring that it e.g. has a domain id) formatted into both
active and inactive versions.

Now qemuxml2xmltest can be simplified by making it test only XMLs parsed
as inactive.

To do this we pass VIR_DOMAIN_DEF_PARSE_INACTIVE in parseFlags. This
will also cause that all output files will become identical so the setup
of the test cases can be simplified by using the non-split output file
name.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemuxmlactivetest: Add qemu active XML to active/inactive XML tests
Peter Krempa [Mon, 18 Dec 2023 12:36:45 +0000 (13:36 +0100)]
qemuxmlactivetest: Add qemu active XML to active/inactive XML tests

Add explicit test cases for XMLs from qemuxml2argvdata which
historically had different output in qemuxml2xmltest.

qemuxmlactivetest explicitly ensures that the input XMLs are parsed in
'live' state and formatted both in inactive as well as live state,
rather than the previously present inactive->inactive,  live->live tests
only.

The XMLs picked in this case are those which had separate output files
in qemuxml2argvtest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemuxmlactivetest: Prepare for proper active/inactive -> active/inactive testing
Peter Krempa [Fri, 15 Dec 2023 15:30:20 +0000 (16:30 +0100)]
qemuxmlactivetest: Prepare for proper active/inactive -> active/inactive testing

Currently the xml->xml testing we have in qemuxml2xmltest covers only 3
of the 4 possibilities:

By invocation:
  active -> active;
  inactive -> inactive;

by unintentionally:
  active -> inactive  (for configs which don't set an 'id' as the
                       formatter assumes it's inactive)

To do it better introduce proper active -> inactive/active testing into
qemuxmlactivetest. It's chosen such as we only really parse an XML as
live when restoring a status XML. To give users possibility to avoid
constructing a full status XML add a simpler variant. As of such it will
be used only for configs where we specifically cared about parsing live
data.

To ensure that the formatter doesn't decide that a config is inactive
because it doesn't have an ID we fill in a domain ID if it was not
present in the source.

In this patch the tests are not yet added.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemu*xml2*test: Invoke tests from a function
Peter Krempa [Mon, 4 Dec 2023 16:00:54 +0000 (17:00 +0100)]
qemu*xml2*test: Invoke tests from a function

Refactor the code so that the test macros invoke a helper function with
no additional steps. This change prevents regressions in compilation
time when adding extra steps for the tests, which happen when the test
macro gets too complicated.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agotestutilsqemu: Create a typedef for struct testQemuInfo
Peter Krempa [Mon, 4 Dec 2023 21:28:10 +0000 (22:28 +0100)]
testutilsqemu: Create a typedef for struct testQemuInfo

The typedef will come in handy to create an autoptr cleaning function
later on.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agotests: Rename 'qemustatusxml2xmltest' to 'qemuxmlactivetest'
Peter Krempa [Fri, 15 Dec 2023 12:39:49 +0000 (13:39 +0100)]
tests: Rename 'qemustatusxml2xmltest' to 'qemuxmlactivetest'

The test will be testing both status XMLs and active XMLs. Rename it to
a shorter name.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agotestCompareDomXML2XMLFiles: Sanitize handling of 'parse_flags'
Peter Krempa [Fri, 15 Dec 2023 14:57:50 +0000 (15:57 +0100)]
testCompareDomXML2XMLFiles: Sanitize handling of 'parse_flags'

Get rid of the extra temporary variable and set the parse and format
flags based on liveness together.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemuxml2xmltest: Use same parameters as in qemuxml2argvtest for 'riscv64-virt'
Peter Krempa [Sat, 16 Dec 2023 18:59:15 +0000 (19:59 +0100)]
qemuxml2xmltest: Use same parameters as in qemuxml2argvtest for 'riscv64-virt'

The main idea of the test is to validate config when PCIe is compiled
out.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemuxmlargvdata: disk-network-nfs: Drop 'index' attribute from backing store
Peter Krempa [Fri, 15 Dec 2023 15:12:21 +0000 (16:12 +0100)]
qemuxmlargvdata: disk-network-nfs: Drop 'index' attribute from backing store

Index is auto-allocated normally. Additionally we now don't need the
extra active/inactive version of this test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agoqemuxml2xmltest: Add invocation for 'numatune-auto-nodeset-invalid' case
Peter Krempa [Sat, 16 Dec 2023 19:18:13 +0000 (20:18 +0100)]
qemuxml2xmltest: Add invocation for 'numatune-auto-nodeset-invalid' case

The test case requires an exception in virschematest as the output file
is no longer invalid.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agovirschematest: Add possibility to have exceptions from the '-invalid' suffix
Peter Krempa [Fri, 15 Dec 2023 20:47:17 +0000 (21:47 +0100)]
virschematest: Add possibility to have exceptions from the '-invalid' suffix

The exception is needed in qemuxml2xmltest which is in one instance
testing update from an invalid config to a valid one. Currently the
compliance with the test is achieved via a hack.

As further patches will be simpler without the hack present we need a
way to invert the expected output in specific cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 months agonews: Mention support for CPU clusters
Andrea Bolognani [Mon, 8 Jan 2024 16:47:45 +0000 (17:47 +0100)]
news: Mention support for CPU clusters

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agodocs: Document CPU clusters
Andrea Bolognani [Mon, 8 Jan 2024 15:11:51 +0000 (16:11 +0100)]
docs: Document CPU clusters

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agodocs: Improve documentation for CPU topology
Andrea Bolognani [Mon, 8 Jan 2024 15:13:25 +0000 (16:13 +0100)]
docs: Improve documentation for CPU topology

On the guest configuration side, mention that support for the
"dies" attribute was introduced in libvirt 6.1.0 and clarify
that the ability to use non-default values is subject to
architecture and machine limitations.

On the host capabilities side, the documentation was pretty
much entirely missing. It's still far from perfect, but anything
is better than having no information at all.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agotests: Verify handling of CPU clusters in QMP data
Andrea Bolognani [Mon, 8 Jan 2024 17:44:25 +0000 (18:44 +0100)]
tests: Verify handling of CPU clusters in QMP data

Since aarch64 doesn't support CPU hotplug at the moment, we have
to get a bit creative.

While the 'query-cpus-fast' output is taken directly from a VM
configured as

  <vcpu current='7'>16</vcpu>
  <cpu mode='host-passthrough'>
    <topology sockets='2' dies='1' clusters='2' cores='2' threads='2'/>
  </cpu>

the 'query-hotpluggable-cpus' output is constructed by hand
starting from the former and using the 'x86-dies' test data as
a model.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoqemu: Make monitor aware of CPU clusters
Andrea Bolognani [Fri, 5 Jan 2024 17:51:29 +0000 (18:51 +0100)]
qemu: Make monitor aware of CPU clusters

This makes it so libvirt can obtain accurate information about
guest CPUs from QEMU, and should make it possible to correctly
perform operations such as CPU hotplug.

Of course this is mostly moot at the moment: only aarch64 can use
CPU clusters, and CPU hotplug is not yet implemented on that
architecture.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agotests: Add test case for CPU clusters
Andrea Bolognani [Mon, 8 Jan 2024 15:21:25 +0000 (16:21 +0100)]
tests: Add test case for CPU clusters

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoqemu: Use CPU clusters for guests
Andrea Bolognani [Fri, 5 Jan 2024 17:44:56 +0000 (18:44 +0100)]
qemu: Use CPU clusters for guests

https://issues.redhat.com/browse/RHEL-7043

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoqemu: Introduce QEMU_CAPS_SMP_CLUSTERS
Andrea Bolognani [Fri, 5 Jan 2024 17:42:13 +0000 (18:42 +0100)]
qemu: Introduce QEMU_CAPS_SMP_CLUSTERS

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoconf: Allow specifying CPU clusters
Andrea Bolognani [Fri, 5 Jan 2024 17:20:14 +0000 (18:20 +0100)]
conf: Allow specifying CPU clusters

The default number of CPU clusters is 1, and values other than
that one are currently rejected by all hypervisor drivers.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agoconf: Report CPU clusters in capabilities XML
Andrea Bolognani [Fri, 5 Jan 2024 15:03:54 +0000 (16:03 +0100)]
conf: Report CPU clusters in capabilities XML

For machines that don't expose useful information through sysfs,
the dummy ID 0 is used.

https://issues.redhat.com/browse/RHEL-7043

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agotests: Add hostcpudata for machine with CPU clusters
Andrea Bolognani [Fri, 5 Jan 2024 14:07:06 +0000 (15:07 +0100)]
tests: Add hostcpudata for machine with CPU clusters

The data is taken from an HPE Apollo 70 machine, which uses
aarch64 CPUs. It is interesting for us because non-dummy
information about CPU clusters is exposed through sysfs.

In order to keep things reasonable, the data was manually
modified so that only 8 of the original 224 CPUs are included.
Care has been taken to ensure that the topology is otherwise
unaltered.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
15 months agovshAdmCatchDisconnect: Don't probe connection URI
Peter Krempa [Thu, 14 Dec 2023 16:13:08 +0000 (17:13 +0100)]
vshAdmCatchDisconnect: Don't probe connection URI

virsh already stores the connection URI in 'ctl->connname', use that
instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
15 months agovshAdmConnect: Preserve connection URI in ctl->connname if auto-detected
Peter Krempa [Thu, 14 Dec 2023 16:18:39 +0000 (17:18 +0100)]
vshAdmConnect: Preserve connection URI in ctl->connname if auto-detected

Probe the current URI so that other places don't need to do that.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
15 months agovirshCatchDisconnect: Don't probe connection URI
Peter Krempa [Thu, 14 Dec 2023 16:13:08 +0000 (17:13 +0100)]
virshCatchDisconnect: Don't probe connection URI

virsh already stores the connection URI in 'ctl->connname', use that
instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
15 months agovirshReconnect: Preserve current URI if not explicitly set in ctl->connname
Peter Krempa [Thu, 14 Dec 2023 16:11:08 +0000 (17:11 +0100)]
virshReconnect: Preserve current URI if not explicitly set in ctl->connname

Probe the current URI so that other places don't need to do that.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
15 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Mon, 15 Jan 2024 04:59:27 +0000 (05:59 +0100)]
Translated using Weblate (Swedish)

Currently translated at 63.1% (6601 of 10447 strings)

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

Translated using Weblate (Swedish)

Currently translated at 62.7% (6558 of 10447 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>
15 months agoPost-release version bump to 10.1.0
Jiri Denemark [Mon, 15 Jan 2024 10:01:50 +0000 (11:01 +0100)]
Post-release version bump to 10.1.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
15 months agoRelease of libvirt-10.0.0
Jiri Denemark [Mon, 15 Jan 2024 09:58:03 +0000 (10:58 +0100)]
Release of libvirt-10.0.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
15 months agoNEWS: mention nbdkit config option
Jonathon Jongsma [Fri, 12 Jan 2024 15:17:56 +0000 (09:17 -0600)]
NEWS: mention nbdkit config option

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
15 months agonews: document auto-selection of VFIO variant drivers
Laine Stump [Sun, 14 Jan 2024 23:01:34 +0000 (18:01 -0500)]
news: document auto-selection of VFIO variant drivers

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
15 months agoNEWS: Document my contributions for upcoming release
Michal Privoznik [Fri, 12 Jan 2024 12:42:28 +0000 (13:42 +0100)]
NEWS: Document my contributions for upcoming release

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
15 months agoci: Do more as part of .qemu-build-template
Andrea Bolognani [Fri, 12 Jan 2024 10:02:56 +0000 (11:02 +0100)]
ci: Do more as part of .qemu-build-template

Entering $SCRATCH_DIR, going back to the original directory and
setting SELinux labels for the newly-installed QEMU binaries
are all steps that logically belong to this template rather
than its callers.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
15 months agoci: Fix .integration_tests_upstream_qemu
Andrea Bolognani [Fri, 12 Jan 2024 10:01:34 +0000 (11:01 +0100)]
ci: Fix .integration_tests_upstream_qemu

We enter $SCRATCH_DIR before going through the process of
cloning QEMU's upstream repo and building it, but once we're
done we don't get back to libvirt's sources, so the very next
step fails with

  /tmp/script.: line 188: ci/jobs.sh: No such file or directory

Use pushd/popd to ensure that we're back to the correct place
once QEMU has been built and installed.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
15 months agoNEWS: Mention migration fixes and iothread mapping
Peter Krempa [Fri, 12 Jan 2024 09:24:12 +0000 (10:24 +0100)]
NEWS: Mention migration fixes and iothread mapping

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
15 months agoTranslated using Weblate (Finnish)
Ricky Tigg [Thu, 11 Jan 2024 22:18:00 +0000 (23:18 +0100)]
Translated using Weblate (Finnish)

Currently translated at 22.3% (2331 of 10433 strings)

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

Co-authored-by: Ricky Tigg <ricky.tigg@gmail.com>
Signed-off-by: Ricky Tigg <ricky.tigg@gmail.com>
15 months agoTranslated using Weblate (Korean)
김인수 [Thu, 11 Jan 2024 22:17:59 +0000 (23:17 +0100)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10433 of 10433 strings)

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

Translated using Weblate (Korean)

Currently translated at 99.7% (10411 of 10433 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>
15 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Thu, 11 Jan 2024 22:17:59 +0000 (23:17 +0100)]
Translated using Weblate (Swedish)

Currently translated at 62.5% (6538 of 10447 strings)

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

Translated using Weblate (Swedish)

Currently translated at 62.4% (6512 of 10433 strings)

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

Translated using Weblate (Swedish)

Currently translated at 62.3% (6497 of 10417 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>
15 months agoconf: domain_conf: cleanup def in case of errors
Shaleen Bathla [Thu, 11 Jan 2024 12:57:54 +0000 (18:27 +0530)]
conf: domain_conf: cleanup def in case of errors

Just like in rest of the function virDomainFSDefParseXML,
use goto error so that def will be cleaned up in error cases.

Signed-off-by: Shaleen Bathla <shaleen.bathla@oracle.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
15 months agoapparmor: Allow access to /sys/devices/system/node/*/cpumap for libnuma
Sergio Durigan Junior [Thu, 11 Jan 2024 21:17:41 +0000 (16:17 -0500)]
apparmor: Allow access to /sys/devices/system/node/*/cpumap for libnuma

A QEMU change (10218ae6d006f76410804cc4dc690085b3d008b5) introduced
some libnuma calls that require read access to
/sys/devices/system/node/*/cpumap, which currently is forbidden by the
standard apparmor profile.

This commit allows read-only access to the file specified above.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/515
Signed-off-by: Sergio Durigan Junior <sergio.durigan@canonical.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
15 months agovirsh: Command completion, add comp-methods with zlib and zstd
Yalei Li [Thu, 11 Jan 2024 01:07:01 +0000 (09:07 +0800)]
virsh: Command completion, add comp-methods with zlib and zstd

Signed-off-by: Yalei Li <liyl43@chinatelecom.cn>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
15 months agoUpdate translation files
Weblate [Tue, 9 Jan 2024 11:41:08 +0000 (12:41 +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>
15 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Tue, 9 Jan 2024 11:41:05 +0000 (12:41 +0100)]
Translated using Weblate (Swedish)

Currently translated at 62.3% (6497 of 10417 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>
15 months agoqemu: Be less aggressive when dropping channel source paths
Michal Privoznik [Tue, 9 Jan 2024 13:40:11 +0000 (14:40 +0100)]
qemu: Be less aggressive when dropping channel source paths

In v9.7.0-rc1~130 I've shortened the path that's generated for
<channel/> source. With that, I had to adjust regex that matches
all versions of paths we have ever generated so that we can drop
them (see comment around qemuDomainChrDefDropDefaultPath()). But
as it is usually the case with regexes - they are write only. And
while I attempted to make one portion of the path optional
("/target/") I accidentally made regex accept more, which
resulted in libvirt dropping the user provided path and
generating our own instead.

Fixes: d3759d3674ab9453e5fb5a27ab6c28b8ff8d5569
Resolves: https://issues.redhat.com/browse/RHEL-20807
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
16 months agorpc: fix race in waking up client event loop
Daniel P. Berrangé [Mon, 18 Dec 2023 12:17:18 +0000 (12:17 +0000)]
rpc: fix race in waking up client event loop

The first thread to issue a client RPC request will own the event
loop execution, sitting in the virNetClientIOEventLoop function.

It releases the client lock while running:

   virNetClientUnlock()
   g_main_loop_run()
   virNetClientLock()

If a second thread arrives with an RPC request, it will queue it
for the first thread to process. To inform the first thread that
there's a new request it calls g_main_loop_quit() to break it out
of the main loop.

This works if the first thread is in g_main_loop_run() at that
time. There is a small window of opportunity, however, where
the first thread has released the client lock, but not yet got
into g_main_loop_run(). If that happens, the wakeup from the
second thread is lost.

This patch deals with that by changing the way the wakeup is
performed. Instead of directly calling g_main_loop_quit(), the
second thread creates an idle source to run the quit function
from within the first thread. This guarantees that the first
thread will see the wakeup.

Tested by: Fima Shevrin <efim.shevrin@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
16 months agoqemu: tighten semantics of 'size' when resizing block devices
Daniel P. Berrangé [Wed, 3 Jan 2024 16:36:45 +0000 (16:36 +0000)]
qemu: tighten semantics of 'size' when resizing block devices

When VIR_DOMAIN_BLOCK_RESIZE_CAPACITY is set, the 'size' parameter
is currently ignored. Since applications must none the less pass a
value for this parameter, it is preferrable to declare some explicit
semantics for it.

This declare that the parameter must be 0, or the exact size of the
underlying block device. The latter gives the management application
the ability to sanity check that the block device size matches what
they think it should be.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
16 months agopo: Refresh potfile for v10.0.0
Jiri Denemark [Tue, 9 Jan 2024 11:07:20 +0000 (12:07 +0100)]
po: Refresh potfile for v10.0.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
16 months agoci: Add notes for integration jobs
Andrea Bolognani [Mon, 8 Jan 2024 10:30:05 +0000 (11:30 +0100)]
ci: Add notes for integration jobs

These are special in that, when a new target is introduced, some
preparation is needed before the changes can be merged. Since
this only happens every six months or so, it's unsurprising that
we keep messing it up and forgetting some steps. Having notes
right in the file will hopefully help going forward.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
16 months agoci: Move upstream-qemu job to Fedora 39
Andrea Bolognani [Mon, 8 Jan 2024 10:34:37 +0000 (11:34 +0100)]
ci: Move upstream-qemu job to Fedora 39

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
16 months agoci: Fix upstream-qemu job definitions
Andrea Bolognani [Mon, 8 Jan 2024 10:33:29 +0000 (11:33 +0100)]
ci: Fix upstream-qemu job definitions

These are jobs are supposed to be running tests using a QEMU
binary built from the latest upstream sources, but right now
they're just doing the same thing as the other jobs for the
target. Use the correct job templates.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
16 months agotests: Add capabilities for QEMU 8.2.0 on aarch64
Andrea Bolognani [Mon, 8 Jan 2024 15:51:53 +0000 (16:51 +0100)]
tests: Add capabilities for QEMU 8.2.0 on aarch64

Notable changes compared to 7.0.0, the most recent version that
we had capabilities for until now:

  * SPICE support is no longer compiled in. CCID devices are
    also affected as they are implemented using libcacard,
    which is part of SPICE;

  * uses of -no-acpi are replaced with -M virt,acpi=off;

  * -netdev uses JSON.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
16 months agotests: Don't use features with vexpress machine
Andrea Bolognani [Mon, 8 Jan 2024 16:00:05 +0000 (17:00 +0100)]
tests: Don't use features with vexpress machine

The vexpress machine has never supported ACPI. This fact has
been silently ignored by QEMU so far, but recent versions have
started reporting attempts to use the combination as an error.

The other features (APIC, PAE) are also not relevant to the
vexpress machine, or the QEMU driver.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
16 months agoNEWS: Mention postcopy-preempt migration capability
Jiri Denemark [Mon, 8 Jan 2024 16:34:41 +0000 (17:34 +0100)]
NEWS: Mention postcopy-preempt migration capability

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
16 months agoqemu: Enable postcopy-preempt migration capability
Jiri Denemark [Fri, 5 Jan 2024 11:43:59 +0000 (12:43 +0100)]
qemu: Enable postcopy-preempt migration capability

During post-copy migration (once it actually switches to post-copy mode)
dirty memory pages are continued to be migrated iteratively, while the
destination can explicitly request a specific page to be migrated before
the iterative process gets to it (which happens when a guest wants to
read a page that was not migrated yet). Without the postcopy-preempt
capability enabled such pages need to wait until all other pages already
queued are transferred. Enabling this capability will instruct the
hypervisor to create a separate migration channel for explicitly
requested pages so that they can preempt the queue.

The only requirement for the feature to work is running a migration over
a protocol that supports multiple connections. In other words, we can't
pre-create the connection and pass its file descriptor to QEMU (i.e.,
using MIGRATION_DEST_CONNECT_SOCKET), but we have to let QEMU open the
connections itself (using MIGRATION_DEST_SOCKET). This change is applied
to all post-copy migrations even if postcopy-preempt is not supported to
avoid making the code even uglier than it is now. There's no real
difference between the two methods with modern QEMU (which can properly
report connection failures) anyway.

This capability is enabled for all post-copy migration as long as the
capability is supported on both sides of migration.

https://issues.redhat.com/browse/RHEL-7100

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
16 months agoqemu: Add support for optional migration capabilities
Jiri Denemark [Mon, 8 Jan 2024 15:31:29 +0000 (16:31 +0100)]
qemu: Add support for optional migration capabilities

We enable various migration capabilities according to the flags passed
to a migration API. Missing support for such capabilities results in an
error because they are required by the corresponding flag. This patch
adds support for additional optional capability we may want to enable
for a given API flag in case it is supported. This is useful for
capabilities which are not critical for the flags to be supported, but
they can make things work better in some way.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
16 months agoqemu: Rename remoteCaps parameter in qemuMigrationParamsCheck
Jiri Denemark [Mon, 8 Jan 2024 14:58:09 +0000 (15:58 +0100)]
qemu: Rename remoteCaps parameter in qemuMigrationParamsCheck

The migration cookie contains two bitmaps of migration capabilities:
supported and automatic. qemuMigrationParamsCheck expects the letter so
lets make it more obvious by renaming the parameter as remoteAuto.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
16 months agoqemu: Use C99 initializers for qemuMigrationParamsFlagMap
Jiri Denemark [Mon, 8 Jan 2024 15:36:34 +0000 (16:36 +0100)]
qemu: Use C99 initializers for qemuMigrationParamsFlagMap

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
16 months agoqemu: Document qemuMigrationParamsFlagMapItem fields
Jiri Denemark [Mon, 8 Jan 2024 14:08:05 +0000 (15:08 +0100)]
qemu: Document qemuMigrationParamsFlagMapItem fields

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
16 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Mon, 8 Jan 2024 06:04:24 +0000 (07:04 +0100)]
Translated using Weblate (Swedish)

Currently translated at 61.9% (6457 of 10417 strings)

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

Translated using Weblate (Swedish)

Currently translated at 61.6% (6417 of 10417 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>
16 months agotests: Add xml->argv and xml->xml tests for the new iothread mapping feature
Peter Krempa [Wed, 1 Mar 2023 13:40:02 +0000 (14:40 +0100)]
tests: Add xml->argv and xml->xml tests for the new iothread mapping feature

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
16 months agoqemu: Implement support for configuring iothread to virtqueue mapping for disks
Peter Krempa [Wed, 1 Mar 2023 13:40:02 +0000 (14:40 +0100)]
qemu: Implement support for configuring iothread to virtqueue mapping for disks

Add validation and formatting of the commandline arguments for
'iothread-vq-mapping' parameter. The validation logic mirrors what qemu
allows.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
16 months agoconf: Add possibility to configure multiple iothreads per disk
Peter Krempa [Thu, 23 Feb 2023 15:25:18 +0000 (16:25 +0100)]
conf: Add possibility to configure multiple iothreads per disk

Introduce a new <iothreads> sub-element of disk's <driver> which will
allow configuring multiple iothreads and also map them to specific
virt-queues of virtio devices.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
16 months agoqemu: capabilities: Introduce QEMU_CAPS_VIRTIO_BLK_IOTHREAD_MAPPING
Peter Krempa [Thu, 23 Feb 2023 14:47:11 +0000 (15:47 +0100)]
qemu: capabilities: Introduce QEMU_CAPS_VIRTIO_BLK_IOTHREAD_MAPPING

The capability represents the support for mapping virtqueues to
iothreads for the 'virtio-blk' device.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
16 months agoutil: xml: Return GPtrArray from virXMLNodeGetSubelement
Peter Krempa [Mon, 13 Feb 2023 14:53:23 +0000 (15:53 +0100)]
util: xml: Return GPtrArray from virXMLNodeGetSubelement

Rework the helper to use a GPtrArray structure to simplify callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
16 months agoqemucapabilitiesdata: Add data for the qemu-9.0 development cycle
Peter Krempa [Wed, 3 Jan 2024 14:37:06 +0000 (15:37 +0100)]
qemucapabilitiesdata: Add data for the qemu-9.0 development cycle

Add data for the qemu-9.0 development cycle based on
'v8.2.0-196-g7425b6277f'

Notable changes:
 - new machine types added
 - 'iommufd' object added
 - 'vfio-pci' device added 'fd' and 'iommufd' properties
 - 'virtio-blk-pci' device added 'iothread-vq-mapping' property

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
16 months agoqemu: automatically bind to a vfio variant driver, if available
Laine Stump [Fri, 5 Jan 2024 01:12:51 +0000 (20:12 -0500)]
qemu: automatically bind to a vfio variant driver, if available

Rather than always binding to the vfio-pci driver, use the new
function virPCIDeviceFindBestVFIOVariant() to see if the running
kernel has a VFIO variant driver available that is a better match for
the device, and if one is found, use that instead.

virPCIDeviceFindBestVFIOVariant() function reads the modalias file for
the given device from sysfs, then looks through
/lib/modules/${kernel_release}/modules.alias for the vfio_pci alias
that matches with the least number of wildcard ('*') fields.

The appropriate "VFIO variant" driver for a device will be the PCI
driver implemented by the discovered module - these drivers are
compatible with (and provide the entire API of) the standard vfio-pci
driver, but have additional device-specific APIs that can be useful
for, e.g., saving/restoring state for migration.

If a specific driver is named (using <driver model='blah'/> in the
device XML), that will still be used rather than searching
modules.alias; this makes it possible to force binding of vfio-pci if
there is an issue with the auto-selected variant driver.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
16 months agoconf: support manually specifying VFIO variant driver in <hostdev> XML
Laine Stump [Fri, 5 Jan 2024 01:12:51 +0000 (20:12 -0500)]
conf: support manually specifying VFIO variant driver in <hostdev> XML

This patch makes it possible to manually specify which VFIO variant
driver to use for PCI hostdev device assignment, so that, e.g. you
could force use of a VFIO "variant" driver, with e.g.

  <driver model='mlx5_vfio_pci'/>

or alternately to force use of the generic vfio-pci driver with

  <driver model='vfio-pci'/>

when libvirt would have normally (after applying a subsequent patch)
found a "better match" for a device in the active kernel's
modules.alias file. (The main potential use of this manual override
would probably be to work around a bug in a new VFIO variant driver by
temporarily not using that driver).

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
16 months agotests: remove explicit <driver name='vfio'/> from hostdev test cases
Laine Stump [Fri, 5 Jan 2024 01:12:51 +0000 (20:12 -0500)]
tests: remove explicit <driver name='vfio'/> from hostdev test cases

The long-deprecated use of <driver name='vfio|xen|kvm'/> in domain xml
for <hostdev> devices was only ever necessary during the period when
libvirt (and the Linux kernel) supported both VFIO and "legacy KVM"
styles of hostdev device assignment for QEMU. This became pointless
many years ago when legacy KVM device assignment was removed from the
kernel, and support for that style of device assignment was completely
disabled in the libvirt source in 2019 (commit
v5.6.0-316-g2e7225ea8c).

Nevertheless, there were instances of <driver name='vfio'/> in the
unit test data that were then (unnecessarily) propagated to several
more tests over the years. This patch cleans out those unnecessary
explicit settings of driver name='vfio' in all QEMU unit test data,
proving that the attribute is no longer (externally) needed. (A later
patch which adds a 2nd attribute to the <driver> element will include
a test case that explicitly exercises the driver name attribute).

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
16 months agoxen: explicitly set hostdev driver.name at runtime, not in postparse
Laine Stump [Fri, 5 Jan 2024 01:12:51 +0000 (20:12 -0500)]
xen: explicitly set hostdev driver.name at runtime, not in postparse

Xen only supports a single type of PCI hostdev assignment, so it is
superfluous to have <driver name='xen'/> peppered throughout the
config. It *is* necessary to have the driver type explicitly set in
the hostdev object before calling into the hypervisor-agnostic "hostdev
manager" though (otherwise the hostdev manager doesn't know whether it
should do Xen-specific setup, or VFIO-specific setup).

Historically, the Xen driver has checked for "default" driver name
(i.e. not set in the XML), and set it to "xen', during the XML
postparse, thus guaranteeing that it will be set by the time the
object is sent to the hostdev manager at runtime, but also setting it
so early that a simple round-trip of parse-format results in the XML
always containing an explicit <driver name='xen'/>, even if that
wasn't specified in the original XML.

The QEMU driver *doesn't* set driver.name during postparse though;
instead, it waits until domain startup time (or device attach time for
hotplug), and sets the driver.name then. The result is that a
parse-format round trip of the XML in the QEMU driver *doesn't* add in
the <driver name='vfio'/>.

This patch modifies the Xen driver to behave similarly to the QEMU
driver - the PostParse just checks for a driver.name that isn't
supported by the Xen driver, and any explicit setting to "xen" is
deferred until domain runtime rather than during the postparse, thus
Xen domain XML also doesn't get extraneous <driver name='xen'/>.

This delayed setting of driver.name of course results in slightly
different xml2xml parse-format results, so the unit test data is
modified accordingly.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
16 months agoconf: replace virHostdevIsVFIODevice with virHostdevIsPCIDevice
Laine Stump [Fri, 5 Jan 2024 01:12:51 +0000 (20:12 -0500)]
conf: replace virHostdevIsVFIODevice with virHostdevIsPCIDevice

virHostdevIsVFIODevice() and virDomainDefHasVFIOHostdev() are only ever
called from the QEMU driver, and in the case of the QEMU driver, any
PCI hostdev by definition uses VFIO, so really all these callers only
need to know if the device is a PCI hostdev.

(It turned out that the less specific virHostdevIsPCIDevice() already
existed in hypervisor/virhostdev.c, so I had to remove one of them;
since conf is a lower level directory than hypervisor, and the
function is called from conf, keeping the copy in hypervisor would
have required moving its caller (virDomainDefHasPCIHostdev()) into
hypervisor as well, so I just removed the copy in hypervisor.)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
16 months agoconf: use new common parser/formatter for hostdev driver in network XML
Laine Stump [Fri, 5 Jan 2024 01:12:51 +0000 (20:12 -0500)]
conf: use new common parser/formatter for hostdev driver in network XML

Now if a new attribute is added to <driver>, we only need to update
the formatting/parsing in one place.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>