]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
2 years agoqemuMigrationSrcBegin: Automatically free 'xml' variable on error
Peter Krempa [Fri, 29 Apr 2022 12:31:43 +0000 (14:31 +0200)]
qemuMigrationSrcBegin: Automatically free 'xml' variable on error

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirObjectLockGuard: Require that returned value is used
Peter Krempa [Thu, 28 Apr 2022 11:16:34 +0000 (13:16 +0200)]
virObjectLockGuard: Require that returned value is used

The returned value is used to unlock the object, so all callers must
necessarily make use of the returned value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirclosecallbacks.h: Reformat header to contemporary style
Peter Krempa [Thu, 28 Apr 2022 08:52:05 +0000 (10:52 +0200)]
virclosecallbacks.h: Reformat header to contemporary style

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: fd: Fix documentation for FD set related functions
Peter Krempa [Tue, 17 May 2022 09:04:40 +0000 (11:04 +0200)]
qemu: fd: Fix documentation for FD set related functions

When dealing with fdsets only we don't need to pass the FD first as we
now generate fdset name directly. Also there are no more caveats in
passing multiple FDs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuFDPassTransferCommand: Remove return value
Peter Krempa [Mon, 16 May 2022 15:17:20 +0000 (17:17 +0200)]
qemuFDPassTransferCommand: Remove return value

Now that the 'direct' mode was separated and thus we don't have any
possible error case we can stop returning any values and simplify
callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: fd: Remove support for 'direct' fd passing from 'qemuFDPass'
Peter Krempa [Mon, 16 May 2022 14:25:31 +0000 (16:25 +0200)]
qemu: fd: Remove support for 'direct' fd passing from 'qemuFDPass'

This finishes the separation of the fdset and direct helpers. Remove
'qemuFDPassNewDirect' and all internals which were applicable only in
direct mode.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuFDPassValidate: Don't validate file descriptors
Peter Krempa [Tue, 17 May 2022 08:32:47 +0000 (10:32 +0200)]
qemuFDPassValidate: Don't validate file descriptors

The callers adding the FDs are validating them regardless so this check
was redundant.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Use 'qemuFDPassDirect' for 'unix' chardevs
Peter Krempa [Mon, 16 May 2022 14:08:18 +0000 (16:08 +0200)]
qemu: Use 'qemuFDPassDirect' for 'unix' chardevs

Unix socket chardevs with FD passing need to use the direct mode so we
need to convert it to use qemuFDPassDirect.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Convert passing of 'slirpfd' to 'qemuFDPassDirect'
Peter Krempa [Mon, 16 May 2022 13:08:05 +0000 (15:08 +0200)]
qemu: Convert passing of 'slirpfd' to 'qemuFDPassDirect'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Convert passing of 'tapfds' to 'qemuFDPassDirect'
Peter Krempa [Mon, 16 May 2022 13:08:05 +0000 (15:08 +0200)]
qemu: Convert passing of 'tapfds' to 'qemuFDPassDirect'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Convert passing of 'vhostfd' to 'qemuFDPassDirect'
Peter Krempa [Mon, 16 May 2022 13:08:05 +0000 (15:08 +0200)]
qemu: Convert passing of 'vhostfd' to 'qemuFDPassDirect'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: fd: Add a distinct set of APIs for 'direct' fd passing mode
Peter Krempa [Mon, 16 May 2022 12:57:57 +0000 (14:57 +0200)]
qemu: fd: Add a distinct set of APIs for 'direct' fd passing mode

Originally I envisioned a common set of APIs for both FD passing
approaches but it turns out they are not really compatible enough for it
to make sense to use one set of APIs.

As of such introduce a distinct set of APIs for the 'direct' mode, which
will later be used to convert all places that currently use
'qemuFDPassNewDirect' and later clean up the existing APIs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: EVENTHANDLERS.txt: Move to kbase and rSTisze
Peter Krempa [Fri, 13 May 2022 11:13:02 +0000 (13:13 +0200)]
qemu: EVENTHANDLERS.txt: Move to kbase and rSTisze

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: MIGRATION.txt: Move to kbase and rSTisze
Peter Krempa [Fri, 13 May 2022 11:13:02 +0000 (13:13 +0200)]
qemu: MIGRATION.txt: Move to kbase and rSTisze

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: THREADS.txt: rSTize and move to knowledge-base
Peter Krempa [Fri, 13 May 2022 11:02:21 +0000 (13:02 +0200)]
qemu: THREADS.txt: rSTize and move to knowledge-base

Move the internal documentation about qemu threading to the knowledge
base.

The conversion included rstizing of the text document, mainly just
fixing of the headline and enclosing function names and code examples
into code block sections.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuBuildCommandLine: Remove 'flags' argument
Peter Krempa [Mon, 16 May 2022 11:55:25 +0000 (13:55 +0200)]
qemuBuildCommandLine: Remove 'flags' argument

The flags are not used for anything.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agoqemuBuildCommandLine: Don't avoid '-S' flag for 'domxml-to-native' conversion
Peter Krempa [Mon, 16 May 2022 11:51:13 +0000 (13:51 +0200)]
qemuBuildCommandLine: Don't avoid '-S' flag for 'domxml-to-native' conversion

The commandline generated from our XML->native convertor is the majority
of cases not usable without libvirt anyways and the situation will not
improve any more.

As of such there's no much utility of avoiding the use of stopped CPUs
flag in such case.

Remove the QEMU_BUILD_COMMAND_LINE_CPUS_RUNNING flag and the associated
logic.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agoqemuBuildCommandLine: Inline qemuCheckFips
Peter Krempa [Mon, 16 May 2022 11:47:28 +0000 (13:47 +0200)]
qemuBuildCommandLine: Inline qemuCheckFips

Now that we store the state of the host FIPS mode setting in the qemu
driver object, we don't need to outsource the logic into
'qemuCheckFips'.

Additionally since we no longer support very old qemu's which would not
yet have --enable-fips we can drop the part of the comment about very
old qemus.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agoqemuBuildCommandLine: Remove 'driver' argument
Peter Krempa [Mon, 16 May 2022 11:32:59 +0000 (13:32 +0200)]
qemuBuildCommandLine: Remove 'driver' argument

We pass 'vm' which already contains it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agoqemuConnectDomainXMLToNative: Refactor cleanup
Peter Krempa [Mon, 16 May 2022 11:27:41 +0000 (13:27 +0200)]
qemuConnectDomainXMLToNative: Refactor cleanup

Automatically free the 'vm' temporary domain object and remove the
'cleanup' label and 'ret' helper variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agoqemuBuildCommandLine: Sanitize debug logging
Peter Krempa [Mon, 16 May 2022 11:20:42 +0000 (13:20 +0200)]
qemuBuildCommandLine: Sanitize debug logging

Improve the debug log inside 'qemuBuildCommandLine' to include the name
from the definition and remove useless data such as the pointer to the
qemuDriver object or qemuCaps.

Additionally remove the non-specific debug statements:

  VIR_DEBUG("Building emulator command line");

from the two callers of qemuBuildCommandLine.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agoqemu: Store state of FIPS in virQEMUDriver
Peter Krempa [Mon, 16 May 2022 10:47:19 +0000 (12:47 +0200)]
qemu: Store state of FIPS in virQEMUDriver

Rather than re-query all the time we can cache the state of FIPS of the
host as it will not change during the runtime of the guest.

Introduce a 'hostFips' flag to 'virQEMUDriver' and move the code
checking the state from 'qemuCheckFips' to 'qemuStateInitialize' and
also populate 'hostFips' in qemuxml2argvtest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agoqemuBuildCommandLine: Convert 'standalone' flag to use 'flags'
Peter Krempa [Mon, 16 May 2022 11:15:22 +0000 (13:15 +0200)]
qemuBuildCommandLine: Convert 'standalone' flag to use 'flags'

Introduce 'qemuBuildCommandLineFlags' and use it instead of specific
flag booleans.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agoqemu: command: Don't hide 'vhost' fds from 'standalone' command line
Peter Krempa [Fri, 13 May 2022 11:49:08 +0000 (13:49 +0200)]
qemu: command: Don't hide 'vhost' fds from 'standalone' command line

We already format a commandline using FD passing for the tap devices so
formatting the 'vhost' file descriptors won't make it any less usable
directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agodocs: drvqemu: Decrease expectations about command line from 'virsh domxml-to-native'
Peter Krempa [Mon, 16 May 2022 11:03:24 +0000 (13:03 +0200)]
docs: drvqemu: Decrease expectations about command line from 'virsh domxml-to-native'

In the qemu driver certain configs such as disk throttling or CPU
hotplug is configured by interacting with the monitor at the startup
phase of the hypervisor and thus is not part of the "native config".

Add a paragraph into the documentation outlining that the native
configuration might not be completely usable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agovirConnectDomainXMLToNative: Add note about dynamically configured features
Peter Krempa [Mon, 16 May 2022 10:56:22 +0000 (12:56 +0200)]
virConnectDomainXMLToNative: Add note about dynamically configured features

In the qemu driver certain configs such as disk throttling or CPU
hotplug is configured by interacting with the monitor at the startup
phase of the hypervisor and thus is not part of the "native config" as
returned by 'virConnectDomainXMLToNative'.

Similarly at least the commandline for qemu contains resources passed
via file descriptors which are obviously not part of the returned
"native config".

Add a paragraph into the documentation outlining that the native
configuration might not be completely usable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agoqemu: Implement 'absolute' clock offset mode
Peter Krempa [Tue, 26 Apr 2022 15:21:51 +0000 (17:21 +0200)]
qemu: Implement 'absolute' clock offset mode

Add support for the mode and add the corresponding qemuxml2argv test
case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoconf: Introduce 'absolute' clock offset
Peter Krempa [Tue, 26 Apr 2022 15:00:36 +0000 (17:00 +0200)]
conf: Introduce 'absolute' clock offset

The 'absolute' clock offset type has a 'start' attribute which is an
unix epoch timestamp to which the hardware clock is always set at start
of the VM.

This is useful if some VM needs to be kept set to an arbitrary time for
e.g. testing or working around broken software.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoTranslated using Weblate (Korean)
김인수 [Sat, 14 May 2022 13:18:39 +0000 (15: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 agoutil: Remove virCommandPassFDIndex()
Jonathon Jongsma [Fri, 13 May 2022 19:14:32 +0000 (14:14 -0500)]
util: Remove virCommandPassFDIndex()

The last use of this function was removed in commit 6d161bcc, so the
function is no longer used except as an internal implementation for
virCommandPassFD().

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoutil: remove virCommandPassFDGetFDIndex()
Jonathon Jongsma [Fri, 13 May 2022 18:33:56 +0000 (13:33 -0500)]
util: remove virCommandPassFDGetFDIndex()

commit f9236200 removed the last use of this function, so it can be
dropped.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agoconf: Fix smm=off handling
Andrea Bolognani [Fri, 13 May 2022 14:09:30 +0000 (16:09 +0200)]
conf: Fix smm=off handling

We have to always store the state of the feature in the
virDomainDef struct, otherwise

  <smm state='off'/>

will incorrectly be interpreted as if the <smm> element was not
present.

Fixes: eeb94215b074a71b3c8932d5fcaf657f269b2c82
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: Introduce smm=off test
Andrea Bolognani [Fri, 13 May 2022 14:05:26 +0000 (16:05 +0200)]
tests: Introduce smm=off test

This complements the existing smm=on tests. Looking at the output
files, one can immediately see how this case is currently not being
handled correctly. We're going to fix that in the next commit.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: Update smm=on test
Andrea Bolognani [Fri, 13 May 2022 14:00:09 +0000 (16:00 +0200)]
tests: Update smm=on test

Use DO_TEST_CAPS_LATEST() instead of hardcoding capabilities and
add the xml2xml part, which was missing; finally, rename it to
accomodate the complementary smm=off test that we're about to
introduce.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: slirp: Remove unused 'qemuSlirpGetFD'
Peter Krempa [Tue, 10 May 2022 14:53:08 +0000 (16:53 +0200)]
qemu: slirp: Remove unused 'qemuSlirpGetFD'

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 unneeded 'slirp' variables and useless debug
Peter Krempa [Tue, 10 May 2022 14:50:58 +0000 (16:50 +0200)]
qemuMonitorAddNetdev: Remove unneeded 'slirp' variables and useless debug

None of the callers now uses the slirp fd passing feature, so it can be
removed.

At this point even the VIR_DEBUG doesn't make sense as it would only log
the pointer of 'props'.

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: Clean up unneeded 'slirp' helper variables
Peter Krempa [Tue, 10 May 2022 14:48:35 +0000 (16:48 +0200)]
qemuDomainAttachNetDevice: Clean up unneeded 'slirp' helper variables

We don't need 'slirpfdName' and 'slirpfd'. The 'slirp' local can be
removed too as qemuSlirpStart is safe to be called if there's nothing to
do.

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: slirp: Pass FDs to qemu via qemuFDPass in the network private data
Peter Krempa [Tue, 10 May 2022 14:45:12 +0000 (16:45 +0200)]
qemu: slirp: Pass FDs to qemu via qemuFDPass in the network private data

Populate the 'slirpfd' qemuFDPass structure inside the private data for
passing the fd to qemu rather than using out-of-band variables.

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: slirp: Call qemuSlirpOpen directly from qemuSlirpStart
Peter Krempa [Tue, 10 May 2022 14:32:27 +0000 (16:32 +0200)]
qemu: slirp: Call qemuSlirpOpen directly from qemuSlirpStart

No need to ask the callers to call this extra function.

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 agoqemuSlirpStart: Simplify parameters
Peter Krempa [Tue, 10 May 2022 14:28:52 +0000 (16:28 +0200)]
qemuSlirpStart: Simplify parameters

The 'driver' can be taken from the private data of 'vm' and 'slirp' can
be taken from private data of 'net', both of which we need anyways.

Additionally by checking whether slirp needs to be started inside the
function we don't need to do this logic in the callers.

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 agoqemuInterfacePrepareSlirp: Directly populate the 'slirp' variable in network private...
Peter Krempa [Tue, 10 May 2022 14:17:17 +0000 (16:17 +0200)]
qemuInterfacePrepareSlirp: Directly populate the 'slirp' variable in network private data

Both callers populate the variable when qemuInterfacePrepareSlirp
returned 1. We can save the hassle in the callers by just doing it right
away.

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 unused 'tapfd' infrastructure
Peter Krempa [Tue, 10 May 2022 13:55:13 +0000 (15:55 +0200)]
qemuMonitorAddNetdev: Remove unused 'tapfd' infrastructure

All callers pass NULL/0.

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: Remove unused 'tapfd' infrastructure
Peter Krempa [Tue, 10 May 2022 13:52:50 +0000 (15:52 +0200)]
qemuBuildNicDevProps: Remove unused 'tapfd' infrastructure

All callers pass NULL/0.

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 unused 'tapfd' infrastructure
Peter Krempa [Tue, 10 May 2022 13:49:14 +0000 (15:49 +0200)]
qemuDomainAttachNetDevice: Remove unused '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 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>