]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
8 months agovirsh: Simplify vshTableRowAppend() calling in cmdList(), part two
Michal Privoznik [Mon, 19 Aug 2024 10:15:01 +0000 (12:15 +0200)]
virsh: Simplify vshTableRowAppend() calling in cmdList(), part two

Instead of having many if-else statements, each with its own
vshTableRowAppend() call, we can use a simple trick - have an
array of string pointers, set array members in the if bodies and
then call vshTableRowAppend() once.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agovirsh: Simplify vshTableRowAppend() calling in cmdList(), part one
Michal Privoznik [Mon, 19 Aug 2024 10:02:29 +0000 (12:02 +0200)]
virsh: Simplify vshTableRowAppend() calling in cmdList(), part one

All calls to vshTableRowAppend() inside of cmdList() share couple
of same arguments: domain ID, domain name and domain state. While
the first one is stored in a variable and then passed to all
vshTableRowAppend() calls, the others are passed as a function
call. Switch the latter to variables too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agolib: Use NULLSTR family of macros more
Michal Privoznik [Mon, 19 Aug 2024 10:26:27 +0000 (12:26 +0200)]
lib: Use NULLSTR family of macros more

There is a family of convenient macros: NULLSTR, NULLSTR_EMPTY,
NULLSTR_STAR, NULLSTR_MINUS which hides ternary operator.

Generated using the following spatch (and its obvious variants):

  @@
  expression s;
  @@
    <+...
  - s ? s : "<null>"
  + NULLSTR(s)
    ...+>

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agoTranslated using Weblate (English (United Kingdom))
Andi Chandler [Sun, 18 Aug 2024 18:23:37 +0000 (18:23 +0000)]
Translated using Weblate (English (United Kingdom))

Currently translated at 48.6% (5110 of 10508 strings)

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

Signed-off-by: Andi Chandler <andi@gowling.com>
8 months agoTranslated using Weblate (English (United Kingdom))
Andi Chandler [Sat, 17 Aug 2024 11:59:08 +0000 (11:59 +0000)]
Translated using Weblate (English (United Kingdom))

Currently translated at 47.9% (5038 of 10508 strings)

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

Signed-off-by: Andi Chandler <andi@gowling.com>
8 months agoTranslated using Weblate (Chinese (Simplified) (zh_CN))
jianqing yan [Fri, 16 Aug 2024 10:41:57 +0000 (10:41 +0000)]
Translated using Weblate (Chinese (Simplified) (zh_CN))

Currently translated at 95.8% (10072 of 10508 strings)

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

Signed-off-by: jianqing yan <yanjianqing@kylinos.cn>
8 months agovirarptable: End parsing earlier in case of NLMSG_DONE
Martin Kletzander [Fri, 16 Aug 2024 12:02:48 +0000 (14:02 +0200)]
virarptable: End parsing earlier in case of NLMSG_DONE

Check for the last multipart message right as the first thing.  The
presumption probably was that the last message might still contain a
payload we want to parse.  However that cannot be true since that would
have to be a type RTM_NEWNEIGH.  This was not caught because older
kernels were note sending NLMSG_DONE and probably relied on the fact
that the parsing just stops after all the messages are walked through,
which the NLMSG_OK macro successfully did.

Resolves: https://issues.redhat.com/browse/RHEL-52449
Resolves: https://bugzilla.redhat.com/2302245
Fixes: a176d67cdfaf5b8237a7e3a80d8be0e6bdf2d8fd
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
8 months agovirarptable: Fix check for message length
Martin Kletzander [Fri, 16 Aug 2024 11:59:15 +0000 (13:59 +0200)]
virarptable: Fix check for message length

The previous check was all wrong since it calculated the how long would
the netlink message be if the netlink header was the payload and then
subtracted that from the whole message length, a variable that was not
used later in the code.  This check can fail if there are no additional
payloads, struct rtattr in particular, which we are parsing later,
however the RTA_OK macro would've caught that anyway.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
8 months agovirarptable: Properly calculate rtattr length
Martin Kletzander [Fri, 16 Aug 2024 11:56:51 +0000 (13:56 +0200)]
virarptable: Properly calculate rtattr length

Use convenience macro which does almost the same thing we were doing,
but also pads out the payload length to a multiple of NLMSG_ALIGNTO (4)
bytes.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
8 months agovirsh: allow both --table and --uuid at the same time
Nikolai Barybin via Devel [Wed, 14 Aug 2024 11:30:02 +0000 (14:30 +0300)]
virsh: allow both --table and --uuid at the same time

This will allow to print full domains info:

   Id   Name   State   UUID
  ---------------------------

Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoci: update OpenSUSE Leap to 15.6
Ján Tomko [Wed, 14 Aug 2024 11:21:15 +0000 (13:21 +0200)]
ci: update OpenSUSE Leap to 15.6

It was released on June 12, 2024.

The update means we no longer have to care about json-c 0.13
present in Leap 15.5, which solves some whitespace issues in
tests.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agotests: json: relax some test cases
Ján Tomko [Thu, 8 Feb 2024 15:50:49 +0000 (16:50 +0100)]
tests: json: relax some test cases

Some JSON parsers do not like bare types outside of objects or arrays
or do validation of object key uniqueness.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
8 months agoTranslated using Weblate (Chinese (Simplified) (zh_CN))
jianqing yan [Wed, 14 Aug 2024 14:12:16 +0000 (14:12 +0000)]
Translated using Weblate (Chinese (Simplified) (zh_CN))

Currently translated at 95.8% (10075 of 10508 strings)

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

Signed-off-by: jianqing yan <yanjianqing@kylinos.cn>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Tue, 13 Aug 2024 07:39:28 +0000 (07:39 +0000)]
Translated using Weblate (Swedish)

Currently translated at 85.0% (8940 of 10508 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 agoformatstorage: Document qcow2 default version change
Peter Krempa [Tue, 12 Mar 2024 11:32:52 +0000 (12:32 +0100)]
formatstorage: Document qcow2 default version change

Based on discussion after commit f432114d9c was pushed it was pointed
out that the documentation still mentions the older version.

Fix the documentation to state the new version and introduce ambiguity
for future updates.

Fixes: f432114d9cf507a4047aa9dc1344b1c13356db08
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
8 months agocpu_map: Add GraniteRapids CPU model
Tim Wiederhake [Sat, 13 Jul 2024 16:36:34 +0000 (18:36 +0200)]
cpu_map: Add GraniteRapids CPU model

This was added in qemu commit 6d5e9694ef.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agosync_qemu_models_i386.py: Add missing features
Tim Wiederhake [Sat, 13 Jul 2024 16:35:21 +0000 (18:35 +0200)]
sync_qemu_models_i386.py: Add missing features

This brings the tool's list of features in sync with qemu
commit 37fbfda8f4145ba1700f63f0cb7be4c108d545de.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agocpu_map: Add libcpuinfo as optional data source
Tim Wiederhake [Mon, 5 Feb 2024 10:18:43 +0000 (11:18 +0100)]
cpu_map: Add libcpuinfo as optional data source

This adds an option to use libcpuinfo [1] as data source for
libvirt's list of x86 cpu features. This is purely optional and
does not change the script's behavior if libcpuinfo is not
installed.

libcpuinfo is a cross-vendor, cross-architecture source for CPU
related information that has the capability to replace libvirt's
dependence on qemu's cpu feature list.

[1] https://gitlab.com/twiederh/libcpuinfo

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: hotplug: Rollback FD passthrough for 'slirpfd' and 'vdpafd' on hotplug failure
Peter Krempa [Mon, 12 Aug 2024 14:04:20 +0000 (16:04 +0200)]
qemu: hotplug: Rollback FD passthrough for 'slirpfd' and 'vdpafd' on hotplug failure

On failure to plug the device the cleanup path didn't roll back the FD
passing to qemu thus qemu would hold the FDs indefinitely.

Resolves: https://issues.redhat.com/browse/RHEL-53964
Fixes: b79abf9c3cdab8bcecfa8769629a4cdf4bf0b6c3 (vdpafd)
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
8 months agovirnetlibsshsession: Reflect API change in libssh
Michal Privoznik [Mon, 12 Aug 2024 10:41:13 +0000 (12:41 +0200)]
virnetlibsshsession: Reflect API change in libssh

As of libssh commit of libssh-0.11.0~70 [1] the
ssh_channel_get_exit_status() function is deprecated and a new
one is introduced instead: ssh_channel_get_exit_state().
It's not a drop-in replacement, but it's simple enough.
Adapt our libssh handling code to this change.

1: https://git.libssh.org/projects/libssh.git/commit/?id=04d86aeeae73c78af8b3dcdabb2e588cd31a8923

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Mon, 12 Aug 2024 09:03:59 +0000 (09:03 +0000)]
Translated using Weblate (Swedish)

Currently translated at 84.8% (8920 of 10508 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 [Sun, 11 Aug 2024 08:03:09 +0000 (08:03 +0000)]
Translated using Weblate (Swedish)

Currently translated at 84.6% (8899 of 10508 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 [Sat, 10 Aug 2024 07:02:51 +0000 (07:02 +0000)]
Translated using Weblate (Swedish)

Currently translated at 84.4% (8879 of 10508 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 [Sat, 10 Aug 2024 07:07:39 +0000 (07:07 +0000)]
Translated using Weblate (Swedish)

Currently translated at 84.4% (8879 of 10508 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, 8 Aug 2024 20:15:37 +0000 (20:15 +0000)]
Translated using Weblate (Swedish)

Currently translated at 84.3% (8859 of 10508 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 agoglibcompat: remove obsolete clang workaround
Daniel P. Berrangé [Mon, 12 Aug 2024 09:53:19 +0000 (10:53 +0100)]
glibcompat: remove obsolete clang workaround

This mostly reverts commit 65491a2dfe00bfcf9f09a8d6eab60234b56c8cc4.

There was a bug introduced in glib 2.67.0 which impacted libvirt with
clang causing -Wincompatible-pointer-types-discards-qualifiers warnings.

This was actually fixed quite quickly in 2.67.1 with

 https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

Our workaround was then broken with glib 2.81.1 due to commit
14b3d5da9019150d821f6178a075d85044b4c255 changing the signature of the
(private) macro we were overriding.

Since odd-number glib releases are development snapshots, and the
original problem was only present in 2.67.0 and no other releases,
just drop the workaround entirely.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
8 months agoqemuxmlconftest: Add test cases for broken and missing XML files
Peter Krempa [Thu, 8 Aug 2024 07:14:11 +0000 (09:14 +0200)]
qemuxmlconftest: Add test cases for broken and missing XML files

Add test cases for few edge cases which excercise the XML reporting from
libxml2 in anticipation of upcoming changes of behaviour.

'virschematest' must skip parsing of the broken file altogether so this
patch adds infrastructure to allow that.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agotestQemuConfXMLCommon: Strip 'abs_srcdir' paths from '.err' files in qemuxmlconftest
Peter Krempa [Fri, 9 Aug 2024 12:21:23 +0000 (14:21 +0200)]
testQemuConfXMLCommon: Strip 'abs_srcdir' paths from '.err' files in qemuxmlconftest

Upcoming patch will result in having the build directory path in some of
the output files. Replace it by a constant 'ABS_SRCDIR' to avoild
breaking tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoglibcompat: "Backport" 'g_string_replace'
Peter Krempa [Fri, 9 Aug 2024 12:14:47 +0000 (14:14 +0200)]
glibcompat: "Backport" 'g_string_replace'

Backport the implementation of 'g_string_replace' until we require at
least glib-2.68

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoNEWS: Mention restore with n/w devices support for ch
Purna Pavan Chandra [Mon, 5 Aug 2024 14:41:01 +0000 (14:41 +0000)]
NEWS: Mention restore with n/w devices support for ch

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoch: kill CH process if restore fails
Purna Pavan Chandra [Mon, 5 Aug 2024 14:41:00 +0000 (14:41 +0000)]
ch: kill CH process if restore fails

Invoke virCHProcessStop to kill CH process incase of any failures during
restore operation.

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoch: support restore with net devices
Purna Pavan Chandra [Mon, 5 Aug 2024 14:40:59 +0000 (14:40 +0000)]
ch: support restore with net devices

Cloud-hypervisor now supports restoring with new net fds.
Ref: https://github.com/cloud-hypervisor/cloud-hypervisor/pull/6402
So, pass new tap fds via SCM_RIGHTS to CH's restore api.

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoch: refactor virCHMonitorSaveVM
Purna Pavan Chandra [Mon, 5 Aug 2024 14:40:58 +0000 (14:40 +0000)]
ch: refactor virCHMonitorSaveVM

Remove the unwanted utility function and make api calls directly from
virCHMonitorSaveVM fn

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoch: use monitor socket fd to send restore request
Purna Pavan Chandra [Mon, 5 Aug 2024 14:40:57 +0000 (14:40 +0000)]
ch: use monitor socket fd to send restore request

Instead of curl, use low-level socket connections to make restore api
request to CH. This will enable passing new net FDs to CH while
restoring domains with network configuration.

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoch: support poll with -1 in chSocketRecv
Purna Pavan Chandra [Mon, 5 Aug 2024 14:40:56 +0000 (14:40 +0000)]
ch: support poll with -1 in chSocketRecv

chSocketRecv fn can be used by operations such as restore, which cannot
have a specific poll timeout. The runtime of these operations at server
side (vmm) cannot be determined or capped as it depends on the guest
configuration. Hence, add a new parameter 'use_timeout' which when set
will pass -1 as timeout to poll, otherwise the default PKT_TIMEOUT_MS is
used.

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoch: refactor chProcessAddNetworkDevices
Purna Pavan Chandra [Mon, 5 Aug 2024 14:40:55 +0000 (14:40 +0000)]
ch: refactor chProcessAddNetworkDevices

Move monitor socket connection, response handling and closing FDs code into
new functions in preparation for adding restore support for net devices.

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoch: Pass net ids explicitly during vm creation
Purna Pavan Chandra [Mon, 5 Aug 2024 14:40:54 +0000 (14:40 +0000)]
ch: Pass net ids explicitly during vm creation

Pass "net_<index>" as net id to CH. This is to have better control over
the network configs. This id can be further used in performing
operations like restore etc.

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoch: report response message instead of just code
Purna Pavan Chandra [Mon, 5 Aug 2024 14:40:53 +0000 (14:40 +0000)]
ch: report response message instead of just code

The response message from CH for vm.add-net api will be more helpful in
debugging. Hence, log the message instead of just response code.

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemucapabilitiesdata: Update data for qemu-9.1 dev cycle on x86_64
Peter Krempa [Thu, 8 Aug 2024 14:26:24 +0000 (16:26 +0200)]
qemucapabilitiesdata: Update data for qemu-9.1 dev cycle on x86_64

Update to v9.1.0-rc0-121-g75c7f57403.

Notable changes:
  - removed machine types:
     - i440fx: 2.0 - 2.3

  - deprecated machine types
     - q35 + i440fx: 2.4 - 6.0

  - GUEST_PVSHUTDOWN event added

  - migration
     - 'postcopy-recover-setup' state added
     - 'direct-io' parameter added

  - 'memory-backend-shm' qom object type added

  - 'emmc' device added

  - iommufd infrastructure added: 'host-iommu-device-iommufd-vfio',
    'host-iommu-device-legacy-vfio', 'vfio-iommu-iommufd',
    'vfio-iommu-legacy'

  - 'in_order' and 'x-pcie-pm-no-soft-reset' property added for various
    virtio-based devices

  - changed type of 'legacy-vm-type' field for 'sev-guest' object from
    boolean to 'on/off/auto'

  - 'memory-hotplug-support' property of 'ICH9-LPC' removed

  - 'migrate-emulated-scsi-request' property of 'scsi-hd' added

  - 'x-device-dirty-page-tracking' property of 'vfio-pci' added

  - 'cxl-add-dynamic-capacity' and 'cxl-release-dynamic-capacity'
     commands added (unstable for now)

  - 'x-query-interrupt-controllers' command added (unstable)

  - dropped unused 'detached-header' infra from 'blockdev-create' for 'luks'

  - design of 'deprecated-props' arg/value of 'query-cpu-model-expansion'
    cleaned up

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemuxmlconftest: Don't use soon-to-be-removed machine types
Peter Krempa [Thu, 8 Aug 2024 15:11:04 +0000 (17:11 +0200)]
qemuxmlconftest: Don't use soon-to-be-removed machine types

Latest qemu will be dropping some very old machine types (2.0 - 2.3) and
some of our tests use them. As in none of the cases the test actually
needs given machine type, switch them to 'pc' instead.

In one case 'numavcpus-topology-mismatch' this caused switch to a more
modern syntax for NUMA memory specification, but the test is testing a
different aspect, thus we can modernize this.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemuxmlconftest: Add test for old-style NUMA memory specification
Peter Krempa [Thu, 8 Aug 2024 15:28:39 +0000 (17:28 +0200)]
qemuxmlconftest: Add test for old-style NUMA memory specification

This excercises the old-style NUMA memory commandline used with 5.0 and
older machine types:

 -smp 16,sockets=2,dies=1,clusters=1,cores=4,threads=2 \
 -numa node,nodeid=0,cpus=0-7,mem=107 \
 -numa node,nodeid=1,cpus=8-15,mem=107 \

in contrast to the modern syntax:

  -smp 16,sockets=2,dies=1,clusters=1,cores=4,threads=2 \
 -object '{"qom-type":"memory-backend-ram","id":"ram-node0","size":112197632}' \
 -numa node,nodeid=0,cpus=0-7,memdev=ram-node0 \
 -object '{"qom-type":"memory-backend-ram","id":"ram-node1","size":112197632}' \
 -numa node,nodeid=1,cpus=8-15,memdev=ram-node1 \

which is tested by the 'cpu-numa1' test case where this was copied from.

This test is added so that other irrelevant test can be modernized.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: format dma-translation on intel-iommu command line
Sandesh Patel [Wed, 7 Aug 2024 07:37:51 +0000 (07:37 +0000)]
qemu: format dma-translation on intel-iommu command line

Add dma-translation attribute to qemu command line if specified in
domain conf.

Signed-off-by: Sandesh Patel <sandesh.patel@nutanix.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoconf: add dma_translation attribute to iommu
Sandesh Patel [Wed, 7 Aug 2024 07:37:50 +0000 (07:37 +0000)]
conf: add dma_translation attribute to iommu

Add dma_translation attribute to iommu to enable/disable dma traslation
for intel-iommu

Signed-off-by: Sandesh Patel <sandesh.patel@nutanix.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu_capabilities: Introduce QEMU_CAPS_INTEL_IOMMU_DMA_TRANSLATION
Sandesh Patel [Fri, 9 Aug 2024 07:30:55 +0000 (09:30 +0200)]
qemu_capabilities: Introduce QEMU_CAPS_INTEL_IOMMU_DMA_TRANSLATION

This capability tracks whether intel-iommu device has
dma-translation attribute.

Signed-off-by: Sandesh Patel <sandesh.patel@nutanix.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: Avoid false failure when resuming post-copy migration
Jiri Denemark [Thu, 8 Aug 2024 11:02:08 +0000 (13:02 +0200)]
qemu: Avoid false failure when resuming post-copy migration

Depending on timing between QEMU and libvirt an attempt to resume failed
post-copy migration could immediately report a failure in post-copy
phase again even though the migration actually resumed and is
progressing just fine.

This is caused by QEMU reporting the original migration state (i.e.,
postcopy-paused) until migration is successfully resumed and QEMU
switches to postcopy-active. QEMU 9.1 introduced a new
postcopy-recover-setup migration state which is entered immediately
after requesting migration to be resumed and we can reliably wait for
the migration to either continue or fail without being confused by the
old state.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoqemu: Add support for postcopy-recover-setup migration state
Jiri Denemark [Thu, 8 Aug 2024 09:45:16 +0000 (11:45 +0200)]
qemu: Add support for postcopy-recover-setup migration state

This patch adds support for recognizing the new migration state reported
by QEMU when post-copy recovery is requested. It is not actually used
for anything yet.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agovsh: Allow vshReadlineInit() to be called multiple times
Michal Privoznik [Thu, 8 Aug 2024 12:21:20 +0000 (14:21 +0200)]
vsh: Allow vshReadlineInit() to be called multiple times

Thing about vshReadlineInit() is - it's called multiple times.
The first time from vshInit(), when @ctl was filled only
partially (most notably, before any argv parsing is done, hence
ctl->imode is set to false). The second time after argv parsing,
from virshInit() -> vshInitReload(). In here, ctl->imode might
have changed and thus vshReadlineInit() can't exit early - it
needs to set up stuff for interactive mode (history basically).

To allow vshReadlineInit() to be called again,
vshReadlineDeinit() must set @autoCompleteOpaque to NULL.

Fixes: cab1e71f0161fd24c5d6ff4c379d3a242ea8c2d9
Resolves: https://issues.redhat.com/browse/RHEL-53560
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
8 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Wed, 7 Aug 2024 19:15:24 +0000 (19:15 +0000)]
Translated using Weblate (Swedish)

Currently translated at 83.9% (8819 of 10508 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 [Tue, 6 Aug 2024 08:29:08 +0000 (08:29 +0000)]
Translated using Weblate (Swedish)

Currently translated at 83.7% (8799 of 10508 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 agonetwork: fix crashing "modify" option for hostname
Adam Julis [Tue, 6 Aug 2024 07:01:42 +0000 (09:01 +0200)]
network: fix crashing "modify" option for hostname

The original condition caused (after adding modify option)
possibly access to not allocated memory. For consistency added
new check for multiple same records.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/654
Signed-off-by: Adam Julis <ajulis@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agonetwork: NULL check for "modify" DNS-txt records
Adam Julis [Tue, 6 Aug 2024 07:01:24 +0000 (09:01 +0200)]
network: NULL check for "modify" DNS-txt records

The "modify" command allowed to replace an existing record, now
checks for the NULL string in the new value and throw error if
found.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/655
Signed-off-by: Adam Julis <ajulis@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
8 months agoapparmor: Allow more paths for qemu-bridge-helper
Andrea Bolognani [Mon, 5 Aug 2024 14:21:31 +0000 (16:21 +0200)]
apparmor: Allow more paths for qemu-bridge-helper

The QEMU package in Debian has recently moved the
qemu-bridge-helper binary under /usr/libexec/qemu. Update the
AppArmor profile accordingly.

https://bugs.debian.org/1077915

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
8 months agoAllow unmounting some things libvirt mounted
Danny Sauer [Mon, 8 Jul 2024 04:30:25 +0000 (04:30 +0000)]
Allow unmounting some things libvirt mounted

Signed-off-by: Danny Sauer <github@dannysauer.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
9 months agoqemuxmlconftest: Add tests for the ACPI stripping hack on s390
Peter Krempa [Wed, 31 Jul 2024 10:38:23 +0000 (12:38 +0200)]
qemuxmlconftest: Add tests for the ACPI stripping hack on s390

Replace the 'misc-acpi' case by testing a bunch of architectures for how
ACPI is handled including a test for the s390 ACPI strip hack added in
previous commit.

The input files are adapted from the corresponding '-minimal.xml' files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
9 months agoqemu_domain: Strip <acpi/> from s390(x) definitions
Peter Krempa [Wed, 31 Jul 2024 09:34:59 +0000 (11:34 +0200)]
qemu_domain: Strip <acpi/> from s390(x) definitions

The s390(x) machines never supported ACPI. That didn't stop users
enabling ACPI in their config. As of libvirt-9.2 (98c4e3d073) with new
enough qemu we reject configs which require ACPI, but qemu can't satisfy
it.

This breaks migration of existing VMs with the old wrong configs to new
libvirt installations.

To address this introduce a post-parse fixup removing the ACPI flag
specifically for s390 machines which do enable it in the definition.

The advantage of doing it in post-parse, rather than simply relaxing the
ABI stability check to allow users providing an fixed XML when migrating
(allowing change of the ACPI flag for s390 in ABI stability check, as it
 doesn't impact ABI), is that only the destination installation needs to
be patched in order to preserve migration.

To mitigate the disadvantage of simply stripping it from all s390(x)
configs the hack is not applied when defining or starting a new domain
from the XML, to preserve the error about unsupported configuration.

Resolves: https://issues.redhat.com/browse/RHEL-49516
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
9 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Mon, 5 Aug 2024 16:14:37 +0000 (16:14 +0000)]
Translated using Weblate (Swedish)

Currently translated at 83.5% (8779 of 10508 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
9 months agoPost-release version bump to 10.7.0
Jiri Denemark [Mon, 5 Aug 2024 11:16:50 +0000 (13:16 +0200)]
Post-release version bump to 10.7.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 months agoRelease of libvirt-10.6.0
Jiri Denemark [Mon, 5 Aug 2024 11:07:41 +0000 (13:07 +0200)]
Release of libvirt-10.6.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Sun, 4 Aug 2024 08:11:02 +0000 (08:11 +0000)]
Translated using Weblate (Swedish)

Currently translated at 83.3% (8759 of 10508 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
9 months agoRevert "network: allow "modify" option for DNS-Srv records"
Adam Julis [Mon, 5 Aug 2024 08:50:43 +0000 (10:50 +0200)]
Revert "network: allow "modify" option for DNS-Srv records"

This reverts commit cf934c87cca32149675020ea595712aad25978e6.

The matching logic is flawed and it would complicate support of
this command.

Signed-off-by: Adam Julis <ajulis@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
9 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Sat, 3 Aug 2024 10:00:07 +0000 (10:00 +0000)]
Translated using Weblate (Swedish)

Currently translated at 83.1% (8739 of 10508 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
9 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Wed, 31 Jul 2024 20:08:52 +0000 (20:08 +0000)]
Translated using Weblate (Swedish)

Currently translated at 82.7% (8699 of 10508 strings)

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

Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
9 months agosecurity: Allow RW access to pstore device
Michal Privoznik [Tue, 30 Jul 2024 15:36:40 +0000 (17:36 +0200)]
security: Allow RW access to pstore device

The whole point of pstore device is that the guest writes crash
dumps into it. But the way SELinux label is set on the
corresponding file warrants RO access only. This is due to a
copy-paste from code around: kernel/initrd/DTB/SLIC - these are
RO indeed, but pstore MUST be writable too. In a sense it's
closer to NVRAM/disks - hence set imagelabel on it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
9 months agoqemu: Pre-create pstore device file
Michal Privoznik [Tue, 30 Jul 2024 15:36:39 +0000 (17:36 +0200)]
qemu: Pre-create pstore device file

So far we are relying on QEMU or sysadmin to create the file for
pstore. This is suboptimal as in the case of the former we can
not set proper seclabels (there's nothing to set seclabels on
until QEMU is started).

Therefore, make sure the file is created before launching QEMU
and that it has the correct size.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
9 months agoTranslated using Weblate (Korean)
김인수 [Tue, 30 Jul 2024 10:38:54 +0000 (12:38 +0200)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10508 of 10508 strings)

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

Co-authored-by: 김인수 <simmon@nplob.com>
Signed-off-by: 김인수 <simmon@nplob.com>
9 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Tue, 30 Jul 2024 10:38:48 +0000 (12:38 +0200)]
Translated using Weblate (Swedish)

Currently translated at 82.3% (8663 of 10516 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>
9 months agoUpdate translation files
Weblate [Tue, 30 Jul 2024 10:38:52 +0000 (12:38 +0200)]
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/

Co-authored-by: Weblate <noreply@weblate.org>
Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
9 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Tue, 30 Jul 2024 10:38:48 +0000 (12:38 +0200)]
Translated using Weblate (Swedish)

Currently translated at 82.5% (8679 of 10508 strings)

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

Translated using Weblate (Swedish)

Currently translated at 82.3% (8663 of 10516 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>
9 months agoNEWS: Document features/improvements/bug fixes I've participated in
Michal Privoznik [Tue, 30 Jul 2024 04:43:34 +0000 (06:43 +0200)]
NEWS: Document features/improvements/bug fixes I've participated in

There are some features/improvements/bug fixes I've either
contributed or reviewed/merged. Document them for upcoming
release.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
9 months agoqemu: Autofill pstore path if missing
Michal Privoznik [Mon, 29 Jul 2024 07:43:35 +0000 (09:43 +0200)]
qemu: Autofill pstore path if missing

Introduced only a couple of commits ago (in
v10.5.0-84-g90e50e67c6) the pstore device acts as a nonvolatile
storage, where guest kernel can store information about crashes.
This device, however, expects a file in the host from which the
crash data is read. So far, we expected users to provide a path,
but we can autogenerate one if missing. Just put it next to
per-domain's NVRAM stores.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
9 months agopo: Refresh potfile for v10.6.0
Jiri Denemark [Mon, 29 Jul 2024 08:53:12 +0000 (10:53 +0200)]
po: Refresh potfile for v10.6.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Sat, 27 Jul 2024 10:38:46 +0000 (12:38 +0200)]
Translated using Weblate (Swedish)

Currently translated at 82.1% (8643 of 10516 strings)

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

Translated using Weblate (Swedish)

Currently translated at 81.8% (8603 of 10516 strings)

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

Translated using Weblate (Swedish)

Currently translated at 81.6% (8583 of 10516 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>
9 months agoTranslated using Weblate (English (United Kingdom))
Andi Chandler [Sat, 27 Jul 2024 10:38:45 +0000 (12:38 +0200)]
Translated using Weblate (English (United Kingdom))

Currently translated at 47.9% (5032 of 10497 strings)

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

Co-authored-by: Andi Chandler <andi@gowling.com>
Signed-off-by: Andi Chandler <andi@gowling.com>
9 months agovirsysinfo: Calculate OEM string index better
Michal Privoznik [Thu, 18 Jul 2024 13:09:22 +0000 (15:09 +0200)]
virsysinfo: Calculate OEM string index better

As can be seen in earlier commits, there can be two OEM strings
with the same index. But since our parser
(virSysinfoParseOEMStrings()) doesn't expect that, it increments
index in each run and thus skips over these strings.
Fortunately, we have the right index at hand - we're just
skipping over it in a loop. Just reconstruct the index back
inside the loop.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
9 months agovirsysinfo: Be more forgiving when decoding OEM strings
Michal Privoznik [Thu, 18 Jul 2024 07:39:05 +0000 (09:39 +0200)]
virsysinfo: Be more forgiving when decoding OEM strings

On some systems, there are two or even more 'OEM Strings'
sections in DMI table. Here's an example of dmidecode output on
such system:

  # dmidecode -q -t 11
  OEM Strings
          String 1: Default string

  OEM Strings
          String 1: ThunderX2 System
          String 2: cavium.com
          String 3: Comanche

Now, this poses a problem, because when one tries to obtain
individual strings, they get:

  # dmidecode -q --oem-string 1
  Default string
  ThunderX2 System

  # dmidecode -q --oem-string 2
  No OEM string number 2
  cavium.com

NB, the "No OEM string number 2" is printed onto stderr and
everything else onto stdout. Oh, and trying to get OEM strings
from just one section doesn't fly:

  # dmidecode -q -H 0x1d --oem-string 2
  Options --string, --type, --handle and --dump-bin are mutually exclusive

This means two things:

1) we have no way of distinguishing OEM strings at the same index
   but in different sections,

2) because of how virSysinfoDMIDecodeOEMString() is written, we
   fail in querying OEM string that exists in one section but not
   in the others (for instance string #2 from example above).

While there's not much we can do about 1), there is something
that can be done about 2) - refine the error condition and make
the function return an error iff there's nothing on stdout and
there's something on stderr.

Resolves: https://issues.redhat.com/browse/RHEL-45952
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
9 months agotests: Add HPE Apollo test case to sysinfotest
Michal Privoznik [Thu, 18 Jul 2024 06:22:27 +0000 (08:22 +0200)]
tests: Add HPE Apollo test case to sysinfotest

Introduce a test case for sysinfotest. The data was obtained by
running dmidecode as libvirt would run it:

   dmidecode -q -t 0,1,2,3,4,11,17

Now, the expected output fits almost perfectly, except for OEM
strings where the third string looks nothing like in the
dmidecode output. This is because of testDMIDecodeDryRun() which
overwrites the third OEM string (see v6.5.0-rc1~214 for more
info). But that's okay for now.

Speaking of OEM strings, it's worth noticing two 'OEM Strings'
sections in the dmidecode output. This is causing some troubles
and will be fixed in next commit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
9 months agovirsysinfo: Trim newline when decoding OEM strings
Michal Privoznik [Thu, 18 Jul 2024 13:13:30 +0000 (15:13 +0200)]
virsysinfo: Trim newline when decoding OEM strings

dmidecode always puts a newline character at the end of each
OEM string it prints. It's the dmi_oem_strings() function [1] that
iterates over strings and calls pr_attr() over each one which
puts "\n" at the end, unconditionally [2[.

Since it's not part of the string though, trim it.

1: https://git.savannah.nongnu.org/cgit/dmidecode.git/tree/dmidecode.c#n2431
2: https://git.savannah.nongnu.org/cgit/dmidecode.git/tree/dmioutput.c#n63

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
9 months agovircommand: Initialize dryRunStatus to portable EXIT_SUCCESS instead of 0
Michal Privoznik [Thu, 18 Jul 2024 07:37:55 +0000 (09:37 +0200)]
vircommand: Initialize dryRunStatus to portable EXIT_SUCCESS instead of 0

If dry run of a command was requested (virCommandSetDryRun())
then a specified callback is called instead of running actual
command. This is meant to be used in tests. To mimic running the
command as closely as possible the callback can also set exit
status of the command it's implementing. To save some lines
though, the exit status is initialized to 0 so that callback has
to set it only on failures. Now, 0 is not exactly portable value
- that's why stdlib.h has EXIT_SUCCESS (and EXIT_FAILURE) values.
Initialize the exit status (held in dryRunStatus) to EXIT_SUCCESS
then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
9 months agoNEWS: Document pstore device addition
Michal Privoznik [Mon, 10 Jun 2024 08:57:40 +0000 (10:57 +0200)]
NEWS: Document pstore device addition

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
9 months agosecurity: Set seclabels for pstore device
Michal Privoznik [Thu, 6 Jun 2024 07:29:30 +0000 (09:29 +0200)]
security: Set seclabels for pstore device

The acpi-erst backend for pstore device exposes a path in the
host accessible to the guest and as such we must set seclabels on
it to grant QEMU RW access.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
9 months agoqemu: Build cmd line for pstore device
Michal Privoznik [Wed, 5 Jun 2024 12:42:23 +0000 (14:42 +0200)]
qemu: Build cmd line for pstore device

Nothing special going on here.

Resolves: https://issues.redhat.com/browse/RHEL-24746
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
9 months agoconf: Introduce pstore device
Michal Privoznik [Tue, 4 Jun 2024 15:45:48 +0000 (17:45 +0200)]
conf: Introduce pstore device

The aim of pstore device is to provide a bit of NVRAM storage for
guest kernel to record oops/panic logs just before the it
crashes. Typical usage includes usage in combination with a
watchdog so that the logs can be inspected after the watchdog
rebooted the machine. While Linux kernel (and possibly Windows
too) support many backends, in QEMU there's just 'acpi-erst'
device so stick with that for now. The device must be attached to
a PCI bus and needs two additional values (well, corresponding
memory-backend-file needs them): size and path. Despite using
memory-backend-file this does NOT add any additional RAM to the
guest and thus I've decided to expose it as another device type
instead of memory model.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
9 months agoqemu_capabilities: Introduce QEMU_CAPS_DEVICE_ACPI_ERST
Michal Privoznik [Tue, 4 Jun 2024 14:02:03 +0000 (16:02 +0200)]
qemu_capabilities: Introduce QEMU_CAPS_DEVICE_ACPI_ERST

This capability tracks whether QEMU has acpi-erst device.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
9 months agoqemu: virtiofs: cache: use 'never' instead of 'none'
Ján Tomko [Tue, 23 Jul 2024 12:14:13 +0000 (14:14 +0200)]
qemu: virtiofs: cache: use 'never' instead of 'none'

The new option style renamed one of the cache modes.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
9 months agoqemu: add a monitor to /proc/$pid when killing times out
Boris Fiuczynski [Fri, 19 Jul 2024 15:44:18 +0000 (17:44 +0200)]
qemu: add a monitor to /proc/$pid when killing times out

In cases when a QEMU process takes longer than the time sigterm and
sigkill are issued to kill the process do not simply fail and leave the
VM in state VIR_DOMAIN_SHUTDOWN until the daemon stops. Instead set up
an fd on /proc/$pid and get notified when the QEMU process finally has
terminated to cleanup the VM state.

Resolves: https://issues.redhat.com/browse/RHEL-28819
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
9 months agoqemu_hotplug: Do not allow absent values in rom settings
Kristina Hanicova [Wed, 24 Jul 2024 11:02:15 +0000 (13:02 +0200)]
qemu_hotplug: Do not allow absent values in rom settings

If there are absent values in an already existing element
specifying rom settings, we simply use the old ones. This
behaviour is not desired, as users might think that deleting the
element from XML would delete the setting (because the hotplug
succeeds) - which does not happen. Because of that, we should not
accept an interface without elements that cannot be changed.

Therefore, we should not allow absent values for already existing
rom setting during hotplug.

Resolves: https://issues.redhat.com/browse/RHEL-7109
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
9 months agovirtiofs: rename member to 'openfiles' for clarity
Adam Julis [Tue, 23 Jul 2024 12:47:58 +0000 (14:47 +0200)]
virtiofs: rename member to 'openfiles' for clarity

New element 'openfiles' had confusing name. Since the patch with
this new element wasn't propagate yet, old name ('rlimit_nofile')
was changed.

...
<binary>
  <openfiles max='122333'/>
</binary>
...

Signed-off-by: Adam Julis <ajulis@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
9 months agomeson: correct git detection
John Levon [Wed, 24 Jul 2024 08:56:04 +0000 (09:56 +0100)]
meson: correct git detection

The current "building from git" test uses "test -d .git"; however, that
doesn't work when libvirt is used as a submodule, as in that case .git
is a normal file. Use "test -e .git" instead.

Signed-off-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
9 months agovirt-host-validate: Allow longer list of CPU flags
Michal Privoznik [Tue, 23 Jul 2024 08:31:27 +0000 (10:31 +0200)]
virt-host-validate: Allow longer list of CPU flags

On various occasions, virt-host-validate parses /proc/cpuinfo to
learn about CPU flags (see virHostValidateGetCPUFlags()). It does
so, by reading the file line by line until the line with CPU
flags is reached. Then the line is split into individual flags
(using space as a delimiter) and the list of flags is then
iterated over.

This works, except for cases when the line with CPU flags is too
long. Problem is - the line is capped at 1024 bytes and on newer
CPUs (and newer kernels), the line can be significantly longer.
I've seen a line that's ~1200 characters long (with 164 flags
reported).

Switch to unbounded read from the file (getline()).

Resolves: https://issues.redhat.com/browse/RHEL-39969
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
9 months agoTranslated using Weblate (Portuguese (Brazil))
Gildasio Junior [Sun, 21 Jul 2024 17:38:48 +0000 (19:38 +0200)]
Translated using Weblate (Portuguese (Brazil))

Currently translated at 46.4% (4875 of 10497 strings)

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

Co-authored-by: Gildasio Junior <gildasiojunior@riseup.net>
Signed-off-by: Gildasio Junior <gildasiojunior@riseup.net>
9 months agoTranslated using Weblate (Swedish)
Göran Uddeborg [Sun, 21 Jul 2024 17:38:48 +0000 (19:38 +0200)]
Translated using Weblate (Swedish)

Currently translated at 81.4% (8563 of 10516 strings)

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

Translated using Weblate (Swedish)

Currently translated at 81.2% (8542 of 10516 strings)

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

Translated using Weblate (Swedish)

Currently translated at 80.8% (8502 of 10516 strings)

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

Translated using Weblate (Swedish)

Currently translated at 80.6% (8482 of 10516 strings)

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

Translated using Weblate (Swedish)

Currently translated at 80.4% (8462 of 10516 strings)

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

Translated using Weblate (Swedish)

Currently translated at 80.2% (8442 of 10516 strings)

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

Translated using Weblate (Swedish)

Currently translated at 80.0% (8422 of 10516 strings)

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

Translated using Weblate (Swedish)

Currently translated at 79.8% (8402 of 10516 strings)

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

Translated using Weblate (Swedish)

Currently translated at 79.7% (8382 of 10516 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>
9 months agoTranslated using Weblate (English (United Kingdom))
Andi Chandler [Sun, 21 Jul 2024 17:38:47 +0000 (19:38 +0200)]
Translated using Weblate (English (United Kingdom))

Currently translated at 47.9% (5029 of 10497 strings)

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

Translated using Weblate (English (United Kingdom))

Currently translated at 47.8% (5023 of 10497 strings)

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

Translated using Weblate (English (United Kingdom))

Currently translated at 47.8% (5020 of 10497 strings)

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

Co-authored-by: Andi Chandler <andi@gowling.com>
Signed-off-by: Andi Chandler <andi@gowling.com>
9 months agodocs: use real examples for QEMU cli passthrough
Daniel P. Berrangé [Fri, 12 Jul 2024 15:17:44 +0000 (16:17 +0100)]
docs: use real examples for QEMU cli passthrough

User feedback has shown that the examples are not clear enough
to illustrate the cli passthrough concept in action.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
9 months agosecurity: AppArmor allow write when os loader readonly=no
Miroslav Los [Tue, 4 Jun 2024 11:10:59 +0000 (11:10 +0000)]
security: AppArmor allow write when os loader readonly=no

Since libvirt commit 3ef9b51b10e52886e8fe8d75e36d0714957616b7,
the pflash storage for the os loader file follows its read-only flag,
and qemu tries to open the file for writing if set so.

This patches virt-aa-helper to generate the VM's AppArmor rules
that allow this, using the same domain definition flag and default.

Signed-off-by: Miroslav Los <mirlos@cisco.com>
Tested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
9 months agotests: Add test for UEFI autoselection on riscv64
Andrea Bolognani [Fri, 5 Jul 2024 16:16:39 +0000 (18:16 +0200)]
tests: Add test for UEFI autoselection on riscv64

This scenario is going to be ever more popular, especially now
that virt-manager has started using UEFI by default on riscv64
(see https://github.com/virt-manager/virt-manager/pull/670/).

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9 months agotests: Add firmware descriptor for edk2 on riscv64
Andrea Bolognani [Fri, 5 Jul 2024 16:02:02 +0000 (18:02 +0200)]
tests: Add firmware descriptor for edk2 on riscv64

It's available as part of the edk2-riscv64 Fedora package.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9 months agoqemu: ROM firmware images are always readonly
Andrea Bolognani [Mon, 8 Jul 2024 12:19:43 +0000 (14:19 +0200)]
qemu: ROM firmware images are always readonly

By definition. Accordingly, filter them out when looking for
a read/write image.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9 months agoqemu: Filter firmware images by type
Andrea Bolognani [Fri, 5 Jul 2024 15:30:27 +0000 (17:30 +0200)]
qemu: Filter firmware images by type

If the configuration explicitly requests a specific type of
firmware image, be it pflash or ROM, we should ignore all images
that are not of that type.

If no specific type has been requested, of course, any type is
considered a match and the selection will be based upon the
other attributes.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9 months agotests: Add more firmware selection coverage
Andrea Bolognani [Fri, 5 Jul 2024 14:50:02 +0000 (16:50 +0200)]
tests: Add more firmware selection coverage

This new test case covers the scenario in which the user
specifically asked for a read/write pflash image.

From the output files, we can see that the firmware selection
algorithm has picked a ROM image, which demonstrates the
presence of another bug. We're going to fix it with an upcoming
commit.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9 months agotests: Update firmware descriptors
Andrea Bolognani [Fri, 5 Jul 2024 14:19:07 +0000 (16:19 +0200)]
tests: Update firmware descriptors

Sync with the edk2-20240524-4.fc39 package from Fedora.

The only notable change is that the inteltdx variant now declares
support for Secure Boot and is a ROM image instead of a stateless
pflash one.

The latter causes it to be considered eligible for the
configuration described by the firmware-auto-efi-rw test cases,
which now passes instead of failing.

Of course that doesn't make any sense, because a ROM image by
definition cannot be read/write. So this indicates the presence
of a bug in our firmware selection algorithm, which we're going
to address with an upcoming commit.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>