1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-12-06 00:24:43 +03:00
Commit Graph

52913 Commits

Author SHA1 Message Date
Andrea Righi
7032eb24e6 qemu: Validate acpi nodeset
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Andrea Righi <arighi@nvidia.com>
2025-09-08 19:12:35 +01:00
Andrea Righi
8275408276 conf: Add nodeset attribute to the <acpi> element
This enables partitioning of PCI devices into multiple isolated
instances, each requiring a dedicated virtual NUMA node definition.

Link: https://mail.gnu.org/archive/html/qemu-arm/2024-03/msg00358.html
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Andrea Righi <arighi@nvidia.com>
2025-09-08 19:12:35 +01:00
Andrea Righi
b21822a29c qemu: Allow to define NUMA nodes without memory or CPUs assigned
Allow to define NUMA nodes without memory or CPUs assigned to properly
support the new acpi-generic-initiator device.

This is required because the NUMA nodes passed to the
acpi-generic-initiator object must be independent and not be shared with
other resources, such as CPU or memory.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Andrea Righi <arighi@nvidia.com>
2025-09-08 18:06:33 +01:00
Andrea Righi
daccea611d qemu: capabilies: Introduce QEMU_CAPS_ACPI_GENERIC_INITIATOR
This capability tracks whether QEMU supports the acpi-generic-initiator
object type.

This object has been introduced in QEMU with the commit:
b64b7ed8bb ("qom: new object to associate device to NUMA node").

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Andrea Righi <arighi@nvidia.com>
2025-09-08 18:06:30 +01:00
Stefan Kober
d0752fafdb NEWS: announce disk hotplug support for ch
On-behalf-of: SAP stefan.kober@sap.com
Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-09-08 16:40:08 +02:00
Stefan Kober
fc7a3099bb ch: implement disk device detach in public API
On-behalf-of: SAP stefan.kober@sap.com
Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-09-08 16:40:08 +02:00
Stefan Kober
62330a66d3 ch: add disk detach helper functions
On-behalf-of: SAP stefan.kober@sap.com
Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-09-08 16:40:08 +02:00
Stefan Kober
f9cd2cf238 ch: add virCHMonitorRemoveDevice function
The function calls the respective CH API to remove a device of any type
from a VM.

On-behalf-of: SAP stefan.kober@sap.com
Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-09-08 16:40:08 +02:00
Stefan Kober
4ba796ab74 ch: add virCHMonitorBuildKeyValueJson
On-behalf-of: SAP stefan.kober@sap.com
Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-09-08 16:40:08 +02:00
Stefan Kober
37f4fc95f3 ch: implement disk attach in public API
On-behalf-of: SAP stefan.kober@sap.com
Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-09-08 16:40:08 +02:00
Stefan Kober
98c995bdf4 ch: add disk attach helper functions
On-behalf-of: SAP stefan.kober@sap.com
Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-09-08 16:40:08 +02:00
Stefan Kober
ce7b66a48a ch: add monitor disk attach logic
On-behalf-of: SAP stefan.kober@sap.com
Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-09-08 16:40:08 +02:00
Stefan Kober
eb9906468f ch: add/use virCHMonitorPut function
This allows users to call API endpoints that require passing data in a
generic way. Previously, only virCHMonitorPutNoContent was offered.

On-behalf-of: SAP stefan.kober@sap.com
Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-09-08 16:40:08 +02:00
Stefan Kober
e285053dc7 ch: refactor virCHMonitorBuildDiskJson
Refactor BuildDiskJson to return a virJSONValue instead of adding the
disk json to an json array. This makes the function reusable for
hotplugging disks.

On-behalf-of: SAP stefan.kober@sap.com
Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-09-08 16:40:08 +02:00
Stefan Kober
c90b6ff46a ch: pass disk alias to CHV
On-behalf-of: SAP stefan.kober@sap.com
Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-09-08 16:40:08 +02:00
Stefan Kober
c5f743c44e ch: assign aliases in ProcessPrepareDomain
This is required to have unique device aliases for devices throughout
the domain lifecycle.

On-behalf-of: SAP stefan.kober@sap.com
Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-09-08 16:40:08 +02:00
Stefan Kober
40b3321a70 ch: add ch_alias.{c,h} for device alias handling
On-behalf-of: SAP stefan.kober@sap.com
Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-09-08 16:40:08 +02:00
Stefan Kober
00db172987 ch: add ch_hotplug.{h,c} files to CH build
The files are meant to contain all device hotplug related code. The
first implementation will be live storage attach and detach.

On-behalf-of: SAP stefan.kober@sap.com
Signed-off-by: Stefan Kober <stefan.kober@cyberus-technology.de>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-09-08 16:40:08 +02:00
Ján Tomko
6d912238ca esx: pass 'long' to curl_easy_setopt when needed
The include header got its type checks fixed in curl 8.14:
79b4e56b3f
https://github.com/curl/curl/pull/17143

This causes a warning on rawhide with clang:
../src/esx/esx_vi.c:318:5: error: call to '_curl_easy_setopt_err_long'
declared with 'warning' attribute: curl_easy_setopt expects a long
argument [-Werror,-Wattribute-warning]
  318 |     curl_easy_setopt(curl->handle, CURLOPT_NOSIGNAL, 1);
      |     ^

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2025-09-08 16:12:40 +02:00
Jiri Denemark
d05443820e qemu: Don't query unavailable-features if qom-list-get is supported
With qom-list-get we already have the value of unavailable-features
property in the returned object (just like we have all values of all
bool properties). Let's use the value from there instead of querying for
it separately using qom-get.

After this patch only a single QMP command is used for getting all the
required info about guest CPUs created by QEMU 10.1 or newer.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-08 15:32:48 +02:00
Jiri Denemark
e18bc30236 qemu: Let qemuMonitorJSONGetCPUProperties also return disabled features
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-08 15:32:48 +02:00
Jiri Denemark
5b88383e21 qemu: Merge qemuMonitorJSONGetCPUDataDisabled in qemuMonitorJSONGetGuestCPU
The qemuMonitorJSONGetCPUDataDisabled function is just a wrapper around
two function calls and it is only used by qemuMonitorJSONGetGuestCPU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-08 15:32:48 +02:00
Jiri Denemark
74261b249f qemu: Always fetch disabled features in qemuMonitorJSONGetGuestCPU
The function is always called with both enabled and disabled pointers
set.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-08 15:32:48 +02:00
Jiri Denemark
ffdbbc4138 qemu: Merge qemuMonitorJSONGetCPUData in qemuMonitorJSONGetGuestCPU
The qemuMonitorJSONGetCPUData function is just a wrapper around two
function calls and it is only used by qemuMonitorJSONGetGuestCPU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-08 15:32:47 +02:00
Jiri Denemark
1dee4afb14 qemu: Add qemuMonitorJSONCPUDataAddFeatures helper
The function translates a list of CPU feature names retrieved from QEMU
and adds them to virCPUData.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-08 15:32:47 +02:00
Jiri Denemark
53eb546519 tests: Test qemuMonitorJSONGetGuestCPU with qom-get-list
The test cases show both the legacy method and the new one produce
identical results.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-08 15:32:47 +02:00
Jiri Denemark
b21b211923 qemu: Use qom-list-get for checking enabled CPU features
qom-list-get is a new QMP command (since QEMU 10.1) that combines
qom-list for listing properties of a specified object with qom-get for
getting a value of a given property. The new command provides an array
of all properties and their values, which allows us to dramatically
reduce the number of QMP commands we have to call when starting a domain
to check which CPU features were actually enabled.

A simple domain with no disk can now be started with only 15 QMP
commands in about 200 ms compared to 485 commands and 400 ms startup
time without this patch.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-08 15:32:47 +02:00
Jiri Denemark
a5322a0a4c qemu: Introduce QEMU_CAPS_QOM_LIST_GET capability
The new capability signals support for qom-list-get QMP command.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-08 15:32:47 +02:00
Jiri Denemark
a9fad838f2 qemu: Parse properties list from any JSON array
The qemuMonitorJSONParsePropsList API expected a QMP reply as an input.
By generalizing it to work on any JSON array, we can reuse the API even
for commands which return the array of properties nested in an object.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-08 15:32:47 +02:00
Jiri Denemark
3c25adb289 qemu: Move feature filtering to qemuMonitorJSONGetCPUProperties
When getting enabled CPU features (qemuMonitorJSONGetCPUData), we used
to call qemuMonitorJSONGetCPUProperties to get the list of all boolean
properties and then queried their values and ignored properties that
were not true. By moving the filtering inside
qemuMonitorJSONGetCPUProperties we don't need to even add disabled
features to any list and also get ready for better QMP interface.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-08 15:32:47 +02:00
Jiri Denemark
001769452b qemu: Generalize filtering in qemuMonitorJSONParsePropsList
qemuMonitorJSONParsePropsList supported filtering based on type. Let's
replace it with a callback supplied by the caller to allow for more
advanced filtering.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-08 15:32:47 +02:00
Jiri Denemark
5935abb72c tests: Test qemuMonitorJSONGetGuestCPU with empty unavailable-features
The key point here is that the unavailable-features property reports an
empty array.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-08 15:32:47 +02:00
Jiri Denemark
4b7304cfe8 tests: Add a test for qemuMonitorJSONGetGuestCPU
The SierraForest CPU was just randomly chosen and it doesn't mean we
should have test cases for all CPU models.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-08 15:32:46 +02:00
Jiri Denemark
cab77b7a14 qemu: Drop legacy probing of CPU features
The legacy probing which reads CPUID registers from QEMU and interprets
the individual bits is not used with any QEMU version currently
supported by libvirt. The code would only be used if
QEMU_CAPS_CPU_UNAVAILABLE_FEATURES capability (detected by probing the
presence of 'unavailable-features') was missing on x86, but all QEMU
release we care about report unavailable-features on x86.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-08 15:32:46 +02:00
Claudio Fontana
55583ae429 libvirt-host: VIR_NODE_CPU_STATS_GUEST: clarify "guest" time
clarify that "guest" time is time spent running VCPUs specifically.

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2025-09-05 09:09:20 -06:00
Jiri Denemark
814bec16ee tests: Drop unused vm variable in testQemuMonitorCPUInfo
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-04 16:19:35 +02:00
Hector Cao
62a40b89b7 docs : add doc on cpu model and features
Add documentation on the way libvirt displays the Host CPU
model and capabilities (features). There is an implicit
expectation from users to get the CPU model name matching the
CPU model they are running on, however, this does not happen
most of the time. As a consequence, having a documentation
is useful both for users to align their expectation and for
us to point to a place where the situation is clearly explained.

Signed-off-by: Hector Cao <hector.cao@canonical.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2025-09-02 15:11:05 +02:00
Américo Monteiro
f68fddeef0 Translated using Weblate (Portuguese)
Currently translated at 80.0% (8764 of 10948 strings)

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

Signed-off-by: Américo Monteiro <a_monteiro@gmx.com>
2025-09-02 11:38:54 +02:00
Fco. Javier F. Serrador
80a51de596 Translated using Weblate (Spanish)
Currently translated at 70.0% (7671 of 10948 strings)

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

Signed-off-by: "Fco. Javier F. Serrador" <fserrador@gmail.com>
2025-09-02 11:38:54 +02:00
Peter Krempa
0aea1d3e46 scripts: qemu-replies-tool: Add option to dump JSON commands that weren't processed by --dump-all
This is useful for checking that the script still covers everything when
using it to compare two .replies files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-02 10:55:24 +02:00
Peter Krempa
3fd2cd1115 scripts: qemu-replies-tool: Add stable dump of 'query-command-line-options'
While 'query-command-line-options' is usually fairly stable (for
comparing between two .replies files) it's simpler to compare it in the
dumped variant.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-02 10:55:24 +02:00
Peter Krempa
8c5eec9814 scripts: qemu-replies-tool: Dump data from query-version/query-target/query-kvm
Process few other simple commands. While this output doesn't change
places it's useful to see it when comparing the dumps of two .replies
files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-02 10:55:24 +02:00
Peter Krempa
c961ddc535 scripts: qemu-replies-tool: Prefix output with filename when dumping data for multiple files
The --dump-* mode can be used together with --repliesdir which iterates
over all '.replies' files in the directory. Make this useful by
outputing the filename so the user can associate the data with the file
it was dumped from.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-02 10:55:24 +02:00
Peter Krempa
301e1ba244 scripts: qemu-replies-tool: List also data from 'qom-list-properties'
In addition to 'device-list-properties' libvirt probes also some
properties of qom types. Since the format is identical make the dumping
function for 'device-list-properties' universal and make it accept also
'qom-list-types'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-02 10:55:24 +02:00
Peter Krempa
e53eb41b0d scripts: qemu-replies-tool: Dump machine types in --dump-all
Dumps the supported machine types and their deprecation state in stable
human-sort order.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-02 10:55:24 +02:00
Peter Krempa
790fec6e53 scripts: qemu-replies-tool: Drop specific invocation of marginally useful dump modes
While '--dump-qmp-query-strings' is useful by itself because it's a
simple way to generate the QMP schema query strings for libvirt, the
other modes aren't useful besides comparing two .replies files by the
dumped output.

Remove specific options for '--dump-qom-list-types' and
'--dump-device-list-properties', so that upcoming additions which will
be useful only for comparisons aren't forced to add these options.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-02 10:55:23 +02:00
Peter Krempa
5e585abc1c scripts: qemu-replies-tool: Convert the QMP conversation to list of dicts
Currently the conversation was a list of tuples. Since upcoming patches
will want to store some additional flags with the processed commands
convert it to a list of dicts, so that we can name the individual
fields.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-02 10:55:23 +02:00
Peter Krempa
05a53dcf54 qemuxmlconftest: Add pinned versions of the 'cpu-host-*' cases for qemu-10.1
Now that the qemu capabilities dump for the qemu-10.2 cycle was added
and thus qemu-10.1 dump is no longer "latest" we can pin the
'cpu-host-' tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-02 10:54:46 +02:00
Peter Krempa
c97374c612 qemucapabilitiestest: Add data for the qemu-10.2 dev cycle
This is an extremely early addition with data as of v10.1.0-1-ge771ba98de
thus effectively no code change compared to the qemu-10.1 release.

This early addition is done since I've upgraded the computer I'm
capturing the dumps from (yes the dumps are host-specific, and there
isn't really a good option if we want to have modern CPU data around).

Thus the only difference in the output files comes from the CPU change.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-02 10:54:46 +02:00
Peter Krempa
a1210230eb qemuxmlconftest: Rename and strip specific machine type from 'x86_64-default-cpu-*' cases
qemu-10.2 which we're about to add capabilities dump for will remove the
'4.2' machine type per deprecation policy.

The 'x86_64-default-cpu-*' still reference it. Since there is no
functional difference when upgrading the tests to the latest machine
type (pc/q35 alias as handled internally by qemuxmlconftest) let's
rename and modernize these.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-09-02 10:54:46 +02:00