]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
5 months agoRelease of libvirt-11.1.0 v11.1.0
Jiri Denemark [Mon, 3 Mar 2025 12:12:30 +0000 (13:12 +0100)] 
Release of libvirt-11.1.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
5 months agoTranslated using Weblate (Korean)
김인수 [Sat, 1 Mar 2025 03:12:33 +0000 (03:12 +0000)] 
Translated using Weblate (Korean)

Currently translated at 99.4% (10783 of 10838 strings)

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

Signed-off-by: 김인수 <simmon@nplob.com>
5 months agoNEWS: Document crasher fix in qemuDomainCheckCPU
Jiri Denemark [Thu, 27 Feb 2025 15:09:45 +0000 (16:09 +0100)] 
NEWS: Document crasher fix in qemuDomainCheckCPU

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoNEWS: Document features/improvements/bug fixes I've participated in
Michal Privoznik [Thu, 27 Feb 2025 14:14:54 +0000 (15:14 +0100)] 
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: Martin Kletzander <mkletzan@redhat.com>
5 months agoTranslated using Weblate (Ukrainian) v11.1.0-rc2
Yuri Chornoivan [Tue, 25 Feb 2025 14:49:16 +0000 (15:49 +0100)] 
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10838 of 10838 strings)

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

Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
Translated using Weblate (Ukrainian)

Currently translated at 99.4% (10774 of 10838 strings)

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

Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
5 months agoTranslated using Weblate (Korean)
김인수 [Tue, 25 Feb 2025 14:49:15 +0000 (15:49 +0100)] 
Translated using Weblate (Korean)

Currently translated at 99.4% (10781 of 10838 strings)

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

Signed-off-by: 김인수 <simmon@nplob.com>
5 months agodocs: formatdomain: fix typo in passt section
Ján Tomko [Wed, 26 Feb 2025 09:45:20 +0000 (10:45 +0100)] 
docs: formatdomain: fix typo in passt section

A mismatch in backticks happened.

Fixes: a47a89a9d335c111a9c2fbb3f4e1c3a13001e74b
Reported-by: Yalan Zhang <yalzhang@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemucapabilitiestest: Update 'caps_10.0.0_x86_64' to 'v9.2.0-1967-gb69801dd6b'
Peter Krempa [Mon, 24 Feb 2025 15:52:20 +0000 (16:52 +0100)] 
qemucapabilitiestest: Update 'caps_10.0.0_x86_64' to 'v9.2.0-1967-gb69801dd6b'

Notable changes:
 - 'NETDEV_VHOST_USER_CONNECTED'/'NETDEV_VHOST_USER_DISCONNECTED' events
   added
 - 'handshake-max-seconds' argument for 'nbd-server-start' added

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
5 months agoapparmor: Allow SGX if configured
Michal Privoznik [Tue, 25 Feb 2025 10:01:04 +0000 (11:01 +0100)] 
apparmor: Allow SGX if configured

If SGX memory model is configured for domain then we need to
allow QEMU access some additional files:

  1) /dev/sgx_vepc needs to be RW
  2) /dev/sgx_provision needs to be RO

We already do this in SELinux driver but not in AppArmor.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/751

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agocpu: Do not call g_strv_contains on NULL list
Jiri Denemark [Mon, 24 Feb 2025 10:24:27 +0000 (11:24 +0100)] 
cpu: Do not call g_strv_contains on NULL list

When virCPUx86UpdateLive checks whether a feature was added to a CPU
model after the model was already released (vmx-* features in most Intel
models), the following assert could be logged by glib:

    g_strv_contains: assertion 'strv != NULL' failed

While most of our CPU models have a non-empty list of added feature, new
models added in 2024 and versioned variants of older models have
addedFeatures == NULL.

Fixes: e622970c8785ec1f7e142d72f792d89f870e07d0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agorun: Use correct SELinux context for modular daemons
Jiri Denemark [Mon, 24 Feb 2025 11:15:39 +0000 (12:15 +0100)] 
run: Use correct SELinux context for modular daemons

Only libvirtd uses virtd_t/virt_exec_t context, modular daemons use
their specific context each.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agoUpdate translation files
Weblate [Mon, 24 Feb 2025 11:52:22 +0000 (12:52 +0100)] 
Update translation files

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

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

Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
5 months agopo: Refresh potfile for v11.1.0 v11.1.0-rc1
Jiri Denemark [Mon, 24 Feb 2025 11:54:04 +0000 (12:54 +0100)] 
po: Refresh potfile for v11.1.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
5 months agobuild: Enable syntax checks for vshError and vshWarn
Jiri Denemark [Thu, 20 Feb 2025 13:02:33 +0000 (14:02 +0100)] 
build: Enable syntax checks for vshError and vshWarn

To make sure both error and warning messages printed by virsh are
properly marked for translation.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agovirsh: Let prohibit_newline_at_end_of_diagnostic check pass
Jiri Denemark [Thu, 20 Feb 2025 13:41:32 +0000 (14:41 +0100)] 
virsh: Let prohibit_newline_at_end_of_diagnostic check pass

The prohibit_newline_at_end_of_diagnostic syntax check is confused when
another unrelated translatable message with a newline is too close to
the function it is supposed to check. Refactoring the code to make the
two strings further apart seems like the easiest solution.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agovirsh: Drop extra newlines at the end of error messages
Jiri Denemark [Thu, 20 Feb 2025 13:28:22 +0000 (14:28 +0100)] 
virsh: Drop extra newlines at the end of error messages

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agovirsh: Avoid using translated messages without format
Jiri Denemark [Thu, 20 Feb 2025 13:23:33 +0000 (14:23 +0100)] 
virsh: Avoid using translated messages without format

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agovirsh: Properly mark all error messages for translation
Jiri Denemark [Thu, 20 Feb 2025 13:03:48 +0000 (14:03 +0100)] 
virsh: Properly mark all error messages for translation

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agovirsh: Do not require \n in vshDebug messages
Jiri Denemark [Thu, 20 Feb 2025 13:04:08 +0000 (14:04 +0100)] 
virsh: Do not require \n in vshDebug messages

Having to put a newline at the end of each debug message in virsh has
always felt strange.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agovirsh: Warn when hypervisor-cpu-* is used with host CPU
Jiri Denemark [Thu, 20 Feb 2025 12:30:36 +0000 (13:30 +0100)] 
virsh: Warn when hypervisor-cpu-* is used with host CPU

While using host CPU definition from capabilities XML is allowed for
historical reasons, it will likely provide incorrect results and should
be avoided.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agovirsh: Introduce vshWarn
Jiri Denemark [Thu, 20 Feb 2025 12:17:47 +0000 (13:17 +0100)] 
virsh: Introduce vshWarn

This new function can be used for printing warnings about suboptimal
usage.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agovirsh: Refactor vshError
Jiri Denemark [Thu, 20 Feb 2025 12:12:22 +0000 (13:12 +0100)] 
virsh: Refactor vshError

The code is moved into a newly introduced generic vshPrintStderr and
vshError changed into a tiny wrapper.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agovirsh: Make messages printed by vshError properly translatable
Jiri Denemark [Thu, 20 Feb 2025 12:06:38 +0000 (13:06 +0100)] 
virsh: Make messages printed by vshError properly translatable

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agovirsh: Do not format messages twice
Jiri Denemark [Thu, 20 Feb 2025 11:49:43 +0000 (12:49 +0100)] 
virsh: Do not format messages twice

The same message was formatted both in vshOutputLogFile and in vshDebug
and vshError functions. This patch refactor vshOutputLogFile and its
callers to only format each message once.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agodocs: Clarify documentation of virsh hypervisor-cpu-baseline
Jiri Denemark [Wed, 19 Feb 2025 15:16:58 +0000 (16:16 +0100)] 
docs: Clarify documentation of virsh hypervisor-cpu-baseline

Using host CPU definition with hypervisor-cpu-baseline is possible, but
it provide incorrect results and thus it should not be documented the
same way we describe the correct usage. Also using host-model CPU from
domain capabilities was not described clearly enough.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agodocs: Clarify documentation of virsh hypervisor-cpu-compare
Jiri Denemark [Wed, 19 Feb 2025 13:42:04 +0000 (14:42 +0100)] 
docs: Clarify documentation of virsh hypervisor-cpu-compare

Using host CPU definition with hypervisor-cpu-compare is possible, but
it provide incorrect results and thus it should not be documented the
same way we describe the correct usage. Also using host-model CPU from
domain capabilities was not described clearly enough.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agoTranslated using Weblate (Chinese (Simplified) (zh_CN))
jianqing yan [Thu, 20 Feb 2025 14:49:27 +0000 (15:49 +0100)] 
Translated using Weblate (Chinese (Simplified) (zh_CN))

Currently translated at 93.6% (10094 of 10781 strings)

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

Signed-off-by: jianqing yan <yanjianqing@kylinos.cn>
5 months agoTranslated using Weblate (Telugu)
Anonymous [Thu, 20 Feb 2025 14:49:26 +0000 (15:49 +0100)] 
Translated using Weblate (Telugu)

Currently translated at 43.9% (4742 of 10781 strings)

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

Signed-off-by: Anonymous <noreply@weblate.org>
Translated using Weblate (Dutch)

Currently translated at 19.4% (2099 of 10781 strings)

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

Signed-off-by: Anonymous <noreply@weblate.org>
Translated using Weblate (Kannada)

Currently translated at 44.2% (4768 of 10781 strings)

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

Signed-off-by: Anonymous <noreply@weblate.org>
Translated using Weblate (Hindi)

Currently translated at 27.2% (2940 of 10781 strings)

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

Signed-off-by: Anonymous <noreply@weblate.org>
Translated using Weblate (French)

Currently translated at 93.5% (10086 of 10781 strings)

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

Signed-off-by: Anonymous <noreply@weblate.org>
Translated using Weblate (German)

Currently translated at 44.7% (4829 of 10781 strings)

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

Signed-off-by: Anonymous <noreply@weblate.org>
5 months agoschema: fix <interleave> errors when validating <domain> subelements
Laine Stump [Fri, 21 Feb 2025 01:13:06 +0000 (20:13 -0500)] 
schema: fix <interleave> errors when validating <domain> subelements

I first noticed a problem when I added a <memoryBacking> element at an
unusual (but still correct) place in the domain XML, and validation
failed. Then I tried adding that element in several different places
and it failed in many, but not all of them.

(NB: from here on, I will use '' for the names of attributes in the
domain XML, <> for elements in the domain XML, and "" for the names of
grammar rule definitions in the RNG file, and "<>" for the names of
elements in the RNG file's own XML. Confused yet? If so, please tell
me a better way - everything I know about RNG I've picked up
informally by looking at examples in already existing RNG files)

Starting from the top level of the grammar for <domain>
("domaincontents" in domaincommon.rng), I noticed that

1) the "<attribute>" for the 'id' attribute of <domain> is defined
   inside an "<interleave>" down in the definition of "ids" (which is
   referenced from "domaincontents") (I'm not familiar with the
   nomenclature - does that make it a "sub-grammer", "child-grammar",
   ???)

2) although the definition of "ids", had all of its
   "<attribute>"s/"<element>"s inside an "<interleave>",
   "domaincontents" already had the reference to "ids" inside an
   "<interleave>", so there were nested "<interleave>"s.

It's not clear to me how an "<attribute>" or "<interleave>" inside
another "<interleave>" is supposed to behave, but they both seemed a
bit suspicious.

I tried all of the below modifications:

1) moving the grammar for the 'id' attribute out of the "<interleave>"
   but still inside "ids"

2) moving the grammer for the 'id' attribute directly into
   "domaincontents" (and outside of its "interleave"

3) removing the "<interleave>" that was inside "ids"

4) (2) + (3)

5) move the entire grammar rule "ids" up directly in place of <ref
   name="ids"> in "domaincontents".

6) (5), but with the grammar for the 'id' attribute moved outside of
   the "<interleave>"

(6) was the only change that allowed all of the following (using
modifications to the subelements of <domain> in
net-vhostuser-passt.xml as example):

a) a <memoryBacking> element in between *any* two existing elements

b) moving <name> in between any two elements

c) oddly, in addition to the problem with putting <memoryBacking> in
   odd places, I also found that the original RNG did not allow the
   <clock> element to be placed in between <on_poweroff> and
   <on_reboot>, but once I'd made the change in (6), this was no
   longer problematic. Why should this have any effect? No idea, but
   it works :-/

(NB: there are many other cases of referencing "sub-grammar" from
inside an "<interleave>", and they all seem to work just fine;
possibly in this case it was problematic because the sub-grammar a)
also contained an "<interleave>", b) had an "<attribute>" at its
toplevel, or c) had multiple "<element>"s.)

(inexplicably (to me) at one point during my experimentation, I tried
reordering the references to "clock", "resources", "features", and
"events", and that *also* made it legal to put a <clock> element in
between the <on_*> elements:-O)

Since I was no longer able to reproduce the error described in (c)
once I had made mod (6) (move all of "ids" directly into
"domaincontent", I decided it was pointless for me to spend any more
time randomly poking and just add that to the new test case for that
in case some other random change to the RNG causes it to start failing
again.

(I thought of writing a test program that would try all possible
orderings of the subelements of <domain>, but since doing that for
even 10 subelements would mean testing > 3.2 million different XML
documents, I decided we could continue in this adhoc manner, just
adding a single new test case if/when a new validation failure is
found.)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agotests: be consistent about following DO_TEST_*() with a ;
Laine Stump [Fri, 21 Feb 2025 04:24:05 +0000 (23:24 -0500)] 
tests: be consistent about following DO_TEST_*() with a ;

As is often the case with macros (especially those that resolve to
multiple statements), it isn't technically necessary to end any of the
invocations of the DO_TEST_*() macros with a semicolon (as evidenced
by the lines changed in this path). Having does make some
auto-indenters (e.g. cc-mode in emacs) more likely to do the right
thing, though, and it also looks nicer if all the lines are similar.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 months agoconf: Validate that iothreads are used only with 'virtio-scsi' controllers
Peter Krempa [Fri, 14 Feb 2025 15:30:58 +0000 (16:30 +0100)] 
conf: Validate that iothreads are used only with 'virtio-scsi' controllers

The documentation states:

 ``iothread``
    Supported for controller type ``scsi`` using model ``virtio-scsi`` for
    ``address`` types ``pci`` and ``ccw`` :since:`since 1.3.5 (QEMU 2.4)`. The

The code itself didn't validate if iothread is specified for any other
controller type.

Add test case showing the issue on one example.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoconf: schemas: Rename 'diskDriverIothreads' to 'iothreadMapping'
Peter Krempa [Fri, 14 Feb 2025 13:07:43 +0000 (14:07 +0100)] 
conf: schemas: Rename 'diskDriverIothreads' to 'iothreadMapping'

The schema definition will be reused when adding iothread<->virtqueue
mapping for 'virtio-scsi'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemuValidateCheckSCSIControllerIOThreads: Return '0' and '-1' instead of bools
Peter Krempa [Fri, 14 Feb 2025 14:23:54 +0000 (15:23 +0100)] 
qemuValidateCheckSCSIControllerIOThreads: Return '0' and '-1' instead of bools

The function reports libvirt errors so stick with the usual '0' and '-1'
return values.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemu: validate: Extract iothread mapping validation code
Peter Krempa [Fri, 14 Feb 2025 12:31:25 +0000 (13:31 +0100)] 
qemu: validate: Extract iothread mapping validation code

Extract the code to 'qemuDomainValidateIothreadMapping'. It will be
reused to validate the mapping for 'virtio-scsi' iothreads.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemu: command: Rename 'qemuBuildDiskDeviceIothreadMappingProps' to 'qemuBuildIothread...
Peter Krempa [Fri, 14 Feb 2025 11:38:49 +0000 (12:38 +0100)] 
qemu: command: Rename 'qemuBuildDiskDeviceIothreadMappingProps' to 'qemuBuildIothreadMappingProps'

Prepare for reuse of the code for 'virtio-scsi' controller.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agohypervisor: domain: Extract code for checking iothread usage
Peter Krempa [Fri, 14 Feb 2025 11:13:02 +0000 (12:13 +0100)] 
hypervisor: domain: Extract code for checking iothread usage

The code will be also needed for 'virtio-scsi' controller definitions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoconf: domain: Extract code for parsing and formatting iothread mapping definition
Peter Krempa [Fri, 14 Feb 2025 11:13:02 +0000 (12:13 +0100)] 
conf: domain: Extract code for parsing and formatting iothread mapping definition

The code will be also needed for 'virtio-scsi' controller definitions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoconf: Rename 'virDomainDiskIothreadDef' to 'virDomainIothreadMappingDef'
Peter Krempa [Tue, 11 Feb 2025 16:59:57 +0000 (17:59 +0100)] 
conf: Rename 'virDomainDiskIothreadDef' to 'virDomainIothreadMappingDef'

The iothread mapping will be also possible for 'virtio-scsi' controllers
so rename the corresponding structs to a generic name.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agodocs: formatdomain: Mention that vhostuser interface with mode='server' waits for...
Peter Krempa [Mon, 17 Feb 2025 15:11:23 +0000 (16:11 +0100)] 
docs: formatdomain: Mention that vhostuser interface with mode='server' waits for connection

When starting a VM with a vhost-user interface in server mode qemu will
wait for the incoming connection without running CPUs. This isn't really
documented in our XML. Additionally when hotplugging the same interface
the above will not happen.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agodocs: formatdomain: Document few NVRAM config limitations
Peter Krempa [Mon, 17 Feb 2025 14:56:08 +0000 (15:56 +0100)] 
docs: formatdomain: Document few NVRAM config limitations

Note that 'block' backed NVRAM may need to use 'qcow2' images to work
properly and that populating from template may not support format
conversion.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemuDomainGetStats: Convert worker functions to void
Peter Krempa [Mon, 17 Feb 2025 13:33:31 +0000 (14:33 +0100)] 
qemuDomainGetStats: Convert worker functions to void

The presence of a return value made it seem that it's expected to fail
on errors which is not the case. The function is designed to skip
anything it can't fill and not fail when fetching individual stats.

Convert the workers to void to make it clear that it's expected not
to fail.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemuDomainGetStatsDirtyRate: Don't error out
Peter Krempa [Mon, 17 Feb 2025 12:55:08 +0000 (13:55 +0100)] 
qemuDomainGetStatsDirtyRate: Don't error out

The bulk domain stats API is meant to collect as much data as possible
without erroring out.

If fetching of the dirty rate stats fails just skip outputting them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemuDomainGetStatsMemoryBandwidth: Don't error out
Peter Krempa [Mon, 17 Feb 2025 12:55:08 +0000 (13:55 +0100)] 
qemuDomainGetStatsMemoryBandwidth: Don't error out

The bulk domain stats API is meant to collect as much data as possible
without erroring out.

If fetching of the memory bandwidth stats fails just skip outputting them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemuDomainGetStatsIOThread: Don't error out if fetching iothread info fails
Peter Krempa [Mon, 17 Feb 2025 13:22:46 +0000 (14:22 +0100)] 
qemuDomainGetStatsIOThread: Don't error out if fetching iothread info fails

The bulk domain stats API is meant to collect as much data as possible
without erroring out. Ignore errors from 'qemuDomainGetIOThreadsMon()'
and skip the data if an error happens.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemuDomainGetStatsPerfOneEvent: Ignore erros from 'virPerfReadEvent'
Peter Krempa [Mon, 17 Feb 2025 13:19:54 +0000 (14:19 +0100)] 
qemuDomainGetStatsPerfOneEvent: Ignore erros from 'virPerfReadEvent'

The bulk domain stats API is meant to collect as much data as possible
without erroring out. Skip the perf stats if we can't fetch them instead
of erroring out.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agovirPerfReadEvent: Refactor to return -errno on failure
Peter Krempa [Mon, 17 Feb 2025 13:16:04 +0000 (14:16 +0100)] 
virPerfReadEvent: Refactor to return -errno on failure

The function didn't comply with libvirt's error reporting scheme as it
reported libvirt errors only sometimes. As callers may want to ignore
errors convert it to returning -errno on failure instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemuDomainGetStatsCpuCache: Don't error out
Peter Krempa [Mon, 17 Feb 2025 12:55:08 +0000 (13:55 +0100)] 
qemuDomainGetStatsCpuCache: Don't error out

The bulk domain stats API is meant to collect as much data as possible
without erroring out.

If fetching of the cache stats fails just skip outputting them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemuDomainGetStatsCpuHaltPollTime: Remove return value
Peter Krempa [Mon, 17 Feb 2025 12:51:10 +0000 (13:51 +0100)] 
qemuDomainGetStatsCpuHaltPollTime: Remove return value

The function can't fail. Remove return value and refactor callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemuDomainGetStatsCpuProc: Remove return value
Peter Krempa [Mon, 17 Feb 2025 12:51:10 +0000 (13:51 +0100)] 
qemuDomainGetStatsCpuProc: Remove return value

The function can't fail. Remove return value and refactor callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemuDomainGetStatsCpuCgroup: Remove return value
Peter Krempa [Mon, 17 Feb 2025 12:51:10 +0000 (13:51 +0100)] 
qemuDomainGetStatsCpuCgroup: Remove return value

The function can't fail. Remove return value and refactor callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agovirBitmapFormat: Don't check return value
Peter Krempa [Mon, 17 Feb 2025 12:43:16 +0000 (13:43 +0100)] 
virBitmapFormat: Don't check return value

'virBitmapFormat' always returns a string; remove pointless checks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agovirDomainCputuneDefFormat: Refactor bitmap formatting
Peter Krempa [Mon, 17 Feb 2025 12:09:41 +0000 (13:09 +0100)] 
virDomainCputuneDefFormat: Refactor bitmap formatting

Use g_autofree for the temporary variables, remove error checks for
virBitmapFormat and simplify formatting of multiple attributes.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agovirDomainResctrlMonDefParse: Refactor temporary variables
Peter Krempa [Mon, 17 Feb 2025 12:01:39 +0000 (13:01 +0100)] 
virDomainResctrlMonDefParse: Refactor temporary variables

Decrease scope of temporary variables so that they don't have to be
autofreed and VIR_FREE()d at the same time.

Remove unneeded checks and temporary variables.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agovirBitmapFormat: Clarify returned values
Peter Krempa [Mon, 17 Feb 2025 11:58:22 +0000 (12:58 +0100)] 
virBitmapFormat: Clarify returned values

NULL can't be returned; don't mention it in the docs.

Avoid extra cofusing variable when returning copy of empty string.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemuDomainGetStatsBlockExportHeader: Remove return value
Peter Krempa [Mon, 17 Feb 2025 10:19:11 +0000 (11:19 +0100)] 
qemuDomainGetStatsBlockExportHeader: Remove return value

The function always returns 0. Remove return value and fix callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemuDomainStorageAlias: Remove NULL checks from callers
Peter Krempa [Mon, 17 Feb 2025 10:38:13 +0000 (11:38 +0100)] 
qemuDomainStorageAlias: Remove NULL checks from callers

'qemuDomainStorageAlias' always returns non-NULL pointer if it gets a
non-NULL string on input. Remove unneeded checks from callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemuDomainGetStatsOneBlock: Remove return value
Peter Krempa [Mon, 17 Feb 2025 10:19:11 +0000 (11:19 +0100)] 
qemuDomainGetStatsOneBlock: Remove return value

The function always returns 0. Remove return value and fix callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemuDomainGetStatsOneBlockFallback: Remove return value
Peter Krempa [Mon, 17 Feb 2025 10:19:11 +0000 (11:19 +0100)] 
qemuDomainGetStatsOneBlockFallback: Remove return value

The function always returns 0. Remove return value and fix callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemuDomainGetStatsBlockExportBackendStorage: Remove return value
Peter Krempa [Mon, 17 Feb 2025 10:19:11 +0000 (11:19 +0100)] 
qemuDomainGetStatsBlockExportBackendStorage: Remove return value

The function always returns 0. Remove return value and fix callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemuDomainGetStatsBlockExportFrontend: Remove return value
Peter Krempa [Mon, 17 Feb 2025 10:19:11 +0000 (11:19 +0100)] 
qemuDomainGetStatsBlockExportFrontend: Remove return value

The function always returns 0. Remove return value and fix callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 months agoqemuDomainGetStatsBlockExportHeader: Remove return value
Peter Krempa [Mon, 17 Feb 2025 10:19:11 +0000 (11:19 +0100)] 
qemuDomainGetStatsBlockExportHeader: Remove return value

The function always returns 0. Remove return value and fix callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 months agobuild-aux: squelch trailing blank warnings from binary files
Daniel P. Berrangé [Mon, 17 Feb 2025 17:00:42 +0000 (17:00 +0000)] 
build-aux: squelch trailing blank warnings from binary files

These files pollute the stderr output when the sc_trailing_blank
syntax check fails.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 months agoqemu: Avoid crash in qemuDomainCheckCPU with unknown host CPU
Jiri Denemark [Tue, 18 Feb 2025 10:24:32 +0000 (11:24 +0100)] 
qemu: Avoid crash in qemuDomainCheckCPU with unknown host CPU

When we don't have any information about host CPU (for example when
running on an aarch64 host), the virQEMUCapsGetHostModel would return
NULL.

Fixes: f928eb5fc80ca0ed7277f2513b63aed36c09d275
Fixes: https://gitlab.com/libvirt/libvirt/-/issues/747
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Tested-by: Jaroslav Suchanek <jsuchane@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
6 months agoutil: fix compile warning in virsystemd.c during mingw builds
Laine Stump [Tue, 18 Feb 2025 04:00:58 +0000 (23:00 -0500)] 
util: fix compile warning in virsystemd.c during mingw builds

A function was changed from having no arguments to having a single
argument, but the entire body of the function was #ifdefed out for
windows builds, leaving that new argument unused. Surprisingly this
didn't cause the build to fail, but I happened to notice it flit by
during an rpm build.

Fixes: 785cd56e5803fbbf60715fb6c7536360df5b4b9e
Signed-off-by: Laine Stump <laine@redhat.com>
6 months agoutils: Canonicalize paths before comparing them
Andrea Bolognani [Thu, 13 Feb 2025 08:54:05 +0000 (09:54 +0100)] 
utils: Canonicalize paths before comparing them

In virFileIsSharedFSOverride() we compare a path against a list
of overrides looking for a match.

All overrides are canonicalized ahead of time though, so e.g.
/var/run/foo will be turned into /run/foo due to /var/run being
a symlink on modern Linux systems. But the path we're trying to
match with the overrides doesn't get the same treatment, so in
this scenario the comparison will always fail.

Canonicalizing the path as well solves the issue.

Resolves: https://issues.redhat.com/browse/RHEL-79165
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 months agodocs: index: fix VMware capitalization
Ján Tomko [Mon, 17 Feb 2025 14:07:56 +0000 (15:07 +0100)] 
docs: index: fix VMware capitalization

Reported-by: Mark Phillips
Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 months agonews: include info about supporting vhostuser+passt combination
Laine Stump [Sat, 15 Feb 2025 14:02:09 +0000 (09:02 -0500)] 
news: include info about supporting vhostuser+passt combination

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 months agodocs: document using passt backend with <interface type='vhostuser'>
Laine Stump [Sat, 15 Feb 2025 04:35:56 +0000 (23:35 -0500)] 
docs: document using passt backend with <interface type='vhostuser'>

Almost everything is already there (in the section for using passt
with type='user'), so we just need to point to that from the
type='vhostuser' section (and vice versa), and add a bit of glue.

Also updated a few related details that have changed (e.g. default
model type for vhostuser is now 'virtio', and source type/mode are now
optional), and changed "vhost-user interface" to "vhost-user
connection" because the interface is a virtio interface, and
vhost-user is being used to connect that interface to the outside.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 months agodocs: improve type='user' docs to higlight differences between SLIRP and passt
Laine Stump [Sat, 15 Feb 2025 03:43:03 +0000 (22:43 -0500)] 
docs: improve type='user' docs to higlight differences between SLIRP and passt

This reorganizes the section about <interface type='user'> and
describes the differences in behavior between SLIRP and passt.

Resolves: https://issues.redhat.com/browse/RHEL-46601
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 months agoqemu: fail validation if a domain def has vhostuser/passt but no shared mem
Laine Stump [Fri, 14 Feb 2025 18:10:19 +0000 (13:10 -0500)] 
qemu: fail validation if a domain def has vhostuser/passt but no shared mem

This can/should also be done for a traditional vhost-user interface
(ie not backend type='passt') but that will be a separate change.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 months agoqemu: complete vhostuser + passt support
Laine Stump [Wed, 12 Feb 2025 21:16:44 +0000 (16:16 -0500)] 
qemu: complete vhostuser + passt support

<interface type='vhostuser'><backend type='passt'/> needs to run the
passt command just as is done for interface type='user', but then add
vhostuser bits to the qemu commandline/monitor command.

There are some changes to the parsing/validation along with changes to
the vhostuser codepath do do the extra stuff for passt. I tried
keeping them separated into different patches, but then the unit test
failed in a strange way deep down in the bowels of the commandline
generation, so this patch both 1) makes the final changes to
parsing/formatting and 2) adds passt stuff at appropriate places for
vhostuser (as well as making a couple of things *not* happen when the
passt backend is chosen). The result is that you can now have:

    <interface type='vhostuser'>
      <backend type='passt'/>
      ...
    </interface>

Then as long as you also have the following as a subelement of
<domain>:

    <memoryBacking>
      <access mode='shared'/>
    </memoryBacking>

your passt interfaces will benefit from the greatly improved
efficiency of a vhost-user data path, and all without requiring
special privileges or capabilities *anywhere* (i.e. it works for
unprivileged libvirt (qemu:///session) as well as privileged libvirt).

Resolves: https://issues.redhat.com/browse/RHEL-69455
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 months agoqemu: make qemuPasstCreateSocketPath() public
Laine Stump [Wed, 12 Feb 2025 17:12:04 +0000 (12:12 -0500)] 
qemu: make qemuPasstCreateSocketPath() public

When passt is used with vhostuser, the vhostuser code that builds the
qemu commandline will need to have the same socket path that is given
to the passt command, so this patch makes it visible outside of
qemu_passt.c.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 months agoqemu: use switch instead of if in qemuProcessPrepareDomainNetwork()
Laine Stump [Tue, 11 Feb 2025 21:30:11 +0000 (16:30 -0500)] 
qemu: use switch instead of if in qemuProcessPrepareDomainNetwork()

qemuProcessPrepareDomain()'s comments say that it should be the only
place to change the "live XML" of a domain (i.e. the public parts of
the virDomainDef object that is shown in the domain's status
XML), and that seems like a reasonable idea (although there aren't
many users of it to date).

qemuProcessPrepareDomainNetwork() is called by the aforementioned
qemuProcessPrepareDomain() - this patch changes the "if (type ==
HOSTDEV)" in that function to a "switch(type)" so it's simpler to add
DomainDef modifications for various other types of virDomainNetDef,
and also so that anyone who adds a new interface type is forced to
look at the code and decide if anything needs to be done here for the
new type.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 months agoconf/qemu: make <source> element *almost* optional for type=vhostuser
Laine Stump [Mon, 10 Feb 2025 03:52:54 +0000 (22:52 -0500)] 
conf/qemu: make <source> element *almost* optional for type=vhostuser

For some reason, when vhostuser interface support was added in 2014,
the parser required that the XML for the <interface> have a <source>
element with type, mode, and path, all 3 also required. This in spite
of the fact that 'unix' is the only possible valid setting for type,
and 95% of the time the mode is set to 'client' (as I understand from
comments in the code, normally a guest will use mode='client' to
connect to an existing socket that is precreated (by OVS?), and the
only use for mode='server' is for test setups where one guest is setup
with a listening vhostuser socket (i.e. 'server') and another guest
connects to that socket (i.e. 'client')). (or maybe one guest connects
to OVS in server mode, and all the others connect in client mode, not
sure - I don't claim to be an expert on vhost-user.)

So from the point of view of existing vhost-user functionality, it
seems reasonable to make 'type' and 'mode' optional, and by default
fill in the vhostuser part of the NetDef as if they were 'unix' and
'client'.

In theory, the <source> element itself is also not *directly* required
after this patch, however, the path attribute of <source> *is*
required (for now), so effectively the <source> element is still
required.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 months agoqemu: do all vhostuser attribute validation in qemu driver
Laine Stump [Mon, 10 Feb 2025 00:01:32 +0000 (19:01 -0500)] 
qemu: do all vhostuser attribute validation in qemu driver

Since vhostuser is only used/supported by the QEMU driver, and all the
rest of the vhostuser-specific validation is done in QEMU's
validation, lets move the final check (to see if they've tried to
enable auto-reconnect when this interface is on the server side of the
vhostuser socket) to the QEMU validate.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 months agoqemu: automatically set model type='virtio' for interface type='vhostuser'
Laine Stump [Sun, 9 Feb 2025 23:23:03 +0000 (18:23 -0500)] 
qemu: automatically set model type='virtio' for interface type='vhostuser'

Both vdpa and vhostuser require that the guest device be virtio, and
for interface type='vdpa', we already set <model type='virtio'/> if it
is unspecified in the input XML, so let's be just as courteous for
interface type='vhostuser'.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 months agoqemu: validate that model is virtio for vhostuser and vdpa interfaces in the same...
Laine Stump [Sun, 9 Feb 2025 23:46:00 +0000 (18:46 -0500)] 
qemu: validate that model is virtio for vhostuser and vdpa interfaces in the same place

Both vhostuser and vdpa interface types must use the virtio model in
the guest (because part of the functionality is implemented in the
guest virtio driver). Due to ["because that's the way it happened"]
this has been validated for vhostuser in the hypervisor-agnostic
validate function, but for vdpa it has been done in the QEMU-specific
validate. Since these interface models are only supported by QEMU
anyway, validate for both of them in the QEMU validation function.

Take advantage of this change to switch to using
virDomainNetIsVirtioModel(net) instead of "net->model ==
VIR_DOMAIN_NET_MODEL_VIRTIO" (the former also matches
...VIRTIO_TRANSITIONAL and ...VIRTIO_NON_TRANSITIONAL, so is more
correct).

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 months agoqemu: fix qemu validation to forbid guest-side IP address for type='vdpa'
Laine Stump [Tue, 4 Feb 2025 21:06:18 +0000 (16:06 -0500)] 
qemu: fix qemu validation to forbid guest-side IP address for type='vdpa'

Because all the checks for VIR_DOMAIN_NET_TYPE_VDPA were inside an
else-if clause that was immediately followed by another else-if clause
that forbid setting guestIP.ips or guestIP.routes, we've been allowing
users to set guestIP.* for vdpa interfaces (but then not doing
validation of the attributes that should have been done if we *did*
support setting IPs for vdpa (but we don't anyway, so :shrug:.)

This can be fixed by turning the vdpa else-if clause into a top-level
if - this way vdpa interfaces will hit the "else if
(net->guestIP.nips)" clause and reject guest-side IP address setting.

Also, since there are currently *no* interface types for QEMU that
support adding guest-side routes, we put that check by itself (I think
it may be possible to set some guest routes for passt interfaces, but
we don't do that)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 months agoconf: change virDomainHostdevInsert() to return void
Laine Stump [Tue, 11 Feb 2025 21:44:49 +0000 (16:44 -0500)] 
conf: change virDomainHostdevInsert() to return void

We haven't checked for memalloc failure in many years, and that was
the only reason this function would have ever failed.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 months agoNEWS: Document ccwgroup based qeth device support
Boris Fiuczynski [Thu, 13 Feb 2025 14:09:30 +0000 (15:09 +0100)] 
NEWS: Document ccwgroup based qeth device support

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
6 months agoremote_daemon: Silence DBus errors
Michal Privoznik [Wed, 12 Feb 2025 11:25:42 +0000 (12:25 +0100)] 
remote_daemon: Silence DBus errors

When a daemon (like libvirtd, virtqemud, etc.) is started as an
unprivileged user (which is exactly how KubeVirt does it), then
it tries to register on both session and system DBus-es so that
it can shut itself down (e.g. when system is powering off or user
logs out). It's worth noting that this is just opportunistic and
if no DBus is available then no error is reported.

Or at least that's what we thought. Because the way our
virGDBusGetSessionBus() and virGDBusGetSystemBus() are written an
error is actually reported every time the daemon starts.

Use virGDBusHasSessionBus() and virGDBusHasSystemBus() to check
if corresponding bus is available.

Resolves: https://issues.redhat.com/browse/RHEL-79088
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 months agovirgdbus: Introduce virGDBusHasSessionBus()
Michal Privoznik [Wed, 12 Feb 2025 13:17:34 +0000 (14:17 +0100)] 
virgdbus: Introduce virGDBusHasSessionBus()

This is just like virGDBusHasSystemBus() except it checks for the
session bus instead of the system one.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 months agoTranslated using Weblate (English (United Kingdom))
Andi Chandler [Thu, 13 Feb 2025 08:08:45 +0000 (09:08 +0100)] 
Translated using Weblate (English (United Kingdom))

Currently translated at 48.7% (5257 of 10781 strings)

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

Signed-off-by: Andi Chandler <andi@gowling.com>
6 months agoqemu: add 'auto_start_delay' configuration parameter
Daniel P. Berrangé [Mon, 16 Dec 2024 19:49:33 +0000 (19:49 +0000)] 
qemu: add 'auto_start_delay' configuration parameter

This allows a user specified delay between autostart of each VM, giving
parity with the equivalent feature of libvirt-guests.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 months agohypervisor: add support for delay interval during autostart
Daniel P. Berrangé [Mon, 16 Dec 2024 19:45:23 +0000 (19:45 +0000)] 
hypervisor: add support for delay interval during autostart

This delay can reduce the CPU/IO load storm when autostarting many
guests.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 months agosrc: convert drivers over to use new autostart helper
Daniel P. Berrangé [Mon, 16 Dec 2024 19:26:13 +0000 (19:26 +0000)] 
src: convert drivers over to use new autostart helper

This eliminates some duplicated code patterns aross drivers.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 months agohypervisor: introduce helper for autostart
Daniel P. Berrangé [Mon, 16 Dec 2024 18:53:28 +0000 (18:53 +0000)] 
hypervisor: introduce helper for autostart

There's a common pattern for autostart of iterating over VMs, acquiring
a lock and ref count, then checking the autostart & is-active flags.
Wrap this all up into a helper method.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 months agoremote: notify systemd when reloading config
Daniel P. Berrangé [Tue, 7 Jan 2025 15:29:20 +0000 (15:29 +0000)] 
remote: notify systemd when reloading config

Switch to the 'notify-reload' service type and send notifications to
systemd when reloading configuration.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 months agoutil: add APIs for more systemd notifications
Daniel P. Berrangé [Mon, 6 Jan 2025 18:58:05 +0000 (18:58 +0000)] 
util: add APIs for more systemd notifications

We have a way to notify systemd when we're done starting the daemon.

Systemd supports many more notifications, however, and many of them
are quite relevant to our needs:

  https://www.freedesktop.org/software/systemd/man/latest/sd_notify.html

This renames the existing notification API to better reflect its
semantics, and adds new APIs for reporting

 * Initiation of config file reload
 * Initiation of daemon shutdown process
 * Adhoc progress status messages
 * Request to extend service shutdown timeout

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 months agobhyve: stop opening & passing connection to bhyveProcessStart
Daniel P. Berrangé [Mon, 3 Feb 2025 15:11:32 +0000 (15:11 +0000)] 
bhyve: stop opening & passing connection to bhyveProcessStart

A connection object is not required because autostarted domains are
never marked for autodestroy.

The comment about needing a connection for the network driver is
obsolete since we can auto-open a connection on demand.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 months agobhyve: add 'driver' to bhyveProcessStart method
Daniel P. Berrangé [Mon, 3 Feb 2025 15:09:29 +0000 (15:09 +0000)] 
bhyve: add 'driver' to bhyveProcessStart method

This allows for passinga  NULL connection object in cases where
domain autodestroy is not required.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 months agoqemu: migration: Reactivate block nodes after migration if VM is left paused
Peter Krempa [Mon, 10 Feb 2025 18:49:10 +0000 (19:49 +0100)] 
qemu: migration: Reactivate block nodes after migration if VM is left paused

On incoming migration qemu doesn't activate the block graph nodes right
away. This is to properly facilitate locking of the images.

The block nodes are normally re-activated when starting the CPUs after
migration, but in cases (e.g. when a paused VM was migrated) when the VM
is left paused the block nodes are not re-activated by qemu.

This means that blockjobs which would want to write to an existing
backing chain member would fail. Generally read-only jobs would succeed
with older qemu's but this was not intended.

Instead with new qemu you'll always get an error if attempting to access
a inactive node:

 error: internal error: unable to execute QEMU command 'blockdev-mirror': Inactive 'libvirt-1-storage' can't be a backing child of active '#block052'

This is the case for explicit blockjobs (virsh blockcopy) but also for
non shared-storage migration (virsh migrate --copy-storage-all).

Since qemu now provides 'blockdev-set-active' QMP command which can
on-demand re-activate the nodes we can re-activate them in similar cases
as when we'd be starting vCPUs if the VM weren't left paused.

The only exception is on the source in case of a failed post-copy
migration as the VM already ran on destination so it won't ever run on
the source even when recovered.

Resolves: https://issues.redhat.com/browse/RHEL-78398
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 months agoqemu: monitor: Add monitor backend for 'blockdev-set-active'
Peter Krempa [Mon, 10 Feb 2025 16:51:31 +0000 (17:51 +0100)] 
qemu: monitor: Add monitor backend for 'blockdev-set-active'

The command will be used to re-activate block nodes after migration when
we're leaving the VM paused so that blockjobs can be used.

As the 'node-name' field is optional the 'qemumonitorjsontest' case
tests both variants.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 months agoqemu: capabilies: Introduce QEMU_CAPS_BLOCKDEV_SET_ACTIVE
Peter Krempa [Mon, 10 Feb 2025 16:57:01 +0000 (17:57 +0100)] 
qemu: capabilies: Introduce QEMU_CAPS_BLOCKDEV_SET_ACTIVE

The flag signals presence of the 'blockdev-set-active' QMP command.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 months agoqemucapabilitiestest: Update 'caps_10.0.0_x86_64' to 'v9.2.0-1636-gffaf7f0376'
Peter Krempa [Fri, 7 Feb 2025 16:48:36 +0000 (17:48 +0100)] 
qemucapabilitiestest: Update 'caps_10.0.0_x86_64' to 'v9.2.0-1636-gffaf7f0376'

Notable changes:
    - 'blockdev-set-active' QMP command and the corresponding 'active'
      flag for instantiating blockdev backends added

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 months agoqemu-replies-tool: Dump also query string for optional members
Peter Krempa [Mon, 10 Feb 2025 17:29:14 +0000 (18:29 +0100)] 
qemu-replies-tool: Dump also query string for optional members

The query language allows querying whether a member is optional by using
the '*' "operator" but the dumper script didn't output those query
strings.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 months agoqemu: snapshot: Limit scope of checkpoint-snapshot interlock
Peter Krempa [Mon, 3 Feb 2025 14:45:49 +0000 (15:45 +0100)] 
qemu: snapshot: Limit scope of checkpoint-snapshot interlock

'qemuDomainSupportsCheckpointsBlockjobs()' should really be used only
with active VMs based on the scope of interlocking it does.

This means that the inactive snapshot code path needs to do the
interlocking based on what's supported:
 - external snapshot support was not implemented yet
    (bitmaps need to be propagated to the new overlay image)
 - internal snapshot support can be deferred to qemu

Move the check inside qemuSnapshotPrepare() which has knowledge about
the snapshot type and implement an explicit check for the inactive case.

See: https://gitlab.com/libvirt/libvirt/-/issues/739
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 months agoqemu: fix qemuDomainSaveImageDefineXML
Pavel Hrdina [Wed, 12 Feb 2025 10:12:03 +0000 (11:12 +0100)] 
qemu: fix qemuDomainSaveImageDefineXML

The commit in question made an incorrect change that resulted in getting
O_RDONLY FD instead of O_RDWR preventing any writes to happen with the
following error:

virQEMUSaveDataWrite:176 : failed to write header to domain save file '/path/to/save.img': Bad file descriptor

Pass 'bypass_cache' as proper bool as the original code did.

Fixes: 517248e2394476a3105ff5866b0b718fc6583073
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
6 months agoci: refresh with 'lcitool manifest'
Daniel P. Berrangé [Tue, 11 Feb 2025 17:15:45 +0000 (17:15 +0000)] 
ci: refresh with 'lcitool manifest'

This replaces Fedora 39 with Fedora 41, updates the FreeBSD
Cirrus CI image names, and tweaks some package names

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 months agonode_device: Do not lock the driver state needlessly
Martin Kletzander [Fri, 7 Feb 2025 14:43:52 +0000 (15:43 +0100)] 
node_device: Do not lock the driver state needlessly

When processing the PCI devices we can only read the configs for each of
them if running as privileged.  That information is saved in the driver
state as a boolean introduced in commit 643c74abff01.  However since
that version it is only written to once during nodeStateInitialize() and
only read from that point (apart from some commits around v3.9.0 release
when it was not even set, but that was fixed before v3.10.0).  And it is
only read once, just to store that boolean in a temporary variable which
is also used in only one condition.

Rewrite this without locking and save few lines of code.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>