]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
8 months agoTranslated using Weblate (French)
Léane GRASSER [Tue, 19 Nov 2024 12:11:03 +0000 (12:11 +0000)] 
Translated using Weblate (French)

Currently translated at 95.9% (10098 of 10526 strings)

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

Signed-off-by: Léane GRASSER <leane.grasser@proton.me>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Tue, 19 Nov 2024 09:22:39 +0000 (09:22 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 96.9% (10205 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Chinese (Simplified) (zh_CN))
jianqing yan [Tue, 19 Nov 2024 09:21:28 +0000 (10:21 +0100)] 
Translated using Weblate (Chinese (Simplified) (zh_CN))

Currently translated at 95.7% (10074 of 10526 strings)

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

Co-authored-by: jianqing yan <yanjianqing@kylinos.cn>
Signed-off-by: jianqing yan <yanjianqing@kylinos.cn>
8 months agoTranslated using Weblate (Swedish)
Weblate [Tue, 19 Nov 2024 09:21:27 +0000 (10:21 +0100)] 
Translated using Weblate (Swedish)

Currently translated at 96.8% (10199 of 10526 strings)

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

Co-authored-by: Weblate <noreply-mt-weblate@weblate.org>
Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Tue, 19 Nov 2024 09:21:26 +0000 (10:21 +0100)] 
Translated using Weblate (Swedish)

Currently translated at 96.8% (10199 of 10526 strings)

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

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoqemuxmlconftest: Add test cases for the <dataStore> feature
Nikolai Barybin [Wed, 20 Nov 2024 15:48:49 +0000 (18:48 +0300)] 
qemuxmlconftest: Add test cases for the <dataStore> feature

Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agoqemuxmlactivetest: Add tests for <dataStore>
Nikolai Barybin [Wed, 20 Nov 2024 15:48:49 +0000 (18:48 +0300)] 
qemuxmlactivetest: Add tests for <dataStore>

Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agotests: virstoragetest: Add tests for detection of qcow2 'data_file' feature
Nikolai Barybin [Wed, 20 Nov 2024 15:48:49 +0000 (18:48 +0300)] 
tests: virstoragetest: Add tests for detection of qcow2 'data_file' feature

Add two test images showing the use of 'data_file' and 'data_file_raw'
(although the latter is not detected by libvirt) so that we can see that
the qcow2 metadata parser and backing chain populators work correctly.

The example files were created by:

 qemu-img create  -f qcow2 -o data_file=raw,data_file_raw=true,preallocation=off datafile.qcow2 1k
 qemu-img create  -f qcow2 -o data_file=rawpreallocation=off -F qcow2 -b datafile.qcow2 qcow2datafile-datafile.qcow2

Note that 'data_file_raw' is mutually exclusive with backing images.

Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
8 months agoqemu: block: Add support for 'data-file' feature of qcow2
Nikolai Barybin [Wed, 20 Nov 2024 15:48:48 +0000 (18:48 +0300)] 
qemu: block: Add support for 'data-file' feature of qcow2

Add the block infrastructure for detecting and landling the data file
for images and starting qemu with the configuration.

Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agoqemu: factor out qemuDomainPrepareStorageSource()
Nikolai Barybin [Wed, 20 Nov 2024 15:48:47 +0000 (18:48 +0300)] 
qemu: factor out qemuDomainPrepareStorageSource()

This refactoring will simplify next changes.

Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agoqemu: put data-file path to VM's cgroup and namespace
Nikolai Barybin [Wed, 20 Nov 2024 15:48:46 +0000 (18:48 +0300)] 
qemu: put data-file path to VM's cgroup and namespace

Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agosecurity: apparmor: handle qcow2 data-file
Nikolai Barybin [Wed, 20 Nov 2024 15:48:45 +0000 (18:48 +0300)] 
security: apparmor: handle qcow2 data-file

Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agosecurity: selinux: handle qcow2 data-file on image label set/restore
Nikolai Barybin [Wed, 20 Nov 2024 15:48:44 +0000 (18:48 +0300)] 
security: selinux: handle qcow2 data-file on image label set/restore

Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agosecurity: DAC: handle qcow2 data-file on image label set/restore
Nikolai Barybin [Wed, 20 Nov 2024 15:48:43 +0000 (18:48 +0300)] 
security: DAC: handle qcow2 data-file on image label set/restore

Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agostorage file: fill in src->dataFileStore during file probe
Nikolai Barybin [Wed, 20 Nov 2024 15:48:42 +0000 (18:48 +0300)] 
storage file: fill in src->dataFileStore during file probe

Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agostorage file: add qcow2 data-file path parsing from header
Nikolai Barybin [Wed, 20 Nov 2024 15:48:41 +0000 (18:48 +0300)] 
storage file: add qcow2 data-file path parsing from header

In qcow2 header data file is represented by incompitible feature bit
and its path is saved to header extension table.
Thus, we implement here the logic similar to backing file probing.

Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agostorage file: add getDataFile function to FileTypeInfo
Nikolai Barybin [Wed, 20 Nov 2024 15:48:40 +0000 (18:48 +0300)] 
storage file: add getDataFile function to FileTypeInfo

Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agoconf: implement XML parsing/formating for <dataStore> element of a storage <source>
Nikolai Barybin [Wed, 20 Nov 2024 15:48:39 +0000 (18:48 +0300)] 
conf: implement XML parsing/formating for <dataStore> element of a storage <source>

Introduce parsing and formatting of <dataStore> element. The <dataStore
represents a different storage volume meant for storing the actual
blocks of guest-visible data. The original disk source is then just a
metadata storage for any advanced features.

This currently works only for 'qcow2' images.

Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months ago Add schema and documentation for 'dataStore' sub-element of disk source
Nikolai Barybin [Wed, 20 Nov 2024 15:48:38 +0000 (18:48 +0300)] 
 Add schema and documentation for 'dataStore' sub-element of disk source

Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agoconf: add data-file feature and related fields to virStorageSource
Nikolai Barybin [Wed, 20 Nov 2024 15:48:36 +0000 (18:48 +0300)] 
conf: add data-file feature and related fields to virStorageSource

The 'data-file' is a qcow2 feature which allows storing the actual data
outside of the qcow2 image.

Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agodocs: formatsecret: Fix an example of secret-set-value
Han Han [Thu, 21 Nov 2024 02:27:36 +0000 (10:27 +0800)] 
docs: formatsecret: Fix an example of secret-set-value

The previous example will cause the error like:
error: Options --file and --base64 are mutually exclusive

Reported-by: Yanqiu Zhang <yanqzhan@redhat.com>
Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoQEMU: allow to hot plugging virtio-serial-pci device
shenjiatong [Sun, 17 Nov 2024 14:44:26 +0000 (22:44 +0800)] 
QEMU: allow to hot plugging virtio-serial-pci device

Virtio-serial-pci device is hot pluggable, loosen the restriction
and allow user to hot plug it.

Signed-off-by: shenjiatong <yshxxsjt715@163.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agotests: qemucapabilitiesdata: Update 'x86_64' capabilities for the qemu-9.2 dev cycle
Peter Krempa [Tue, 19 Nov 2024 08:46:24 +0000 (09:46 +0100)] 
tests: qemucapabilitiesdata: Update 'x86_64' capabilities for the qemu-9.2 dev cycle

Update to v9.2.0-rc0-42-g3428a3894c

Apart from the changes below there are changes to CPU features reported
by qemu, some of which were reported multiple times previously which no
longer happens.

Notable changes:
 - 'reconnect-ms' added and 'reconnect' deprecated for 'stream' variant
   of 'netdev-add' backend
 - 'BLOCK_IO_ERROR' event removed 'qom-path' parameter
 - 'GraniteRapids-v2-x86_64-cpu' added
 - 'sm3' hashing algorithm for 'luks' added
 - 'acpi-generic-port' object added
 - deprecated field 'loaded' of 'secret'/'secret_keyring'/'tls-creds*'
   removed
 - 'sh4eb' target added
 - 'query-migrationthreads' command deprecated
 - 'busnr' and 'x-pcie-ext-tag' attributes added for
    'ICH9-LPC'/'PIIX4_PM'/'VGA'/'mch'/'pcie-root-port'/'qxl'/'vfio-pci'/
    'virtio-*'/'vmware-svga'
    devices
 - 'stale-tm' property added for 'intel-iommu' device

Experimental features:
 - 'device-sync-config' command added

As the addition of the 'reconnect-ms' property of the 'stream' network
backend happened along with deprecation of the 'reconnect' field which
was already in use by libvirt this patch also captures the change to the
new format.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoqemu: passt: Use 'reconnect-ms' instead of 'reconnect' with new qemus
Peter Krempa [Tue, 19 Nov 2024 09:53:08 +0000 (10:53 +0100)] 
qemu: passt: Use 'reconnect-ms' instead of 'reconnect' with new qemus

The 'reconnect' field of 'stream' network backend type is about to be
deprecated so libvirt will need to start using 'reconnect-ms'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoqemu: capabilities: Introduce QEMU_CAPS_NETDEV_STREAM_RECONNECT_MILISECONDS
Peter Krempa [Tue, 19 Nov 2024 09:41:13 +0000 (10:41 +0100)] 
qemu: capabilities: Introduce QEMU_CAPS_NETDEV_STREAM_RECONNECT_MILISECONDS

The 'stream' type for 'netdev-add' recently added support for
'reconnect-ms' which supersedes 'reconnect' (now deprecated). Add a
capability which will allow us to switch to the new property.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoqemu: capabilities: Restore grouping in 'virQEMUCapsQMPSchemaQueries'
Peter Krempa [Tue, 19 Nov 2024 09:35:16 +0000 (10:35 +0100)] 
qemu: capabilities: Restore grouping in 'virQEMUCapsQMPSchemaQueries'

Historically the QMP schema lookup queries were grouped by the first
component of the query (which was also sorted), but not fully sorted.
This deteriorated over time. Re-group the query strings now that some
were added at the bottom.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoqemuDomainDiskChangeSupported: Add missing iothreads check
Adam Julis [Fri, 26 Jul 2024 08:52:18 +0000 (10:52 +0200)] 
qemuDomainDiskChangeSupported: Add missing iothreads check

GSList of iothreads is not allowed to be changed while the
virtual machine is running.

Resolves: https://issues.redhat.com/browse/RHEL-23607
Signed-off-by: Adam Julis <ajulis@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agomanpage: virsh: Add warning about 'migrate' with '--persistent' together with '-...
Peter Krempa [Mon, 18 Nov 2024 13:12:20 +0000 (14:12 +0100)] 
manpage: virsh: Add warning about 'migrate' with '--persistent' together with '--xml'

When a VM is being migrated to a destination host it can be made
persistent on the destination by using '--persistent'. That may not
work as intended if '--xml' is used as well as that allows overriding
certain aspects of the VM xml, but does not involve the persistent
definition. In most cases users will need to supply also
'--persistent-xml' with the same set of modification.

Modify the man page to clarify the above so that users don't end up with
broken VM after migrating and restarting it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoAPI: migration: Warn about use of VIR_MIGRATE_PERSIST_DEST with VIR_MIGRATE_PARAM_DES...
Peter Krempa [Mon, 18 Nov 2024 13:25:22 +0000 (14:25 +0100)] 
API: migration: Warn about use of VIR_MIGRATE_PERSIST_DEST with VIR_MIGRATE_PARAM_DEST_XML

When a VM is being migrated to a destination host it can be made
persistent on the destination by using VIR_MIGRATE_PERSIST_DEST. That
may not work as intended if VIR_MIGRATE_PARAM_DEST_XML or the 'xmlin'
parameter is used as that allows overriding certain aspects of the VM
xml, but does not involve the persistent definition.
In most cases users will need to supply also VIR_MIGRATE_PARAM_PERSIST_XML
with the same set of modification.

Modify the man page to clarify the above so that users don't end up with
broken VM after migrating and restarting it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoRevert "qemu: migration: Improve handling of VIR_MIGRATE_PARAM_DEST_XML with VIR_MIGR...
Peter Krempa [Mon, 18 Nov 2024 13:02:17 +0000 (14:02 +0100)] 
Revert "qemu: migration: Improve handling of VIR_MIGRATE_PARAM_DEST_XML with VIR_MIGRATE_PERSIST_DEST"

The original intention was to improve the behaviour of the
VIR_MIGRATE_PERSIST_DEST flag which makes the VM persistent after
migration on the destination when used with VIR_MIGRATE_PARAM_DEST_XML.

While it worked as intended with p2p migration where the migration is
driven from the virtqemud instance on the source of the migration, which
can distinguish between the user-provided input XML and the one fetched
from the source of the migration, it's not easily possible to achieve
the same behaviour with normal migration driven from the client library.

The approach also still had corner cases (originally deemed worth
changing) such as if the persistent definition was modified it would be
overwritten.

As there is no clear fix which would improve both styles of migrations
with no corner cases revert the change.

Upcoming commits will modify the documentation to add warning about the
use of VIR_MIGRATE_PERSIST_DEST with VIR_MIGRATE_PARAM_DEST_XML/xmlin
without using VIR_MIGRATE_PARAM_PERSIST_XML instead of a code fix.

This reverts commit 6a385590926d01ab2f2137d1d0833ae797cd2839.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoNEWS: Add the news for CVE-2024-4418
Han Han [Fri, 25 Oct 2024 04:57:26 +0000 (12:57 +0800)] 
NEWS: Add the news for CVE-2024-4418

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoNEWS: Add the news for CVE-2024-2494
Han Han [Fri, 25 Oct 2024 04:57:25 +0000 (12:57 +0800)] 
NEWS: Add the news for CVE-2024-2494

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoNEWS: cpu_map: Add the EPYC-Genoa cpu mode
Han Han [Fri, 25 Oct 2024 04:57:24 +0000 (12:57 +0800)] 
NEWS: cpu_map: Add the EPYC-Genoa cpu mode

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoNEWS: qemu: Add support for hyperv enlightenments features
Han Han [Fri, 25 Oct 2024 04:57:23 +0000 (12:57 +0800)] 
NEWS: qemu: Add support for hyperv enlightenments features

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agodocs: Recommend virtio instead of virtio-(non-)transitional
Andrea Bolognani [Thu, 7 Nov 2024 15:36:15 +0000 (16:36 +0100)] 
docs: Recommend virtio instead of virtio-(non-)transitional

When virtio-(non-)transitional models were introduced, the
documentation was updated to include them; at the same time,
language was introduced indicating that using the existing
virtio model is no longer recommended.

This is unnecessarily harsh, and has resulted in people
incorrectly believing (through no fault of their own) that the
virtio model has been deprecated.

In reality, it's perfectly fine to use the virtio model as the
stress-free option that, while often not producing the ideal
PCI topology, will generally get the job done and work reliably
across libvirt versions and machine types.

Tweak the documentation so that it hopefully carries the
desired message across.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
8 months agovmx: Get the VMware boolean uefi.secureBoot.enabled
Richard W.M. Jones [Mon, 18 Nov 2024 13:53:48 +0000 (13:53 +0000)] 
vmx: Get the VMware boolean uefi.secureBoot.enabled

Some VMware guests have a boolean uefi.secureBoot.enabled.  If found,
and it's set to "TRUE", and if it's a UEFI guest, then add this clause
into the domain XML:

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

This approximates the meaning of this VMware flag.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Fixes: https://issues.redhat.com/browse/RHEL-67836
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: Avoid use of '-loadvm' commandline argument for internal snapshot reversion
Peter Krempa [Thu, 7 Nov 2024 09:48:10 +0000 (10:48 +0100)] 
qemu: Avoid use of '-loadvm' commandline argument for internal snapshot reversion

The '-loadvm' commandline parameter has exactly the same semantics as
the HMP 'loadvm' command. This includes the selection of which block
device is considered to contain the 'vmstate' section.

Since libvirt recently switched to the new QMP commands which allow a
free selection of where the 'vmstate' is placed, snapshot reversion will
no longer work if libvirt's algorithm disagrees with qemu's. This is the
case when the VM has UEFI NVRAM image, in qcow2 format, present.

To solve this we'll use the QMP counterpart 'snapshot-load' to load the
snapshot instead of using '-loadvm'. We'll do this before resuming
processors after startup of qemu and thus the behaviour is identical to
what we had before.

The logic for selecting the images now checks both the snapshot metadata
and the VM definition. In case images not covered by the snapshot
definition do have the snapshot it's included in the reversion, but it's
fatal if the snapshot is not present in a disk covered in snapshot
metadata.

The vmstate is selected based on where it's present as libvirt doesn't
store this information.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: monitor: Extract vmstate presence for internal snapshots in qemuBlockGetNamedNo...
Peter Krempa [Wed, 13 Nov 2024 08:44:03 +0000 (09:44 +0100)] 
qemu: monitor: Extract vmstate presence for internal snapshots in qemuBlockGetNamedNodeData

Refactor the parts of qemuBlockGetNamedNodeData which fetch the names of
internal snapshots present in the on-disk state of QCOW2 images to also
extract the presence of the 'vmstate' section.

This requires conversion of the snapshot list to a hash table as we
always know the name of the snapshot that we're looking for, and the
hash table allows also storing of additional data which we'll use to
store the presence of the 'vmstate'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: Add enum entries for 'snapshot-load' qemu job
Peter Krempa [Thu, 7 Nov 2024 11:57:42 +0000 (12:57 +0100)] 
qemu: Add enum entries for 'snapshot-load' qemu job

The internal snapshot code will use the 'snapshot-load' command so we
need to add the corresponding job type.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: monitor: Add monitor infrastructure for 'snapshot-load' QMP command
Peter Krempa [Wed, 6 Nov 2024 14:59:34 +0000 (15:59 +0100)] 
qemu: monitor: Add monitor infrastructure for 'snapshot-load' QMP command

Libvirt currently loads snapshots via the '-loadvm' commandline option
but that uses the same logic as the 'loadvm' text monitor command used
to pick the disk image with the 'vmstate' section. Since libvirt now
implements our own logic to pick the 'vmstate' device it can happen that
we pick a different than qemu and thus qemu would fail to load the
snapshot. This happens currently on VMs with UEFI firmware with NVRAM
image in qcow2 format.

To fix this libvirt will need to use the 'snapshot-load' QMP command
instead of relying on '-savevm'.

Implement the monitor bits for 'snapshot-load'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemuSnapshotForEachQcow2: Handle also NVRAM image for internal snapshots
Peter Krempa [Tue, 12 Nov 2024 12:22:39 +0000 (13:22 +0100)] 
qemuSnapshotForEachQcow2: Handle also NVRAM image for internal snapshots

The live VM snapshot code already does handle the NVRAM image when it's
in use, so we should also handle it when modifying/creating the
snapshots via qemu-img when inactive.

Add the handling to qemuSnapshotForEachQcow2 which is used for all
inactive operations.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemuSnapshotForEachQcow2: Refactor
Peter Krempa [Tue, 12 Nov 2024 07:47:29 +0000 (08:47 +0100)] 
qemuSnapshotForEachQcow2: Refactor

Refactor the function to avoid recursive call to rollback and simplify
calling parameters.

To achieve that most of the fatal checks are extracted into a dedicated
loop that runs before modifying the disk state thus removing the need to
rollback altoghether. Since rollback is still necessary when creation of
the snapshot fails half-way through the rollback is extracted to handle
only that scenario.

Additionally callers would only pass the old 'try_all' argument as true
on all non-creation ("-c") modes. This means that we can infer it from
the operation instead of passing it as an extra argument.

This refactor will also make it much simpler to implement handling of
the NVRAM pflash backing file (in case it's qcow2) for internal
snapshots.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: Move 'qemuDomainSnapshotForEachQcow2(Raw)' to qemu_snapshot.c
Peter Krempa [Mon, 11 Nov 2024 16:20:39 +0000 (17:20 +0100)] 
qemu: Move 'qemuDomainSnapshotForEachQcow2(Raw)' to qemu_snapshot.c

The functions are exclusively used in the snapshot module. Move and
rename them:

  qemuDomainSnapshotForEachQcow2Raw -> qemuSnapshotForEachQcow2Internal
  qemuDomainSnapshotForEachQcow2 -> qemuSnapshotForEachQcow2

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemuDomainSnapshotForEachQcow2Raw: Remove 'driver' argument
Peter Krempa [Mon, 11 Nov 2024 16:17:04 +0000 (17:17 +0100)] 
qemuDomainSnapshotForEachQcow2Raw: Remove 'driver' argument

Now that it's unused except for the recursive call it can be dropped
from all of the call tree.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: Don't store path to qemu img
Peter Krempa [Mon, 11 Nov 2024 15:42:10 +0000 (16:42 +0100)] 
qemu: Don't store path to qemu img

The 'virCommand' helpers already look up the full path to the binary in
PATH if it's not specified. This means that the qemu driver doesn't have
to lookup and store the path to 'qemu-img' in the conf object but rather
can be cleaned up to use this new infrastructure.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoch: Enable callbacks for ch domain events
Praveen K Paladugu [Tue, 10 Sep 2024 19:22:43 +0000 (14:22 -0500)] 
ch: Enable callbacks for ch domain events

Enable callbacks for define, undefine, started, booted, stopped,
destroyed events of ch guests.

Signed-off-by: Praveen K Paladugu <praveenkpaladugu@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoch: enable virNodeGetMemoryStats API
Praveen K Paladugu [Fri, 15 Nov 2024 19:48:58 +0000 (13:48 -0600)] 
ch: enable virNodeGetMemoryStats API

Enable virNodeGetMemoryStats API to return the stats of host memory.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Signed-off-by: Praveen K Paladugu <praveenkpaladugu@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Sun, 17 Nov 2024 09:42:07 +0000 (09:42 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 96.5% (10165 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Fri, 15 Nov 2024 20:38:33 +0000 (20:38 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 96.3% (10145 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Thu, 14 Nov 2024 21:04:48 +0000 (21:04 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 96.1% (10118 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Wed, 13 Nov 2024 20:40:42 +0000 (20:40 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.9% (10098 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Swedish)
Weblate [Wed, 13 Nov 2024 20:37:54 +0000 (20:37 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.8% (10087 of 10526 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Wed, 13 Nov 2024 20:35:45 +0000 (20:35 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.8% (10087 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Czech)
Pavel Borecki [Wed, 13 Nov 2024 19:28:20 +0000 (19:28 +0000)] 
Translated using Weblate (Czech)

Currently translated at 96.9% (10206 of 10526 strings)

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

Signed-off-by: Pavel Borecki <pavel.borecki@gmail.com>
8 months agoqemu: Read back the profile name after creation of a TPM instance
Stefan Berger [Wed, 13 Nov 2024 17:39:51 +0000 (12:39 -0500)] 
qemu: Read back the profile name after creation of a TPM instance

Get the JSON profile that the swtpm instance was created with from the
output of 'swtpm socket --tpm2 --print-info 0x20 --tpmstate ...'. Get the
name of the profile from the JSON and set it in the current and persistent
emulator descriptions as 'name' attribute and have the persistent
description stored with this update. The user should avoid setting this
'name' attribute since it is meant to be read-only. The following is
an example of how the XML could look like:

  <profile source='local:restricted' name='custom:restricted'/>

If the user provided no profile node, and therefore swtpm_setup picked its
default profile, the XML may now shows the 'name' attribute with the name
of the profile. This makes the 'source' attribute now optional.

  <profile name='default-v1'/>

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: Move adding --tpmstate to swtpm command line into own function
Stefan Berger [Wed, 13 Nov 2024 17:39:50 +0000 (12:39 -0500)] 
qemu: Move adding --tpmstate to swtpm command line into own function

Factor-out code related to adding the --tpmstate option to the swtpm
command line into its own function.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: Move adding of keys to swtpm command line into own function
Stefan Berger [Wed, 13 Nov 2024 17:39:49 +0000 (12:39 -0500)] 
qemu: Move adding of keys to swtpm command line into own function

Factor-out code related to adding key to the swtpm command line into its
own function.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: Extend swtpm_setup command line to set a profile by its name
Stefan Berger [Wed, 13 Nov 2024 17:39:48 +0000 (12:39 -0500)] 
qemu: Extend swtpm_setup command line to set a profile by its name

Run swtpm_setup with the --profile-name option if the user provided the
name of a profile. swtpm_setup will try to load the profile from
directories with local profiles and distro profiles and if no profile
by this name with appended '.json' suffix could be found there, it will
fall back to try to use an internal profile with the given name.

Also set the --profile-remove-disabled option if the user provided a value
in the remove_disabled attribute in the profile XML node.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agodocs: Add documentation for the TPM backend profile node
Stefan Berger [Wed, 13 Nov 2024 17:39:47 +0000 (12:39 -0500)] 
docs: Add documentation for the TPM backend profile node

Add documentation for the TPM backend profile node and point the reader to
further documentation about TPM profiles available in the swtpm man page.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoconf: Add support for profile parameter on TPM emulator in domain XML
Stefan Berger [Wed, 13 Nov 2024 17:39:46 +0000 (12:39 -0500)] 
conf: Add support for profile parameter on TPM emulator in domain XML

Extend the parser and XML builder with support for the profile parameter
and its remove_disabled attribute.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoschema: Extend schema for TPM emulator profile node
Stefan Berger [Wed, 13 Nov 2024 17:39:45 +0000 (12:39 -0500)] 
schema: Extend schema for TPM emulator profile node

Extend the schema for the TPM emulator profile node. Require that the
profile the user provides is described in a 'source' attribute. An optional
remove_disabled attribute is also supported for swtpm to automatically
remove algorithms from the 'custom' profile if they are disabled by FIPS
mode on the host.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoconf: Define enum virDomainTPMProfileRemoveDisabled
Stefan Berger [Wed, 13 Nov 2024 17:39:44 +0000 (12:39 -0500)] 
conf: Define enum virDomainTPMProfileRemoveDisabled

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoutil: Add parsing support for swtpm_setup's cmdarg-profile capability
Stefan Berger [Wed, 13 Nov 2024 17:39:43 +0000 (12:39 -0500)] 
util: Add parsing support for swtpm_setup's cmdarg-profile capability

Add support for parsing swtpm_setup 'cmdarg-profile' capability
(since v0.10).

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: Pass virQEMUDriverConfig rather than some of its fields
Stefan Berger [Wed, 13 Nov 2024 17:39:42 +0000 (12:39 -0500)] 
qemu: Pass virQEMUDriverConfig rather than some of its fields

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoconf: Move TPM emulator parameters into own struct
Stefan Berger [Wed, 13 Nov 2024 17:39:41 +0000 (12:39 -0500)] 
conf: Move TPM emulator parameters into own struct

To avoid passing TPM emulator parameters around individually, move them
into a structure and pass around the structure.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: Avoid useless tmp variable in qemuCanonicalizeMachine
Jiri Denemark [Thu, 7 Nov 2024 08:53:33 +0000 (09:53 +0100)] 
qemu: Avoid useless tmp variable in qemuCanonicalizeMachine

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
8 months agoch: explicitly set INFILESIZE to 0
Praveen K Paladugu [Fri, 11 Oct 2024 18:13:11 +0000 (13:13 -0500)] 
ch: explicitly set INFILESIZE to 0

While sending API requests that don't need any body, explicitly set
CURLOPT_INFILESIZE to 0.

Without this option, curl sends a chunked request with `Expect: 100-continue`
header. The client, in this case curl, expects a response from the server,
ch in this case, to respond within a timeout period.

If guest definition has a PCI passthrough device configuration,
cloud-hypervisor process cannot respond within above mentioned timeout.
Even if cloud-hypervisor responds after the timeout, curl cannot read
the response. Because of this, virsh request to create a guest, hangs. This
only happens while using "mshv" hypervisor.

By setting CURLOPT_INFILESIZE to O, curl drops the Expect header and
sychronously waits for server to respond.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoch: reattach PCI devices to host while stopping guest
Praveen K Paladugu [Fri, 11 Oct 2024 18:13:10 +0000 (13:13 -0500)] 
ch: reattach PCI devices to host while stopping guest

Reattach PCI devices to host, while stopping ch guest.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoch: allow hostdev in domain definitions
Praveen K Paladugu [Fri, 11 Oct 2024 18:13:09 +0000 (13:13 -0500)] 
ch: allow hostdev in domain definitions

Allow hostdev configurations in ch guest definitions.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoch: prepare host for PCI passthrough
Wei Liu [Fri, 11 Oct 2024 18:13:08 +0000 (13:13 -0500)] 
ch: prepare host for PCI passthrough

Prepare host to passthrough PCI devices for ch guests.

Co-authored-by: Wei Liu <liuwe@microsoft.com>
Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoch: prepare domain definition for pci passthrough
Wei Liu [Fri, 11 Oct 2024 18:13:06 +0000 (13:13 -0500)] 
ch: prepare domain definition for pci passthrough

Check if the domain definition is valid for PCI passthrough and update
it if necessary.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoch: add host device manager to driver
Wei Liu [Fri, 11 Oct 2024 18:13:05 +0000 (13:13 -0500)] 
ch: add host device manager to driver

Co-authored-by: Wei Liu <liuwe@microsoft.com>
Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agohypervisor: move HostdevHostSupportsPassthroughVFIO
Praveen K Paladugu [Fri, 11 Oct 2024 18:13:03 +0000 (13:13 -0500)] 
hypervisor: move HostdevHostSupportsPassthroughVFIO

Move HostdevHostSupportsPassthroughVFIO method to hypervisor to be
shared between qemu and ch drivers.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agohypervisor: move HostdevNeedsVFIO to hypervisor
Praveen K Paladugu [Fri, 11 Oct 2024 18:13:02 +0000 (13:13 -0500)] 
hypervisor: move HostdevNeedsVFIO to hypervisor

Move HostdevNeedsVFIO method to hypervisor to be reused between qemu
and ch drivers.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agokbase: virtiofs: Clarify migration support statement
Peter Krempa [Fri, 15 Nov 2024 09:00:25 +0000 (10:00 +0100)] 
kbase: virtiofs: Clarify migration support statement

virtiofs 1.11 contains support for migration so update the 'Note' which
states that migration is not supported.

Additionally mention that VM snapshots don't save state of the files
shared via virtiofs so reverting is not a good idea.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: process: Introduce setup of block-device backed NVRAM
Peter Krempa [Fri, 18 Oct 2024 13:55:44 +0000 (15:55 +0200)] 
qemu: process: Introduce setup of block-device backed NVRAM

In case when a management application will require to store the nvram in
a block device instead of a file libvirt needs to be able to set up the
block device.

This patch introduces support for setting up the block device by using
'qemu-img convert' to produce a qcow2-formatted block device.

The use of 'qcow2' is made mandatory as the UEFI firmware requires that
the NVRAM image has the exact expected size, which is almost impossible
with block devices. 'qcow2' also allows libvirt to detect wheher the
block device is formatted allowing file-like semantics.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoqemu: process: Extract setup of file-backed nvram from template
Peter Krempa [Fri, 18 Oct 2024 13:55:33 +0000 (15:55 +0200)] 
qemu: process: Extract setup of file-backed nvram from template

The setup of nvram will later be extended to also support block-device
backed nvram, so extract the file-backed nvram setup steps from
'qemuPrepareNVRAM' into 'qemuPrepareNVRAMFile'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoconf: Remove nonsensical requirement of nvram format matching firmware format
Peter Krempa [Thu, 15 Aug 2024 15:02:54 +0000 (17:02 +0200)] 
conf: Remove nonsensical requirement of nvram format matching firmware format

The nvram image can have any supported format and there's no technical
requirement of them having the same format. In fact the actual nvram
image doesn't necessarily need to have the same format as the template
if the user is willing to format it themselves (as libvirt is not going
to convert it).

Remove the nonsensical check and adjust tests. The test case required
swapping around the format in order to work properly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoqemuFirmwareMatchDomain: Don't base firmware selection on nvram image format
Peter Krempa [Tue, 20 Aug 2024 14:15:05 +0000 (16:15 +0200)] 
qemuFirmwareMatchDomain: Don't base firmware selection on nvram image format

Basing the selection on the format of the actual NVRAM image makes no
sense as user may format the image themselves.

Additionally it doesn't make much sense to even limit the firmware
selection based on the nvram template itself. As format of the template
is given and firmware images don't really provide any choice.

Remove the limitation so that autoselection can pick a template
regardless of the selected format or template format.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoqemuPrepareNVRAM: Refuse conversion of NVRAM backing file format
Peter Krempa [Mon, 4 Nov 2024 17:04:29 +0000 (18:04 +0100)] 
qemuPrepareNVRAM: Refuse conversion of NVRAM backing file format

Refuse situations where the user configures a different format for a
file-backed nvram than the template file has.

At this point it's still required that the NVRAM and firmware share
format, but that is going to be relaxed, thus we need to refuse
configurations that the code can't handle.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoconf: Always format firmware image format
Peter Krempa [Mon, 26 Aug 2024 13:37:35 +0000 (15:37 +0200)] 
conf: Always format firmware image format

The code historically skipped the 'format' field for 'raw' images as we
didn't output it when no format support was present. Stop misleading and
output the format also for 'raw' images.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoconf: domain: Output 'format' attribute of '<nvram>' also for' raw images
Peter Krempa [Thu, 22 Aug 2024 10:12:10 +0000 (12:12 +0200)] 
conf: domain: Output 'format' attribute of '<nvram>' also for' raw images

As the 'format' field is meant to carry the format of the nvram image we
should output it even when the image is 'raw'.

Currently this is not a problem but later patches will allow mismatch
between the nvram format and loader format (as nothing really
technically requires them to be the same and this then could become
problem).

Modify the condition and update tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agofirmware: Add 'templateFormat' XML attribute and plumb it in
Peter Krempa [Tue, 20 Aug 2024 14:19:00 +0000 (16:19 +0200)] 
firmware: Add 'templateFormat' XML attribute and plumb it in

Currently the qemu firmware code weirdly depends on the 'format' field
of the nvram image itself to do the auto-selection process as well as
then uses it to declare the actual type to qemu.

As it's not technically required that the template and the on disk image
share the type introduce a 'templateFormat' field which will split off
from the shared purpose of the type and will be used for the selection
and instantiation process, while 'format' will be left for the actual
type of the on disk image.

This patch introduces the field, adds XML infrastructure as well as
plumbs it to the firmware bits.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agodocs: formatdomain: Clarify that NVRAM template is also being autoselected
Peter Krempa [Thu, 22 Aug 2024 15:20:32 +0000 (17:20 +0200)] 
docs: formatdomain: Clarify that NVRAM template is also being autoselected

The NVRAM template file may be autoselected same as the loader/firmware
image. Add a hint that this can occur and also that it doesn't
necessarily need to be from the 'qemu.conf' configured files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoconf: domain: Clarify nvram/loader format logic
Peter Krempa [Mon, 19 Aug 2024 14:57:55 +0000 (16:57 +0200)] 
conf: domain: Clarify nvram/loader format logic

Restructure the code to assign first (as this is simpler to refactor in
the future) and avoid mixing implicit value checks with explicit ones by
checking for _NONE.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoqemu: Install backing store terminators for 'pflash' blockdevs
Peter Krempa [Mon, 4 Nov 2024 16:45:54 +0000 (17:45 +0100)] 
qemu: Install backing store terminators for 'pflash' blockdevs

The qemu driver does support qcow2 images for the firmware and nvram
pflash devices, but we do not do the full backing chain setup for them
as we don't expect that those images would actually have a backing
store. We don't tell that to qemu though which theoretically can lead to
qemu probing the backing store from the image itself. We don't want that
for now.

Deny qemu probing the backing store by installing a "terminator" empty
virStorageSource as 'backingStore' for pflash and nvram.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoqemuFirmwareEnsureNVRAM: Don't try to setup non-local nvram
Peter Krempa [Mon, 19 Aug 2024 13:45:31 +0000 (15:45 +0200)] 
qemuFirmwareEnsureNVRAM: Don't try to setup non-local nvram

'qemuFirmwareEnsureNVRAM' which fills the NVRAM configuration bits which
may be missing was basing its decision to do something based on whether
the 'path' field was set. This is insufficient if remote storage is to
be considered.

Use 'virStorageSourceIsEmpty()' instead as that properly considers
remote filesystems and explain why the source is unref'd when the
function decides to rewrite the config.

The 'firmware-auto-efi-format-nvram-qcow2-network-nbd' is modified to
omit filling the 'path' field, which without this fix would result in
the nvram to be reset to a local file.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoqemuPrepareNVRAM: Don't attempt to create NVRAM on block device
Peter Krempa [Fri, 23 Aug 2024 11:14:33 +0000 (13:14 +0200)] 
qemuPrepareNVRAM: Don't attempt to create NVRAM on block device

'virFileRewrite()' which is used to setup the NVRAM image if it doesn't
exist or when it is requested by the user forcibly replaces the
destination file by the file it creates. For block devices this
overwrites the device node file or the symlink pointing to the device
node by a regular file instead of formatting it.

As this not only makes the VM fail to start but also breaks user's /dev/
filesystem forbid it for now.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agosyntax-check: Suggest ways to fix internal references
Andrea Bolognani [Wed, 13 Nov 2024 21:51:35 +0000 (22:51 +0100)] 
syntax-check: Suggest ways to fix internal references

The rule catches incorrect attempts to use internal references,
but doesn't guide the developer hitting a failure towards the
not exactly obvious acceptable alternatives.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agodocs: Document authselect to enable the NSS module
Andrea Bolognani [Tue, 12 Nov 2024 22:32:33 +0000 (23:32 +0100)] 
docs: Document authselect to enable the NSS module

When using recent Fedora and RHEL versions, the manual setup that
is otherwise necessary to enable the module can be replaced with
executing a single command.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agodocs: Rework documentation for the NSS module
Andrea Bolognani [Tue, 12 Nov 2024 19:28:49 +0000 (20:28 +0100)] 
docs: Rework documentation for the NSS module

The page contains some confusing information, especially around
limitations that supposedly only affect one of the two variants,
and goes into what is arguably an unnecessary amount of detail
when it comes to its inner workings.

We can make the page a lot shorter and snappier without
affecting its usefulness, so let's do just that.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: Move PostParse functions out of qemu_domain.c
Michal Privoznik [Tue, 12 Nov 2024 14:55:14 +0000 (15:55 +0100)] 
qemu: Move PostParse functions out of qemu_domain.c

Problem with qemu_domain.c is that it's constantly growing. But
there are few options for improvement. For instance, validation
functions were moved out and now live in qemu_validate.c. We can
do the same for PostParse functions, though since PostParse may
modify domain definition, some functions need to be exported from
qemu_domain.c.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
8 months agoqemu_hotplug: Do not report unknown error when hot-unplugging non-existing device
Martin Kletzander [Fri, 8 Nov 2024 11:30:06 +0000 (12:30 +0100)] 
qemu_hotplug: Do not report unknown error when hot-unplugging non-existing device

When qemuDomainDeleteDevice() gets "DeviceNotFound" error it is a
special case as we're trying to remove a device which does not exists
any more.  Such occasion is indicated by the return value -2.

Callers of the aforementioned function ought to base their behaviour on
the return value.  However not all callers take as much care for the
return value as one could realistically anticipate.

Follow the usual direction of removing possible backend object (in case
of character devices), remove the device from its XML without waiting
for the device removal from QEMU (since it is already not there) and
basically follow the same algorithm as there is when the device was
removed, skipping over the wait for the device removal.

The overall return value also needs to be adjusted since
qemuDomainDeleteDevice() does not set an error on the -2 return value
and would otherwise trigger an unknown error being reported to the user
or management application.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agoDrop unused function declarations
Michal Privoznik [Tue, 12 Nov 2024 13:32:12 +0000 (14:32 +0100)] 
Drop unused function declarations

When moving function and/or renaming them sometimes corresponding
change to corresponding header file is not done. This leaves us
with functions that are declared in header files, but nowhere
implemented. Drop such declarations.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agovirnetserverclient.h: Fix typo in comment of virNetServerClientPrivPreExecRestart()
Michal Privoznik [Tue, 12 Nov 2024 13:33:07 +0000 (14:33 +0100)] 
virnetserverclient.h: Fix typo in comment of virNetServerClientPrivPreExecRestart()

The function the comment is referring to is
virNetServerClientPrivNew() not virNetServerClintPrivNew(). The
latter doesn't even exist.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agodocs: Add Sys::Async::Virt to apps.html
Martin Kletzander [Tue, 12 Nov 2024 09:57:48 +0000 (10:57 +0100)] 
docs: Add Sys::Async::Virt to apps.html

As requested on the libvirt users list I am adding this mention to the
apps page.

Reported-by: Erik Huelsmann <ehuels@gmail.com>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Tue, 12 Nov 2024 09:21:47 +0000 (09:21 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.7% (10079 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Swedish)
Weblate [Tue, 12 Nov 2024 09:21:33 +0000 (09:21 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.7% (10078 of 10526 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Tue, 12 Nov 2024 09:21:26 +0000 (09:21 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.7% (10078 of 10526 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
8 months agoTranslated using Weblate (Swedish)
Weblate [Tue, 12 Nov 2024 09:21:14 +0000 (09:21 +0000)] 
Translated using Weblate (Swedish)

Currently translated at 95.7% (10077 of 10526 strings)

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

Signed-off-by: Weblate <noreply-mt-weblate@weblate.org>