51664 Commits

Author SHA1 Message Date
Daniel P. Berrangé
f1bd98f887 ci: refresh with 'lcitool manifest'
This replaces Fedora 39 with Fedora 41, updates the FreeBSD
Cirrus CI image names, and tweaks some package names

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2025-02-12 09:34:45 +00:00
Martin Kletzander
b1e9699b31 node_device: Do not lock the driver state needlessly
When processing the PCI devices we can only read the configs for each of
them if running as privileged.  That information is saved in the driver
state as a boolean introduced in commit 643c74abff01.  However since
that version it is only written to once during nodeStateInitialize() and
only read from that point (apart from some commits around v3.9.0 release
when it was not even set, but that was fixed before v3.10.0).  And it is
only read once, just to store that boolean in a temporary variable which
is also used in only one condition.

Rewrite this without locking and save few lines of code.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2025-02-12 10:31:09 +01:00
Andi Chandler
b6f4466b1b Translated using Weblate (English (United Kingdom))
Currently translated at 48.6% (5241 of 10781 strings)

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

Signed-off-by: Andi Chandler <andi@gowling.com>
2025-02-11 13:00:55 +01:00
Remus-Gabriel Chelu
ac9500aaf8 Translated using Weblate (Romanian)
Currently translated at 20.1% (2175 of 10781 strings)

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

Signed-off-by: Remus-Gabriel Chelu <remusgabriel.chelu@disroot.org>
2025-02-11 13:00:54 +01:00
Nicolás Gal
662d47845c Translated using Weblate (Spanish)
Currently translated at 52.8% (5700 of 10781 strings)

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

Signed-off-by: Nicolás Gal <nialegal@yandex.com>

Translated using Weblate (Spanish)

Currently translated at 52.6% (5679 of 10781 strings)

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

Signed-off-by: Nicolás Gal <nialegal@yandex.com>

Translated using Weblate (Spanish)

Currently translated at 52.6% (5676 of 10781 strings)

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

Signed-off-by: Nicolás Gal <nialegal@yandex.com>

Translated using Weblate (Spanish)

Currently translated at 52.6% (5674 of 10781 strings)

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

Signed-off-by: Nicolás Gal <nialegal@yandex.com>

Translated using Weblate (Spanish)

Currently translated at 52.6% (5671 of 10781 strings)

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

Signed-off-by: Nicolás Gal <nialegal@yandex.com>

Translated using Weblate (Spanish)

Currently translated at 52.2% (5634 of 10781 strings)

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

Signed-off-by: Nicolás Gal <nialegal@yandex.com>
2025-02-11 13:00:54 +01:00
Boris Fiuczynski
af732d27cc node_device_udev: add error reporting to udevProcessCCWGroup
Add reporting an internal error when the string to type conversion of
devtype fails as this indicates a serious problem since devtype was used
to get into this method during the udev event handling.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-02-07 15:07:23 +01:00
Peter Krempa
5830e564bb qemu: domain: Initialize FD passthrough for a virStorageSource before using it
The call to 'qemuBlockStorageSourceNeedsFormatLayer()' bases the
decision also on the state of the passed FD, so we must initialize the
passthrough data via 'qemuDomainPrepareStorageSourceFDs()' before the
aforementioned call.

In the test change it's visible that we didn't add the necessary 'raw'
driver which allows the 'protocol' blockdev to be opened in 'rw' mode so
that qemu picks the proper file descriptior while keeping the device
read-only.

Resolves: https://issues.redhat.com/browse/RHEL-37519
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2025-02-07 13:52:45 +01:00
Peter Krempa
7a119483a3 qemuxmlconftest: Add testing of FDs with 'writable' flag in 'disk-source-fd'
Add few examples of fd groups with the 'writable' flag set, when passing
a single FD. Notably as a top level image of a readonly disk (even when
that doesn't make much sense) and also as a base image of a chain.

Note that this documents a status quo of a bug fixed in upcoming patch.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2025-02-07 13:52:45 +01:00
Peter Krempa
500d985a13 qemuxmlconftest: Allow testing of the 'writable' flag for passed FDs for disks
Pass also the 'writable' state to the fake passed FDs so that we can
test it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2025-02-07 13:52:45 +01:00
Nicolás Gal
8e48a4fafb Translated using Weblate (Spanish)
Currently translated at 51.9% (5600 of 10781 strings)

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

Signed-off-by: Nicolás Gal <nialegal@yandex.com>

Translated using Weblate (Spanish)

Currently translated at 51.5% (5557 of 10781 strings)

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

Signed-off-by: Nicolás Gal <nialegal@yandex.com>

Translated using Weblate (Spanish)

Currently translated at 51.2% (5522 of 10781 strings)

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

Signed-off-by: Nicolás Gal <nialegal@yandex.com>

Translated using Weblate (Spanish)

Currently translated at 51.2% (5522 of 10781 strings)

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

Signed-off-by: Nicolás Gal <nialegal@yandex.com>

Translated using Weblate (Spanish)

Currently translated at 51.0% (5507 of 10781 strings)

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

Signed-off-by: Nicolás Gal <nialegal@yandex.com>

Translated using Weblate (Spanish)

Currently translated at 50.7% (5472 of 10781 strings)

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

Signed-off-by: Nicolás Gal <nialegal@yandex.com>

Translated using Weblate (Spanish)

Currently translated at 50.6% (5458 of 10781 strings)

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

Signed-off-by: Nicolás Gal <nialegal@yandex.com>

Translated using Weblate (Spanish)

Currently translated at 50.4% (5437 of 10781 strings)

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

Signed-off-by: Nicolás Gal <nialegal@yandex.com>
2025-02-06 14:23:47 +01:00
Martin Kletzander
105c33bfe7 docs: Reword virDomainGetEmulatorPinInfo description
This API only queries the XML settings and not the running threads
themselves.  In order to avoid confusion, change the wording slightly.

Resolves: https://issues.redhat.com/browse/RHEL-72052
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-02-06 14:24:35 +01:00
Michal Privoznik
14af443139 tests: qemuxmlconfdata: Update launch-security-sev-snp.xml
Recently, I was part of a discussion where it was suspected that
libvirt does not pick up correct FW for SEV-SNP guests. Update
our test to demonstrate it does.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-02-06 11:31:42 +01:00
Guoyi Tu
8a92493596 nodedev: udev: Hook up virFileWaitForExist to address uevent race of pci device
Similarly to commit 1af45804 we should be safer by waiting for the whole
sysfs tree is created for the device.

Signed-off-by: Guoyi Tu <tugy@chinatelecom.cn>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-02-06 10:50:40 +01:00
Peter Krempa
946b81a2e9 qemu: Attach persistent reservations manager if block-copy target requires it
Users can choose to copy a disk into a destination where they want to
use persistent reservations. Start the daemon if the configuration
requires it.

Resolves: https://issues.redhat.com/browse/RHEL-7342
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-02-05 19:29:38 +01:00
Peter Krempa
1697323bfe qemu: blockjob: Remove persistent reservations manager when dropping disk images
Check if the persistent reservations manager daemon is still needed
after a disk (sub)-chain was dropped after a blockjob.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-02-05 19:29:38 +01:00
Peter Krempa
fc5b6ed091 qemu: hotplug: Export persistent reservations manager helper functions
Export qemuHotplugAttachManagedPR/qemuHotplugRemoveManagedPR for reuse
in blockjob code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-02-05 19:29:38 +01:00
Peter Krempa
8e0591520f virDomainDefHasManagedPR: Consider also disk's 'mirror' chain
Consider also the destination of a block-copy job.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-02-05 19:29:38 +01:00
Peter Krempa
7087d8b46f qemu_hotplug.h: Reformat according to new coding style
Fix the mixed style by unifying the formatting.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-02-05 19:29:38 +01:00
Peter Krempa
712c39f987 qemucapabilitiestest: Add data for the qemu-10.0 dev cycle on x86_64
Add data based on 'v9.2.0-1537-gd922088eb4'

Notable changes:
    - '10.0' machine types added
    - 'hub' chardev backend added
    - 'cpr' migrate channel added
    - 'nsamples' field for 'dbus' audio backend now reported
    - 'ClearwaterForest-v1' cpu model added
    - 'SierraForest-v2' cpu model added
    - 'ivshmem-flat' device added
    - new qom objects:
        - 'virtio-mem-system-reset'
        - 'vmclock'
    - default value of 'rombar' changed from 1 to -1 for all devices
    - 'intel-iommu' device:
        - default value of 'aw-bit' changed from '39' to '48'
        - 'fs1gp' boolean added
        - 'x-flts' boolean added
    - 'virtio-balloon-pci'/'virtio-mem-pci':
        - 'ioeventfd' added
        - 'vectors' added

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-02-05 19:29:38 +01:00
Peter Krempa
fde300fa74 qemucapabilitiestest: Final update for qemu-9.2 release on x86_64
Update the data after the release.

Notable changes:
 - the 6.2 machine types became deprecated

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-02-05 19:29:38 +01:00
Peter Krempa
650e6fb7eb qemu: snapshot: Ensure that NVRAM image exists when taking inactive internal snapshot
Attempting to take an internal snapshot of a freshly defined VM with
qcow2 backed NVRAM results in failure as the NVRAM image doesn't get
populated until the VM is started for the first time.

Fix this by invoking qemuPrepareNVRAM() when qcow2 nvram is defined.

Resolves: https://issues.redhat.com/browse/RHEL-73315
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2025-02-05 19:29:38 +01:00
Peter Krempa
a377404ed9 qemu: process: Export qemuPrepareNVRAM for use in snapshot code
Export qemuPrepareNVRAM so that it doesn't require the VM object. The
snapshot code needs in the corner case of creating a snapshot of a
freshly defined VM ensure that the nvram image exists in order to
snapshot it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2025-02-05 19:29:38 +01:00
Peter Krempa
d15eff6304 qemuSnapshotForEachQcow2: Don't initialize 'nrollback'
The variable holds the amount of disks to roll back the snapshot for.
The value must be set before the code jumps to the 'rollback:' label so
the best situation is to not initialize it and let the compiler catch
errors rather than initialize the unsigned variable to -1 and let it
crash.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2025-02-05 19:29:38 +01:00
Peter Krempa
15cd4ec832 node_device_udev: Fix build failure in ccw device code
clang complains:

../../../libvirt/src/node_device/node_device_udev.c:1408:82: error: result of comparison of unsigned enum expression < 0 is always false [-Werror,-Wtautological-unsigned-enum-zero-compare]
 1408 |     if ((data->ccwgroup_dev.type = virNodeDevCCWGroupCapTypeFromString(devtype)) < 0)
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
1 error generated.

Fix it by adding a temporary int variable to facilitate the check before
assigning to the unsigned enum value.

Fixes: 985cb9c32a6
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2025-02-05 19:27:36 +01:00
Boris Fiuczynski
78f72efddc nodedev: add qeth layer2 and layer3 device types
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-02-05 17:56:42 +01:00
Boris Fiuczynski
55e921d5cb nodedev: add ccwgroup capability support to ccw devices
Add the group membership information to a CCW device. Allow to filter
CCW devices based on a group membership.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-02-05 17:56:42 +01:00
Boris Fiuczynski
985cb9c32a nodedev: add ccwgroup node device support
Add ccwgroup node device type supporting qeth generic driver.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-02-05 17:56:42 +01:00
Boris Fiuczynski
de4c28cd4a nodedev: refactor udevCCWGetState
Refactor method to be only ccw state type depended to allow reuse in a
later patch.

Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-02-05 17:56:42 +01:00
Boris Fiuczynski
20560cb6c4 nodedev: refactor CCW state format for use in ccwgroup
Refactor to allow reuse in ccwgroup.

Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-02-05 17:56:42 +01:00
Boris Fiuczynski
1260f3bd4f nodedev: remove virNodeDeviceCapCCWDefFormat
Directly use virCCWDeviceAddressFormat.

Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-02-05 17:56:42 +01:00
Boris Fiuczynski
7ad25b4665 nodedev: refactor CCW device address
Replace cssid, ssid and devno elements with virCCWDeviceAddress.

Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-02-05 17:56:42 +01:00
Boris Fiuczynski
04de9ad285 nodedev: refactor CCW device address format
Refactor for reuse in the following patch.

Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2025-02-05 17:56:42 +01:00
Fabricio Duarte
0d9d439175 docs: fix 'virsh domstats --vcpu' measure units and descriptions
The fields are in nanoseconds, not microseconds. Also fixes the
description of `vcpu.<num>.wait`, as it does not actually represent the
time waiting on I/O.

Signed-off-by: Fabricio Duarte <fabricio.duarte.jr@gmail.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2025-02-05 17:14:01 +01:00
Daniel P. Berrangé
4589468c69 Translated using Weblate (Chinese (Traditional) (zh_TW))
Currently translated at 2.4% (265 of 10781 strings)

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

Signed-off-by: "Daniel P. Berrange" <berrange@redhat.com>

Translated using Weblate (Chinese (Simplified) (zh_CN))

Currently translated at 93.3% (10067 of 10781 strings)

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

Signed-off-by: "Daniel P. Berrange" <berrange@redhat.com>
2025-02-04 15:57:04 +00:00
Nicolás Gal
da17a3558a Translated using Weblate (Spanish)
Currently translated at 51.0% (5507 of 10781 strings)

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

Signed-off-by: Nicolás Gal <nialegal@yandex.com>

Translated using Weblate (Spanish)

Currently translated at 50.7% (5472 of 10781 strings)

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

Signed-off-by: Nicolás Gal <nialegal@yandex.com>

Translated using Weblate (Spanish)

Currently translated at 50.6% (5458 of 10781 strings)

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

Signed-off-by: Nicolás Gal <nialegal@yandex.com>

Translated using Weblate (Spanish)

Currently translated at 50.4% (5437 of 10781 strings)

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

Signed-off-by: Nicolás Gal <nialegal@yandex.com>
2025-02-04 15:57:04 +00:00
Peter Krempa
4557ac4c77 NEWS: Mention preserving I/O error messages for qemu VMs
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2025-02-04 14:40:56 +01:00
Peter Krempa
97c47333cb include: libvirt-domain: Add 'message' @reason of VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
In case when the hypervisor does report the reason for the I/O error as
an unstable string to display to users we can add a @reason possibility
for the I/O error event noting that the error is available.

Add 'message' as a reason enumeration value and document it
to instruct users to look at the logs or virDomainGetMessages().

The resulting event looks like:

 event 'io-error' for domain 'cd': /dev/mapper/errdev0 (virtio-disk0) report due to message

Users then can look at the virDomainGetMessages() API:

 I/O error: disk='vda', index='1', path='/dev/mapper/errdev0', timestamp='2025-01-28 15:47:52.776+0000', message='Input/output error'

Or in the VM log file:

 2025-01-28 15:47:52.776+0000: IO error device='virtio-disk0' node-name='libvirt-1-storage' reason='Input/output error'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2025-02-04 14:40:55 +01:00
Peter Krempa
3a3c5616eb include: libvirt-domain: Reword documentation for @reason of VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
Emphasise that it's an enumeration and convert the possibilities to a
list of values with explanation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2025-02-04 14:40:55 +01:00
Peter Krempa
666219f5f1 virDomainGetMessages: Introduce VIR_DOMAIN_MESSAGE_IOERRORS
Report any stored I/O error messages reported by the hypervisor when
reporting messages of a domain. As the I/O error may be already stale we
report also the timestamp when it was recorded.

Example message:

 I/O error: disk='vda', index='1', path='/dev/mapper/errdev0', timestamp='2025-01-28 15:47:52.776+0000', message='Input/output error'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2025-02-04 14:40:55 +01:00
Peter Krempa
1a02760cc6 virDomainObjGetMessages: Refactor using GPtrArray
Simplify the function especially by rewriting it using GPtrArray to
construct the string list, especially for the upcoming case when the
number of added elements will not be known beforehand and when
hypervisor specific data will be added.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2025-02-04 14:40:55 +01:00
Peter Krempa
042ea8630b libxlDomainGetMessages: Add existing flags to 'virCheckFlags'
The two VIR_DOMAIN_MESSAGE_* flags were not listed in the virCheckFlags
check in 'libxl' but were present in 'test' and 'qemu' driver impls.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2025-02-04 14:40:55 +01:00
Peter Krempa
18f8d572be qemuProcessHandleIOError: Log IO errors in the VM log file
Add a log entry to the VM log file for every time we receive an IO error
event from qemu. The log entry is as follows:

 2025-01-24 16:03:28.928+0000: IO error device='virtio-disk0' node-name='libvirt-1-storage' reason='other: Input/output error'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2025-02-04 14:40:55 +01:00
Peter Krempa
300f7e9bd4 qemuProcessHandleIOError: Populate I/O error reason to virStorageSource
Record the last I/O error reason and timestamp which happened with the
corresponding virStorageSource struct.

This will later allow querying the last error e.g. via the
virDomainGetMessages() API.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2025-02-04 14:40:55 +01:00
Peter Krempa
2f6c9fa4f6 virStorageSource: Add fields for storing last I/O error message
Hypervisors may report a I/O error message (unstable; for human use)
to libvirt. In order to store it with the appropriate virStorageSource
so that it can be later queried we need to add fields to
virStorageSource to store the timestamp and message.

The message is deliberately not copied via virStorageSourceCopy.

The messages are also not serialized to the status XML as losing them on
a daemon restart as they're likely to be stale anyways.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2025-02-04 14:40:55 +01:00
Peter Krempa
0525323175 qemuMonitorJSONHandleIOError: Propagate new 'qom-path' field
QEMU commit v9.1.0-1065-ge67b7aef7c added 'qom-path' as an optional
field for the BLOCK_IO_ERROR event. Extract and propagate it as an
alternative to lookup via 'node-name' and 'device' (alias).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2025-02-04 14:40:54 +01:00
Peter Krempa
784538a470 qemuProcessHandleIOError: Prefer lookup by node name
When qemu reports a node name for an I/O error we should prefer the
lookup by node name instead as it gives us the path to the specific
image which caused the error instead of the top level image path.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2025-02-04 14:40:54 +01:00
Peter Krempa
f8f8d5a253 qemuMonitorJSONHandleIOError: Do not munge 'reason' field of IO error event
Leave the interpretation of the event to 'qemuProcessHandleIOError()'
which will create it's own variant of the messages for the user-facing
libvirt events. qemuMonitorJSONHandleIOError() will pass through the raw
data it got from qemu.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2025-02-04 14:40:54 +01:00
Peter Krempa
590a5765c1 qemuProcessHandleIOError: Rename local variables
Prefix the helper variables used to supply data to the event by
'event'. Declare them with the default value of an empty string rather
than doing it later.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2025-02-04 14:40:54 +01:00
Peter Krempa
2d6bd6f05f qemu: Rename 'diskAlias' to 'device' in qemu IO error event handling
The field is named 'device' in the event so unify our naming.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2025-02-04 14:40:54 +01:00
Peter Krempa
2f8359f827 qemu: Handle quirks of 'device' field of BLOCK_IO_ERROR event in monitor code
BLOCK_IO_ERROR's 'device' field is an empty string in case when it isn't
applicable as it was originally mandatory in the qemu API docs.

Move the logic that convert's empty string back to NULL from
'qemuProcessHandleIOError()' to 'qemuMonitorJSONHandleIOError()'

This also fixes a hypothetical NULL-dereference if qemu would indeed
report an IO error without the 'device' field present.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2025-02-04 14:40:54 +01:00