]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
7 weeks agovirDomainDriverAutoShutdown: Fix printf conversion specifier for 'waitShutdownSecs'
Peter Krempa [Mon, 9 Jun 2025 06:19:04 +0000 (08:19 +0200)] 
virDomainDriverAutoShutdown: Fix printf conversion specifier for 'waitShutdownSecs'

The variable is declared as unsigned int but two places used '%d'.

Reported-in: https://issues.redhat.com/browse/RHEL-95721
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
7 weeks agoqemu: capabilities: Check if cpuModels is not NULL before trying to dereference it
anonymix007 [Wed, 4 Jun 2025 09:05:23 +0000 (12:05 +0300)] 
qemu: capabilities: Check if cpuModels is not NULL before trying to dereference it

accel->cpuModels field might be NULL if QEMU does not return CPU models.
The following backtrace is observed in such cases:
0  virQEMUCapsProbeQMPCPUDefinitions (qemuCaps=qemuCaps@entry=0x7f1890003ae0, accel=accel@entry=0x7f1890003c10, mon=mon@entry=0x7f1890005270)
   at ../src/qemu/qemu_capabilities.c:3091
1  0x00007f18b42fa7b1 in virQEMUCapsInitQMPMonitor (qemuCaps=qemuCaps@entry=0x7f1890003ae0, mon=0x7f1890005270) at ../src/qemu/qemu_capabilities.c:5746
2  0x00007f18b42fafaf in virQEMUCapsInitQMPSingle (qemuCaps=qemuCaps@entry=0x7f1890003ae0, libDir=libDir@entry=0x7f186c1e70f0 "/var/lib/libvirt/qemu",
   runUid=runUid@entry=955, runGid=runGid@entry=955, onlyTCG=onlyTCG@entry=false) at ../src/qemu/qemu_capabilities.c:5832
3  0x00007f18b42fb1a5 in virQEMUCapsInitQMP (qemuCaps=0x7f1890003ae0, libDir=0x7f186c1e70f0 "/var/lib/libvirt/qemu", runUid=955, runGid=955)
   at ../src/qemu/qemu_capabilities.c:5848
4  virQEMUCapsNewForBinaryInternal (hostArch=VIR_ARCH_X86_64, binary=binary@entry=0x7f1868002fc0 "/usr/bin/qemu-system-alpha",
   libDir=0x7f186c1e70f0 "/var/lib/libvirt/qemu", runUid=955, runGid=955,
   hostCPUSignature=0x7f186c1e9f20 "AuthenticAMD, AMD Ryzen 9 7950X 16-Core Processor, family: 25, model: 97, stepping: 2", microcodeVersion=174068233,
   kernelVersion=0x7f186c194200 "6.14.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 29 May 2025 21:42:15 +0000", cpuData=0x7f186c1ea490)
   at ../src/qemu/qemu_capabilities.c:5907
5  0x00007f18b42fb4c9 in virQEMUCapsNewData (binary=0x7f1868002fc0 "/usr/bin/qemu-system-alpha", privData=0x7f186c194280)
   at ../src/qemu/qemu_capabilities.c:5942
6  0x00007f18bd42d302 in virFileCacheNewData (cache=0x7f186c193730, name=0x7f1868002fc0 "/usr/bin/qemu-system-alpha") at ../src/util/virfilecache.c:206
7  virFileCacheValidate (cache=cache@entry=0x7f186c193730, name=name@entry=0x7f1868002fc0 "/usr/bin/qemu-system-alpha", data=data@entry=0x7f18b67c37c0)
   at ../src/util/virfilecache.c:269
8  0x00007f18bd42d5b8 in virFileCacheLookup (cache=cache@entry=0x7f186c193730, name=name@entry=0x7f1868002fc0 "/usr/bin/qemu-system-alpha")
   at ../src/util/virfilecache.c:301
9  0x00007f18b42fb679 in virQEMUCapsCacheLookup (cache=cache@entry=0x7f186c193730, binary=binary@entry=0x7f1868002fc0 "/usr/bin/qemu-system-alpha")
   at ../src/qemu/qemu_capabilities.c:6036
10 0x00007f18b42fb785 in virQEMUCapsInitGuest (caps=<optimized out>, cache=<optimized out>, hostarch=VIR_ARCH_X86_64, guestarch=VIR_ARCH_ALPHA)
   at ../src/qemu/qemu_capabilities.c:1037
11 virQEMUCapsInit (cache=0x7f186c193730) at ../src/qemu/qemu_capabilities.c:1229
12 0x00007f18b431d311 in virQEMUDriverCreateCapabilities (driver=driver@entry=0x7f186c01f410) at ../src/qemu/qemu_conf.c:1553
13 0x00007f18b431d663 in virQEMUDriverGetCapabilities (driver=0x7f186c01f410, refresh=<optimized out>) at ../src/qemu/qemu_conf.c:1623
14 0x00007f18b435e3e4 in qemuConnectGetVersion (conn=<optimized out>, version=0x7f18b67c39b0) at ../src/qemu/qemu_driver.c:1492
15 0x00007f18bd69c5e8 in virConnectGetVersion (conn=0x55bc5f4cda20, hvVer=hvVer@entry=0x7f18b67c39b0) at ../src/libvirt-host.c:201
16 0x000055bc34ef3627 in remoteDispatchConnectGetVersion (server=0x55bc5f4b93f0, msg=0x55bc5f4cdf60, client=0x55bc5f4c66d0, rerr=0x7f18b67c3a80,
   ret=0x55bc5f4b8670) at src/remote/remote_daemon_dispatch_stubs.h:1265
17 remoteDispatchConnectGetVersionHelper (server=0x55bc5f4b93f0, client=0x55bc5f4c66d0, msg=0x55bc5f4cdf60, rerr=0x7f18b67c3a80, args=0x0, ret=0x55bc5f4b8670)
   at src/remote/remote_daemon_dispatch_stubs.h:1247
18 0x00007f18bd5506da in virNetServerProgramDispatchCall (prog=0x55bc5f4cae90, server=0x55bc5f4b93f0, client=0x55bc5f4c66d0, msg=0x55bc5f4cdf60)
   at ../src/rpc/virnetserverprogram.c:423
19 virNetServerProgramDispatch (prog=0x55bc5f4cae90, server=server@entry=0x55bc5f4b93f0, client=0x55bc5f4c66d0, msg=0x55bc5f4cdf60)
   at ../src/rpc/virnetserverprogram.c:299
20 0x00007f18bd556c32 in virNetServerProcessMsg (srv=srv@entry=0x55bc5f4b93f0, client=<optimized out>, prog=<optimized out>, msg=<optimized out>)
   at ../src/rpc/virnetserver.c:135
21 0x00007f18bd556f77 in virNetServerHandleJob (jobOpaque=0x55bc5f4d2bb0, opaque=0x55bc5f4b93f0) at ../src/rpc/virnetserver.c:155
22 0x00007f18bd47dd19 in virThreadPoolWorker (opaque=<optimized out>) at ../src/util/virthreadpool.c:164
23 0x00007f18bd47d253 in virThreadHelper (data=0x55bc5f4b7810) at ../src/util/virthread.c:256
24 0x00007f18bce117eb in start_thread (arg=<optimized out>) at pthread_create.c:448
25 0x00007f18bce9518c in __GI___clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

Signed-off-by: anonymix007 <anonymix007@users.noreply.github.com>
7 weeks agodocs: Drop mention of read-only git mirrors
Andrea Bolognani [Thu, 5 Jun 2025 13:27:27 +0000 (15:27 +0200)] 
docs: Drop mention of read-only git mirrors

These mirrors no longer exist, they're just straight up
redirects to GitLab now.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
7 weeks agodocs: Unify clone instructions
Andrea Bolognani [Thu, 5 Jun 2025 13:30:24 +0000 (15:30 +0200)] 
docs: Unify clone instructions

We use the same format for GitLab and libvirt.org, but not
for GitHub.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
7 weeks agolibxl_capabilities: Make some functions return void
Michal Privoznik [Mon, 26 May 2025 08:41:00 +0000 (10:41 +0200)] 
libxl_capabilities: Make some functions return void

Inside of libxlMakeDomainCapabilities() there are some functions
called and basically all of them never return anything but zero
(indicating success). Yet, they are called in a fashion that
suggests otherwise. Turn those functions into void and drop
checks for their retvals.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agolibxl: capabilities: report supported console types
Roman Bogorodskiy [Sat, 24 May 2025 14:00:04 +0000 (16:00 +0200)] 
libxl: capabilities: report supported console types

Extend domain capabilities with information about the supported console
device types.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 weeks agoqemu: capabilities: report supported console types
Roman Bogorodskiy [Wed, 14 May 2025 16:28:47 +0000 (18:28 +0200)] 
qemu: capabilities: report supported console types

Extend domain capabilities with information about the supported console
device types.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 weeks agobhyve: capabilities: report NMDM console
Roman Bogorodskiy [Sun, 11 May 2025 16:20:33 +0000 (18:20 +0200)] 
bhyve: capabilities: report NMDM console

Extend domain capabilities to report the NMDM console support.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 weeks agodomain_capabilities: add console capabilities
Roman Bogorodskiy [Sun, 11 May 2025 16:20:20 +0000 (18:20 +0200)] 
domain_capabilities: add console capabilities

Currently, domain capabilities do not include information about the
supported console device types. While most of the drivers support
'pty' console type, it's not the case for bhyve. Without this
information, management software cannot always generate compatible
domain configuration.

To address that, extend domain capabilities like that:

   <devices>
    ...
    <console supported='yes'>
      <enum name='type'>
        <value>pty</value>
        <value>type2</value>
        ...
      </enum>
    </console>
    ...
   </devices>

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 weeks agoconf: desktop graphics remove unused option
Kirill Shchetiniuk [Wed, 4 Jun 2025 12:24:15 +0000 (14:24 +0200)] 
conf: desktop graphics remove unused option

Previously, the 'desktop' graphics configuration contained the
'fullscreen' option which was never used, removed the unused option.

Signed-off-by: Kirill Shchetiniuk <kshcheti@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agoconf: RDP graphics parse refactor
Kirill Shchetiniuk [Wed, 4 Jun 2025 12:24:14 +0000 (14:24 +0200)] 
conf: RDP graphics parse refactor

Previously, the RDP graphics definition parsing were implemented by
string parsing, the virDomainGraphicsDefParseXMLRDP function is
refactored to use the appropriate virXMLProp* utility functions.
Overall parsing logic was not changed and results the same output as
before.

Moreover, 'replaceUser' and 'mutliUser' params type was changed from
bool to tristate type, to avoid unnecessary type convertions.

Signed-off-by: Kirill Shchetiniuk <kshcheti@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agoconf: SDL fullscreen option refactor
Kirill Shchetiniuk [Wed, 4 Jun 2025 12:24:13 +0000 (14:24 +0200)] 
conf: SDL fullscreen option refactor

Previously, the fullscreen option were parsed as a tristate but stored
as a bool type, changed the fullscreen option type to tristate bool to
avoid unnecessary type convertions.

Signed-off-by: Kirill Shchetiniuk <kshcheti@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agoconf: VNC graphics parse refactor
Kirill Shchetiniuk [Wed, 4 Jun 2025 12:24:12 +0000 (14:24 +0200)] 
conf: VNC graphics parse refactor

Previously, the VNC graphics definition parsing were implemented by
string parsing, the virDomainGraphicsDefParseXMLVNC was refactored
to use the appropriate virXMLProp* utility functions. Overall
parsing logic was not changed and results the same output as before.

Signed-off-by: Kirill Shchetiniuk <kshcheti@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agoNEWS: Document removal of support of VIR_DUMP_LIVE flag from QEMU driver
Michal Privoznik [Tue, 3 Jun 2025 07:26:17 +0000 (09:26 +0200)] 
NEWS: Document removal of support of VIR_DUMP_LIVE flag from QEMU driver

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
8 weeks agoqemu: Don't accept VIR_DUMP_LIVE flag in qemuDomainCoreDumpWithFormat()
Michal Privoznik [Tue, 3 Jun 2025 06:27:31 +0000 (08:27 +0200)] 
qemu: Don't accept VIR_DUMP_LIVE flag in qemuDomainCoreDumpWithFormat()

QEMU can't really do live dumps of guest memory. It's because
inside of dump_init() the vm_stop() is called basically
unconditionally (the only condition is whether vCPUs are
running). Hence, there is no way for us to do live dumps and thus
honor VIR_DUMP_LIVE flag. Instead of silently pretending the flag
works, reject it with appropriate error message.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/646
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
8 weeks agoqemu: command: Don't attempt to set backend MTU for networks which don't use host...
Peter Krempa [Mon, 2 Jun 2025 14:55:16 +0000 (16:55 +0200)] 
qemu: command: Don't attempt to set backend MTU for networks which don't use host backend directly

Attempting to set MTU for network types which don't actually use the
network device on the host results in a failure. The 'mtu' property is
also used e.g. for the 'host_mtu' property of e.g. 'virtio-net-pci'
which is applied even in vhost-user mode.

Use the existing switch which selects devices without a network device
backend on the host side and skip setting the MTU.

Tested by running 'passt' in vhost-user mode manually:

 passt -f --vhost-user -s /tmp/vh.sock

and the following XML:

 <interface type="vhostuser">
   <mac address="52:54:00:3d:91:97"/>
   <source type="unix" path="/tmp/vh.sock" mode="client"/>
   <model type="virtio"/>
   <mtu size="9999"/>
   <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0"/>
 </interface>

The OS in the guest reports MTU 9999.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/717
Closes: https://gitlab.com/libvirt/libvirt/-/issues/192
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agoesx: Avoid corner case where esxUtil_ParseDatastorePath could be called with NULL...
Peter Krempa [Mon, 2 Jun 2025 08:26:38 +0000 (10:26 +0200)] 
esx: Avoid corner case where esxUtil_ParseDatastorePath could be called with NULL 'datastorePath'

The generated code which parses the data from XML in
esxVI_LookupDatastoreContentByDatastoreName can fill the 'folderPath'
property with NULL if it were missing from the input XML. While this is
not likely when talking to esx it is a possible outcome. Skipp NULL
results.

All other code paths already ensure that the function is not called with
NULL.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/776
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
8 weeks agodocs: Change units to 'kiB' from 'kB'/'kilobytes'/'kb'
Peter Krempa [Mon, 2 Jun 2025 08:56:32 +0000 (10:56 +0200)] 
docs: Change units to 'kiB' from 'kB'/'kilobytes'/'kb'

Use the short unit for kibibytes instead of the confusing or plainly
wrong units.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/594
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
8 weeks agovirConnectAuthCallbackDefault: Return failure if 'virGetPassword' returns NULL
Peter Krempa [Thu, 29 May 2025 20:00:49 +0000 (22:00 +0200)] 
virConnectAuthCallbackDefault: Return failure if 'virGetPassword' returns NULL

virGetPassword can return NULL on linux or BSD if it fails. The caller
in virConnectAuthCallbackDefault does dereference it unconditionally.

Return failure if virGetPassword returns NULL.

Fixes: db72866310d1e520efa8ed2d4589bdb5e76a1c95
Closes: https://gitlab.com/libvirt/libvirt/-/issues/777
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
8 weeks agostorage_file_probe: Remove unused image probing callbacks
Peter Krempa [Wed, 28 May 2025 16:18:38 +0000 (18:18 +0200)] 
storage_file_probe: Remove unused image probing callbacks

Remove the old now-unused infrastructure.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agostorage_file_probe: Move setting of 'compat' attribute to qcow2GetFeatures
Peter Krempa [Wed, 28 May 2025 16:13:39 +0000 (18:13 +0200)] 
storage_file_probe: Move setting of 'compat' attribute to qcow2GetFeatures

Since the 'compat' field is set based on qcow2 features it belongs to
the qcow2 code rather than to the main metadata probing function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agostorage_file_probe: Parse all qcow2 extensions at once
Peter Krempa [Wed, 28 May 2025 15:49:20 +0000 (17:49 +0200)] 
storage_file_probe: Parse all qcow2 extensions at once

Refactor qcow2GetExtensions to parse everything at once and directly
assign it into fields in the parsed virStorageSource.

This removes the need for qcow2GetDataFile as it will be parsed
directly.

The patch also simplifies the juggling of variables which was needed to
parse the backing file format, when it was passed via pointer in
argument.

qcow2GetExtensions is now invoked on qcow2 images so we can remove the
version check for qcow(v1) images.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agostorage_file_probe: Call qcow2GetFeatures from qcow2GetImageSpecific
Peter Krempa [Wed, 28 May 2025 15:36:13 +0000 (17:36 +0200)] 
storage_file_probe: Call qcow2GetFeatures from qcow2GetImageSpecific

Parse qcow2 feature flags from qcow2GetImageSpecific. To achieve that
qcow2GetFeatures is refactored to take virStorageSource directly and
fill the data. To avoid the need to pass 'format' the parsing of the
qcow2 version is changed to access the offset directly (same as in
qcow2GetExtensions)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agostorage_file_probe: Move qcow2GetFeatures(ProcessGroup) functions
Peter Krempa [Thu, 29 May 2025 08:12:05 +0000 (10:12 +0200)] 
storage_file_probe: Move qcow2GetFeatures(ProcessGroup) functions

Move the two functions to where they will be used. Subsequent patches
will refactor the control flow so that they will no longer be declared
ahead of time. Moving them in a separate patch will make the changes in
the refactor more clear to see.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agostorage_file_probe: Move logic from qcow2GetClusterSize to qcow2GetImageSpecific
Peter Krempa [Wed, 28 May 2025 15:26:13 +0000 (17:26 +0200)] 
storage_file_probe: Move logic from qcow2GetClusterSize to qcow2GetImageSpecific

Move the cluster size parser into the image specific code for qcow2,
which will later allow us to remove the callback for cluster size which
is not used by any other format.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agostorage_file_probe: Refactor qcowXGetBackingStore into specific callbacks for qcow...
Peter Krempa [Wed, 28 May 2025 15:18:36 +0000 (17:18 +0200)] 
storage_file_probe: Refactor qcowXGetBackingStore into specific callbacks for qcow and qcow2

Change qcowXGetBackingStore to use the new function prototype which
fills virStorageSource directly. Convert the copying of the backing file
string from 'g_new0' + 'memcpy' to 'g_strndup' as we treat it as a
string.

Introduce qcowGetImageSpecific (as a wrapper for qcowXGetBackingStore)
and qcow2GetImageSpecific. The latter of the two will be used to collect
all the qcow2-specific code later on, but for now it just parses the
backing store and the format.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agostorage_file_probe: Refactor vmdk4GetBackingStore into vmdk4GetImageSpecific
Peter Krempa [Wed, 28 May 2025 14:20:15 +0000 (16:20 +0200)] 
storage_file_probe: Refactor vmdk4GetBackingStore into vmdk4GetImageSpecific

Change to the new function prototype and adjust the code to fill the
fields in virStorageSource directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agostorage_file_probe: Refactor qedGetBackingStore into qedGetImageSpecific
Peter Krempa [Wed, 28 May 2025 14:15:42 +0000 (16:15 +0200)] 
storage_file_probe: Refactor qedGetBackingStore into qedGetImageSpecific

Change to the new function prototype and adjust the code to fill the
fields in virStorageSource directly.

The code also converts the copying of the backing file string from
'g_new0' + 'memcpy' to 'g_strndup' as we treat it as a string later on.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agostorage_file_probe: Refactor cowGetBackingStore into cowGetImageSpecific
Peter Krempa [Wed, 28 May 2025 14:09:01 +0000 (16:09 +0200)] 
storage_file_probe: Refactor cowGetBackingStore into cowGetImageSpecific

Rename the function, adjust parameters and fix the code to fill the
virStorageSource fields directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agostorage_file_probe: Add image specific callback taking the whole virStorageSource
Peter Krempa [Wed, 28 May 2025 13:59:33 +0000 (15:59 +0200)] 
storage_file_probe: Add image specific callback taking the whole virStorageSource

The callbacks getting just some fields are not flexible and in some
cases cause the metadata to be probed multiple times.

Add a callback that will pass the whole virStorageSource struct being
probed so that the code can be written more efficiently.

As a first step we add just the callback. The specific format helpers
will be refactored and subsequently all the other callbacks will be
removed.

To simplify the refactors that will convert all the code to the new
callbacks the new callback is placed first but the calls to cleanup
previous metadata are moved before it. They'll be removed once the
refactors are complete together with the other callbacks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agovirstoragetest: Add qcow2 bitmaps to some images
Peter Krempa [Thu, 29 May 2025 08:31:46 +0000 (10:31 +0200)] 
virstoragetest: Add qcow2 bitmaps to some images

Add change block tracking bitmaps to some of the qcow2 images, to ensure
that they work with our qcow2 header parser even when we don't parse
them ourselves.

The existing images were modified by running:

 $ qemu-img bitmap --add qcow2_qcow2-qcow2_qcow2-auto.qcow2 testbitmap
 $ qemu-img bitmap --add qcow2datafile-datafile.qcow2 testbitmap
 $ qemu-img bitmap --add datafile.qcow2 testbitmap

in tests/virstoragetestdata/images/.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agostorage_file_probe: qcow2GetExtensions: Fix qcow2 header extension parsing
Peter Krempa [Tue, 27 May 2025 15:39:03 +0000 (17:39 +0200)] 
storage_file_probe: qcow2GetExtensions: Fix qcow2 header extension parsing

There are 3 bugs in the qcow2 header extension parser:

1) Header extension padding not taken into account

  Per qcow2 documentation (qemu.git/docs/interop/qcow2.txt, also now
  mirrored in the comment explaining the parser) each header extension
  entry is padded to a multiple of 8 bytes.

  Our parser didn't take the padding into account and advanced the
  current offset only by the 'length', which corresponds to the length
  of the data.

  This meant that in vast majority of cases only the first extension
  would be parsed correctly. For any other one we'd try to fetch the
  magic and length from wrong place.

  Luckily this wasn't a problem for most of the almost 15 years this bug
  existed as we only cared about the backing file format string header
  which was always stored first by qemu.

  It is now a problem in the very specific case when a qcow2 image has a
  'data-file' and also a backing store with format. In such case we'd
  parse the backing store format properly as it's the first header and
  'data-file' being the second would be skipped.

  The buffer bounds checks were correct so we didn't violate any memory
  boundaries.

2) Integer underflow in calculation of end of header extension block

  If the image doesn't have a backing image, the 'backing_file_offset'
  qcow2 header field is 0. We use that value as 'extensions_end' which
  is used in the while loop to parse the extension entries.

  The check was done as "offset < (extensions_end - 8)", thus it
  unreflows when there's no filename.

  The design of the loop prevented anything bad from happening though.

3) Off-by-one when determining end of header extension block

  The aforementioned end of extension check above also has an off-by-one
  error as it allowed another loop if more than 8 bytes were available.

  Now the termination entry has data length of 0 bytes so we'd not be
  able to properly process that one.

  This wasn't a problem either as for now there's just the terminator
  having 0 byte length.

This patch improves documentation by quoting the qcow2 interoperability
document and adjusts the loop condition and length handling to comply
with the specs.

Interestingly we also had a test case for this specific scenario but the
expected test output was wrong.

Fixes: a93402d48b2996e5300754d299ef0d3f646aa098
Resolves: https://issues.redhat.com/browse/RHEL-93775
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agovirstoragetest: Reformat output to highlight dataFile relationship
Peter Krempa [Tue, 27 May 2025 14:55:06 +0000 (16:55 +0200)] 
virstoragetest: Reformat output to highlight dataFile relationship

Move the 'dataFileRaw' field to the main block as it's based on the data
in the qcow2 header same as 'backingStoreRaw'.

Indent and annotate the corresponding dataFile block to show where it
belongs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agoqcow2GetExtensions: Add debug logs for interesting fields in qcow2 header extension...
Peter Krempa [Wed, 28 May 2025 08:00:34 +0000 (10:00 +0200)] 
qcow2GetExtensions: Add debug logs for interesting fields in qcow2 header extension parser

Add debug statements which were useful in figuring out bugs in the qcow2
extension parser.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agoqemuProcessStartValidateGraphics: Move RDP validation logic to qemu_validate.c
Peter Krempa [Mon, 26 May 2025 10:20:00 +0000 (12:20 +0200)] 
qemuProcessStartValidateGraphics: Move RDP validation logic to qemu_validate.c

Move the rest of the RDP graphics validation code to
qemuValidateDomainDeviceDefRDPGraphics together with the rest of the
validation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
8 weeks agoqemuProcessStartValidateGraphics: Remove redundant checks for RDP protocol features
Peter Krempa [Mon, 26 May 2025 08:48:10 +0000 (10:48 +0200)] 
qemuProcessStartValidateGraphics: Remove redundant checks for RDP protocol features

Both the 'replaceUser' and 'multiUser' field are already validated in
qemuValidateDomainDeviceDefRDPGraphics.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
8 weeks agoqemu: Move checks for number of listening sockets of graphics to validation code
Peter Krempa [Mon, 26 May 2025 08:37:52 +0000 (10:37 +0200)] 
qemu: Move checks for number of listening sockets of graphics to validation code

Move the checks from 'qemuProcessStartValidateGraphics' to the
correspodning graphics validation functions in qemu_validate.c:

 - qemuValidateDomainDeviceDefSPICEGraphics
 - qemuValidateDomainDeviceDefVNCGraphics
 - qemuValidateDomainDeviceDefRDPGraphics

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
8 weeks agoqemu: Move logic from qemuProcessStartValidateShmem to qemuValidateDomainDeviceDefShmem
Peter Krempa [Fri, 23 May 2025 14:43:56 +0000 (16:43 +0200)] 
qemu: Move logic from qemuProcessStartValidateShmem to qemuValidateDomainDeviceDefShmem

Move the check to the appropriate central place.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
8 weeks agoqemu: conf: Drop handling of 'vxhs' config options
Peter Krempa [Sun, 25 May 2025 06:17:21 +0000 (08:17 +0200)] 
qemu: conf: Drop handling of 'vxhs' config options

Remove the config file handling for the config options we no longer use.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
8 weeks agoqemu.conf: Document options for VxHS block network protocol TLS config as ignored
Peter Krempa [Sun, 25 May 2025 06:12:48 +0000 (08:12 +0200)] 
qemu.conf: Document options for VxHS block network protocol TLS config as ignored

qemu-5.2 dropped support for VxHS. As we now require at least qemu-6.2,
the qemu.conf option for setting up TLS for VxHS are no longer used.
Document them as such.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
8 weeks agoqemu: block: Drop code for 'vxhs' storage protocol
Peter Krempa [Sun, 25 May 2025 06:18:21 +0000 (08:18 +0200)] 
qemu: block: Drop code for 'vxhs' storage protocol

qemu-5.2 dropped support for the 'vxhs' protocol. We require qemu-5.2
since commit ce48d584cc4 and thus the block code for vxhs is now dead.
Remove it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
8 weeks agoqemu: Move disk backend validation checks from qemuProcessStartValidateDisks to qemuD...
Peter Krempa [Fri, 23 May 2025 14:05:34 +0000 (16:05 +0200)] 
qemu: Move disk backend validation checks from qemuProcessStartValidateDisks to qemuDomainValidateStorageSource

Move the check forbidding VXHS disks and checking the NVME backend
capability to the validation code.

Remove the now unused qemuProcessStartValidateDisks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
8 weeks agoqemuDomainValidateStorageSource: Rework protocol validation into a switch statement
Peter Krempa [Fri, 23 May 2025 13:25:31 +0000 (15:25 +0200)] 
qemuDomainValidateStorageSource: Rework protocol validation into a switch statement

Move the validation of TFTP and NFS into a new switch statement which
will be used for validating also other protocol config in the future.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
8 weeks agoutil: Move virFileGetExistingParent out of ifdef __linux__
Jiri Denemark [Tue, 3 Jun 2025 09:23:28 +0000 (11:23 +0200)] 
util: Move virFileGetExistingParent out of ifdef __linux__

The function is called by virFileIsSharedFSOverride which is not Linux
specific and thus building on anything but Linux failes.

Fixes: 94fb348d670f612c0b58901c9829b4eec81faa50
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
8 weeks agoutil: Avoid statfs in virFileGetExistingParent
Jiri Denemark [Tue, 3 Jun 2025 08:33:03 +0000 (10:33 +0200)] 
util: Avoid statfs in virFileGetExistingParent

The code was separated from virFileIsSharedFSType which is Linux-only,
but virFileGetExistingParent is also called from
virFileIsSharedFSOverride which is OS independent. Thus we can't use
statfs. Let's use virFileExists (access) instead, we were not interested
in anything but success/failure from statfs anyway.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
8 weeks agodocs: fix indent of hostdev examples
Daniel P. Berrangé [Fri, 30 May 2025 14:05:55 +0000 (15:05 +0100)] 
docs: fix indent of hostdev examples

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
8 weeks agoutil: Fix virFileIsSharedFSOverride on nonexistent paths
Jiri Denemark [Wed, 28 May 2025 14:37:32 +0000 (16:37 +0200)] 
util: Fix virFileIsSharedFSOverride on nonexistent paths

Commit v11.0.0-162-gf2023e8018 added path canonicalization to
virFileIsSharedFSOverride to make sure we can properly match shared
filesystem override paths which include symlinks. But
virFileCanonicalizePath only works on existing paths, while
virFileIsSharedFSOverride may be called on paths that do not exist yet.
Matching paths against overrides has always worked even for nonexistent
paths. To fix the regression we need to first get the longest existing
sub-path and canonicalize only this part and use the result for
searching in overrides. Clearly any portion of the path we dynamically
create is not going to end up on a different filesystem to what the
parent directory is stored in. So checking just the existing parent is
enough.

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

Fixes: f2023e8018fe18550ad6aec66fe72bd1376f8522
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agoutil: Introduce virFileGetExistingParent helper
Jiri Denemark [Wed, 28 May 2025 14:36:59 +0000 (16:36 +0200)] 
util: Introduce virFileGetExistingParent helper

The code from virFileIsSharedFSType which finds the longest existing
path for a given input is separated into a new helper so that it can be
reused elsewhere.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agoutil: Document limitation of virFileCanonicalizePath
Jiri Denemark [Wed, 28 May 2025 14:34:18 +0000 (16:34 +0200)] 
util: Document limitation of virFileCanonicalizePath

On most platforms virFileCanonicalizePath is implemented using
realpath(), which only works on existing paths.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 weeks agoPost-release version bump to 11.5.0
Jiri Denemark [Mon, 2 Jun 2025 07:57:25 +0000 (09:57 +0200)] 
Post-release version bump to 11.5.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 weeks agoRelease of libvirt-11.4.0 v11.4.0
Jiri Denemark [Mon, 2 Jun 2025 07:52:35 +0000 (09:52 +0200)] 
Release of libvirt-11.4.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 weeks agoTranslated using Weblate (Korean)
김인수 [Sun, 1 Jun 2025 09:35:21 +0000 (09:35 +0000)] 
Translated using Weblate (Korean)

Currently translated at 99.8% (10912 of 10925 strings)

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

Signed-off-by: 김인수 <simmon@nplob.com>
2 months agoNEWS: Mention removal of compile time helper program lookup, virito-net ABI check...
Peter Krempa [Thu, 29 May 2025 12:25:32 +0000 (14:25 +0200)] 
NEWS: Mention removal of compile time helper program lookup, virito-net ABI check and FDC capabilities

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2 months agoqemu: Fix error when migration with shared TPM storage is unsupported v11.4.0-rc2
Jiri Denemark [Tue, 27 May 2025 13:42:36 +0000 (15:42 +0200)] 
qemu: Fix error when migration with shared TPM storage is unsupported

The VIR_ERR_NO_SUPPORT error is supposed to be used for unsupported
driver APIs. It is incorrectly used when swtpm does not support
migration with shared storage resulting in a rather strange error
message:

    this function is not supported by the connection driver: the running
    swtpm does not support migration with shared storage

The correct VIR_ERR_OPERATION_UNSUPPORTED error code provides a much
better message:

    Operation not supported: the running swtpm does not support
    migration with shared storage

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 months agoNEWS: update NEWS for POWER11 support
Narayana Murty N [Wed, 28 May 2025 05:11:57 +0000 (01:11 -0400)] 
NEWS: update NEWS for POWER11 support

Update NEWS.rst with the now added POWER11 processor support

Signed-off-by: Narayana Murty N <nnmlinux@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2 months agoNEWS: Make sure releases are separated by two blank lines
Jiri Denemark [Tue, 27 May 2025 10:58:18 +0000 (12:58 +0200)] 
NEWS: Make sure releases are separated by two blank lines

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 months agoNEWS: Fix virtqemud crash when resuming failed post-copy migration
Jiri Denemark [Tue, 27 May 2025 10:17:11 +0000 (12:17 +0200)] 
NEWS: Fix virtqemud crash when resuming failed post-copy migration

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 months agoqemu: Fix crash when resuming failed post-copy migration
Jiri Denemark [Tue, 27 May 2025 09:48:49 +0000 (11:48 +0200)] 
qemu: Fix crash when resuming failed post-copy migration

Since commit 28a06215280 (released in 11.2.0) resuming a failed
post-copy migration calls qemuProcessIncomingDefNew with fd == NULL
rather than -1. The function does not expect to be called with NULL file
descriptor and tries to dereference it causing virtqemud on the
destination host to crash.

Fixes: 28a06215280b99708ed8dc2d183f62ba7b34ccf8
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 months agoUpdate translation files
Weblate [Tue, 27 May 2025 08:56:18 +0000 (08:56 +0000)] 
Update translation files

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

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

Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
2 months agopo: Refresh potfile for v11.4.0 v11.4.0-rc1
Jiri Denemark [Tue, 27 May 2025 08:42:44 +0000 (10:42 +0200)] 
po: Refresh potfile for v11.4.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2 months agodocs: domain: Explain supported options of 'error_policy'
Peter Krempa [Wed, 21 May 2025 15:01:21 +0000 (17:01 +0200)] 
docs: domain: Explain supported options of 'error_policy'

Explain what the individual settings actually result in. The changes
are based on the paraprhase of qemu documentation which in
'qemu-options.hx' states:

  ``werror=action,rerror=action``
      Specify which action to take on write and read errors. Valid
      actions are: "ignore" (ignore the error and try to continue),
      "stop" (pause QEMU), "report" (report the error to the guest),
      "enospc" (pause QEMU only if the host disk is full; report the
      error to the guest otherwise). The default setting is
      ``werror=enospc`` and ``rerror=report``.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/138
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 months agoTranslated using Weblate (Georgian)
Weblate [Sun, 11 May 2025 06:24:16 +0000 (06:24 +0000)] 
Translated using Weblate (Georgian)

Currently translated at 4.2% (465 of 10918 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
2 months agoTranslated using Weblate (Chinese (Simplified) (zh_CN))
Poesty Li [Sun, 11 May 2025 06:24:15 +0000 (06:24 +0000)] 
Translated using Weblate (Chinese (Simplified) (zh_CN))

Currently translated at 98.2% (10730 of 10918 strings)

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

Signed-off-by: Poesty Li <poesty7450@gmail.com>
2 months agoTranslated using Weblate (Korean)
김인수 [Sun, 11 May 2025 06:24:15 +0000 (06:24 +0000)] 
Translated using Weblate (Korean)

Currently translated at 100.0% (10918 of 10918 strings)

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

Signed-off-by: 김인수 <simmon@nplob.com>
2 months agoqemuDomainMachineSupportsFloppy: Check for QEMU_CAPS_BUS_FLOPPY
Peter Krempa [Thu, 22 May 2025 18:49:51 +0000 (20:49 +0200)] 
qemuDomainMachineSupportsFloppy: Check for QEMU_CAPS_BUS_FLOPPY

Refuse to use floppy devices if qemu doesn't support them. Reflect that
also in capabilities. Both of the above is achieved by checking for the
QEMU_CAPS_BUS_FLOPPY in qemuDomainMachineSupportsFloppy.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 months agoqemu: capabilities: Introduce QEMU_CAPS_BUS_FLOPPY
Peter Krempa [Thu, 22 May 2025 18:43:10 +0000 (20:43 +0200)] 
qemu: capabilities: Introduce QEMU_CAPS_BUS_FLOPPY

Introduce a common capability for support of floppy devices by qemu.

Floppy support can be compiled out ('FDC', 'FDC_ISA', 'FDC_SYSBUS' qemu
Kconfig options) and also isn't supported by all architectures. Add a
capability that will check for 'isa-fdc' and 'sysbus-fdc' devices and
signal that given qemu supports the floppy bus.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 months agoqemu: Move floppy device support validation to validation code
Peter Krempa [Fri, 23 May 2025 14:38:32 +0000 (16:38 +0200)] 
qemu: Move floppy device support validation to validation code

Move the validation from qemuProcessStartValidateDisks to
qemuValidateDomainDeviceDefDiskFrontend and adjust the test case which
now fails a bit earlier, thus no output XML is needed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 months agoqemu: domain: Introduce qemuDomainMachineSupportsFloppy
Peter Krempa [Mon, 26 May 2025 07:27:29 +0000 (09:27 +0200)] 
qemu: domain: Introduce qemuDomainMachineSupportsFloppy

Add a helper that will collect the logic for determinin whether a VM
supports floppy disks.

Use it in the capabilities code and when validating the VM definition at
startup.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 months agolibvirt_nss: Allocate buffer in aiforaf() dynamically
Michal Privoznik [Wed, 21 May 2025 16:14:51 +0000 (18:14 +0200)] 
libvirt_nss: Allocate buffer in aiforaf() dynamically

While we were trying to decrease stack usage of some functions,
in v9.8.0-rc1~217 we introduced a couple of internal blocks to
the aiforaf() and declared some variables inside those blocks
hoping the compiler will reuse the stack for each block. While in
general this might be a good strategy, specifically in case of
NSS_NAME(gethostbyname2) this is a terrible thing to do.

Problem is, NSS_NAME(gethostbyname2) is given a caller allocated
buffer and an address of a pointer where the resolved address is
stored. And you've probably guessed it already: upon successful
return, the pointer is set to point somewhere inside the buffer.

Now, if the buffer doesn't live long enough, which in our case it
does not (since it was left in the previous block), we should
refrain from dereferencing the resolved pointer.

Just allocate the buffer on the heap.

Fixes: 9e5f2fe4021ada74adbe34ca03be60812c91f334
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2 months agolibvirt_nss: Allocate buffer in ERROR() dynamically
Michal Privoznik [Wed, 21 May 2025 16:14:38 +0000 (18:14 +0200)] 
libvirt_nss: Allocate buffer in ERROR() dynamically

So far, inside of the ERROR() macro there's pretty large buffer
allocated on the stack (for use by strerror_r()). Problem is,
with our current stack size limit of 2048 bytes we may come
pretty close to the limit or even overshoot it, e.g. in aiforaf()
where the function itself declares another stack allocated buffer
1024 bytes long.

Just allocate the buffer dynamically.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 months agolibvirt_nss: Drop needless cleanup labels
Michal Privoznik [Wed, 21 May 2025 15:43:28 +0000 (17:43 +0200)] 
libvirt_nss: Drop needless cleanup labels

After previous cleanup, some labels were rendered pointless. Drop
them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2 months agolibvirt_nss: Use automatic memory freeing
Michal Privoznik [Wed, 21 May 2025 15:40:22 +0000 (17:40 +0200)] 
libvirt_nss: Use automatic memory freeing

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2 months agonss: Declare g_autofree and g_steal_pointer() macros
Michal Privoznik [Wed, 21 May 2025 15:26:01 +0000 (17:26 +0200)] 
nss: Declare g_autofree and g_steal_pointer() macros

While we do not want the nss plugin to link with anything but
necessary libs (libc and libjson-c) it can benefit from automatic
memory freeing. Instead of inventing macros with new name for
them, lets stick with g_autofree and g_steal_pointer() which we
are used to from the rest of the code. Borrow and simplify
definitions for these macros then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2 months agonss: Add missing includes for gai_strerror()
Michal Privoznik [Thu, 22 May 2025 07:17:16 +0000 (09:17 +0200)] 
nss: Add missing includes for gai_strerror()

There are two places where gai_strerror() is called but neither
of them includes all necessary header files as documented in its
manpage. Fortunately, both calls occur in ERROR() macro which by
default does nothing - hence we don't see any compilation errors.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2 months agolibvirt_nss_macs: Fix type of @len in findMACsFromJSON()
Michal Privoznik [Wed, 21 May 2025 12:52:55 +0000 (14:52 +0200)] 
libvirt_nss_macs: Fix type of @len in findMACsFromJSON()

Inside of findMACsFromJSON(), the retval of
json_object_array_length() is stored in a variable that's type of
int. But the function is declared to return size_t:

  /usr/include/json-c/json_object.h:JSON_EXPORT size_t json_object_array_length(const struct json_object *obj);

Fix the type of the local variable.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2 months agocpu_ppc64: Add POWER11 host-model support
Narayana Murty N [Tue, 13 May 2025 07:43:26 +0000 (03:43 -0400)] 
cpu_ppc64: Add POWER11 host-model support

This patch adds POWER11 CPU host-model support in libvirt's ppc64
CPU driver. With this addition, guests using CPU mode 'host-model'
can specify POWER11 as the CPU model and have libvirt handle it
correctly.

With this change, libvirt can generate correct QEMU command line using
`-machine ... max-cpu-compat=power11` when a POWER11 host-model guest is
defined. This aligns with the QEMU support for POWER11 compatibility mode
starting from version 10.0.0.

Test coverage includes:
- XML validation tests for POWER11 host model
- Negative test for invalid compatibility on POWER10 hosts
- Command line generation tests for POWER11 guests

Signed-off-by: Narayana Murty N <nnmlinux@linux.ibm.com>
Tested-By: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Reviewed-By: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 months agocpu_map: Add POWER11 CPU model support
Narayana Murty N [Tue, 13 May 2025 07:43:25 +0000 (03:43 -0400)] 
cpu_map: Add POWER11 CPU model support

Add support for the POWER11 CPU model in libvirt ppc64 CPU map. This
allows libvirt to recognize and handle guests that specify POWER11 as
the target CPU model when running on recent Power systems supporting
this architecture.

The addition includes:
- A new src/cpu_map/ppc64_POWER11.xml definition file describing the
  features and flags for POWER11 CPUs.
- Updates to src/cpu_map/index.xml and build system (meson) to include
  the new model.
- Test updates to qemucapabilitiesdata and qemuxmlconfdata to reflect
  the presence of POWER11 in supported CPU models.
- Adjustments to existing test XMLs to fix CPU model expectations
  and avoid mismatches during validation against QEMU output.

With this change, users can specify <model>POWER11</model> in guest CPU
configuration and have libvirt map it correctly to the corresponding
QEMU CPU model and capabilities.

Tested with:
- QEMU 10.0.0 on POWER11 host system
- Validated with updated domain capabilities and qemu capabilities tests

Signed-off-by: Narayana Murty N <nnmlinux@linux.ibm.com>
Tested-By: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Reviewed-By: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 months agotests: Add capabilities for QEMU 10.0.0 on ppc64
Narayana Murty N [Tue, 13 May 2025 07:43:24 +0000 (03:43 -0400)] 
tests: Add capabilities for QEMU 10.0.0 on ppc64

Add the qemu test capabilities xml and reply files for
QEMU v10.0.0 on ppc64. A QEMU v10.0.0 was used for generating
this data.The tests with the 'latest' suffix, which expect
the latest available CPU version from the capabilities XML,
are bumped up to the latest CPU version.

Notable changes:
   - new pseries-10 machine type
   - old machine types (2.7) dropped
   - new CPU models power11 added

Signed-off-by: Narayana Murty N <nnmlinux@linux.ibm.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 months agotests: qemuhotplugtest: Set the cpu version at source for PPC64 tests
Narayana Murty N [Tue, 13 May 2025 07:43:23 +0000 (03:43 -0400)] 
tests: qemuhotplugtest: Set the cpu version at source for PPC64 tests

Commit 140ff3c5141 ("tests: qemuhotplugtest: Fix arch-specific parts of
'ppc64' test XMLs") hardcoded the CPU model as POWER9 in the test result
XMLs. However, this value actually reflects the host CPU model detected
at build or test time, and can vary depending on the machine where the
tests run.

As newer POWER CPU models (e.g., POWER10, POWER11) become common, this
requires continuous updates to the test result files to match the CPU
version detected on the host. This adds unnecessary maintenance effort.

Fix this by updating the test source domain XMLs to specify POWER9 (or
any fixed version) as the CPU model. This ensures the test result files
stay stable and do not require updates every time a newer CPU is used on
the host system.

Signed-off-by: Narayana Murty N <nnmlinux@linux.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 months agotests: Pin pseries-2.7 tests to the version 7.0
Narayana Murty N [Tue, 13 May 2025 07:43:22 +0000 (03:43 -0400)] 
tests: Pin pseries-2.7 tests to the version 7.0

Support for the pseries-2.7 machine type in QEMU was officially removed in
version 9.2 with qemu commit 445d3facffe8 ("ppc/spapr: remove deprecated
machine pseries-2.7"). Instead of removing related tests, they are now pinned
to the latest available capabilities version 7.0.0 to ensure continued
functionality where applicable.

Signed-off-by: Narayana Murty N <nnmlinux@linux.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 months agovirsh: Do not print warnings with "error:" prefix
Jiri Denemark [Thu, 22 May 2025 12:13:15 +0000 (14:13 +0200)] 
virsh: Do not print warnings with "error:" prefix

Both vshWarn and vshError are just wrappers around vshPrintStderr which
properly propagates the message level to the log, but fails to honor it
when printing on stderr.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 months agodocs: drvbhyve: document NVRAM support
Roman Bogorodskiy [Tue, 20 May 2025 17:01:52 +0000 (19:01 +0200)] 
docs: drvbhyve: document NVRAM support

Add a couple of examples of the explicit NVRAM configuration, and also
an automatic configuration, along with `<os firmware="efi">`.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 months agoNEWS: bhyve: document NVRAM support
Roman Bogorodskiy [Tue, 20 May 2025 16:48:12 +0000 (18:48 +0200)] 
NEWS: bhyve: document NVRAM support

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 months agobuild-aux: simplify grep detection on FreeBSD
Alexey Dokuchaev [Tue, 20 May 2025 17:23:52 +0000 (19:23 +0200)] 
build-aux: simplify grep detection on FreeBSD

For quite some time now FreeBSD provides its own version of the grep(1)
tool, and the GNU grep from the ports collection is available as
ggrep(1). So remove the detection code and just request ggrep.

Signed-off-by: Alexey Dokuchaev <danfe@FreeBSD.org>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 months agoqemuMonitorJSONMigrate: Drop 'detach' QMP option
Peter Krempa [Wed, 21 May 2025 07:59:53 +0000 (09:59 +0200)] 
qemuMonitorJSONMigrate: Drop 'detach' QMP option

The argument was always ignored by qemu [1], as of qemu-10.1 it will be
deprecated. As it was always unused/ignored we can drop it without any
extra logic.

[1] qemu docs state:

   3. The user Monitor's "detach" argument is invalid in QMP and
     should not be used.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 months agoqemuMonitorDumpToFd: Drop 'detach' argument
Peter Krempa [Wed, 21 May 2025 07:50:08 +0000 (09:50 +0200)] 
qemuMonitorDumpToFd: Drop 'detach' argument

The only caller always passes 'true'. We also don't want to ever use the
blocking variant as it blocks the whole monitor until dump finishes.

Hardcode it to 'true' in the monitor code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 months agovirsh: domain: Annotate rest of arguments taking local existing file
Peter Krempa [Tue, 20 May 2025 13:57:02 +0000 (15:57 +0200)] 
virsh: domain: Annotate rest of arguments taking local existing file

Few arguments were missing the 'vshCompletePathLocalExisting' completer.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 months agovirsh: Apply empty completer to arguments where completion doesn't make sense
Peter Krempa [Tue, 20 May 2025 12:56:03 +0000 (14:56 +0200)] 
virsh: Apply empty completer to arguments where completion doesn't make sense

Few outstanding arguments were not marked with 'virshCompleteEmpty'
completer despite the fact that we can't provide any reasonable
suggestion, e.g. for the new description of a domain or for the launch
secret.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 months agovsh: Apply empty/local completers to global commands
Peter Krempa [Tue, 20 May 2025 12:56:03 +0000 (14:56 +0200)] 
vsh: Apply empty/local completers to global commands

Few outstanding arguments were not marked with completers
completer despite the fact that we can't provide any reasonable
suggestion (e.g 'echo' or 'complete' commands) or where we want to
complete local path ( 'cd' ).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 months agovirsh: completer: Extract common completer methods from virsh to vsh
Peter Krempa [Tue, 20 May 2025 13:21:22 +0000 (15:21 +0200)] 
virsh: completer: Extract common completer methods from virsh to vsh

The helper methods as well as the empty completers can be useful also in
other virt shells; extract the code and rename the functions
appropriately.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 months agocputest: Skip more tests requiring JSON_MODELS if QEMU is disabled
Jaroslav Suchanek [Tue, 20 May 2025 13:50:24 +0000 (15:50 +0200)] 
cputest: Skip more tests requiring JSON_MODELS if QEMU is disabled

Marking more tests with JSON_MODELS_REQUIRED as these tests fail if QEMU is
disabled, typically when running tests on FreeBSD or macOS systems.

Signed-off-by: Jaroslav Suchanek <jsuchane@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2 months agobhyve: support removing NVRAM on domain undefine
Roman Bogorodskiy [Tue, 6 May 2025 16:58:29 +0000 (18:58 +0200)] 
bhyve: support removing NVRAM on domain undefine

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 months agobhyve: introduce bhyveDomainDefValidate()
Roman Bogorodskiy [Wed, 7 May 2025 18:20:18 +0000 (20:20 +0200)] 
bhyve: introduce bhyveDomainDefValidate()

Add the bhyveDomainDefValidate() validation which currently checks
whether the requested NVRAM is supported.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 months agobhyve: firmware: try to guess NVRAM settings
Roman Bogorodskiy [Wed, 7 May 2025 18:33:21 +0000 (20:33 +0200)] 
bhyve: firmware: try to guess NVRAM settings

Extend bhyveFirmwareFillDomain() so that when we find the default edk2
firmware, also look for its matching template file, and use it as a
nvramTemplate if found.

Extend bhyvexml2argvtest to verify various NVRAM configurations.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 months agobhyve: generate NVRAM bhyve arguments
Roman Bogorodskiy [Wed, 7 May 2025 18:25:56 +0000 (20:25 +0200)] 
bhyve: generate NVRAM bhyve arguments

Currently, bhyve bootrom specification looks like this:

 bhyve ... -l bootrom,/path/to/firmware.fd

In addition to that, it supports specifying the VARS files using:

 -l bootrom,/path/to/firmware.fd,/path/to/my_domain_VARS.fd

Update virBhyveProcessBuildBhyveCmd() to include the VARS file if NVRAM
is specified in the domain XML.

Additionally, support copying this file from the specified template. To
do that, introduce the bhyveProcessPrepareHost() and related helpers.
They are currently not doing anything but NVRAM preparations, but should
be useful for other host-side related tasks in the future.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 months agobhyve: conf: introduce nvramDir
Roman Bogorodskiy [Wed, 7 May 2025 18:17:31 +0000 (20:17 +0200)] 
bhyve: conf: introduce nvramDir

As a preparation for NVRAM support, introduce nvramDir configuration
item.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 months agoqemu: fd: Log information about passed file descriptor
Peter Krempa [Mon, 19 May 2025 11:37:32 +0000 (13:37 +0200)] 
qemu: fd: Log information about passed file descriptor

Log information (type, label, etc) about FDs passed to qemu via APIs
from this module.

This does "spill" the selinux library code into this module, but
acessing it via the security driver would require passing much more
context to this module. Since it's for logging only it can be easily
removed if necessary.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 months agodocs: backup: Hint at proper selinux labelling of the FD-passed NBD socket
Peter Krempa [Mon, 19 May 2025 13:15:35 +0000 (15:15 +0200)] 
docs: backup: Hint at proper selinux labelling of the FD-passed NBD socket

In case selinux is used on the host the socket passed to qemu needs to
be properly labelled. Add a hint to the example code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 months agoqemuBackupPrepare: Actually allow 'VIR_STORAGE_NET_HOST_TRANS_FD'
Peter Krempa [Wed, 14 May 2025 15:53:13 +0000 (17:53 +0200)] 
qemuBackupPrepare: Actually allow 'VIR_STORAGE_NET_HOST_TRANS_FD'

While I've actually implemented support for FD passing the NBD server
socket in eb768a556db I managed to misplace the hunk allowing the 'FD'
transport in the validation code, rendering the whole feature useless.

Fix the validation logic to make the feature usable.

Fixes: eb768a556db75040f7b518d198a18bd0f5d6faad
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 months agobuild: do not use -Winline
Ján Tomko [Fri, 16 May 2025 16:54:33 +0000 (18:54 +0200)] 
build: do not use -Winline

We don't really care if a function cannot be inlined.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>