]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
2 years agoqemuBuildInterfaceCommandLine: Remove 'tapfd' infrastructure
Peter Krempa [Tue, 10 May 2022 13:48:03 +0000 (15:48 +0200)]
qemuBuildInterfaceCommandLine: Remove 'tapfd' infrastructure

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Move opening of tap file descriptors for net devices into qemuBuildInterfaceConnect
Peter Krempa [Tue, 10 May 2022 13:43:07 +0000 (15:43 +0200)]
qemu: Move opening of tap file descriptors for net devices into qemuBuildInterfaceConnect

Use the new infrastructure which stores the fds inside 'qemuFDPass'
objects in the private data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuMonitorAddNetdev: Remove 'vhostfd' machinery
Peter Krempa [Tue, 10 May 2022 12:41:12 +0000 (14:41 +0200)]
qemuMonitorAddNetdev: Remove 'vhostfd' machinery

All callers now pass NULL/0 as arguments for vhostfd passing so we can
remove all the associated code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuBuildHostNetProps: Remove 'vhostfd' machinery
Peter Krempa [Tue, 10 May 2022 12:38:03 +0000 (14:38 +0200)]
qemuBuildHostNetProps: Remove 'vhostfd' machinery

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuBuildInterfaceCommandLine: Remove 'vhostfd' machinery
Peter Krempa [Tue, 10 May 2022 07:54:10 +0000 (09:54 +0200)]
qemuBuildInterfaceCommandLine: Remove 'vhostfd' machinery

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuDomainAttachNetDevice: Remove 'vhostfd' machinery
Peter Krempa [Tue, 10 May 2022 12:30:28 +0000 (14:30 +0200)]
qemuDomainAttachNetDevice: Remove 'vhostfd' machinery

Now all the helper variables and code are not needed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Move opening of vhost file descriptors for net devices into qemuBuildInterfaceC...
Peter Krempa [Mon, 9 May 2022 15:42:08 +0000 (17:42 +0200)]
qemu: Move opening of vhost file descriptors for net devices into qemuBuildInterfaceConnect

Use the new infrastructure which stores the fds inside 'qemuFDPass'
objects in the private data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuInterfaceOpenVhostNet: Reformat error messages per new guidelines
Peter Krempa [Mon, 9 May 2022 15:35:18 +0000 (17:35 +0200)]
qemuInterfaceOpenVhostNet: Reformat error messages per new guidelines

Remove the linebreaks inside of error messages.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuBuildNicDevProps: Don't pass 'vhostfdSize'
Peter Krempa [Mon, 9 May 2022 15:12:12 +0000 (17:12 +0200)]
qemuBuildNicDevProps: Don't pass 'vhostfdSize'

All callers effectively pass 'net->driver.virtio.queues'. In case of the
code in 'qemu_hotplug.c' this value was set to '1' if it was 0 before.

Since 'qemuBuildNicDevProps' only uses it if it's greater than 1 we can
remove all the extra complexity.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Prepare netdev code for use of qemuFDPass for tapfd/vhostfd passing
Peter Krempa [Mon, 9 May 2022 14:45:12 +0000 (16:45 +0200)]
qemu: Prepare netdev code for use of qemuFDPass for tapfd/vhostfd passing

Add alternative code paths for passing of the FDs using the new
infrastructure. This way we'll be able to refactor the code
incrementally.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuDomainAttachNetDevice: Don't construct network device properties under monitor...
Peter Krempa [Mon, 9 May 2022 14:39:48 +0000 (16:39 +0200)]
qemuDomainAttachNetDevice: Don't construct network device properties under monitor lock

After the 'qemuFDPass' code was refactored we no longer need to hand off
the FD to qemu before we know the path for it.

Thus the call to qemuBuildHostNetProps can be moved outside of the
monitor critical section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuBuildHostNetProps: Refactor construction of tapfd/vhostfd arguments
Peter Krempa [Mon, 9 May 2022 14:19:49 +0000 (16:19 +0200)]
qemuBuildHostNetProps: Refactor construction of tapfd/vhostfd arguments

Pre-construct the array the same way for the case when there's only one
FD and when there are multiple. We just change the argument name
depending on the count.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuBuildHostNetProps: Move all 'tap' code together
Peter Krempa [Mon, 9 May 2022 14:16:35 +0000 (16:16 +0200)]
qemuBuildHostNetProps: Move all 'tap' code together

Move the block guarded by 'is_tap' boolean to the only place where
'is_tap' is set to true.

This causes few arguments to change places.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuBuildInterfaceConnect: Connect to 'vdpa' netdev
Peter Krempa [Mon, 9 May 2022 13:34:09 +0000 (15:34 +0200)]
qemuBuildInterfaceConnect: Connect to 'vdpa' netdev

Move the setup of the 'vdpa' netdev into the new helper shared between
commandline and hotplug code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: command: Introduce 'qemuBuildInterfaceConnect' helper
Peter Krempa [Mon, 9 May 2022 12:38:20 +0000 (14:38 +0200)]
qemu: command: Introduce 'qemuBuildInterfaceConnect' helper

The helper will aggregate code that is used to connect the network
backend to the corresponding host portion.

This will be used to refactor the duplicated code between the cold-start
and hotplug helper functions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: domain: Add qemuFDPass helpers into network private data
Peter Krempa [Mon, 9 May 2022 07:50:51 +0000 (09:50 +0200)]
qemu: domain: Add qemuFDPass helpers into network private data

Prepare for the upcoming refactor to use qemuFDPass for all the network
related file descriptors:

    - tapfds
    - vhostfds
    - slirp
    - vdpa

This patch adds the private data variables and a utility function to
clear it. Clearing is useful since we don't really need the data once
the VM is running so we save some memory.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Clear 'qemuFDPass' helpers of char devices when no longer needed
Peter Krempa [Fri, 6 May 2022 12:50:06 +0000 (14:50 +0200)]
qemu: Clear 'qemuFDPass' helpers of char devices when no longer needed

While the FDs are closed right after use to prevent leaks, at certain
point we don't need the whole helper any more. Clear them for char
devices after hotplug and on start.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuFDPassTransferMonitor: Close local copy of the FD as soon as it's passed to qemu
Peter Krempa [Fri, 6 May 2022 12:36:04 +0000 (14:36 +0200)]
qemuFDPassTransferMonitor: Close local copy of the FD as soon as it's passed to qemu

We don't want to keep the FDs open more than we need to.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuMonitorAddFileHandleToSet: Remove return of 'qemuMonitorAddFdInfo'
Peter Krempa [Thu, 5 May 2022 15:06:10 +0000 (17:06 +0200)]
qemuMonitorAddFileHandleToSet: Remove return of 'qemuMonitorAddFdInfo'

The only caller doesn't use the fdset info any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_fd: Don't rely on fdset id allocation by qemu
Peter Krempa [Thu, 5 May 2022 14:34:52 +0000 (16:34 +0200)]
qemu_fd: Don't rely on fdset id allocation by qemu

If we use our own fdset ID when hot-adding a fdset we can vastly
simplify our internals.

As a stop-gap when a fdset would be added behind libvirt's back we'll
validated that the fdset to be added is not yet used.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: domain: Store and update 'fdsetindex' across libvirtd restarts
Peter Krempa [Thu, 5 May 2022 13:45:55 +0000 (15:45 +0200)]
qemu: domain: Store and update 'fdsetindex' across libvirtd restarts

While 'add-fd' qmp command gives the possibility to find an unused fdset
ID when hot-adding fdsets, such usage is extremely inconvenient.

This patch allows us to track the used fdset id so that we can avoid the
need to check results and thus employ simpler code flow when hot-adding
devices which use FD passing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuMonitorJSONQueryFdsets: Ensure that JSON arrays are valid before using them
Peter Krempa [Fri, 6 May 2022 10:55:00 +0000 (12:55 +0200)]
qemuMonitorJSONQueryFdsets: Ensure that JSON arrays are valid before using them

The code didn't check that the reply value is an array and that the
'fds' array is present. This could lead to a crash if qemu wouldn't
return an array in those places.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: monitor: Don't parse actual fd's from query-fdsets/add-fd replies
Peter Krempa [Thu, 5 May 2022 13:10:25 +0000 (15:10 +0200)]
qemu: monitor: Don't parse actual fd's from query-fdsets/add-fd replies

Libvirt doesn't use the returned value and in fact there's nothing we
could even do with them. Avoid parsing and storing them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuDomainAttachNetDevice: Use 'qemuFDPass' for the vdpa file descriptor
Peter Krempa [Fri, 6 May 2022 07:45:08 +0000 (09:45 +0200)]
qemuDomainAttachNetDevice: Use 'qemuFDPass' for the vdpa file descriptor

We use the qemuFDPass infrastructure when building the command line,
refactor the monitor too.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_fd: Remove error checking from qemuFDPassAddFD
Peter Krempa [Wed, 4 May 2022 12:12:58 +0000 (14:12 +0200)]
qemu_fd: Remove error checking from qemuFDPassAddFD

It's effectively replaced by checks in qemuFDPassTransfer. This will
simplify cleanup paths on constructing the qemuFDPass object when FDs
are being handled.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_fd: Add validation before transferring file descriptors
Peter Krempa [Wed, 4 May 2022 11:58:37 +0000 (13:58 +0200)]
qemu_fd: Add validation before transferring file descriptors

Add validation to the transfer step to make the adding step more simple
for easier cleanup paths.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_fd: Add return value handling for qemuFDPassTransfer* APIs
Peter Krempa [Wed, 4 May 2022 10:55:36 +0000 (12:55 +0200)]
qemu_fd: Add return value handling for qemuFDPassTransfer* APIs

Add possibility to delay checks to the point when the FDs are to be
passed to qemu.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirt-xml-validate: Add more XML formats support
Han Han [Wed, 11 May 2022 06:18:32 +0000 (14:18 +0800)]
virt-xml-validate: Add more XML formats support

Add these XML formats validation in manpage or script:
cpu, domainbackup, domaincaps, domaincheckpoint, networkport,
storagepoolcaps.

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2 years agovirDomainRestoreFlags: Require VIR_DOMAIN_SAVE_PARAM_FILE for now
Michal Privoznik [Fri, 13 May 2022 07:33:36 +0000 (09:33 +0200)]
virDomainRestoreFlags: Require VIR_DOMAIN_SAVE_PARAM_FILE for now

Calling virDomainRestoreFlags() with no typed params results in
an error in open() because it tries to open a NULL path.
Obviously, this is wrong and path to restore from must be
provided, at least for now until other sources of restore are
introduced. Then this limitation can be relaxed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agolib: Repurpose virDomainSaveParams() with no VIR_DOMAIN_SAVE_PARAM_FILE
Michal Privoznik [Thu, 12 May 2022 13:51:23 +0000 (15:51 +0200)]
lib: Repurpose virDomainSaveParams() with no VIR_DOMAIN_SAVE_PARAM_FILE

When no VIR_DOMAIN_SAVE_PARAM_FILE typed param is set when
calling virDomainSaveParams() then in turn virQEMUFileOpenAs()
tries to open a NULL path.

We have two options now:
1) require the typed param, which in turn may be promoted to a
   regular argument, or

2) use this opportunity to make the API behave like
   virDomainManagedSave() and use typed params to pass extra
   arguments, instead of having to invent new managed save API
   with typed params.

Let's go with option 2, as it is more future proof.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu: Separate out save code from qemuDomainManagedSave()
Michal Privoznik [Thu, 12 May 2022 14:13:40 +0000 (16:13 +0200)]
qemu: Separate out save code from qemuDomainManagedSave()

The code that actually does managed save within
qemuDomainManagedSave() is going to be reused shortly. Move it
out into a separate helper.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agodocs: formatdomain: Fix the introduced version of vdagent
Han Han [Wed, 11 May 2022 07:48:26 +0000 (15:48 +0800)]
docs: formatdomain: Fix the introduced version of vdagent

The qemu-vdagent channel is introduced since:
"05b09f039e    conf: add qemu-vdagent channel"

It will be in the version 8.4.0.

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2 years agoTranslated using Weblate (Korean)
김인수 [Fri, 13 May 2022 01:18:32 +0000 (03:18 +0200)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10419 of 10419 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>
2 years agoqemu: Don't check for qemuDomainManagedSavePath() retval
Michal Privoznik [Thu, 12 May 2022 11:32:49 +0000 (13:32 +0200)]
qemu: Don't check for qemuDomainManagedSavePath() retval

The qemuDomainManagedSavePath() function does no more than a
g_strdup_printf() and as such can't return NULL really.
Therefore, don't check for its return value.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu: Enable migration events only for fresh QEMU process
Jiri Denemark [Wed, 11 May 2022 13:32:58 +0000 (15:32 +0200)]
qemu: Enable migration events only for fresh QEMU process

Every running QEMU process we are willing to reconnect (i.e., at least
3.1.0) supports migration events and we can assume the capability is
already enabled since last time libvirt daemon connected to its monitor.

Well, it's not guaranteed though. If libvirt 1.2.17 or older was used to
start QEMU 3.1.0 or newer, migration events would not be enabled. And if
the user decides to upgrade libvirt from 1.2.17 to 8.4.0 while the QEMU
process is still running, they would not be able to migrate the domain
because of disabled migration events. I think we do not really need to
worry about this scenario as libvirt 1.2.17 is 7 years old while QEMU
3.1.0 was released only 3.5 years ago. Thus a chance someone would be
running such configuration should be fairly small and a combination with
upgrading 1.2.17 to 8.4.0 (or newer) with running domains should get it
pretty much to zero. The issue would disappear ff the ancient libvirt is
first upgraded to something older than 8.4.0 and then to the current
libvirt.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu: Make migration events mandatory
Jiri Denemark [Wed, 11 May 2022 13:03:30 +0000 (15:03 +0200)]
qemu: Make migration events mandatory

All QEMU versions we care about support migration events and we should
be able to enable the associated capability when connecting to the
monitor. Failure to do so is thus considered fatal now.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu: Refactor qemuDomainGetJobInfoMigrationStats
Jiri Denemark [Wed, 11 May 2022 12:30:45 +0000 (14:30 +0200)]
qemu: Refactor qemuDomainGetJobInfoMigrationStats

The code was a bit too complicated, especially after removing the check
for QEMU_CAPS_MIGRATION_EVENT.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu: Drop QEMU_CAPS_MIGRATION_EVENT
Jiri Denemark [Wed, 11 May 2022 12:22:13 +0000 (14:22 +0200)]
qemu: Drop QEMU_CAPS_MIGRATION_EVENT

All QEMU versions we care about already support migration events.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoci: Add a Fedora integration test job utilizing upstream QEMU
Erik Skultety [Fri, 6 May 2022 13:24:56 +0000 (15:24 +0200)]
ci: Add a Fedora integration test job utilizing upstream QEMU

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoci: Add a new integration job template for the upstream QEMU scenario
Erik Skultety [Fri, 6 May 2022 13:16:43 +0000 (15:16 +0200)]
ci: Add a new integration job template for the upstream QEMU scenario

YAML anchors don't work with Shell condition structures, so we cannot
simply reference the QEMU build template YAML anchor conditionally and
hence have everything as part of a single job template.
Instead, we have to "subclass" the .integration_tests template and
inject the QEMU building bits explicitly.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoci: Introduce a template for upstream QEMU build
Erik Skultety [Fri, 6 May 2022 07:02:23 +0000 (09:02 +0200)]
ci: Introduce a template for upstream QEMU build

This was heavily inspired by QEMU's upstream CI buildtest-template.yml.
Rather than referencing QEMU's template directly (which GitLab can do),
this patch resorts to hard-coding the build steps ourselves, solely
because there's no guarantee QEMU will keep either the template file
name or the template name from which the build steps were mostly copied
from.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoci: Break off the integration_tests template into more templates
Erik Skultety [Fri, 6 May 2022 07:01:28 +0000 (09:01 +0200)]
ci: Break off the integration_tests template into more templates

There's quite a lot happening in the .integration_tests template
already even without adding upstream QEMU build into the mix.
Let's break the template into more pieces which can then reference
in the .integration_tests template when putting all the pieces back
together using YAML anchors.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoci: Separate the integration job template to a separate file
Erik Skultety [Fri, 6 May 2022 06:16:46 +0000 (08:16 +0200)]
ci: Separate the integration job template to a separate file

Future patches will do more code extraction from the existing template
using YAML anchors so it'd be better that the templates would live
separately from job definitions.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agolib: Rename VIR_SAVE_PARAM_* to VIR_DOMAIN_SAVE_PARAM_*
Michal Privoznik [Thu, 12 May 2022 07:59:57 +0000 (09:59 +0200)]
lib: Rename VIR_SAVE_PARAM_* to VIR_DOMAIN_SAVE_PARAM_*

A few commits ago new APIs were introduced (virDomainSaveParams()
and virDomainRestoreParams()) and with them new typed parameters:
VIR_SAVE_PARAM_FILE and VIR_SAVE_PARAM_DXML. But their name does
not suggest they apply to either of the APIs nor that they are
intended for domain related APIs. Switch to
VIR_DOMAIN_SAVE_PARAM prefix to make it obvious.

It's true we already have VIR_DOMAIN_SAVE_* symbols which are
part of virDomainSaveRestoreFlags enum, therefore stick also with
'_PARAM_ ' part of the name to differentiate the two.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoqemu: Disable spice-related devices without spice graphics
Martin Kletzander [Wed, 11 May 2022 13:46:57 +0000 (15:46 +0200)]
qemu: Disable spice-related devices without spice graphics

For most of them qemu errors out with unclear message, and for the
audiodev qemu just falls back to timer-based audio with a warning
message, and will possibly also error out in the future.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2035163
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoconf: Add virDomainDefHasSpiceGraphics
Martin Kletzander [Wed, 11 May 2022 13:42:56 +0000 (15:42 +0200)]
conf: Add virDomainDefHasSpiceGraphics

It will be used in future patch in multiple places.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agotests: Adjust for invalid qemu command combinations
Martin Kletzander [Thu, 12 May 2022 07:40:03 +0000 (09:40 +0200)]
tests: Adjust for invalid qemu command combinations

Everything spice is not supported (and does not make sense) without spice
graphics.  For some tests I also added cirrus VGA capability so that the XML
stays simple and libvirt can guess a default video model rather than adding too
much of an irrelevant XML into the individual tests.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoRemove serial-spiceport-nospice test
Martin Kletzander [Wed, 11 May 2022 14:47:28 +0000 (16:47 +0200)]
Remove serial-spiceport-nospice test

This old test was added by me to allow people to keep the spicevmc
channel while changing graphics type from spice to something else.
However we do not do this in other places and also now we have all the
Validate functions so it is better to show the user they will not have
the spicevmc channel available rather than simply not formatting it on
the qemu command line.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu_domain: Drop needless 'error' label in qemuDomainObjPrivateXMLParse()
Michal Privoznik [Wed, 11 May 2022 14:38:28 +0000 (16:38 +0200)]
qemu_domain: Drop needless 'error' label in qemuDomainObjPrivateXMLParse()

After previous cleanup the 'error' label in
qemuDomainObjPrivateXMLParse() contains nothing but a return
statement. Well, the label can be dropped and all 'goto'-s can be
replaced with the return statement directly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu_domain: Drop needless free from qemuDomainObjPrivateXMLParse()
Michal Privoznik [Wed, 11 May 2022 14:37:50 +0000 (16:37 +0200)]
qemu_domain: Drop needless free from qemuDomainObjPrivateXMLParse()

The qemuDomainObjPrivateXMLParse() is responsible for parsing
given XML into qemuDomainObjPrivate struct. As it does so, memory
might be allocated for some members. If an error occurs during
parsing the control jumps onto 'error' label where only some of
previously allocated memory is freed. The reason there's no
memory leak is simple: the only caller (virDomainObjParseXML())
unrefs freshly created virDomainObj which in turn causes
qemuDomainObjPrivateFree() to be called. Therefore, these
partial, selective frees are needless and should be just dropped.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoqemu_domain: Format qemuDomainObjPrivate::originalMemlock
Michal Privoznik [Wed, 11 May 2022 14:37:27 +0000 (16:37 +0200)]
qemu_domain: Format qemuDomainObjPrivate::originalMemlock

Now that qemuDomainObjPrivate struct gained new member format it
into XML and parse it so that the value is preserved across
daemon restarts.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoconf: Move virDomainObj::originalMemlock into qemuDomainObjPrivate
Michal Privoznik [Wed, 11 May 2022 14:27:18 +0000 (16:27 +0200)]
conf: Move virDomainObj::originalMemlock into qemuDomainObjPrivate

Since v1.3.0-90-gafbe1d4c56 the original value of memlock limit
is stored inside virDomainObj struct directly (under
originalMemlock member). This is needless because the value is
used only inside QEMU driver and thus can reside in
qemuDomainObjPrivate struct.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoqemu: add support for qemu-vdagent channel
Jonathon Jongsma [Fri, 18 Mar 2022 22:04:05 +0000 (17:04 -0500)]
qemu: add support for qemu-vdagent channel

Implement the qemu-vdagent channel introduced in the previous commit.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
3 years agoconf: add qemu-vdagent channel
Jonathon Jongsma [Fri, 18 Mar 2022 20:51:39 +0000 (15:51 -0500)]
conf: add qemu-vdagent channel

Add the ability to configure a qemu-vdagent in guest domains. This
device is similar to the spice vdagent channel except that qemu handles
the spice-vdagent protocol messages itself rather than routing them over
a spice protocol channel.

The qemu-vdagent device has two notable configuration options which
determine whether qemu will handle particular vdagent features:
'clipboard' and 'mouse'.

The 'clipboard' option allows qemu to synchronize its internal clipboard
manager with the guest clipboard, which enables client<->guest clipboard
synchronization for non-spice guests such as vnc.

The 'mouse' option allows absolute mouse positioning to be sent over the
vdagent channel rather than using a usb or virtio tablet device.

Sample configuration:
  <channel type='qemu-vdagent'>
    <target type='virtio' name='com.redhat.spice.0'/>
    <source>
      <clipboard copypaste='yes'/>
      <mouse mode='client'/>
    </source>
  </channel>

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
3 years agoRename virDomainGraphicsSpiceMouseMode to virDomainMouseMode
Jonathon Jongsma [Wed, 23 Mar 2022 17:06:36 +0000 (12:06 -0500)]
Rename virDomainGraphicsSpiceMouseMode to virDomainMouseMode

This enumeration will be useful for vnc with the upcoming qemu-vdagent
device so make the name more generic.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
3 years agoqemu: add capability for qemu-vdagent chardev
Jonathon Jongsma [Mon, 14 Mar 2022 20:29:54 +0000 (15:29 -0500)]
qemu: add capability for qemu-vdagent chardev

Detect whether qemu supports the qemu-vdagent character device. This
enables support for copy/paste with VNC graphics.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
3 years agoqemucapabilitiestest: Add test data for the qemu-7.1 dev cycle on x86_64
Peter Krempa [Tue, 10 May 2022 07:55:15 +0000 (09:55 +0200)]
qemucapabilitiestest: Add test data for the qemu-7.1 dev cycle on x86_64

Notable schema changes:

 - 'cluster-id' is now reported for CPU topology
 - 'display-update' QMP command added
 - 'main-loop' QOM object added with a whole set of properties
 - 'cpu0-id' field reported in SEV data
 - 'blockdev-change-medium' command now has 'force' property
 - 'screendump' QMP command now has a 'format' property
    - supported formats are 'ppm' and 'png'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: apps: Add the app cockpit
Han Han [Mon, 9 May 2022 07:47:28 +0000 (15:47 +0800)]
docs: apps: Add the app cockpit

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: fix insert/instead documentation mixup
Jonathon Jongsma [Wed, 11 Nov 2020 21:17:12 +0000 (15:17 -0600)]
util: fix insert/instead documentation mixup

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
3 years agoconf: ensure only one vgpu has ramfb enabled
Jonathon Jongsma [Fri, 29 Apr 2022 20:07:26 +0000 (15:07 -0500)]
conf: ensure only one vgpu has ramfb enabled

Validate the domain configuration to ensure that if there are more than
one vgpu assigned to a domain, only one of them has 'ramfb' enabled.

This was never a supported configuration. QEMU failed confusingly when
attempting to start a domain with this configuration. This change
attempts to provide better information about the error.

https://bugzilla.redhat.com/show_bug.cgi?id=2079760

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemu_security: Drop qemuSecurityStartVhostUserGPU()
Michal Privoznik [Thu, 28 Apr 2022 11:19:11 +0000 (13:19 +0200)]
qemu_security: Drop qemuSecurityStartVhostUserGPU()

There's no real difference between
qemuSecurityStartVhostUserGPU() and qemuSecurityCommandRun(). The
latter is used more frequently while the former has just one
user. Therefore, drop the less frequently used one.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotests: qemucapabilities: update ppc64 qemu caps for 7.0.0 release
Daniel Henrique Barboza [Fri, 6 May 2022 19:54:22 +0000 (16:54 -0300)]
tests: qemucapabilities: update ppc64 qemu caps for 7.0.0 release

There are no major changes since 7.0.0-rc2, but a few additional
features are enabled in this build.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
3 years agoapibuild: Fix self.waring method call
luzhipeng [Sat, 7 May 2022 01:17:31 +0000 (09:17 +0800)]
apibuild: Fix self.waring method call

The parameters of self.warning is inconsistent with its definition, So
fix it.

Signed-off-by: luzhipeng <luzhipeng@cestc.cn>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoTranslated using Weblate (Finnish)
Jan Kuparinen [Sun, 8 May 2022 17:18:29 +0000 (19:18 +0200)]
Translated using Weblate (Finnish)

Currently translated at 22.8% (2385 of 10419 strings)

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

Co-authored-by: Jan Kuparinen <copper_fin@hotmail.com>
Signed-off-by: Jan Kuparinen <copper_fin@hotmail.com>
3 years agoNEWS: Mention improved heuristics for CPU baseline
Jiri Denemark [Fri, 6 May 2022 15:26:56 +0000 (17:26 +0200)]
NEWS: Mention improved heuristics for CPU baseline

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
3 years agocpu_x86: Ignore enabled features for input models in x86DecodeUseCandidate
Jiri Denemark [Fri, 29 Apr 2022 08:35:02 +0000 (10:35 +0200)]
cpu_x86: Ignore enabled features for input models in x86DecodeUseCandidate

While we don't want to aim for the shortest list of disabled features in
the baseline result (it would select a very old model), we want to do so
while looking at any of the input models for which we're trying to
compute a baseline CPU model. Given a set of input models, we always
want to take the least capable one of them (i.e., the one with shortest
list of disabled features) or a better model which is not one of the
input models.

So when considering an input model, we just check whether its list of
disabled features is shorter than the currently best one. When looking
at other models we check both enabled and disabled features while
penalizing disabled features as implemented by the previous patch.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_x86: Penalize disabled features when computing CPU model
Jiri Denemark [Tue, 26 Apr 2022 13:06:30 +0000 (15:06 +0200)]
cpu_x86: Penalize disabled features when computing CPU model

For finding the best matching CPU model for a given set of features
while we don't know the CPU signature (i.e., when computing a baseline
CPU model) we've been using a "shortest list of features" heuristics.
This works well if new CPU models are supersets of older models, but
that's not always the case. As a result it may actually select a new CPU
model as a baseline while removing some features from it to make it
compatible with older models. This is in general worse than using an old
CPU model with a bunch of added features as a guest OS or apps may crash
when using features that were disabled.

On the other hand we don't want to end up with a very old model which
would guarantee no disabled features as it could stop a guest OS or apps
from using some features provided by the CPU because they would not
expect them on such an old CPU.

This patch changes the heuristics to something in between. Enabled and
disabled features are counted separately so that a CPU model requiring
some features to be disabled looks worse than a model with fewer
disabled features even if its complete list of features is longer. The
penalty given for each additional disabled feature gets bigger to make
longer list of disabled features look even worse.

https://bugzilla.redhat.com/show_bug.cgi?id=1851227

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_x86: Refactor feature list comparison in x86DecodeUseCandidate
Jiri Denemark [Tue, 26 Apr 2022 13:02:51 +0000 (15:02 +0200)]
cpu_x86: Refactor feature list comparison in x86DecodeUseCandidate

It will become more complicated and so it deserves to be separated into
a new function.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_x86: Consolidate signature match in x86DecodeUseCandidate
Jiri Denemark [Tue, 26 Apr 2022 09:58:07 +0000 (11:58 +0200)]
cpu_x86: Consolidate signature match in x86DecodeUseCandidate

Checking the signature in two different places makes no sense since the
code in between can only mark the candidate as the best option so far,
which is what the second signature match does as well.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocputest: Add some real world baseline tests
Jiri Denemark [Thu, 21 Apr 2022 16:25:15 +0000 (18:25 +0200)]
cputest: Add some real world baseline tests

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocputest: Give better names to baseline tests
Jiri Denemark [Wed, 4 May 2022 14:28:03 +0000 (16:28 +0200)]
cputest: Give better names to baseline tests

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocputest: Drop some old artificial baseline tests
Jiri Denemark [Wed, 4 May 2022 14:21:38 +0000 (16:21 +0200)]
cputest: Drop some old artificial baseline tests

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_map: Disable cpu64-rhel* for host-model and baseline
Jiri Denemark [Tue, 26 Apr 2022 10:50:41 +0000 (12:50 +0200)]
cpu_map: Disable cpu64-rhel* for host-model and baseline

These ancient RHEL-only CPU models should not really be used by any CPU
definition created by libvirt. We keep them just for backwards
compatibility with domains which might still be using them.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: update refs to virDomainSaveParams and virDomainRestoreParams
Claudio Fontana [Fri, 6 May 2022 13:11:15 +0000 (15:11 +0200)]
docs: update refs to virDomainSaveParams and virDomainRestoreParams

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Claudio Fontana <cfontana@suse.de>
3 years agoqemu: add implementation for virDomainRestoreParams API
Claudio Fontana [Fri, 6 May 2022 13:11:00 +0000 (15:11 +0200)]
qemu: add implementation for virDomainRestoreParams API

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Claudio Fontana <cfontana@suse.de>
3 years agoqemu: add implementation for virDomainSaveParams API
Claudio Fontana [Fri, 6 May 2022 13:10:59 +0000 (15:10 +0200)]
qemu: add implementation for virDomainSaveParams API

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Claudio Fontana <cfontana@suse.de>
3 years agoremote: Add RPC support for the virDomainRestoreParams API
Claudio Fontana [Fri, 6 May 2022 13:10:55 +0000 (15:10 +0200)]
remote: Add RPC support for the virDomainRestoreParams API

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agogendispatch: add DomainRestoreParams as requiring conn argument
Claudio Fontana [Fri, 6 May 2022 13:10:54 +0000 (15:10 +0200)]
gendispatch: add DomainRestoreParams as requiring conn argument

in preparation for the addition of DomainRestoreParams,
add it to the list of methods requiring a conn first argument.

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoremote: Add RPC support for the virDomainSaveParams API
Claudio Fontana [Fri, 6 May 2022 13:10:53 +0000 (15:10 +0200)]
remote: Add RPC support for the virDomainSaveParams API

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agolibvirt: introduce virDomainRestoreParams public API
Claudio Fontana [Fri, 6 May 2022 13:10:52 +0000 (15:10 +0200)]
libvirt: introduce virDomainRestoreParams public API

add new API in order to be able to extend parameters to the domain
restore operation. We will use it to fit the existing arguments of
VirDomainRestoreFlags for now.

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agolibvirt: introduce virDomainSaveParams public API
Claudio Fontana [Fri, 6 May 2022 13:10:51 +0000 (15:10 +0200)]
libvirt: introduce virDomainSaveParams public API

create an alternative to virDomainSaveFlags that is more
extendible via parameters.

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agovirfile: add comment about the use of SEEK_END in virFileDiskCopy
Claudio Fontana [Fri, 6 May 2022 13:10:50 +0000 (15:10 +0200)]
virfile: add comment about the use of SEEK_END in virFileDiskCopy

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agovirfile: change virFileDiskCopy arguments to extend beyond stdin, stdout
Claudio Fontana [Fri, 6 May 2022 13:10:49 +0000 (15:10 +0200)]
virfile: change virFileDiskCopy arguments to extend beyond stdin, stdout

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Claudio Fontana <cfontana@suse.de>
3 years agovirfile: rename runIO to virFileDiskCopy
Claudio Fontana [Fri, 6 May 2022 13:10:48 +0000 (15:10 +0200)]
virfile: rename runIO to virFileDiskCopy

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Claudio Fontana <cfontana@suse.de>
3 years agoiohelper: move runIO function to virfile.c
Claudio Fontana [Fri, 6 May 2022 13:10:47 +0000 (15:10 +0200)]
iohelper: move runIO function to virfile.c

where it can be reused by other helpers.
No changes other than the move.

Note that this makes iohelper now dependent on -lutil and -lacl.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Claudio Fontana <cfontana@suse.de>
3 years agoiohelper: refactor copy operation as a separate function
Claudio Fontana [Fri, 6 May 2022 13:10:46 +0000 (15:10 +0200)]
iohelper: refactor copy operation as a separate function

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoiohelper: introduce new struct to carry copy operation parameters
Claudio Fontana [Fri, 6 May 2022 13:10:45 +0000 (15:10 +0200)]
iohelper: introduce new struct to carry copy operation parameters

this is in preparation for a minor refactoring of the copy
function itself out of runIO().

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoci: Move clang/asan/ubsan jobs to Ubuntu 22.04
Andrea Bolognani [Fri, 6 May 2022 09:16:36 +0000 (11:16 +0200)]
ci: Move clang/asan/ubsan jobs to Ubuntu 22.04

Using an updated toolchain means we're likely to catch more
issues.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotestutilsqemu: Write getter/setter for CPU def global variables
Michal Privoznik [Thu, 5 May 2022 14:27:55 +0000 (16:27 +0200)]
testutilsqemu: Write getter/setter for CPU def global variables

As of 47503cc859 we are statically linking libtest_utils_qemu.a
into qemuhotplugmock.so (see the original commit for reasoning).
However, this breaks ASAN on older clang because now
qemuhotplugtest has two instances of virCPUDef global variables
(cpuDefault, cpuHaswell, cpuPower8, cpuPower9). One that comes
from the binary itself (which also links with
libtest_utils_qemu.a) and the other from the mock. Resolve this
by making the variables static and introducing getter and setter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agotestutils: Write setter for virTestHostArch global variable
Michal Privoznik [Thu, 5 May 2022 13:27:14 +0000 (15:27 +0200)]
testutils: Write setter for virTestHostArch global variable

As of 47503cc859 we are statically linking libtest_utils.a into
qemuhotplugmock.so (see the original commit for reasoning).
However, this breaks ASAN on older clang because now
qemuhotplugtest has two instances of virTestHostArch global
variable. One that comes from the binary itself (which also links
with libtest_utils.a) and the other from the mock. Resolve this
by making the variable static and introducing getter and setter.
Well, the former already exists (as virArchFromHost()) so only
the latter is needed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoci: Add Ubuntu 22.04
Andrea Bolognani [Fri, 6 May 2022 07:13:41 +0000 (09:13 +0200)]
ci: Add Ubuntu 22.04

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoci: Refresh configuration
Andrea Bolognani [Fri, 6 May 2022 07:11:22 +0000 (09:11 +0200)]
ci: Refresh configuration

Notable changes:

  * use the most recent point release for FreeBSD 12.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agomeson: Drop support for -Wl,-M
Andrea Bolognani [Thu, 5 May 2022 13:48:53 +0000 (15:48 +0200)]
meson: Drop support for -Wl,-M

This was originally introduced in c2fb8bfee309, reportedly to
support symbol versioning on Solaris; more recently, 30b301c6eaa9
ported it to meson.

Up until the previous commit this has resulted in passing

  -M .../libvirt/build/src/libvirt.syms

to the linker on macOS, but the implementation of the -M option
on that platform's linker is literally

  else if ( strcmp(arg, "-M") == 0 ) {
      // FIX FIX
  }

so in practice we've been providing an additional input file,
which the linker understandably ignores after printing a warning
since it's not in any format that it recognizes.

Considering that LLVM's linker, which is now used by default on
FreeBSD, supports the same --version-script option as the GNU
linker, that we have introduced special handling for macOS, and
that we don't target Solaris, we can simply drop the branch at
this point.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agomeson: Don't attempt to use version scripts on macOS
Andrea Bolognani [Thu, 5 May 2022 13:29:00 +0000 (15:29 +0200)]
meson: Don't attempt to use version scripts on macOS

macOS libraries don't support symbol versioning, so the only
result that we achieve by passing additional flags to the linker
is a bunch of messages like

  ld: warning: ignoring file .../libvirt/build/src/libvirt.syms,
  building for macOS-x86_64 but attempting to link with file built
  for unknown-unsupported file format ( 0x23 0x20 0x57 0x41 ... )

being produced during the build.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agomeson: Refactor handling of link_args and link_depends
Andrea Bolognani [Thu, 5 May 2022 13:06:47 +0000 (15:06 +0200)]
meson: Refactor handling of link_args and link_depends

This ensures variable names and the overall structure of the
code setting and using them is consistent. It will also make
upcoming changes less disruptive.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: Deduplicate some WITH_* checks
Michal Privoznik [Thu, 14 Apr 2022 10:44:31 +0000 (12:44 +0200)]
tests: Deduplicate some WITH_* checks

When constructing mock_libs array it is firstly initialized to a
static set of mocks followed by couple of WITH_* checks to append
driver specific mocks. These checks are then repeated when
filling some other variables (e.g. supplementary helpers,
libraries, tests, etc.). Dissolve the former in the latter since
we are already doing that, partially, for qemu (qemucapsprobemock
and qemuhotplugmock)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotest: Link qemuhotplugmock with test_utils_qemu and test_utils
Michal Privoznik [Mon, 4 Apr 2022 10:22:37 +0000 (12:22 +0200)]
test: Link qemuhotplugmock with test_utils_qemu and test_utils

As of ad81aa8ad07 the qemuhotplugmock.c calls
testQemuPrepareHostBackendChardevOne() which is implemented in
testutilsqemu.c. However, the mock is not linked with
testutilsqemu static library which makes some tools (valgrind
particularly) unhappy because the resulting mock library has
unresolved symbol.

The fix is simple, link mock library with test_utils_qemu_lib and
also with test_utils_lib since testutils.c calls some functions
from testutils.c.

Since these two libraries are declared only after mock_libs[], I
had to move the line that declares qemuhotplugmock after those
two.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirnetdev: Fix regression in setting VLAN tag
Michal Privoznik [Fri, 22 Apr 2022 12:15:47 +0000 (14:15 +0200)]
virnetdev: Fix regression in setting VLAN tag

In the past, we did set VLAN tag on <interface type='direct'/>.
However, during rewrite (v8.1.0-rc1~191) virNetDevSetVfConfig()
was changed and a condition that was responsible for calling
a function that sets VLAN tag was changed accidentally resulting
in VLAN tag not being set anymore.

However, because of other changes in the same patchset, it may
happen that @adminMac is NULL (this is to work around yet another
broken SRIOV driver), and thus we must refrain from setting MAC
and have to set VLAN tag only.

Fixes: 73961771a1cfec3c0f43caec9d117d2fbcc7af39
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2075383
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirNetDevSetVfMac: Fix error message on invalid args
Michal Privoznik [Fri, 22 Apr 2022 12:15:46 +0000 (14:15 +0200)]
virNetDevSetVfMac: Fix error message on invalid args

If virNetDevSetVfMac() is called with either @macaddr or
@allowRetry arguments NULL an error is reported, because this is
considered invalid use. However, the error message is not
informative as it could be.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoSupport cpu0-id of Qemu QMP query-sev-capabilities
Niteesh Dubey [Wed, 27 Apr 2022 19:57:12 +0000 (19:57 +0000)]
Support cpu0-id of Qemu QMP query-sev-capabilities

It allows libvirt to provide the value of cpu0-id retuned by the Qemu QMP
 command query-sev-capabilities as implemented by the Qemu Patch [1] which
 is merged to Qemu master branch and should be available with Qemu 7.1.
 This is used to get the signed Chip Endorsement Key (CEK) of the CPU of AMD
 system from AMD's Key Distribution Service (KDS).

Similar to  cbitpos, reducedPhysBits, maxGuests & maxESGuests;
 the value of cpu0-id is also provided using 'virsh domcapability'.

[1] https://lore.kernel.org/all/20220228093014.882288-1-dovmurik@linux.ibm.com/

Signed-off-by: Niteesh Dubey <niteesh@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>