]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
3 years agoqemuProcessPrepareHost: Create domain private dirs as early as possible
Michal Privoznik [Mon, 13 Dec 2021 11:17:14 +0000 (12:17 +0100)]
qemuProcessPrepareHost: Create domain private dirs as early as possible

As of ff024b60cc3 we are opening chardevs before starting QEMU.
However, we are also doing that before domain private directories
are created. This leaves us unable to create guest agent socket
which lives under priv->channelTargetDir.

While creating the dirs can be moved just before
qemuProcessPrepareHostBackendChardev() it's better to do it as
the very first step so that this kind of error is prevented in
future.

Fixes: ff024b60cc39d5d41b1e68728a00a47e103ec4dd
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoRevert "virt-ssh-helper: Add manual page"
Ján Tomko [Fri, 10 Dec 2021 22:07:48 +0000 (23:07 +0100)]
Revert "virt-ssh-helper: Add manual page"

This was pushed by mistake with incorrect claim of my R-b.

This reverts commit dadcd352604d9a4620a8a1d714e6324818cf9246.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
3 years agovirt-pki-query-dn: Add manual page
Andrea Bolognani [Thu, 9 Dec 2021 17:36:34 +0000 (18:36 +0100)]
virt-pki-query-dn: Add manual page

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirt-qemu-run: Improve manual page
Andrea Bolognani [Fri, 10 Dec 2021 10:05:54 +0000 (11:05 +0100)]
virt-qemu-run: Improve manual page

Specifically:

  * use the correct notation and markup for commands, options
    and arguments;
  * rename arguments meta-variables to be more descriptive;
  * sort options so that the most common ones come first;
  * use consistent vertical spacing;
  * fix a typo.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirt-qemu-run: Improve usage information
Andrea Bolognani [Fri, 10 Dec 2021 10:56:31 +0000 (11:56 +0100)]
virt-qemu-run: Improve usage information

Specifically, include non-option argument 'GUEST-XML-FILE'
in usage summary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirt-ssh-helper: Add manual page
Andrea Bolognani [Fri, 10 Dec 2021 14:56:29 +0000 (15:56 +0100)]
virt-ssh-helper: Add manual page

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirt-ssh-helper: Improve usage information
Andrea Bolognani [Fri, 10 Dec 2021 10:59:33 +0000 (11:59 +0100)]
virt-ssh-helper: Improve usage information

Specifically:

  * include non-option argument 'URI' in usage summary;
  * mention that it's an internal tool not meant to be
    called directly;
  * exit earlier if required arguments are absent.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirt-ssh-helper: Don't use optind
Andrea Bolognani [Fri, 10 Dec 2021 13:53:31 +0000 (14:53 +0100)]
virt-ssh-helper: Don't use optind

It's a getopt interface and we're not using getopt, at least
directly, so even though it works relying on it feels wrong.

GOption takes care of removing any trace of the arguments it
consumes from argc and argv, leaving behind only non-option
arguments, so we can just use those standard variables.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Enable unprivileged userfaultfd for post-copy migration
Jiri Denemark [Thu, 2 Dec 2021 14:43:27 +0000 (15:43 +0100)]
qemu: Enable unprivileged userfaultfd for post-copy migration

Userfaultfd is by default allowed only for privileged processes. Since
libvirt runs QEMU unprivileged, we need to enable unprivileged access to
userfaultfd to enable post-copy migration.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu: command: Use 'qemuBuildChrChardevCommand' to build TPM backend
Peter Krempa [Fri, 5 Nov 2021 16:12:37 +0000 (17:12 +0100)]
qemu: command: Use 'qemuBuildChrChardevCommand' to build TPM backend

Since the backend of the TPM is a chardev we can use the common helper
to instantiate it.

This commit also ensures proper ordering so that the backend chardev is
formatted before it's being referenced.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Implement chardev source setup for tpm
Peter Krempa [Wed, 8 Dec 2021 09:07:44 +0000 (10:07 +0100)]
qemu: Implement chardev source setup for tpm

Add handling to qemuDomainDeviceBackendChardevForeachOne and callbacks
so that we can later use 'qemuBuildChardevCommand' for TPM devices.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Use qemuBuildChrChardevCommand for vhost-user-gpu backend chardev
Peter Krempa [Fri, 5 Nov 2021 14:40:40 +0000 (15:40 +0100)]
qemu: Use qemuBuildChrChardevCommand for vhost-user-gpu backend chardev

Now that the API for qemuBuildChrChardevCommand is sane enough, we can
use it to centralize formatting of '-chardev' generally.

The 'virDomainVideoDef' doesn't use 'virDomainChrSourceDef' internally so
we create it for this occasion manually.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Use qemuBuildChrChardevCommand for virtiofs backend chardev
Peter Krempa [Fri, 5 Nov 2021 14:40:40 +0000 (15:40 +0100)]
qemu: Use qemuBuildChrChardevCommand for virtiofs backend chardev

Now that the API for qemuBuildChrChardevCommand is sane enough, we can
use it to centralize formatting of '-chardev' generally.

The 'virDomainFSDef' doesn't use 'virDomainChrSourceDef' internally so
we create it for this occasion manually.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Use qemuBuildChrChardevCommand for vhost-user disk backend
Peter Krempa [Thu, 4 Nov 2021 16:12:13 +0000 (17:12 +0100)]
qemu: Use qemuBuildChrChardevCommand for vhost-user disk backend

Now that the API for qemuBuildChrChardevCommand is sane enough, we can
use it to centralize formatting of '-chardev' generally.

For virtiofs we don't have a centrally stored chardev source so we
allocate one inline for temporary use.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Implement chardev source setup for disk
Peter Krempa [Wed, 8 Dec 2021 09:07:44 +0000 (10:07 +0100)]
qemu: Implement chardev source setup for disk

Add handling to qemuDomainDeviceBackendChardevForeachOne and callbacks
so that we can later use 'qemuBuildChardevCommand' for vhost-user disks
instead of a custom formatter.

Since we don't pass the FD for the vhost-user connection to qemu all of
the setup can be skipped.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuBuildChardevCommand: Remove unused 'cfg' parameter
Peter Krempa [Mon, 22 Nov 2021 13:46:24 +0000 (14:46 +0100)]
qemuBuildChardevCommand: Remove unused 'cfg' parameter

Now that the parameter is unused we can remove it as well as from each
caller that doesn't need it any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Store TLS config options for chardevs in qemuDomainChrSourcePrivate
Peter Krempa [Mon, 22 Nov 2021 13:41:23 +0000 (14:41 +0100)]
qemu: Store TLS config options for chardevs in qemuDomainChrSourcePrivate

When setting up TLS options from config in qemuDomainPrepareChardevSourceOne
we can also extract the x509 certificate path and default tlsVerify
setting so that 'qemuBuildChardevCommand' doesn't need to access the
config object any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuBuildChardevCommand: Split creation of the command and setup of other objects
Peter Krempa [Fri, 19 Nov 2021 16:35:21 +0000 (17:35 +0100)]
qemuBuildChardevCommand: Split creation of the command and setup of other objects

Completely seprate the creation of the commandline string from the setup
of other objects instantiated on the commandline.

'qemuBuildChardevCommand' will aggregate the setup of individual
parameters such as -add-fd and setup of TLS and the -chardev parameter
itself while the code formatting the commandline will be moved into
qemuBuildChardevStr.

'fdset' names are then stored in qemuDomainChrSourcePrivate.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuBuildChardevCommand: Don't prefix alias
Peter Krempa [Fri, 5 Nov 2021 14:28:43 +0000 (15:28 +0100)]
qemuBuildChardevCommand: Don't prefix alias

Make the callers construct the alias for the chardev so that the
function can be used also for code paths which use a different
convention.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuBuildChardevCommand: Move earlier
Peter Krempa [Thu, 4 Nov 2021 16:04:37 +0000 (17:04 +0100)]
qemuBuildChardevCommand: Move earlier

Make it accessible sooner inside qemu_command.c

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuBuildChrChardevStr: Directly generate command line
Peter Krempa [Thu, 4 Nov 2021 12:59:47 +0000 (13:59 +0100)]
qemuBuildChrChardevStr: Directly generate command line

'qemuBuildChrChardevStr' used a hybrid approach where some arguments
were directly added to '@cmd' while the commandline itself was returned
as a string.

This patch renames qemuBuildChrChardevStr to qemuBuildChardevCommand
and adds the argument directly to @cmd inside the function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuBuildConsoleCommandLine: Remove identical code
Peter Krempa [Thu, 4 Nov 2021 13:12:05 +0000 (14:12 +0100)]
qemuBuildConsoleCommandLine: Remove identical code

Unify the cases for SCLP/SCLPLM/VIRTIO consoles as the code is
identical.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2argvtest: Add _LATEST version for 'name-escape' case
Peter Krempa [Mon, 15 Nov 2021 16:00:56 +0000 (17:00 +0100)]
qemuxml2argvtest: Add _LATEST version for 'name-escape' case

It was impossible to use _LATEST when commit d7c814f7f75 was modernizing
the cases as improper separation in the code caused that files were
created in the host during the testsuite run.

Now that the host manipulation when instantiating chardevs is separated
we can add the missing version.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2argvtest: Add DO_TEST_CAPS_LATEST versions for all character device tests
Peter Krempa [Tue, 26 Oct 2021 12:38:41 +0000 (14:38 +0200)]
qemuxml2argvtest: Add DO_TEST_CAPS_LATEST versions for all character device tests

Now that the test cases won't cause host modification we can add the
contemporary versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuBuildChrChardevStr: Remove unused arguments and clean up callers
Peter Krempa [Thu, 4 Nov 2021 09:51:34 +0000 (10:51 +0100)]
qemuBuildChrChardevStr: Remove unused arguments and clean up callers

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuBuildChrChardevStr: Remove 'cdevflags' argument
Peter Krempa [Wed, 3 Nov 2021 15:42:31 +0000 (16:42 +0100)]
qemuBuildChrChardevStr: Remove 'cdevflags' argument

The argument and corresponding enum are not used any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Store chardev 'wait' flag in chardev source private data
Peter Krempa [Wed, 3 Nov 2021 13:12:16 +0000 (14:12 +0100)]
qemu: Store chardev 'wait' flag in chardev source private data

We have just one case when we wish to wait for incomming connections for
a listening socket and that is for vhost-user network devices.

Passing this via a flag to qemuBuildChrChardevStr is unwieldy. Add a
field to qemuDomainChrSourcePrivate and populate it for our special
case inside of qemuDomainPrepareChardevSourceOne.

Since we wait for incomming connections only on startup of a new VM we
also need to pass in a flag whether qemuDomainPrepareChardevSourceOne
is called on a new start or on hotplug.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: domain: Refactor chardev definition preparing
Peter Krempa [Thu, 18 Nov 2021 14:16:20 +0000 (15:16 +0100)]
qemu: domain: Refactor chardev definition preparing

Use the qemuDomainDeviceBackendChardevForeach helper to iterate all
eligible structs and convert the setup of the TLS defaults from the
config.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: command: remove the unused 'chardevStdioLogd' argument/variable
Peter Krempa [Wed, 3 Nov 2021 12:59:41 +0000 (13:59 +0100)]
qemu: command: remove the unused 'chardevStdioLogd' argument/variable

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: command: Remove unused QEMU_BUILD_CHARDEV_FILE_LOGD and QEMU_BUILD_CHARDEV_UNIX...
Peter Krempa [Wed, 3 Nov 2021 12:24:24 +0000 (13:24 +0100)]
qemu: command: Remove unused QEMU_BUILD_CHARDEV_FILE_LOGD and QEMU_BUILD_CHARDEV_UNIX_FD_PASS

'qemuBuildChrChardevStr' doesn't use these flags any more. Stop passing
them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Move creation and opening of chardev backend FDs to host prepare step
Peter Krempa [Mon, 25 Oct 2021 10:42:16 +0000 (12:42 +0200)]
qemu: Move creation and opening of chardev backend FDs to host prepare step

The opening of files for FD passing for a chardev backend was
historically done in the function which is formatting the commandline.

This has multiple problems. Firstly the function takes a lot of
parameters which need to be passed through the commandline formatters.
This made the 'qemuBuildChrChardevStr' extremely unappealing to the
extent that we have multiple other custom formatters in places which
didn't really want to use the function.

Additionally the function is also creating files in the host in certain
configurations which is wrong for a commandline formatter to do. This
meant that e.g. not all chardev test cases can be converted to use
DO_TEST_CAPS_LATEST as we attempt to use such code path and attempt to
create files outside of the test directory.

This patch moves the opening of the filedescriptors from
'qemuBuildChrChardevFileStr' into a new helper
'qemuProcessPrepareHostBackendChardevOne' which is called using
'qemuDomainDeviceBackendChardevForeach'.

To preserve test behaviour we also have another instance
'testPrepareHostBackendChardevOne' which is populating mock
filedescriptors.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: domain: Introduce helpers for initializing chardev backend of devices
Peter Krempa [Tue, 2 Nov 2021 13:15:58 +0000 (14:15 +0100)]
qemu: domain: Introduce helpers for initializing chardev backend of devices

Introduce qemuDomainDeviceBackendChardevForeach(One) which calls the
callback if either given device has a chardev backend or for all chardev
backends of all devices.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainDeviceInfoIterateFlags: Export the symbol
Peter Krempa [Tue, 2 Nov 2021 13:15:10 +0000 (14:15 +0100)]
virDomainDeviceInfoIterateFlags: Export the symbol

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirHostCPUGetInfoPopulateLinux: Use automatic memory freeing for virBitmap
Peter Krempa [Tue, 7 Dec 2021 15:34:00 +0000 (16:34 +0100)]
virHostCPUGetInfoPopulateLinux: Use automatic memory freeing for virBitmap

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirt-host-validate-qemu: Use automatic memory freeing for virBitmap
Peter Krempa [Tue, 7 Dec 2021 15:34:00 +0000 (16:34 +0100)]
virt-host-validate-qemu: Use automatic memory freeing for virBitmap

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirt-host-validate-common: Use automatic memory freeing for virBitmap
Peter Krempa [Tue, 7 Dec 2021 15:34:00 +0000 (16:34 +0100)]
virt-host-validate-common: Use automatic memory freeing for virBitmap

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirLXCControllerSetup(Resource|Cgroup)Limits: Refactor cleanup
Peter Krempa [Tue, 7 Dec 2021 15:35:24 +0000 (16:35 +0100)]
virLXCControllerSetup(Resource|Cgroup)Limits: Refactor cleanup

Remove the pointless cleanup sections.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolxc_controller: Use automatic memory freeing for virBitmap
Peter Krempa [Tue, 7 Dec 2021 15:34:00 +0000 (16:34 +0100)]
lxc_controller: Use automatic memory freeing for virBitmap

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolibxlDomainGetNumaParameters: Don't clear a freshly allocated bitmap
Peter Krempa [Tue, 7 Dec 2021 15:18:24 +0000 (16:18 +0100)]
libxlDomainGetNumaParameters: Don't clear a freshly allocated bitmap

The bitmap is allocated just above the explicit clear, so it's already
empty.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolibxl_driver: Use automatic memory freeing for virBitmap
Peter Krempa [Tue, 7 Dec 2021 15:17:38 +0000 (16:17 +0100)]
libxl_driver: Use automatic memory freeing for virBitmap

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolxcSetCpusetTune: Refactor memory clearing
Peter Krempa [Tue, 7 Dec 2021 15:12:34 +0000 (16:12 +0100)]
lxcSetCpusetTune: Refactor memory clearing

Use automatic memory clearing for virBitmap and remove a reuse of a
temporary string.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotest_driver: Use automatic memory freeing for temporary virBitmaps
Peter Krempa [Tue, 7 Dec 2021 15:08:07 +0000 (16:08 +0100)]
test_driver: Use automatic memory freeing for temporary virBitmaps

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoutil: bitmap: Unify parsing of bitmaps
Peter Krempa [Mon, 6 Dec 2021 15:28:44 +0000 (16:28 +0100)]
util: bitmap: Unify parsing of bitmaps

There were two separate instances of string->virBitmap code:
virBitmapParseInternal and virBitmapParseUnlimited.

By adding a flag to switch to expanding APIs we can merge the two
implementations into one.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirBitmapParseInternal: Allocate the bitmap in the caller
Peter Krempa [Mon, 6 Dec 2021 15:18:57 +0000 (16:18 +0100)]
virBitmapParseInternal: Allocate the bitmap in the caller

In order to prepare for reuse of the function, move the allocation of
the bitmap to the caller.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirBitmapParseSeparator: Remove separator parsing capability
Peter Krempa [Mon, 6 Dec 2021 15:16:18 +0000 (16:16 +0100)]
virBitmapParseSeparator: Remove separator parsing capability

Since the feature is not needed remove it and remove the function to
virBitmapParseInternal.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirBitmapSetBitExpand: Remove return value
Peter Krempa [Mon, 6 Dec 2021 14:55:46 +0000 (15:55 +0100)]
virBitmapSetBitExpand: Remove return value

The function can't fail at this point. Remove the return value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirBitmapClearBitExpand: Remove return value
Peter Krempa [Mon, 6 Dec 2021 14:55:46 +0000 (15:55 +0100)]
virBitmapClearBitExpand: Remove return value

The function can't fail at this point. Remove the return value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirBitmapUnion: Remove return value
Peter Krempa [Mon, 6 Dec 2021 14:55:46 +0000 (15:55 +0100)]
virBitmapUnion: Remove return value

The function can't fail at this point. Remove the return value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirBitmapExpand: Remove return value
Peter Krempa [Mon, 6 Dec 2021 14:53:27 +0000 (15:53 +0100)]
virBitmapExpand: Remove return value

There's nothing that can fail in the function. Remove the return value
and adjust callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoutil: bitmap: Unexport 'virBitmapParseSeparator'
Peter Krempa [Mon, 6 Dec 2021 14:47:00 +0000 (15:47 +0100)]
util: bitmap: Unexport 'virBitmapParseSeparator'

The function isn't used besides tests. Since the separator parsing
capability is trivial we can keep it in place and just unexport it for
now.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotest_virCapabilitiesGetCpusForNodemask: Refactor cleanup
Peter Krempa [Tue, 7 Dec 2021 16:22:26 +0000 (17:22 +0100)]
test_virCapabilitiesGetCpusForNodemask: Refactor cleanup

Use automatic memory freeing for the temporary bitmap and remove the
pointless 'cleanup' section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirnumamock: Use automatic memory freeing for virBitmap
Peter Krempa [Mon, 6 Dec 2021 13:10:40 +0000 (14:10 +0100)]
virnumamock: Use automatic memory freeing for virBitmap

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirshParseCPUList: Refactor cleanup
Peter Krempa [Tue, 7 Dec 2021 16:22:26 +0000 (17:22 +0100)]
virshParseCPUList: Refactor cleanup

Use automatic memory freeing for the temporary bitmap and remove the
pointless 'cleanup' section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirCgroupGetPercpuStats: Refactor cleanup
Peter Krempa [Tue, 7 Dec 2021 16:22:26 +0000 (17:22 +0100)]
virCgroupGetPercpuStats: Refactor cleanup

Use automatic memory freeing for the temporary bitmap and remove the
pointless 'cleanup' section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirHostCPUParseNode: Use automatic memory freeing for virBitmap
Peter Krempa [Mon, 6 Dec 2021 12:21:37 +0000 (13:21 +0100)]
virHostCPUParseNode: Use automatic memory freeing for virBitmap

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirHostCPUHasValidSubcoreConfiguration: Refactor cleanup
Peter Krempa [Tue, 7 Dec 2021 16:22:26 +0000 (17:22 +0100)]
virHostCPUHasValidSubcoreConfiguration: Refactor cleanup

Use automatic memory freeing for the temporary bitmap and remove the
pointless 'cleanup' section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirHostCPUCountThreadSiblings: Refactor cleanup
Peter Krempa [Tue, 7 Dec 2021 16:22:26 +0000 (17:22 +0100)]
virHostCPUCountThreadSiblings: Refactor cleanup

Use automatic memory freeing for the temporary bitmap and remove the
pointless 'cleanup' section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuSnapshotCreateInactiveExternal: Automatically free temporary variables
Peter Krempa [Tue, 7 Dec 2021 16:24:48 +0000 (17:24 +0100)]
qemuSnapshotCreateInactiveExternal: Automatically free temporary variables

Automatically free 'cmd' and 'created' by moving them to the appropriate
scopes.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuProcessValidateHotpluggableVcpus: Refactor cleanup
Peter Krempa [Tue, 7 Dec 2021 16:22:26 +0000 (17:22 +0100)]
qemuProcessValidateHotpluggableVcpus: Refactor cleanup

Use automatic memory freeing for the temporary bitmap and remove the
pointless 'cleanup' section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuDomainSetVcpuInternal: Refactor cleanup
Peter Krempa [Tue, 7 Dec 2021 16:22:26 +0000 (17:22 +0100)]
qemuDomainSetVcpuInternal: Refactor cleanup

Use automatic memory freeing for the temporary bitmap and remove the
pointless 'cleanup' section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuDomainSetVcpusInternal: Refactor cleanup
Peter Krempa [Tue, 7 Dec 2021 16:22:26 +0000 (17:22 +0100)]
qemuDomainSetVcpusInternal: Refactor cleanup

Use automatic memory freeing for the temporary bitmap and remove the
pointless 'cleanup' section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuDomainSelectHotplugVcpuEntities: Refactor cleanup
Peter Krempa [Tue, 7 Dec 2021 16:22:26 +0000 (17:22 +0100)]
qemuDomainSelectHotplugVcpuEntities: Refactor cleanup

Use automatic memory freeing for the 'ret' bitmap and remove the
pointless 'cleanup' section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: driver: Automatically free temporary virBitmap-s
Peter Krempa [Tue, 7 Dec 2021 16:21:17 +0000 (17:21 +0100)]
qemu: driver: Automatically free temporary virBitmap-s

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuDomainAssignMemorySlots: Refactor cleanup
Peter Krempa [Tue, 7 Dec 2021 16:20:46 +0000 (17:20 +0100)]
qemuDomainAssignMemorySlots: Refactor cleanup

Automatically free the 'slotmap' bitmap and get rid of the cleanup
section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainDriverGetIOThreadsConfig: Automatically free virBitmap
Peter Krempa [Tue, 7 Dec 2021 16:18:46 +0000 (17:18 +0100)]
virDomainDriverGetIOThreadsConfig: Automatically free virBitmap

Use g_autoptr for the temp bitmap. To achieve this the variable must be
moved down to the appropriate scope.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainNumatuneParseXML: Refactor cleanup
Peter Krempa [Tue, 7 Dec 2021 16:17:13 +0000 (17:17 +0100)]
virDomainNumatuneParseXML: Refactor cleanup

Use automatic memory clearing for the temporary strings and bitmap and
remove the cleanup section. There are multiple temporary strings added
so that we don't reuse one.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainSchedulerParse: Refactor cleanup
Peter Krempa [Tue, 7 Dec 2021 16:16:14 +0000 (17:16 +0100)]
virDomainSchedulerParse: Refactor cleanup

Automatically free the 'ret' temporary bitmap and get rid of the cleanup
section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoconf: capabilities: Clean up freeing of virBitmap
Peter Krempa [Tue, 7 Dec 2021 16:15:18 +0000 (17:15 +0100)]
conf: capabilities: Clean up freeing of virBitmap

Use automatic freeing where possible and use g_clear_pointer instead of
manual NULL-ing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirCapabilitiesInitCaches: Refactor freeing of temporary variables
Peter Krempa [Tue, 7 Dec 2021 16:13:50 +0000 (17:13 +0100)]
virCapabilitiesInitCaches: Refactor freeing of temporary variables

Move the 'path' and 'type' variables down to the appropriate block and
use automatic freeing for them as well as the temporary virBitmap.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoRevert "lxc: controller: Fix container launch on cgroup v1"
Michal Privoznik [Fri, 10 Dec 2021 12:46:54 +0000 (13:46 +0100)]
Revert "lxc: controller: Fix container launch on cgroup v1"

Unfortunately, this fix breakes machinectl in a very nasty way,
for instance 'machinectl shell' drops into the host shell. It's
worse than being unable to start a container with CGroupsV1.

Revert until a proper fix is figured out.

This reverts commit 1b9ce05ce241a581d4e80228c92ceb0266f21f94.

References: https://gitlab.com/libvirt/libvirt/-/issues/182
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agoremote: Avoid crash in remoteSplitURIScheme()
Andrea Bolognani [Fri, 10 Dec 2021 09:54:54 +0000 (10:54 +0100)]
remote: Avoid crash in remoteSplitURIScheme()

We need to make sure the URI scheme is present before passing
it to strchr(), otherwise we're going to get

  $ virt-ssh-helper foo
  Segmentation fault (core dumped)

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoRevert "qemu: Avoid crash in qemuStateShutdownPrepare() and qemuStateShutdownWait()"
Michal Privoznik [Thu, 9 Dec 2021 14:29:27 +0000 (15:29 +0100)]
Revert "qemu: Avoid crash in qemuStateShutdownPrepare() and qemuStateShutdownWait()"

This reverts commit 69977ff10560a80bcf5bf93f1a3f819a2d1623ca.

After previous commit it's no longer possible that QEMU driver is
not initialized in qemuStateShutdownPrepare() nor
qemuStateShutdownWait().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoremote_daemon: Set shutdown callbacks only after init is done
Michal Privoznik [Thu, 9 Dec 2021 14:29:43 +0000 (15:29 +0100)]
remote_daemon: Set shutdown callbacks only after init is done

The initialization of drivers happens in a separate thread.
However, the main thread continues initialization and sets
shutdown callbacks (virStateShutdownPrepare() and
virStateShutdownWait()) even though the driver init thread is
still running. This is dangerous because if the daemon decides to
quit early (e.g. because SIGINT was delivered) the
shutdownPrepare and shutdownWait callback are called over
partially init drivers.

Set callbacks only after all drivers were initialized.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/218
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2027400

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoqemu_monitor_json.h: Unify header formatting
Peter Krempa [Thu, 9 Dec 2021 16:34:46 +0000 (17:34 +0100)]
qemu_monitor_json.h: Unify header formatting

Use the modern style and fix all offenders since new functions were
already using the contemporary style.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuValidateDomainDeviceDefDiskFrontend: Aggregate disk iomode validation
Peter Krempa [Tue, 7 Dec 2021 12:51:00 +0000 (13:51 +0100)]
qemuValidateDomainDeviceDefDiskFrontend: Aggregate disk iomode validation

Move the two checks under a common block.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuValidateDomainDeviceDefDiskFrontend: Fix error message if io='native' is unsupported
Peter Krempa [Tue, 7 Dec 2021 12:53:30 +0000 (13:53 +0100)]
qemuValidateDomainDeviceDefDiskFrontend: Fix error message if io='native' is unsupported

The error is a hard error, so the part about fallback doesn't make
sense. Spell the attribute the same way as it's in XML.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: Update more links to point to the new Go modules
Andrea Bolognani [Thu, 9 Dec 2021 11:15:49 +0000 (12:15 +0100)]
docs: Update more links to point to the new Go modules

A couple of links were still pointing to the obsolete Go
packages instead of the current module-aware ones.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
3 years agoNEWS: Fix spacing between releases
Andrea Bolognani [Wed, 8 Dec 2021 16:42:47 +0000 (17:42 +0100)]
NEWS: Fix spacing between releases

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
3 years agoqemu: do not compare missing cpu data
Ján Tomko [Wed, 8 Dec 2021 12:13:35 +0000 (13:13 +0100)]
qemu: do not compare missing cpu data

For x86, we invalidate qemu caps cache if the host CPUID changed.
However other cpu drivers do not have the 'getHostData' function
implemented.

Skip the comparison if we do not have host CPUData available,
since virCPUDataIsIdentical always returns an error in that case.

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

Fixes: 3bc6f46d305ed82f7314ffc4c2a66847b831a6bd
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
3 years agoNEWS: Mention synchronous copy job additions
Peter Krempa [Thu, 2 Dec 2021 16:35:05 +0000 (17:35 +0100)]
NEWS: Mention synchronous copy job additions

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: migration: Add a paragraph about non-shared storage migration
Peter Krempa [Thu, 2 Dec 2021 15:36:01 +0000 (16:36 +0100)]
docs: migration: Add a paragraph about non-shared storage migration

Outline some of the basics and the caveats of the non-shared migration
code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: Convert 'migration' doc to RST
Peter Krempa [Wed, 1 Dec 2021 15:30:34 +0000 (16:30 +0100)]
docs: Convert 'migration' doc to RST

After conversion the table doesn't have to custom colors, but otherwise
seems to hold well.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: migration: Implement VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES
Peter Krempa [Thu, 2 Dec 2021 15:54:57 +0000 (16:54 +0100)]
qemu: migration: Implement VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES

Use it to enable the 'write-blocking' mode of 'blockdev-mirror'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainMigrate: Introduce VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES flag
Peter Krempa [Wed, 1 Dec 2021 15:21:29 +0000 (16:21 +0100)]
virDomainMigrate: Introduce VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES flag

Non-shared storage migration of guests which are disk I/O intensive and
have fast local storage may actually never converge if the guest happens
to dirty the disk faster than it can be copied.

This patch introduces a new flag
'VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES' which will instruct
hypervisors to synchronize local I/O writes with the writes to remote
storage used for migration so that the guest can't overwhelm the
migration. This comes at a cost of decreased local I/O performance for
guests which behave well on average.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoVIR_REQUIRE_FLAG_(GOTO|RET): Add parens around arguments in expansion
Peter Krempa [Thu, 2 Dec 2021 09:48:54 +0000 (10:48 +0100)]
VIR_REQUIRE_FLAG_(GOTO|RET): Add parens around arguments in expansion

Make the macro useful also for cases when one of multiple flags is
required.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoman: virsh: Separate paragraphs describing distinct flags
Peter Krempa [Thu, 2 Dec 2021 12:33:55 +0000 (13:33 +0100)]
man: virsh: Separate paragraphs describing distinct flags

Separate the paragraphs where the topic changes to simplify further
additions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoinclude: virDomainMigrateFlags: Remove "block alignment" whitespace
Peter Krempa [Wed, 1 Dec 2021 14:39:07 +0000 (15:39 +0100)]
include: virDomainMigrateFlags: Remove "block alignment" whitespace

Using whitespace to align the '=' and values doesn't make sense for the
virDomainMigrateFlags enum as the visual block is interrupted by
comments.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuDomainBlockCopy: Implement VIR_DOMAIN_BLOCK_COPY_SYNCHRONOUS_WRITES
Peter Krempa [Wed, 1 Dec 2021 14:15:34 +0000 (15:15 +0100)]
qemuDomainBlockCopy: Implement VIR_DOMAIN_BLOCK_COPY_SYNCHRONOUS_WRITES

Wire up the flag to enable the 'write-blocking' 'copy-mode' of
'blockdev-mirror'.

It's not supported by all qemu versions but it is with those which we
use -blockdev with so we can use that instead of adding another custom
capability as we use blockdev for some time now.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainBlockCopy: Introduce VIR_DOMAIN_BLOCK_COPY_SYNCHRONOUS_WRITES flag
Peter Krempa [Wed, 1 Dec 2021 14:09:45 +0000 (15:09 +0100)]
virDomainBlockCopy: Introduce VIR_DOMAIN_BLOCK_COPY_SYNCHRONOUS_WRITES flag

In cases when the destination storage is slower than the normal VM
storage and the VM does intensive I/O to the disk a block copy job may
never converge.

Switching it to synchronous mode will ensure that all writes done by the
guest are propagated to the destination at the cost of slowing down I/O
of the guest to the synchronous speed.

This patch adds the new API flag and implements virsh support.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoinclude: virDomainBlockCopyFlags: Convert to prefix comments
Peter Krempa [Wed, 1 Dec 2021 13:54:30 +0000 (14:54 +0100)]
include: virDomainBlockCopyFlags: Convert to prefix comments

Switch to the comment style allowing more text.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: monitor: Add support for 'write-blocking' copy mode for blockdev-mirror
Peter Krempa [Tue, 30 Nov 2021 19:22:46 +0000 (20:22 +0100)]
qemu: monitor: Add support for 'write-blocking' copy mode for blockdev-mirror

Forces the data to be written synchronously to both the original and the
mirrored images which ensures that the job will reach synchronized
phase.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuMonitorJSONGraphicsRelocate: Clean up command argument construction
Peter Krempa [Tue, 30 Nov 2021 15:20:50 +0000 (16:20 +0100)]
qemuMonitorJSONGraphicsRelocate: Clean up command argument construction

Move the construction of the command from the variable declaration so
that it doesn't exceed the line length and we can also move the logic of
determining the protocol outside of the command construction.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuMonitorJSONMigrate: Extract flags prior to constructing command
Peter Krempa [Tue, 30 Nov 2021 15:12:00 +0000 (16:12 +0100)]
qemuMonitorJSONMigrate: Extract flags prior to constructing command

The migration API takes specific flags which are then converted to
boolean parameters for the command. Extract the flag into helper
variables rather than using ternary operators while constructing the
command itself.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuMonitorJSONEjectMedia: Use a bool directly for constructing JSON with 'b' modifier
Peter Krempa [Tue, 30 Nov 2021 15:08:29 +0000 (16:08 +0100)]
qemuMonitorJSONEjectMedia: Use a bool directly for constructing JSON with 'b' modifier

It actually already expects a bool.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuMonitorJSONHandleShutdown: Use virTristateBoolFromBool
Peter Krempa [Tue, 30 Nov 2021 15:07:53 +0000 (16:07 +0100)]
qemuMonitorJSONHandleShutdown: Use virTristateBoolFromBool

Instead of a ternary operator we can use the existing helper.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: monitor: Avoid ternary operators in helpers for drive/blockdev-mirror
Peter Krempa [Tue, 30 Nov 2021 14:50:53 +0000 (15:50 +0100)]
qemu: monitor: Avoid ternary operators in helpers for drive/blockdev-mirror

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: agent: Remove unneeded cleanup sections
Peter Krempa [Wed, 1 Dec 2021 09:44:50 +0000 (10:44 +0100)]
qemu: agent: Remove unneeded cleanup sections

Remove the cleanup sections where not needed after we've converted to
automatic freeing of virJSONValue.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: agent: Automatically free virJSONValue-s
Peter Krempa [Wed, 1 Dec 2021 09:38:47 +0000 (10:38 +0100)]
qemu: agent: Automatically free virJSONValue-s

Convert the code to use g_autoptr for the few cases sill using explicit
cleanup.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuAgentIOProcessLine: refactor cleanup
Peter Krempa [Wed, 1 Dec 2021 09:08:03 +0000 (10:08 +0100)]
qemuAgentIOProcessLine: refactor cleanup

Refactor the control flow so we can remove the cleanup label.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuMonitorAddObject: Use g_clear_pointer for a free and reset operation
Peter Krempa [Wed, 1 Dec 2021 08:31:30 +0000 (09:31 +0100)]
qemuMonitorAddObject: Use g_clear_pointer for a free and reset operation

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>