Commit Graph

8201 Commits

Author SHA1 Message Date
Michal Privoznik
bf140a6edd qemu_capabilities: Stop detecting QEMU_CAPS_VSERPORT_CHANGE
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
c18e2fd746 qemu_agent: Drop @singleSync from _qemuAgent
Historically, before sending any guest agent command we would
send 'guest-sync' command to make guest agent reset its internal
state and flush any partially read command (json). This was
because there was no event emitted when the agent
(dis-)connected.

But now that we have the event we can execute the sync command
just once - the first time after we've connected. Should agent
disconnect in the middle of reading a command, and then connect
back again we would get the event and disconnect and connect back
again, resulting in the sync command being executed again.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
8ffcafe211 qemu_capabilities: Stop detecting QEMU_CAPS_NUMA
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
8bf50fa018 qemu: Assume QEMU_CAPS_NUMA
Introduced in QEMU's commit of v3.0.0-rc0~124^2~1 the
set-numa-node command is always available for all QEMU versions
we support (4.2.0, currently). Therefore, we can assume the
capability is always set and thus doesn't need to be checked for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
bb5bc36792 tests: Make qemuAgent single sync
The qemuAgent has option to issue guest-sync command before each
intended command or issue the sync commend just once, right after
the socket is opened and before the first intended command is
issued. The latter is referred to as single sync agent and is
enabled by VSERPORT_CHANGED event which allows us to detect
when the agent (dis-)connects in the guest.

Now, every QEMU that we support (4.2.0 or newer) has the event
and thus will use single sync agent. Therefore, adjust
qemuagenttest to make it test what's used in the real world,
rather than old approach.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-08 12:10:50 +01:00
Michal Privoznik
d649faddb3 tests: Drop needless .err files from qemuxml2argvdata/
As some qemxml2argvtest cases were removed, we forgot to remove
their expected output counterparts.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-07 18:25:57 +01:00
Michal Privoznik
fc141bfe88 qemu_capabilities: Stop detecting QEMU_CAPS_OBJECT_MEMORY_FILE_ALIGN
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:43 +01:00
Michal Privoznik
881cf3c4f1 qemu_capabilities: Stop detecting QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:43 +01:00
Michal Privoznik
8c0d43803b qemu: Assume QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD
Introduced in QEMU's commit of v2.11.0-rc0~95^2~9 the .discard
attribute of memory-backend-file is always available for all QEMU
versions we support (4.2.0, currently). Therefore, we can assume
the capability is always set and thus doesn't need to be checked
for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:42 +01:00
Michal Privoznik
9b279f2d3e qemu_capabilities: Stop detecting QEMU_CAPS_OBJECT_MEMORY_FILE
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:42 +01:00
Michal Privoznik
8641fcfa63 qemu: Assume QEMU_CAPS_OBJECT_MEMORY_FILE
Introduced in QEMU's commit of v2.1.0-rc0~41^2~26 only for Linux,
and later in v3.1.0-rc0~71^2~10 for all POSIX, the
memory-backend-file is going to be present for all QEMU versions
we support (4.2.0, currently). Therefore, we can assume the
capability is always set and thus doesn't need to be checked for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:42 +01:00
Michal Privoznik
b77f5b08a7 qemu_capabilities: Stop detecting QEMU_CAPS_OBJECT_MEMORY_RAM
All supported QEMUs have this capability. Stop detecting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:42 +01:00
Michal Privoznik
fbbae04214 qemu: Assume QEMU_CAPS_OBJECT_MEMORY_RAM
Introduced in QEMU's commit of v2.1.0-rc0~41^2~104 the
memory-backend-ram is going to be present for all QEMU versions
we support (4.2.0, currently). Therefore, we can assume the
capability is always set and thus doesn't need to be checked for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:42 +01:00
Michal Privoznik
35f3864090 qemuxml2argvtest: Drop cpu-numa-memshared-1 test case
The aim of this test case it to make sure we error out when
QEMU_CAPS_OBJECT_MEMORY_RAM is missing. Well, it's never going to
be missing. Drop the test case.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:42 +01:00
Michal Privoznik
682dd480ac qemuxml2xmltest: Convert hugepages related tests to _CAPS_LATEST
Currently, we have maybe a dozen tests for hugepages related stuff in
qemuxml2xmltest. In all cases DO_TEST() is used, which means we have to
enumerate all capabilities needed (though, it's usually just
QEMU_CAPS_OBJECT_MEMORY_RAM and QEMU_CAPS_OBJECT_MEMORY_FILE,
exceptionally QEMU_CAPS_DEVICE_PC_DIMM too).

Instead of deleting the caps flags one-by-one, just switch the
tests to use DO_CAPS_LATEST().

Since some of our expected output files are just a symlink to their
respective input files, these are changed too. But from QEMU's
POV nothing changes as no .args file is changed.

Oh, and I'm also adding a 'hugepages-memaccess3' test case, which
was missing, surprisingly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:42 +01:00
Michal Privoznik
ea32d397fe qemuxml2argvtest: Convert hugepages related tests to _CAPS_LATEST
Currently, we have maybe a dozen tests for hugepages related
stuff in qemuxml2argvtest. In all cases DO_TEST() is used, which
means we have to enumerate all capabilities needed (though, it's
usually just QEMU_CAPS_OBJECT_MEMORY_RAM and
QEMU_CAPS_OBJECT_MEMORY_FILE, exceptionally
QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD too).

Instead of deleting the caps flags one-by-one, just switch the
tests to use DO_CAPS_LATEST().

The qemuxml2xmltest will undergo similar treatment in next
commit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 15:27:42 +01:00
Peter Krempa
9acd9fa733 qemu: validate: Validate maximum start time for <clock offset='absolute'>
Glib can internally convert only unix timestamps up to
9999-12-31T23:59:59 (253402300799). Validate that the user doesn't use
more than that as otherwise we cause an assertion failure:

 (process:1183396): GLib-CRITICAL **: 14:25:00.906: g_date_time_format: assertion 'datetime != NULL' failed

Additionally adjust the schema to allow bigger values as we use
'unsigned long long' to parse the value.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2128993
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-04 09:54:33 +01:00
Peter Krempa
8daa94cd8e virschematest: Add infrastructure for testing single devices
Introduce an internal schema for a single device and use it to test the
various files in tests/qemuhotplugtestdevices and
tests/qemublocktestdata directories.

This also requires us to implement schema for (some) privateData bits
for the disk source.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-03 09:19:54 +01:00
Peter Krempa
32d49d4b91 virschematest: Improve testing schemas in 'tests/cputestdata'
The 'cputestdata' directory has a collection of XML files with very
complicated naming schemes for various input and output XML files.

Rather than trying to write complex regexes for selecting specific files
which diverged already multiple times we can introduce an internal
schema file which will cover all of the 3 top level elements used in the
XML files.

Schema for <cpu> is taken from our main RNG schema, <cpuTest> is just a
collection of <cpu> elements, and finally <cpudata> is a simple enough
to describe inline.

To keep the validator happy we have to generate the schema file to
place full paths for the included documents.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-03 09:19:54 +01:00
Peter Krempa
640448cc14 qemublocktest: Mark 'network-ssh-qcow2' input XML as invalid
The XML does not conform to the RNG schema as we don't yet expose the
'ssh' protocol officially. Mark the XML as invalid by renaming it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-02 09:26:03 +01:00
Peter Krempa
ab9beff6b8 tests: qemublocktestdata/imagecreate: Remove bogus 'name="vda"' attribute from <disk>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-02 09:26:03 +01:00
Peter Krempa
c8fe5614c4 qemublocktestdata: Fix 'block-raw-reservations' case
The 'reservations' element doesn't have an 'enabled' attribute according
to our schema, remove it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-02 09:26:03 +01:00
Peter Krempa
cc2cdb3324 virschematest: Construct path to the schema in the SCHEMAS_PATH
'abs_top_srcdir' can be prepended to the schema in the macro. Apart from
removing one needless string copy it will also allow pointing to schema
files in the builddir which will come handy in upcoming patches.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-02 09:26:03 +01:00
Peter Krempa
21e67c667e qemustatusxml2xml: Remove obsolete 'json' attribute
We no longer support HMP-only qemus. Remove the leftover attribute from
the test files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-02 09:26:03 +01:00
Peter Krempa
696aa32e14 virschematest: Test 'nodedevxml2xmlout' directory
Test the output files against the RNG schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-02 09:26:03 +01:00
Peter Krempa
fd97c85b95 tests: qemucapabilities: Add data for the qemu-7.2 dev cycle
Add data based on the v7.1.0-1579-g5107fd3eff qemu commit.

Notable changes:

- New machine types and corresponding objects:
    - pc-i440fx-7.2, pc-i440fx-7.2-machine, pc-q35-7.2, pc-q35-7.2-machine
- new NETDEV_STREAM_CONNECTED/NETDEV_STREAM_DISCONNECTED events
- thread-context object and prealloc-property for memory devices added
- libblkio block driver backed support added:
    - new backend protocol drivers:
       - io_uring, nvme-io_uring, virtio-blk-vhost-user, virtio-blk-vhost-vdpa
- New CPU flags and some CPU features become migratable
  (corresponding 'cpu-host-model' test changed output)
- cpu features 'avx', 'avx2', 'f16c', 'fma', 'vaes' became available in
  TCG
- 'dumpdtb' command added
- New disk frontend properties:
    - account-failed, account-invalid
- New unstable commands for debugging virtio:
  x-query-virtio, x-query-virtio-status, x-query-virtio-queue-status,
  x-query-virtio-vhost-queue-status, x-query-virtio-queue-element

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-01 15:47:44 +01:00
Peter Krempa
3ae376535a virNodeDeviceCapPCIDefFormat: Use %u for unsigned values
'bus', 'slot' and 'function' are unsigned int variables parsed as
unsigned int, but were formated as signed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-11-01 13:07:20 +01:00
Peter Krempa
0268270b0f conf: node_device: Add 'validate' argument to virNodeDeviceDefParse
Allow callers to request XML validation against the schema. All callers
for now pass 'false'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-11-01 13:07:20 +01:00
Cole Robinson
72d4709ab9 tests: Fix libxlxml2domconfigtest with latest xen
shadow_memkb is populated from a libxl API call, and the value can
change. For example:
https://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=2c992810854a15b41be920519ce83a4a328d5168

Mock libxl_get_required_shadow_memory to give consistent output

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-10-30 12:34:02 -04:00
Peter Krempa
e204f8e516 qemuxml2argvtest: Don't re-parse and re-generate commandline for QAPI schema validation
The removal of the special internal flag for '-netdev' validatition now
allows us to use the same virCommand object for validation of the
schema.

Pass it into the validator instead of re-parsing and re-generating
everything.

This improved the runtime of qemuxml2argvtest by ~25% on my box.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-10-20 09:34:42 +02:00
Pavel Hrdina
33178b9e52 vircgroup: rework virCgroupNewSelf
With the introduction of `libvirt` sub-directory to the cgroup topology
some of the cgroup configuration was moved into that sub-directory
together with the VM processes.

LXC uses virCgroupNewSelf() in the container process to detect cgroups
in order to report various data from cgroups inside the container.

We need to properly detect the new `libvirt` sub-directory here
otherwise LXC will report incorrect data.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-19 16:32:30 +02:00
Pavel Hrdina
76ff847386 vircgroupmock: fix cgroup v1 mocking
The `legacy` mode is also valid so we need to take it into account as
well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-19 16:32:14 +02:00
Amneesh Singh
415f8b2233 qemu_capabilities: add "query-stats-schemas" QMP command to the QEMU capabilities
Related: https://gitlab.com/libvirt/libvirt/-/issues/276

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2022-10-19 15:58:29 +02:00
Tim Wiederhake
ad5a9fbb97 cputestdata: Fix test data for EPYC 7502
Commit 5c17a7ba41 introduced a new feature (ibrs) but did not update
existing cputestdata.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-10-19 14:25:57 +02:00
Jim Fehlig
71d9836ca1 conf: Add channel devices to domain capabilities
As qemu becomes more modularized, it is important for libvirt to advertise
availability of the modularized functionality through capabilities. This
change adds channel devices to domain capabilities, allowing clients such
as virt-install to avoid using spicevmc channel devices when not supported
by the target qemu.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-17 11:39:00 -06:00
Jim Fehlig
4e13cc4adb conf: Add USB redirect devices to domain capabilities
As qemu becomes more modularized, it is important for libvirt to advertise
availability of the modularized functionality through capabilities. This
change adds USB redirect devices to domain capabilities, allowing clients
such as virt-install to avoid using redirdev devices when not supported
by the target qemu.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-14 16:10:01 -06:00
Daniel Henrique Barboza
06ebad7c78 tests: refactor pseries features parse failure tests
The qemuxml2argvtest pseries-feature parse failure tests uses a symlink
to the pseries-features.xml test domain and control which feature it is
supposed to fail by excluding it from the capabilities list. The
advantage of this approach is that the same XML can be used in multiple
tests.

One downside is that any new pseries capability must be declared in all
existent tests, otherwise all other tests can break if this new
capability happens to be validated early in qemu_validate.c. Any new
parse_error test must declare all other existent capabilities.

Another downside is the fact that we're testing fairly improbable
scenarios: all pseries capabilities being tested here were introduced by
the same QEMU version, 4.2.0, at least as far as libvirt is aware of.
This means that it's no possible to have a scenario where, for example,
ccf-assist is not present but cfpc is. And last, but not the least, it's
getting in the way of our effort to convert all pseries tests to not use
explicit capabilities.

Changing all these tests to use DO_TEST_PARSE_ERROR_NOCAPS() will allow
us to test exactly what we want to test, which is the parse error given
for each feature if the binary does not have support for it. The XML
being used for each test can be simplified to just declare a single
feature. In the end we'll end up with more XML lines, but less
complexity inside qemuxml2argvtest.c.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2022-10-13 16:28:01 -03:00
Daniel Henrique Barboza
8ff73d22c7 tests: change qemuxml2argv pseries tests to TEST_CAPS_LATEST
Eliminate most of the pseries tests that are using explicit qemu caps
instead of CAPS_LATEST. The remaining tests will be handled in the next
patch.

The changes made are trivial: rename the .args/.err files to
ppc64-latest.(args/err) and do the required changes to match the newest
capabilities.

A notable expection were tests pseries-console-native,
pseries-serial-compat and pseries-serial+console-native. These are
aliases of the pseries-serial-native tests.  In this case we needed to
re-create the symlink accordingly.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2022-10-13 16:27:16 -03:00
Daniel Henrique Barboza
41c685292b tests: qemucapabilities: bump ppc64 caps with qemu 7.1.0
No significant changes from the 7.0.0 capabilities.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2022-10-13 16:26:58 -03:00
Michal Privoznik
27df3522e6 meson: Replace external_program.path() with external_program.full_path()
The path() method is deprecated in 0.55.0 and we're recommended
to use full_path() instead. Interestingly, we were already doing
do in couple of places, but not all of them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-10 15:06:09 +02:00
Michal Privoznik
3395c35f2f meson: Replace meson.source_root() with meson.project_source_root()
The source_root() method is deprecated in 0.56.0 and we're
recommended to use project_source_root() instead.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-10 15:06:09 +02:00
Michal Privoznik
5ecdcf8541 meson: Replace meson.build_root() with meson.project_build_root()
The build_root() method is deprecated in 0.56.0 and we're
recommended to use project_build_root() instead.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-10 15:06:09 +02:00
Jiri Denemark
e8efe42409 cpu_ppc64: Implement virCPUGetVendorForModel
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-10 14:31:43 +02:00
Jiri Denemark
311e21ad32 cpu_x86: Implement virCPUGetVendorForModel
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-10 14:31:43 +02:00
Jiri Denemark
2784a83907 domain_capabilities: Add vendor attribute for CPU models
Even though several CPU models from various vendors are reported as
usable on a given host, user may still want to use only those that match
the host vendor. Currently the only place where users can check the
vendor of each CPU model is our CPU map, which is considered internal
and users should not really be using it directly. So to allow for such
filtering we now advertise the vendor of each CPU model in domain
capabilities.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-10 14:31:42 +02:00
Jiri Denemark
f0554d88fb conf: virDomainCapsCPUModelsAdd never fails
Since the function always returns 0, we can just return void and make
callers simpler.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-10 14:31:42 +02:00
Peter Krempa
30095f4f4c util: xml: Remove virXMLParseFile
Most callers prefer using the XPath context. Convert the last user to
use virXMLParseFileCtxt and remove the helper macro.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:25 +02:00
Peter Krempa
402c31f3ac virDomainDefParseNode: Pass only the XPath context as argument
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:25 +02:00
Peter Krempa
1eb67d24de conf: network: Provide only virNetworkDefParse
Replace virNetworkDefParseString/File by direct calls to
virNetworkDefParse.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:25 +02:00
Peter Krempa
37de09a2f9 conf: nodedev: Provide only virNodeDeviceDefParse
Replace the thin wrappers virNodeDeviceDefParseString/File by directly
calling the main parser.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:25 +02:00
Peter Krempa
5ea1d04322 conf: nwfilter: Provide only virNWFilterDefParse
Replace virNWFilterDefParseString/File with the common function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:25 +02:00
Peter Krempa
7c32578531 conf: secret: Provide only virSecretDefParse
Replace the virSecretDefParseFile/String shims by calls to
virSecretDefParse.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:24 +02:00
Peter Krempa
2a166e6c12 conf: storage: Provide only virStorageVolDefParse
Remove the virStorageVolDefParseFile/String shim functions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:24 +02:00
Peter Krempa
97df89d7f5 conf: storage: Provide only virStoragePoolDefParse
Replace the virStoragePoolDefParseString/File thin wrappers by
virStoragePoolDefParse.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:24 +02:00
Peter Krempa
ed080445a6 conf: networkportdef: Provide only virNetworkPortDefParse
Replace the two helpers virNetworkPortDefParseString/File with the
common helper.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:24 +02:00
Peter Krempa
1cd64b7326 tests: qemuxml2argv: Use virXMLParse properly
Don't validate the root node and don't allocate a private XPath context
when virXMLParse can do that internally.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:24 +02:00
Peter Krempa
0dceac9b8e conf: nwfilterbinding: Provide only virNWFilterBindingDefParse
Remove the virNWFilterBindingDefParseString/File thin wrappers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:24 +02:00
Peter Krempa
0c5378bc07 util: xml: Expose all arguments of virXMLParseHelper in virXMLParse macro
The generic helper also has helper code to validate the root element and
create an XPath context. Many places in the code duplicate code for
doing these operations.

Extend the helper to provide all arguments and fix all callers.

In many cases this patch refactors the passing of the 'validate'
field into a separate variable to avoid quirky looking arguments.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-06 10:54:24 +02:00
Ján Tomko
d6245e36c2 qemu: retire QEMU_CAPS_CCW
Now that we no longer use the capability, stop probing for existence
of 'virtual-css-bridge' and its properties.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-03 19:46:42 +02:00
Ján Tomko
bbaa22e24a qemu: retire QEMU_CAPS_CCW_CSSID_UNRESTRICTED
Now that it is no longer used, stop probing for it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-03 19:46:42 +02:00
Ján Tomko
0662e6bd36 qemu: Assume QEMU_CAPS_CCW
Introduced in libvirt by:
  commit f245a9791c
    qemu: introduce capability for virtual-css-bridge

Which mentions that its support was in QEMU 2.7.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-03 19:46:42 +02:00
Ján Tomko
b02568f1be qemu: Assume QEMU_CAPS_CCW_CSSID_UNRESTRICTED
This capability was introduced by libvirt commit:
  commit 263e65fd20
      qemu: introduce vfio-ccw capability

It probes for the cssid-unrestricted property of
virtual-css-bridge, which was introduced in QEMU v2.12 by:
  commit 99577c492fb2916165ed9bc215f058877f0a4106
      s390x/css: unrestrict cssids

Since we bumped the minimum QEMU version to 4.2.0, assume
this property is always present.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-03 19:46:42 +02:00
Ján Tomko
3f35149d4f qemu: convert some s390x tests to use real capability data
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-03 19:46:42 +02:00
Ján Tomko
e4e22bf3ed tests: qemuxml2argvdata: switch zpci address generation to real caps
Among the usual changes, this puts the virtio memballoon on the CCW bus.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-10-03 19:46:42 +02:00
Michal Privoznik
b1fc788957 virgdbusmock: Mock g_dbus_connection_call_with_unix_fd_list_sync() only on UNIX-like systems
As of GLib commit c9874f817be51d3b652457daef3b10766b59db9a,
relesed in GLib 2.73, the g_dbus_connection_call_with_unix_fd_list_sync()
function is not defined always, only when G_OS_UNIX condition is
set. This is also the reason why our virGDBusCallMethodWithFD()
function is guarded with that macro. But virgdbusmock is compiled
always, even on !UNIX systems, e.g. mingw. Therefore, we need to
use the same macro to condition compile its mock.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-30 15:38:47 +02:00
Lin Ma
85aafea449 qemu: Remove host-passthrough validation check for host-phys-bits=on
Besides the -cpu host, The host-phys-bits=on applies to custom or max
cpu model, So the host-passthrough validation check is unnecessary for
maxphysaddr with mode='passthrough'.

Signed-off-by: Lin Ma <lma@suse.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2022-09-29 08:45:03 -06:00
Daniel P. Berrangé
8496880866 tests: add better QEMU capabilities example
Updated example covers:

  * UUID
  * CPU model, vendor, microcode, signature, counters,
    topology, maxphysaddr, features,
  * Power management
  * NUMA page size info, multiple nodes, CPU topology IDs, distances
  * CPU cache bank info
  * Multiple secmodels

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-09-21 12:02:40 +01:00
Peter Krempa
bc753aa6f7 qemu: migration: Remove QEMU_MONITOR_MIGRATE_BACKGROUND
'qemuMonitorJSONMigrate' is called from:
 - qemuMonitorMigrateToHost
 - qemuMonitorMigrateToSocket
   Both of the above function are called only from
   qemuMigrationSrcStart.

 - qemuMonitorMigrateToFd
   - called from:
     - qemuMigrationSrcToFile
       Both instances here pass QEMU_MONITOR_MIGRATE_BACKGROUND
       directly.
     - qemuMigrationSrcStart

qemuMigrationSrcStart is then called from qemuMigrationSrcRun and
qemuMigrationSrcResume, both of which always add QEMU_MONITOR_MIGRATE_BACKGROUND
to the flags.

Thus any caller always passes the flag so that we can remove the flag
altogether.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-09 16:10:47 +02:00
Peter Krempa
d5fb23bc6e qemu: monitor: Drop support for old-style non-shared storage migration
Remove the support for enabling the 'blk' and 'inc' parameters of the
'migrate' command as there are no users any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-09 16:10:47 +02:00
Peter Krempa
2980268b22 qemu: capabilities: Retire QEMU_CAPS_NBD_SERVER
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-09 16:10:47 +02:00
Kristina Hanicova
0150f7a8c1 virdomainjob: make drivers use job object in the domain object
This patch uses the job object directly in the domain object and
removes the job object from private data of all drivers that use
it as well as other relevant code (initializing and freeing the
structure).

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-07 12:13:13 +02:00
Kristina Hanicova
84e9fd068c conf: extend xmlopt with job config & add job object into domain object
This patch adds the generalized job object into the domain object
so that it can be used by all drivers without the need to extract
it from the private data.

Because of this, the job object needs to be created and set
during the creation of the domain object. This patch also extends
xmlopt with possible job config containing virDomainJobObj
callbacks, its private data callbacks and one variable
(maxQueuedJobs).

This patch includes:
* addition of virDomainJobObj into virDomainObj (used in the
  following patches)
* extending xmlopt with job config structure
* new function for freeing the virDomainJobObj

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2022-09-07 12:06:18 +02:00
Ján Tomko
d2e767d237 qemu: do not probe for properties of nec-usb-xhci
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-07 12:05:40 +02:00
Ján Tomko
6600c0ff18 qemu: retire QEMU_CAPS_VIRTIO_PACKED_QUEUES
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-07 12:05:40 +02:00
Ján Tomko
b710fcaff7 qemu: assume QEMU_CAPS_VIRTIO_PACKED_QUEUES
Added by QEMU commit:

commit 74b3e46630446568aecb0be1c77c4875d7a52f6d
Author:     Jason Wang <jasowang@redhat.com>
CommitDate: 2019-10-25 07:46:22 -0400

    virtio: add property to enable packed virtqueue

    Signed-off-by: Jason Wang <jasowang@redhat.com>
    Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
    Reviewed-by: Jens Freimann <jfreimann@redhat.com>
    Message-Id: <20191025083527.30803-9-eperezma@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

git describe: v4.1.0-1780-g74b3e46630 contains: v4.2.0-rc0~32^2~17

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-07 12:05:40 +02:00
Ján Tomko
3ae85b6a69 qemu: retire QEMU_CAPS_VIRTIO_SCSI_IOTHREAD
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-07 12:05:40 +02:00
Ján Tomko
d8e274253a qemu: retire QEMU_CAPS_NEC_USB_XHCI_PORTS
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-07 12:05:40 +02:00
Ján Tomko
04bf98a418 qemu: assume QEMU_CAPS_NEC_USB_XHCI_PORTS
Introduced by QEMU commit 0846e6359c407e372f446723b8b7b09ac20d0f03
released in QEMU 1.3.0

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-07 12:05:40 +02:00
Ján Tomko
935865e057 qemu: retire QEMU_CAPS_CHARDEV_LOGFILE
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-07 12:05:40 +02:00
Ján Tomko
72768bde3d qemu: assume QEMU_CAPS_CHARDEV_LOGFILE
Introduced in QEMU 2.6

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-07 12:05:40 +02:00
Ján Tomko
be217321eb qemu: retire QEMU_CAPS_CHARDEV_FILE_APPEND
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-07 12:05:40 +02:00
Ján Tomko
0a5b820f8f qemu: assume QEMU_CAPS_CHARDEV_FILE_APPEND
Introduced in QEMU 2.6

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-09-07 12:05:40 +02:00
Peter Krempa
4a95d1ede4 tests: qemuxml2argvdata: Remove two unused output files
Commit d7ae7ce363 forgot to clean up unused error output files
'boot-dev+order.err' and 'boot-menu-enable-with-timeout-invalid'
after converting tests to DO_TEST_CAPS_LATEST.

Fixes: d7ae7ce363
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2022-09-05 17:22:28 +02:00
Peter Krempa
35acaa9488 qemucapabilitiestest: Update qemu capabilities for qemu-7.1 release
qemu-7.1 is released now. Update the capabilities for the final time.

Notable change since last update:
 - 'exit-failure' action for 'panic' lifecycle action added

The 'min-xlevel' change is related to upgrade of the host kernel.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-09-01 13:11:10 +02:00
Peter Krempa
d34be15c6c qemu: command: Don't use deprecated chardev backend drivers 'tty' and 'parport'
The replacement is 'serial' and 'parallel' respectively introduced at
least in qemu-2.9 and the old versions are deprecated since qemu-6.0
(qemu commit 5965243641d797b22 ).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:10 +02:00
Peter Krempa
e55888d075 virDomainControllerDefParseXML: Parse 'index' by virXMLPropInt
'index' is parsed to fit into a signed int but not have negative values.
virXMLPropInt can do that internally.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:10 +02:00
Peter Krempa
45e5648350 qemu: capabilities: Retire QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:10 +02:00
Peter Krempa
ec91195ead qemuxml2xmltest: Convert all test cases asserting QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY
Turn them into DO_TEST_CAPS_LATEST tests so that we are closer to real
world.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:10 +02:00
Peter Krempa
517ca3c46a qemuxml2*test: Remove 'q35-virtio-pci' test case
As noted by the comments the only difference was the qemu capabilities
asserted. Now that we use only real caps for this test case it makes no
sense to have two copies.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:10 +02:00
Peter Krempa
80a0f44a7a qemuxml2argvtest: Convert all test cases asserting QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY
Turn them into DO_TEST_CAPS_VER bound to qemu-4.2 to show the minimum
amount of change. We already have DO_TEST_CAPS_LATEST versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:10 +02:00
Peter Krempa
e097e1a755 qemuxml2argvtest: Add DO_TEST_CAPS_LATEST versions of tests which assert QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY
Further patches will try to remove QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
so add few more modern tests before doing that.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:10 +02:00
Peter Krempa
a7669aa119 qemuxml2*test: Use QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL for macos hfv tests
Switch from QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY to
QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL as it has no impact on the test
output.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:09 +02:00
Peter Krempa
50704f6c25 qemudomainsnapshotxml2xmltest: Add test case for a snapshot with 'inactiveDomain' element
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:09 +02:00
Peter Krempa
bbda8bea04 qemudomainsnapshotxml2xmltest: Allow regenerating into non-existing output file
Replacing the 'virTestLoadFile' + 'virTestDifferenceFull' by '
virTestCompareToFile' allows to use the VIR_TEST_REGENERATE_OUTPUT=1
option to also generate the output file if it doesn't exist.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:09 +02:00
Peter Krempa
41460774ea nodedevschematest: Add example file for a HBA with 'vport_ops' capability
Illustrate the problem in the schema fixed by previous commit.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:09 +02:00
Peter Krempa
9ac2bbcbbf tests: Remove storage pool/vol tests for sheepdog
The support for the sheepdog storage backend will be dropped in the
upcoming patches. Remove all the relevant tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:09 +02:00
Peter Krempa
d7ae7ce363 tests: qemuxml2argv: Convert all 'boot*' cases to DO_TEST_CAPS_LATEST
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:09 +02:00
Peter Krempa
89bef9575a tests: qemuxml2argv: Use x86_64 arch and emulator in all boot* test files
Using the modern emulator and arch will allow us to convert all of the
tests to use DO_TEST_CAPS_LATEST.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:09 +02:00
Peter Krempa
9b2902c835 qemuxml2argvtest: Use different network storage protocol for boot order tests
The support for 'sheepdog' was dropped from qemu-6.1 and later, to
convert the tests to latest caps we need to use something else. Use
'nbd'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-01 13:11:09 +02:00
Martin Kletzander
6457619d18 Rename iterface type='dummy' to type='null'
When commit bac6b266fb added this "functionality" this was the only
naming I could think of, but after discussion with Dan we found the name
'null' fits a bit better, so change it before we make a release with the
old name.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-08-25 13:27:04 +02:00
Laine Stump
15bd9179be tests: remove superfluous cleanup: labels and ret return variables
After converting virNetworkDef * to g_autoptr(virNetworkDef) the
cleanup codepath was empty, so it has been removed.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-24 12:22:47 -04:00
Laine Stump
d9074b8e01 tests: replace explicit virNetworkDefFree() with g_autoptr(virNetworkDef)
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-24 12:22:47 -04:00
Michal Privoznik
da255ce831 lib: Don't check for retval for virCommandNew*()
The virCommand module is specifically designed so that no caller
has to check for retval of individual virCommand*() APIs except
for virCommandRun() where the actual error is reported. Moreover,
virCommandNew*() use g_new0() to allocate memory and thus it's
not really possible for those APIs to return NULL. Which is why
they are even marked as ATTRIBUTE_NONNULL. But there are few
places where we do check the retval which is a dead code
effectively. Drop those checks.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2022-08-23 16:14:05 +02:00
Ján Tomko
f3ce408b67 qemu: do not probe for -pcihost properties
Now that we no longer care about any of their properties, there's no need
to call `device-list-properties` on these devices.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-22 14:45:04 +02:00
Ján Tomko
f4d70f3ef3 qemu: retire QEMU_CAPS_Q35_PCI_HOLE64_SIZE
We no longer use it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-22 14:45:04 +02:00
Ján Tomko
a2fc283ab6 qemu: Retire QEMU_CAPS_I440FX_PCI_HOLE64_SIZE
We no longer use it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-22 14:45:04 +02:00
Ján Tomko
6b4c1e010e qemu: always assume QEMU_CAPS_*_HOLE64_SIZE
Introduced back in 2013 by QEMU commit:
  commit 398489018183d613306ab022653552247d93919f

      pc: limit 64 bit hole to 2G by default

Released in 1.6.0

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-22 14:45:04 +02:00
Ján Tomko
ec73ad2ea5 qemu: retire QEMU_CAPS_DUMP_GUEST_MEMORY
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-22 14:45:04 +02:00
Andrea Bolognani
838f64515e tests: Reset macOS dyld environment
This is needed to ensure the environment variables that we need
for the test program itself, specifically to load mock libraries,
do not interfere with any command that gets invoked by it, either
directly or indirectly. We already perform the same cleanup step
for LD_* variables.

This makes the test failures

  error : virCommandWait:2752 : internal error: Child process
    (/usr/libexec/qemu/vhost-user/test-vhost-user-gpu --print-capabilities)
    unexpected fatal signal 6: dyld[8896]: symbol not found in flat
    namespace '_virQEMUCapsGet'
  error : qemuVhostUserFillDomainGPU:394 : operation failed: Unable to
    find a satisfying vhost-user-gpu

that were showing up on macOS 12 go away.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-22 10:50:56 +02:00
Jiri Denemark
f1929d4289 tests: Drop irrelevant CPU config from graphics-spice-timeout
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/243

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-08-18 16:32:21 +02:00
Amneesh Singh
ceaa74dfe0 qemu_capabilities: add "query-stats" QMP command to the QEMU capabilities
Related: https://gitlab.com/libvirt/libvirt/-/issues/276

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-08-18 15:09:49 +02:00
Martin Kletzander
580538c5dd vmx: Add support for VDS interface
Since we cannot properly plug a new VM into the distributed switch, we can at
least report the provided pieces of information, so that XML editing still works
even for VMs with such interfaces.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-18 08:34:32 +02:00
Martin Kletzander
9c9fc39ded tests: Fix vmx/xml filenames
Commit 70768cda97 added a functionality that was previously (in an unsubmitted
version of the commit) represented differently in the XML, but the filenames
kept the old name.  Fix the name so they are not misleading.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-18 08:34:30 +02:00
Jim Fehlig
231af0a08c schema: Add maxphysaddr element to hostcpu
The output of "virsh capabilities" was not conformant to the
capability.rng schema. Add the missing element to the schema.

Fixes: c647bf29af
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-08-15 09:32:59 -06:00
Jim Fehlig
65e8ac6f92 schema: Don't enforce ordering of hostcpu capabilities elements
The change to caps-test.xml demonstrates the need for the change to
cputypes.rng.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-08-15 09:32:59 -06:00
Ján Tomko
01cf26d41f qemu: retire QEMU_CAPS_VIRTIO_TX_ALG
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-08-11 18:34:47 +02:00
Ján Tomko
c80b10e88f qemu: always assume QEMU_CAPS_VIRTIO_TX_ALG
Introduced back in 2010 by QEMU commit:
  commit a697a334b3c4d3250e6420f5d38550ea10eb5319
      virtio-net: Introduce a new bottom half packet TX

Released in QEMU 0.14.0

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-08-11 18:34:47 +02:00
Ján Tomko
9a23c55b04 tests: qemuxml2xmltest: remove interface from disk test
There is no need to specify an interface for a disk test.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-08-11 18:34:47 +02:00
Peter Krempa
5eb283e294 qemu: Assume and retire QEMU_CAPS_BLOCKDEV_BACKUP
The blockdev-backup QMP command was introduced in qemu-2.3.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:26:32 +02:00
Peter Krempa
66c442f80f qemu: Assume support and retire QEMU_CAPS_BLOCK_WRITE_THRESHOLD
The event was introduced in qemu-2.3

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:26:17 +02:00
Peter Krempa
3a7955979c qemu: capabilities: Retire QEMU_CAPS_QUERY_NAMED_BLOCK_NODES
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:26:02 +02:00
Peter Krempa
a0b8b54348 qemu: Retire QEMU_CAPS_BLOCKDEV
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:25:36 +02:00
Peter Krempa
1050d80585 qemuDomainValidateStorageSource: Remove 'maskBlockdev' argument
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:25:11 +02:00
Peter Krempa
6695162c76 qemu: domain: Assume QEMU_CAPS_BLOCKDEV for the domain private code
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:24:11 +02:00
Peter Krempa
2ebb44a957 qemuhotplugtest: Switch to -blockdev mode
Enable blockdev mode and convert the expected commands to the modern
equivalents in preparation for removing the old-style hotplug code
paths.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:22:14 +02:00
Peter Krempa
d2831cd521 qemu: monitor: Remove unused qemuMonitor(Eject|Change)Media
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:21:59 +02:00
Peter Krempa
b573224cf7 qemu: monitor: Remove unused qemuMonitorDrivePivot
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:20:21 +02:00
Peter Krempa
d926d7b4c9 qemu: monitor: Remove unused arguments of qemuMonitorBlockStream
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:19:39 +02:00
Peter Krempa
01f8c55f22 qemu: monitor: Remove unused arguments of qemuMonitorBlockCommit
The 'persistjob' is always true and 'top' and 'base' are always NULL.
Adjust the functions to drop the arguments.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:19:11 +02:00
Peter Krempa
8c67518256 qemu: monitor: Remove unused qemuMonitorDriveMirror
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:18:44 +02:00
Peter Krempa
071a4c8ba7 qemu: alias: Remove check for QEMU_CAPS_BLOCKDEV
The only instance in this file can be simplified to avoid checking the
capability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:14:18 +02:00
Peter Krempa
75a0fbe420 qemu: block: Remove 'qemuBlockNodeNamesDetect' and related infrastructure
With blockdev we are generating the nodenames ourselves so all of this
infrastructure became obsolete. Remove it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:13:55 +02:00
Peter Krempa
58e740aa24 qemu: Remove unused code for pre-blockdev disk snapshot monitor interaction
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:07:39 +02:00
Peter Krempa
b27549e631 qemu: capabilities: Retire QEMU_CAPS_BLOCKDEV_DEL
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 15:07:14 +02:00
Peter Krempa
b45f63ecd9 qemu: capabilities: Retire QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
ebfa1fb0f9 qemu: capabilities: Retire capabilities used for -blockdev detection
Retire:
    QEMU_CAPS_BLOCK_FILE_AUTO_READONLY_DYNAMIC
    QEMU_CAPS_SCSI_DISK_DEVICE_ID
    QEMU_CAPS_SAVEVM_MONITOR_NODES

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
b51512f915 qemu: command: Always assume support for QEMU_CAPS_SCSI_DISK_DEVICE_ID
The 'device_id' property of 'scsi_disk' was added in qemu-4.0 and it's
unconditionally present, thus we can now always assume its presence.

Update some fake-caps test which didn't yet assert the capability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
5998381b08 tests: Force QEMU_CAPS_BLOCKDEV(_HOSTDEV_SCSI) in fake caps tests
Until we finish removing the capabilities we need to force them in the
tests so that it's obvious that the code changes have no impact.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
9b54efb7cf qemu: capabilities: Unconditionally set QEMU_CAPS_BLOCKDEV/QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI
The cleanup of the code to always assume support for QEMU_CAPS_BLOCKDEV
will not be simple, so for now we hardcode the support and the code will
be cleaned up gradually.

We also disallow users to clear the flags via the namespace property or
qemu.conf configuration.

The change to the PPC64 test data originates from the fact that the
capability dump is not from the release version but is lacking one of
the necessary flags to enable -blockdev.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
78ad796a43 qemu: capabilities: Retire QEMU_CAPS_QCOW2_LUKS
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
8eae01ba28 qemuxml2xmltest: Modernize all test cases using QEMU_CAPS_QCOW2_LUKS
Modernize 'disk-nvme', 'encrypted-disk-usage', 'encrypted-disk', and
'user-aliases' cases to use DO_TEST_CAPS_LATEST.

This will remove all uses of QEMU_CAPS_QCOW2_LUKS from the test suite.

Since the output files are done via symlinks to input files, the input
files need to be modernized with few auto-added XML bits.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
cd2d9808db qemuxml2argvtest: Use DO_TEST_CAPS_LATEST for all 'user-aliases' tests
Modernize the tests as they mostly care that the aliases are properly
propagated to qemu.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
f80829dece qemu: capabilities: Retire QEMU_CAPS_DRIVE_DISCARD and QEMU_CAPS_DRIVE_DETECT_ZEROES
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
c250c5a3db qemu: capabilities: Retire QEMU_CAPS_GLUSTER_DEBUG_LEVEL
The debug level of gluster backend became configurable in qemu-2.8.

This also removes the only old-style syntax for the 'blockdev-add'
command prior to stabilization.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
fc0aa62377 qemu: capabilities: Retire QEMU_CAPS_ACTIVE_COMMIT
Active block commit is supported since qemu-2.0

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
3d367a2c93 qemu: capabilities: Retire QEMU_CAPS_CHANGE_BACKING_FILE
The 'change-backing-file' command is unconditionally supported since
qemu-2.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
d1e0eaabb1 qemu: capabilities: Retire QEMU_CAPS_AUDIODEV
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
95215e6b79 qemuxml2(argv|xml)test: Remove use of QEMU_CAPS_AUDIODEV in fake-caps tests
The code no longer uses the capability so the tests don't need to assert
it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
31ee59d4e1 qemu: command: Always assume QEMU_CAPS_AUDIODEV
Generate only new version of the '-audiodev' commandline. The leftover
old code and validation will be removed in subsequent patches.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
c7ab87b8a6 domaincapstest: Remove test data for qemu-4.1
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
ff4e0b775b qemucapabilitiestest: Remove test data for qemu-4.1
qemu-4.1 will not be supported any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
1228fc69b1 domaincapstest: Remove test data for qemu-4.0
qemu-4.0 will no longer be supported.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
3397826a68 qemucapabilitiestest: Remove test data for qemu-4.0
qemu-4.0 will no longer be supported, remove the test data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
91c7835cf9 tests: domaincaps: Remove test data for qemu-3.1
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
79cb01304f tests: qemucapabilities: Remove qemu-3.1 test data
Upcoming patches will raise the minimum required qemu version to 4.2.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
b1973b883c qemuxml2argvtest: Remove 'qemu-4.0' versions of 'cpu-host-model-cmt' and 'cpu-tsc-frequency'
Minimum qemu version is going to be bumped to qemu-4.2. Upgrading the
version of these tests doesn't make sense as the host cpu in the real
capabilities doesn't support the features the tests are attempting to
test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
081230fcdb qemuxml2argvtest: Remove 'qemu-4.0' version of aarch64-features-sve case
Minimum qemu will be bumped to 4.2 so this test no longer makes sense.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
a0ce9317fc qemuxml2argvtest: Remove pre-qemu-4.2 versions of 'cpu-host-model' test
Minimum qemu will be bumped to 4.2 so remove the older test cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
9248434536 qemuxml2argvtest: Remove 'qemu-3.1' versions of virtio-(non-)transitional tests
Starting from qemu-4.0 a new device model name is used instead of the
'disable_*' props. Since we are going to bump to qemu-4.2 as minimum
this test can be removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
6a9b336be1 qemuxml2argvtest: Drop 'qemu-4.1' variants of all audio tests
Minimum qemu version will be bumped to qemu-4.2 so we no longer need to
care about configuring audiodevs via the environment variables.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
5838bd98a4 tests: qemuxml2argv: Remove pre-blockdev versions of disk-related tests
Upcoming patches will bump minimum supported qemu version to 4.2 which
will use '-blockdev' with qemu so we can drop all the old test cases for
pre-blockdev configs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Peter Krempa
88dbfabd4e qemuxml2(argv|xml)test: Remove 'qemu-4.1' variant of 'x86-kvm-32-on-64'
Upcoming patches will bump minimum qemu version to 4.2. In this case we
the 'latest' case is sufficient as with qemu-4.2 we already behave as
upstream ('qemu64' cpu is used instead of 'qemu32').

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-11 14:38:31 +02:00
Andrea Bolognani
1f14dbccbc tests: Mock virQEMUCapsProbeHVF()
Successfully returning without doing anything is what the
function already does on non-Apple platforms.

When building on macOS, however, the check for HVF availability
will be performed. When running on bare metal, that will result
in the QEMU_CAPS_HVF flag being added to the virQEMUCaps
instance, and a bunch of error messages along the lines of

  In 'tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml':
  Offset 7557
  Expect [c]
  Actual [hvf'/>
    <flag name=‘c]

showing up.

Up until now we hadn't noticed because our CI jobs run in VMs,
where HVF support is not available.

Reported-by: Christophe de Dinechin <dinechin@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Christophe de Dinechin <dinechin@redhat.com>
Tested-by: Christophe de Dinechin <dinechin@redhat.com>
2022-08-10 17:49:52 +02:00
Andrea Bolognani
92cc65783e tests: Use domaincapsmock in qemucapabilitiestest
This doesn't change anything at the moment, but is necessary
for the upcoming fix.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Christophe de Dinechin <dinechin@redhat.com>
Tested-by: Christophe de Dinechin <dinechin@redhat.com>
2022-08-10 17:49:30 +02:00
Kristina Hanicova
203e74ff42 qemu: remove unused driver and all its propagations
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2022-08-10 16:50:07 +02:00
Christophe de Dinechin
ede39c1fc6 tests: Pass the flat_namespace option to the linker
This fixes vircryptotest on macOS 12 (Monterey).

The test relies on library injection (using DYLD_INSERT_LIBRARIES)
to replace the normal random functions with functions giving predictable
results, defined in virrandommock.c. However, using DYLD_INSERT_LIBRARIES
only works when building with flat namespaces.

Adding the -Wl,-flat_namespace option to the linker fixes the problem.
The option was already defined in the top-level meson.build, but had been
forgotten in the test linker arguments.

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-08-09 11:42:45 +02:00
Paolo Bonzini
2dd3ec6f57 qemu: deprecate query-cpus-fast capability
All supported versions of QEMU have the command.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-08 17:36:49 +02:00
Paolo Bonzini
b1f57ef0fd qemu: remove support for query-cpus
The query-cpus-fast command was introduced in 2.12, therefore
query-cpus is never used on supported versions of QEMU.  Remove
the logic to parse its output, as well as the parameters to
choose between the two commands.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-08 17:36:49 +02:00
Paolo Bonzini
cf1c191155 tests: remove query-cpus tests
All tests now use query-cpus-fast.  Since the QEMU driver will lose
support for query-cpus soon, go ahead and remove support for testing
it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-08 17:36:49 +02:00
Paolo Bonzini
332ea27164 tests: convert x86_64 tests to query-cpus-fast
All supported versions of QEMU include the query-cpus-fast QMP command.
In preparation for dropping support for the old "query-cpus" commands,
convert the JSON output for x86 tests to the new format, and drop the
"halted" field from the expected output as it is not available anymore.

The CPU properties were obtained from the query-hotpluggable-cpus output
in tests/qemumonitorjsondata.  CPU, thread_id, and qom_path are renamed
respectively to cpu-index, qom-path and thread-id, while nip and halted
are removed.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-08 17:36:49 +02:00
Paolo Bonzini
eb98eb0ce8 tests: convert ppc64 tests to query-cpus-fast
All supported versions of QEMU include the query-cpus-fast QMP command.
In preparation for dropping support for the old "query-cpus" commands,
convert the JSON output for PPC tests to the new format, and drop the
"halted" field from the expected output as it is not available anymore.

The CPU properties were obtained from the query-hotpluggable-cpus output
in tests/qemumonitorjsondata.  CPU, thread_id, and qom_path are renamed
respectively to cpu-index, qom-path and thread-id, while nip and halted
are removed.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-08 17:36:49 +02:00
Paolo Bonzini
e398a6aba4 tests: drop "-fast" from query-cpus-fast tests
All supported versions of QEMU include the query-cpus-fast QMP command.
In preparation for dropping support for the old "query-cpus" commands,
remove the "-fast" suffix from both x86-full-fast and s390-fast.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-08 17:36:49 +02:00
Paolo Bonzini
3635864fa8 tests: remove duplicate cpuinfo test
All supported versions of QEMU include the query-cpus-fast QMP command.
In preparation for dropping support for the old "query-cpus" commands,
remove the query-cpus version of the x86-full test.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-08 17:36:49 +02:00
Martin Kletzander
70768cda97 vmx: Add support for dummy network interface
Also map it to an ethernet without connectionType and networkName.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-08-05 14:37:54 +02:00
Dario Faggioli
1c1a7cdd40 qemu: Add support for max physical address size
This patch maps /domain/cpu/maxphysaddr into -cpu parameters:

  - <maxphysaddr mode='passthrough'/> becomes host-phys-bits=on
  - <maxphysaddr mode='emualte' bits='42'/> becomes phys-bits=42

Passthrough mode can only be used if the chosen CPU model is
'host-passthrough'. Also validate that an explicitly specified
bits value does not exceed the physical address bits on the host.

The feature is available since QEMU 2.7.0.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-08-04 09:04:16 +02:00
Dario Faggioli
e6c29f09e5 conf: Add support for specifying CPU max physical address size
This patch introduces the

    <maxphysaddr mode='passthrough'/>
    <maxphysaddr mode='emulate' bits='42'/>

sub element of /domain/cpu, which allows specifying the guest virtual CPU
address size. This can be useful if the guest needs to have a large amount
of memory.

If mode='passthrough', the virtual CPU will have the same number of address
bits as the host. If mode='emulate', the mandatory bits attribute specifies
the number of address bits.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-08-04 09:04:07 +02:00
Michal Privoznik
67b03faaf1 qemuxml2argvtest: Add negative cases for TPM version
Now that we have all the machinery needed, we can introduce two
simple test cases:

1) only TPM 1.2 is supported, but TPM 2.0 was requested in domain XML,
2) only TPM 2.0 is supported, but TPM 1.2 was requested in domain XML.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2022-08-04 08:14:43 +02:00
Michal Privoznik
1445f62fce testutilsqemu: Fake TPM versions
Because of v8.5.0-rc1~25 we are already faking TPM support for
domaincaps. Might as well fake supported TPM versions.
The swtpm binary supports both TPM versions since its first
release, but pretend it isn't the case. For QEMU-5.2 and older
pretend only TPM-1.2 is available, QEMU-6.* has both TPM-1.2 and
TPM-2.0 and QEMU-7.0 and newer has only TPM-2.0 available.
This way, domaincaps are more dispersed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2022-08-04 08:13:55 +02:00
Peter Krempa
31699d3914 qemuMonitorOpenUnix: Remove 'retry' argument
All callers now pass false for 'retry' we are guaranteed to have a
monitor socket present. This means that the retry code can be removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-08-03 14:26:56 +02:00
Peter Krempa
7c849ad518 qemuMonitorTestNew: Call qemuMonitorOpen with 'retry' false
The 'retry' argument makes the monitor connection opening re-try the
connection in case the monitor socket doesn't exist or isn't properly
listening. In case of the test code this can't happen because the socket
is created and made listening in 'qemuMonitorCommonTestNew' which is
called prior to calling 'qemuMonitorOpen'.

We can thus avoit the code which attempts retries in monitor connection.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-08-03 14:26:56 +02:00
Peter Krempa
dce9047496 qemu: monitor: Remove 'timeout' argument from qemuMonitorOpen
The 'timeout' argument is used by 'qemuMonitorOpenUnix' only when the
'retry' argument is true. The callers of 'qemuMonitorOpen' only pass '0'
for timeout when they call it with 'retry' true and use other values
when 'retry' is false and thus ignored.

This means we can remove the argument and simply have it set to the
default value of QEMU_DEFAULT_MONITOR_WAIT.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-08-03 14:26:56 +02:00
Michal Privoznik
271d337a56 testutilsqemu: Mock virTPMSwtpmSetupCapsGet()
In a recent commit of v8.5.0-85-g430ab88ab1 I've made domaincaps
XML report supported TPM versions. This was done by calling
virTPMSwtpmSetupCapsGet(). But this function isn't mocked and
thus domaincapstest calls the real implementation, which tries to
execute swtpm_setup binary. This fails, because
virFindFileInPath() is mocked in such way that it returns NULL
for anything else than qemu-*.

Anyway, while the real binary is not executed after all, we
should mock the function which tries to execute it so that
predictable result is returned.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-08-02 09:03:24 +02:00
Michal Privoznik
23d4684640 qemu_command: Separate domain memory building into a helper
The qemuBuildMachineCommandLine() function is needlessly long.
Separate out parts that generate memory related arguments into
qemuAppendDomainMemoryMachineParams(). Unfortunately, expected
outputs for some qemuxml2argvdata cases needed to be updated
because the order in which arguments are generated is changed.
But there's no functional change.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-01 10:36:37 +02:00
Michal Privoznik
b185abe9d9 qemu_command: Separate domain features building into a helper
The qemuBuildMachineCommandLine() function is needlessly long.
Separate out parts that generate arguments based on
domainDef->features[] into
qemuAppendDomainFeaturesMachineParam(). Unfortunately, expected
outputs for some qemuxml2argvdata cases needed to be updated
because the order in which features are generated is changed. But
there's no functional change.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-01 10:36:27 +02:00
Michal Privoznik
f7baee531a conf: Validate virDomainMemoryDef::targetNode
Almost all of memory models we currently support allow setting
virDomainMemoryDef::targetNode so that the memory module is
associated with given guest NUMA node. And we do have a check
whether the requested node is within bounds, but it's executed
only when building QEMU's cmd line. Move it into validation
phase.

While this commit is moving the validation to a place that does
not validate all the possible code paths, it's okay, because only
the explicit memory device has user-configurable target node
which could break the assumption.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-01 10:36:15 +02:00
Michal Privoznik
303636e7d0 qemuxml2xmltest: Test memory-hotplug-dimm-addr
After previous commit, when memory-hotplug-dimm-addr.xml file was
fixed, we can also introduce the test case to qemuxml2xmltest.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-01 10:36:11 +02:00
Michal Privoznik
2be3d3bb76 qemuxml2argvtest: Switch memory-hotplug-dimm-addr to latest caps
So far, we are testing memory-hotplug-dimm-addr against a set of
explicitly listed capabilities. While this works, lets switch it
to DO_TEST_CAPS_LATEST() so that the latest capabilities are
used. This in turn means, we have to update the <emulator/>
because the latest capabilities don't contain caps for
qemu-system-i386.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-01 10:36:07 +02:00
Michal Privoznik
42ca6d6f33 virjson: Change virJSONValueObjectHasKey() signature
Currently, virJSONValueObjectHasKey() can return one of three
values:

  -1 if passed object type is not VIR_JSON_TYPE_OBJECT,
   0 if the key is not present, and finally
   1 if the key is present.

But, neither of callers is interested in the -1 case. In fact,
some callers call this function treating -1 and 1 cases the same.
Therefore, make the function return just true/false and fix few
callers that explicitly checked for == 1 case.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-08-01 10:24:34 +02:00
Daniel P. Berrangé
ef53798ab6 qemu: support use of stateless EFI firmware
When the <loader stateless='yes'/> attribute is set, the QEMU driver
needs to do three things

 - Avoid looking for an NVRAM template
 - Avoid auto-populating an <nvram/> path
 - Find firmware descriptors with mode=stateless instead of mode=split

Note, the first thing happens automatically when we solve the second
thing.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-07-26 15:41:44 +01:00
Daniel P. Berrangé
578ac25c6a conf: support stateless UEFI firmware
Normally when an UEFI firmware is marked as read-only, an associated
NVRAM file will be created. Some builds of UEFI firmware, however, wish
to remain stateless and so will be read-only, but never have any NVRAM
file. To represent this concept a 'stateless' tristate bool attribute
is introduced on the <loader/> element.

There are rather a large number of permutations to consider.

With default firmware selection

  *  <os/>

     => Historic default, no change

  *  <os>
       <loader stateless='yes'/>
     </os>

     => Explicit version of historic default, no change

  *  <os>
       <loader stateless='no'/>
     </os>

      => Invalid, bios is always stateless

With manual legacy BIOS selection

  *  <os>
       <loader>/path/to/seabios</loader>
       ...
     </os>

     => Historic default, no change

  *  <os>
       <loader stateless='yes'>/path/to/seabios</loader>
       ...
     </os>

     => Explicit version of historic default, no change

  *  <os>
       <loader stateless='no'>/path/to/seabios</loader>
       ...
     </os>

      => Invalid, bios is always stateless

With manual UEFI selection

  *  <os>
       <loader type='pflash'>/path/to/edk2</loader>
       ...
     </os>

     => Historic default, no change

  *  <os>
       <loader type='pflash' stateless='yes'>/path/to/edk2</loader>
       ...
     </os>

     => Skip auto-filling NVRAM / template

  *  <os>
       <loader type='pflash' stateless='no'>/path/to/edk2</loader>
       ...
     </os>

     => Explicit version of historic default, no change

With automatic firmware selection

  *  <os firmware='bios'/>

     => Historic default, no change

  *  <os firmware='bios'>
       <loader stateless='yes'/>
     </os>

     => Explicit version of historic default, no change

  *  <os firmware='bios'>
       <loader stateless='no'/>
     </os>

      => Invalid, bios is always stateless

  *  <os firmware='uefi'/>

     => Historic default, no change

  *  <os firmware='uefi'>
       <loader stateless='yes'/>
     </os>

     => Skip auto-filling NVRAM / template

  *  <os firmware='uefi'>
       <loader stateless='no'/>
     </os>

     => Explicit version of historic default, no change

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-07-26 15:41:44 +01:00
Peter Krempa
f81d26f3b6 tests: qemucapabilities: Update test data for the qemu-7.1 cycle on x86_64
Update to v7.0.0-2780-g5288bee45f

Notable changes:
 - set-vcpu-dirty-limit/cancel-vcpu-dirty-limit/query-vcpu-dirty-limit command added
 - snapshot-save/snapshot-load command added
 - dirty-sync-missed-zero-copy migration statistic added
 - postcopy-preempt migration feature added
 - the 'copy-before-write' block driver gained:
    - 'cbw-timeout' property
    - 'on-cbw-error' property with values:
        - 'break-guest-write'
        - 'break-snapshot'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-07-25 10:50:03 +02:00
Andrea Bolognani
5105409614 qemu: Add IOMMU device alias to command line
Note that we can only do this for intel-iommu and virtio-iommu,
which are configured using -device; smmuv3 is configured using
a machine type property, so there's no room on the command line
for an alias in that case.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-22 17:38:09 +02:00
Jonathon Jongsma
1e9d84d9f9 qemu: introduce capability QEMU_CAPS_MIGRATION_BLOCKED_REASONS
since qemu 6.0, if migration is blocked for some reason, 'query-migrate'
will return an array of error strings describing the migration blockers.
This can be used to check whether there are any devices blocking
migration, etc.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2022-07-21 00:58:06 -04:00
minglei.liu
3078799fef qemu: support CDROM hotplug cdrom with USB/SCSI bus
QEMU supports hotplug of a cdrom device with USB or SCSI bus. Just
unblock these devices in qemuDomainAttachDeviceDiskLiveInternal() and
qemuDomainDetachPrepDisk().

Fixes: https://gitlab.com/libvirt/libvirt/-/issues/261

Signed-off-by: minglei.liu <minglei.liu@smartx.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-20 16:53:51 +02:00
Jonathon Jongsma
62ca300530 util: remove virObjectUnref() adapters
These wrapper functions were used to adapt the virObjectUnref() function
signature for different callbacks. But in commit 0d184072, the
virObjectUnref() function was changed to return a void instead of a
bool, so these adapters are no longer necessary.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-07-15 16:44:39 -05:00
Peter Krempa
d531b9c724 qemu: monitor: Remove unused migration property getters/setters
The getters/setters for individual properties of migration
speed/downtime/cache size are unused once we switched to setting them
purely via migration parameters. Remove the unused helpers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-15 15:57:10 +02:00
Peter Krempa
e2b86ffa19 qemu: capabilities: Retire QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-15 15:57:10 +02:00
Peter Krempa
af2d983567 qemu: capabilties: Retire QEMU_CAPS_MIGRATION_PARAM_DOWNTIME
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-15 15:57:10 +02:00
Peter Krempa
ce761753d3 qemu: capabilities: Retire QEMU_CAPS_MIGRATION_PARAM_BANDWIDTH
The parameter is supported since qemu-2.8.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-15 15:57:10 +02:00
Michal Privoznik
265d49896d qemu: Generate cmd line for guestReset
QEMU offers two attributes for handling reset requests of an USB
host device: guest-reset and guest-resets-all. When combined they
act as follows:

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

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

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

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

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-13 16:01:14 +02:00
Michal Privoznik
0738d339a3 qemu_capabilities: Track usb-host.guest-resets-all capability
We will need two attributes of usb-host device to set:
guest-reset and guest-resets-all. The former was introduced in
QEMU v4.0.0-rc0~56^2 and the other in v4.2.0-rc1~9^2. Hence,
track the latter only as it's only starting from that commit when
QEMU has both attributes.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-13 16:00:59 +02:00
Michal Privoznik
85ea114016 conf: Introduce @guestReset to hostdev's <source/>
Some USB devices have a buggy firmware that either crashes on
device reset, or make the device unusable in some other way.
Fortunately, QEMU offers a way to skip device reset either
completely, or if device is not initialized yet. Expose this
ability to users under:

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

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-13 16:00:50 +02:00
Michal Privoznik
dcfbfffd6a tests: Fix qemu replies wrt usb-host properties
My commit of v6.9.0-rc1~457 was a bit too harsh. While it served
its purpose (adding usb-host.hostdevice capability) it has a side
effect: because I copied reply from qemu-5.1.0 to older .replies
files one might now think that say qemu-3.1.0 supports both
.guest-reset and .guest-resets-all properties. But in fact it
doesn't. There are three problematic properties:

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

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

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-13 16:00:41 +02:00
Michal Privoznik
94ae42fd25 tests: Update hostdev-usb-* hostdev-pci-* xml2xml and xml2argv tests
Currently, we have bunch of PCI/USB tests cases for
qemuxml2argvtest and qemuxml2xmltest but all of them run without
any capabilities. This makes is needlessly complicated when
trying to extend them. Switch to DO_TEST_CAPS_LATEST().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-13 15:42:08 +02:00
Peter Krempa
f99808ff25 qemuxml2*test: Add 'startupPolicy' fields to aio-io_uring case
Extend the test for io_uring to also test startup policy.

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

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-13 09:27:06 +02:00
Peter Krempa
9adeafac81 qemucapabilitiestest: Fake proper version for 'caps_4.2.0.aarch64' case
The capabilities for that version were not updated from the development
version and thus would fail our upcoming minimum version change. Fake
the data to report 4.2.0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-11 12:48:28 +02:00
Peter Krempa
7a3f48247e qemucapabilitiestest: Fake proper version for 'caps_4.2.0.ppc64' case
The capabilities for that version were not updated from the development
version and thus would fail our upcoming minimum version change. Fake
the data to report 4.2.0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-11 12:48:28 +02:00
Peter Krempa
8eb8096556 qemu: Remove qemu-4.0 version of 'cpu-translation' test case
The cpu commandline is identical with the '-latest' version so there's
no need for a separate case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-11 12:48:28 +02:00
Peter Krempa
ed150afb4e qemuxml2argvtest: Move real-caps versions of cpu-host tests out of the block setting fake host cpu
Make it obvious that the fake cpu does not apply to the test cases based
on real capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-11 12:48:28 +02:00
Peter Krempa
061224892c qemuxml2argvtest: Make 'qemu-ns' test case more stable
The test was showing that the 'blockdev' capability is properly added
although we didn't detect it yet. Unfortunately this test can't be
carried over once we bump minimum qemu version to qemu-4.2.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-11 12:48:28 +02:00
Peter Krempa
5177143117 qemuxml2argvtest: Convert 'net-user' case to _LATEST
The tested net device has the same syntax with latest qemu so there's no
need to have a version-locked test for it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-11 12:48:28 +02:00
Peter Krempa
dc231a1d38 qemuxml2argvtest: Remove qemu-4.0 versions of cpu feature test cases
The cpu feature formatting doesn't change between the versions thus we
can just keep the '-latest' versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-11 12:48:28 +02:00
Peter Krempa
5579ff564b qemuxml2argvtest: Convert 'cpu-eoi-(disabled|enabled)' cases to VIR_TEST_CAPS_LATEST
The tested feature doesn't change across versions so we can use the
modern testing infrastructure.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-11 12:48:28 +02:00
Peter Krempa
92f1f61e5b qemuxml2argvtest: Drop 'qemu-4.1' versions of hyperv tests
The version-locked version of the test data is identical to the 'latest'
version so we can remove them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-11 12:48:28 +02:00
Peter Krempa
dcd30a3bf3 qemuxml2(argv|xml)test: Drop qemu-3.1 version of 'cpu-Icelake-Server-pconfig'
Prior to qemu-3.2 we'd have to disable the 'pconfig' feature explicitly
which is no longer needed with new qemu. Remove the version locked to
qemu-3.1 as the 'latest' case sufficiently handles what we want to test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-11 12:48:28 +02:00
Peter Krempa
48e049dca3 test: domaincaps: Remove old test data
Remove the test data for qemu-2.11, qemu-2.12 and qemu-3.0 which are no
longer supported.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-11 12:48:27 +02:00
Peter Krempa
ebe0e34b64 storagepoolxml2argvtest: Fix output data for 'pool-netfs-protocol-ver'
The storage pool tests have host-specific versions which I neglected to
update in commit c44930d932 thus breaking
the test-suite on non-linux OSes.

Fixes: c44930d932
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2022-07-01 16:53:08 +02:00
Peter Krempa
c44930d932 storage: pool: Allow more intricate nfs protocol versions
Treat the 'protocolVer' field as a string so that e.g. '4.1' can be
used. Forbid only ',' in the string as it's a separator of arguments for
mount options.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-01 16:15:23 +02:00
Andrea Bolognani
262672dbbf qemu_firmware: Enable loader.secure when requires-smm
Currently, a firmware configuration such as

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

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

  <loader secure='yes'/>

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

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

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:39 +02:00
Andrea Bolognani
73c5ae55c7 conf: Reject features when using manual firmware selection
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:37 +02:00
Andrea Bolognani
de2a338dce conf: Validate firmware configuration more thoroughly
Generally speaking, when firmware autoselection is in use we
don't want any information to be provided manually. There are
two exceptions:

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

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

Anything else should result in a descriptive error.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/327
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:34 +02:00
Andrea Bolognani
161b31f958 conf: Reject enrolled-keys=yes with secure-boot=no
This combination doesn't make sense and so the firmware
autoselection logic will not be able to find a suitable firmware,
but it's more user-friendly to report a detailed error upfront.

Note that this check would ideally happen in the validate phase,
but if we moved it there we would no longer be able to
automatically enable secure-boot when enrolled-keys=yes. Since
the combination never resulted in a working configuration, the
chances of this causing real-world VMs to disappear are
extremely low.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:30 +02:00
Andrea Bolognani
6cacfc751e conf: Enable secure-boot when enrolled-keys is enabled
The latter doesn't make sense without the former, so make that
visible in the XML.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:27 +02:00
Andrea Bolognani
9c7499ce54 conf: Always parse NVRAM path if present
Currently, the lack of a <loader> element results in the <nvram>
element being completely ignored, but this is unnecessarily
limiting: even when firmware autoselection is in use, it should
be possible for the user to specify a custom path for the NVRAM
file.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:26 +02:00
Andrea Bolognani
1afc026c73 tests: Add more firmware tests
Note that some of these new tests are displaying incorrect or
suboptimal behavior. When we address those in upcoming patches,
this will be highlighted by changes in the test data.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:16 +02:00
Andrea Bolognani
29bbd927f8 tests: Don't use loader.secure=no with firmware autoselection
This currently has not effect whatsoever, so it's just cluttering
the input files.

We're going to add specific handling for this scenario, as well
as a test case covering it, in an upcoming commit.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:14 +02:00
Andrea Bolognani
2ce1dcc6b5 tests: Don't set NVRAM path manually
This does the opposite of

  commit 392292cd99
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Wed Feb 23 12:45:51 2022 +0000

    tests: don't use auto-generated NVRAM path in tests

in order to minimize input files.

We're going to add a test case specifically covering the use of
custom NVRAM paths with firmware autoselection in an upcoming
commit.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:13 +02:00
Andrea Bolognani
53cdfd7994 tests: Use minimal hardware for firmware tests
When testing firmware selection, we don't really care about any
of the hardware assigned to the VM, and in fact it's better to
keep it as minimal as possible to make sure that the focus
remains on the firmware bits.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:12 +02:00
Andrea Bolognani
f29a8bcef1 tests: Rename and reorganize firmware tests
Group all tests related to firmware selection together and give
them consistent names that leave room for further tests to be
added in an upcoming commit.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:10 +02:00
Andrea Bolognani
acb8733924 tests: Drop bios-nvram-os-interleave test
This was introduced in

  commit 5882064084
  Author: Martin Kletzander <mkletzan@redhat.com>
  Date:   Wed Feb 25 15:45:26 2015 +0100

    tests: Add test for os interleaving

to ensure a recent change in the schema was behaving correctly.

Seven years later, it no longer seems very useful to keep it
around.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:09 +02:00
Andrea Bolognani
031f379573 tests: Use firmware autoselection on aarch64
This simplifies the test data without negatively impacting test
coverage.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:05 +02:00
Andrea Bolognani
c76e595131 tests: Remove firmware bits from unrelated tests
The pci-bridge-many-disks test case is not related to firmware
handling at all, so we can trim it without losing any coverage.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:09:50 +02:00
David Michael
9f13f54a63 security_selinux.c: Relabel existing mode="bind" UNIX sockets
This supports sockets created by libvirt and passed by FD using the
same method as in security_dac.c.

Signed-off-by: David Michael <david@bigbadwolfsecurity.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 14:51:19 +02:00
Michal Privoznik
09010f7e76 virnettlscontext: Don't set DH parameters ourselves
According to [1]:

  Prior to GnuTLS 3.6.0 for the ephemeral or anonymous
  Diffie-Hellman (DH) TLS ciphersuites the application was
  required to generate or provide DH parameters. That is no
  longer necessary as GnuTLS utilizes DH parameters and
  negotiation from [RFC7919].

This allows us to:

  a) drop the code that's setting DH params,
  b) drop @dhParams member from _virNetTLSContext struct. and
  c) drop gnutls_dh_params_generate2() mock.

1: https://www.gnutls.org/manual/html_node/Parameter-generation.html

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-01 13:04:59 +02:00
Michal Privoznik
91e96ab71a virnetdevbandwidthtest: Test QoS for OVS
Ever since v7.6.0-rc1~235 we can use ovs-vsctl to set QoS instead
of tc. However, we don't have a test that's verifying generated
cmd line for ovs-vsctl.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-07-01 13:04:18 +02:00
Michal Privoznik
5f6aa07303 virnetdevbandwidthtest: Reformat TC cmd line
Our coding style expects a long line to be broken into shorter
lines which are then aligned on the first character, for
instance:

  "some string that's broken "
  "into multiple lines"

However, one can argue that there are few cases where shifting
the alignment makes the code more readable. And this is the case
of expected cmd line for DO_TEST_SET() where a long cmd line can
be aligned on the arguments rather than the binary:

  TC " filter ..."
     " police ..."

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-07-01 13:04:18 +02:00
Michal Privoznik
5c5ca1970f virnetdevbandwidthtest: Drop unused testMinimalStruct
The last usage of the testMinimalStruct struct was removed in
v1.2.2-rc1~206 which forgot to remove the struct as well. Remove
it now.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-07-01 13:04:17 +02:00
Michal Privoznik
b7ab6a6bd6 virnetdevbandwidthtest: Drop unnecessary brackets
Some cases that call DO_TEST_SET() macro wrap each argument in
curved brackets. This is unnecessary, drop the brackets.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-07-01 13:04:17 +02:00
Jiri Denemark
766abdc291 qemu_migration: Apply max-postcopy-bandwidth on post-copy resume
When resuming post-copy migration users may want to limit the bandwidth
used by the migration and use a value that is different from the one
specified when the migration was originally started.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/333

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 11:28:34 +02:00
Peter Krempa
170eccd03c qemucapabilitiestest: Update capabilities for the 7.1 release cycle on x86_64
Update to v7.0.0-2187-g2a8835cb45

Notable changes:
    - VFU_CLIENT_HANGUP event added
    - query-stats and query-stats-schemas commands added
    - 'vduse-blk' block export export
    - 'loongarch64' arch added
    - added new qom types:
        - cxl-downstream
        - cxl-upstream
        - qio-channel-block
        - qio-channel-null
    - added smi-irq[0], smm-enabled, unnamed-gpio-out[0] properties for PIIX4_PM

    - removed:
        - piix3-ide-xen

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-06-29 15:37:40 +02:00
Ján Tomko
28337e9485 tests: remove pointless label in testURIParse
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-06-22 12:28:29 +02:00
Ján Tomko
8d9bd178e2 Use g_auto for virURI almost everywhere
Convert all the cases where we can unconditionally free
the virURI at the end of scope.

In libxlDomainMigrationDstPrepare, uri is only filled
if uri_in was present, so moving the virURIFree out of
the condition is safe.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2022-06-22 12:28:29 +02:00
Cole Robinson
8b09303f24 tests: mock swtpm initialization for all qemu tests
Don't restrict this to domcaps testing only, we will soon
need it for qemu command line validation

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-06-21 08:23:18 -04:00
Cole Robinson
812edc95a3 conf: cpu: Add <signature family=X model=X stepping=X/>
Internally we already collect x86 host family + model + stepping
numeric values. This exposed them in capabilities CPU output.
Example:

$ sudo virsh capabilities | grep -A1 -B1 signature
      <microcode version='240'/>
      <signature family='6' model='94' stepping='3'/>
      <counter name='tsc' frequency='3408010000' scaling='no'/>

Users need to know these values to calculate an expected.
SEV-ES/SEV-SNP launch measurement.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-06-16 12:12:45 -04:00
Ján Tomko
0df2e7df80 conf: virtiofs: add thread_pool element
Add an element to configure the thread pool size:

...
<binary>
  <thread_pool size='16'/>
</binary>
...

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-06-16 14:58:25 +02:00
Peng Liang
48e8c36b05 tests: Remove unused includes
Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-06-16 06:43:58 +02:00
Rohit Kumar
d762abfe3f Add unit tests for new specification of nvram.
This patch adds unit tests for remote NVRAM.

Examples:

<nvram type='network'>
  <source protocol='iscsi' name='iqn.2013-07.com.example:iscsi-nopool/0'>
    <host name='example.com' port='6000'/>
    <auth username='myname'>
      <secret type='iscsi' usage='mycluster_myname'/>
    </auth>
  </source>
</nvram>

and

<nvram type='network'>
  <source protocol='nbd' name='bar'>
    <host name='example.org' port='6000'/>
  </source>
</nvram>

and

<nvram type='file'>
  <source file='/var/lib/libvirt/nvram/guest_VARS.fd'/>
</nvram>

Signed-off-by: Prerna Saxena <prerna.saxena@nutanix.com>
Signed-off-by: Florian Schmidt <flosch@nutanix.com>
Signed-off-by: Rohit Kumar <rohit.kumar3@nutanix.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Rohit Kumar <rohit.kumar3@nutanix.com>
2022-06-14 15:53:11 +02:00
Michal Privoznik
425d3b12a4 qemu: Generate command line for <defaultiothread/> pool size
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2059511
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-06-10 14:01:08 +02:00
Michal Privoznik
3e4bebb9d1 conf: Introduce <defaultiothread/>
As of v7.0.0-877-g70ac26b9e5 QEMU exposes its default event loop
for devices with no IOThread assigned as an QMP object. In the
very next commit (v7.0.0-878-g71ad4713cc) it was extended for
thread-pool-min and thread-pool-max attributes. Expose them under
new <defaultiothread/> element.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-06-10 14:01:03 +02:00
Michal Privoznik
86c10f81e5 qemu: Generate command line for IOThread pool size
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-06-10 14:00:13 +02:00