]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
3 years agotools: virsh: use automatic cleanup for vshTable
Ján Tomko [Wed, 11 Aug 2021 13:12:02 +0000 (15:12 +0200)] 
tools: virsh: use automatic cleanup for vshTable

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agotools: virsh: use automatic cleanup for xmlDoc
Ján Tomko [Wed, 11 Aug 2021 11:57:15 +0000 (13:57 +0200)] 
tools: virsh: use automatic cleanup for xmlDoc

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agotools: virsh: use automatic cleanup for xmlXPathObject
Ján Tomko [Wed, 11 Aug 2021 11:50:23 +0000 (13:50 +0200)] 
tools: virsh: use automatic cleanup for xmlXPathObject

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agotools: virsh: use automatic cleanup for xmlXPathContext
Ján Tomko [Wed, 11 Aug 2021 11:21:18 +0000 (13:21 +0200)] 
tools: virsh: use automatic cleanup for xmlXPathContext

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agotools: virsh: use automatic cleanup for virDomainObj
Ján Tomko [Wed, 11 Aug 2021 09:33:50 +0000 (11:33 +0200)] 
tools: virsh: use automatic cleanup for virDomainObj

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agotools: virsh: cmdDominfo: rename 'ostype' variable
Ján Tomko [Wed, 11 Aug 2021 14:16:39 +0000 (16:16 +0200)] 
tools: virsh: cmdDominfo: rename 'ostype' variable

Use 'ostype' instead of generic 'str', to discourage
reuse. Also mark it as autofree.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agotools: virsh: split variable declarations
Ján Tomko [Wed, 11 Aug 2021 13:45:59 +0000 (15:45 +0200)] 
tools: virsh: split variable declarations

One variable per line.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemu: Open chardev logfile on behalf of QEMU
Michal Privoznik [Fri, 6 Aug 2021 08:25:29 +0000 (10:25 +0200)] 
qemu: Open chardev logfile on behalf of QEMU

If the QEMU driver is configured to use the old "file" stdio
handler (meaning virtlogd is out of the picture) and a chardev
has a log file configured we rely on QEMU being able to create
the file itself. This may not be always possible (e.g. if the
logfile is set to a directory that QEMU process can't reach).
In such case we should create the file and just pass its FD to
QEMU.

We could do that unconditionally and just either pass FD from
virtlogd or the one we opened, because we bumped QEMU version
and are now requiring new enough QEMU. However, I'm keeping the
old style where logfile is appended on the cmd line for the tests
sake.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1989457
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Tested-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuDomainOpenFile: Take @cfg instead of driver
Michal Privoznik [Fri, 6 Aug 2021 08:48:50 +0000 (10:48 +0200)] 
qemuDomainOpenFile: Take @cfg instead of driver

Again, we don't need full driver, just its config.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Tested-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuDomainOpenFile: Take virDomainDef instead of virDomainObj
Michal Privoznik [Fri, 6 Aug 2021 08:31:22 +0000 (10:31 +0200)] 
qemuDomainOpenFile: Take virDomainDef instead of virDomainObj

The function doesn't really need domain object, but domain
definition from which it takes seclabels.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Tested-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainDefGetSecurityLabelDef: Fix const correctness
Michal Privoznik [Fri, 6 Aug 2021 08:30:59 +0000 (10:30 +0200)] 
virDomainDefGetSecurityLabelDef: Fix const correctness

The function doesn't write to domain definition really so make
@def argument as const. This allows us to call it from functions
where the domain definition is already const.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Tested-by: Ján Tomko <jtomko@redhat.com>
3 years agolibxl: remove conditionals from discard configuration
Olaf Hering [Fri, 13 Aug 2021 14:03:11 +0000 (16:03 +0200)] 
libxl: remove conditionals from discard configuration

LIBXL_HAVE_LIBXL_DEVICE_DISK_DISCARD_ENABLE exists since Xen 4.5.0

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
3 years agoutil: xml: clean up unnecessary ret variables
Ján Tomko [Wed, 11 Aug 2021 12:05:42 +0000 (14:05 +0200)] 
util: xml: clean up unnecessary ret variables

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agoutil: xml: use g_auto for xmlXPathObject
Ján Tomko [Wed, 11 Aug 2021 11:48:13 +0000 (13:48 +0200)] 
util: xml: use g_auto for xmlXPathObject

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agoutil: define cleanup func for xmlXPathObject
Ján Tomko [Wed, 11 Aug 2021 11:34:32 +0000 (13:34 +0200)] 
util: define cleanup func for xmlXPathObject

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agoconf: replace validation with variables passed to virXMLParse()
Kristina Hanicova [Wed, 11 Aug 2021 12:36:48 +0000 (14:36 +0200)] 
conf: replace validation with variables passed to virXMLParse()

virXMLParse() now allows validating xml against schema directly,
eliminating the need to do it individually in each function.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
3 years agodomain_conf: Remove redundant variable
Kristina Hanicova [Wed, 11 Aug 2021 12:36:47 +0000 (14:36 +0200)] 
domain_conf: Remove redundant variable

xmlDocPtr is no longer needed, because validation against schema
was moved to another function.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
3 years agodomain_conf: replace validation with variables passed to virXMLParse()
Kristina Hanicova [Wed, 11 Aug 2021 12:36:46 +0000 (14:36 +0200)] 
domain_conf: replace validation with variables passed to virXMLParse()

virXMLParse() now allows to validate xml against schema directly,
eliminating the need to do it individually.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
3 years agoutil: add xml validation against schema in virXMLParseHelper()
Kristina Hanicova [Wed, 11 Aug 2021 12:36:45 +0000 (14:36 +0200)] 
util: add xml validation against schema in virXMLParseHelper()

We need this in order to validate XML against schema at one
place, rather than have the same code for validation in different
functions.
I will add '--validate' option to more virsh commands soon and
this makes it easier as virXMLParse() is called in every one I
plan to change.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
3 years agosrc: add 'schema' and 'validate' variable to virXMLParseHelper()
Kristina Hanicova [Wed, 11 Aug 2021 12:36:44 +0000 (14:36 +0200)] 
src: add 'schema' and 'validate' variable to virXMLParseHelper()

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
3 years agovsh: steal pointer in vshEditWriteToTempFile
Ján Tomko [Thu, 12 Aug 2021 09:45:03 +0000 (11:45 +0200)] 
vsh: steal pointer in vshEditWriteToTempFile

Fixes: 13896b5ad1d7f157273b6e49106df1f33958a9ed
Signed-off-by: Ján Tomko <jtomko@redhat.com>
3 years agovirsh: refactor cmdDomblkinfo
Ján Tomko [Wed, 11 Aug 2021 14:04:45 +0000 (16:04 +0200)] 
virsh: refactor cmdDomblkinfo

Use automatic memory cleanup to get rid of the cleanup section,
and of the memory leak that happens inside the loop, because
cap, alloc and phy are only freed once per function.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemu: save status xml after generating taint message
Kristina Hanicova [Tue, 27 Jul 2021 12:36:00 +0000 (14:36 +0200)] 
qemu: save status xml after generating taint message

We didn't always save status xml after generating new taint message
which resulted in it being deleted in case of a libvirtd restart.
Some taint messages were preserved thanks to saving status xml
separately at the end of the calling functions. With this, every taint
message is saved, regardless of the calling functions.

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

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agorun: set abs_builddir variables
Ján Tomko [Wed, 11 Aug 2021 07:41:02 +0000 (09:41 +0200)] 
run: set abs_builddir variables

test-lib.sh needs these to be set.

Export them so that the virsh-* tests can be run using:
  builddir$ ./run srcdir/tests/virsh-snapshot

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
3 years agovirsh: snapshot: remove pointless cleanup labels
Ján Tomko [Tue, 10 Aug 2021 16:18:40 +0000 (18:18 +0200)] 
virsh: snapshot: remove pointless cleanup labels

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agovirsh: snapshot: use g_auto where possible
Ján Tomko [Tue, 10 Aug 2021 15:57:15 +0000 (17:57 +0200)] 
virsh: snapshot: use g_auto where possible

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agovirsh: checkpoint: remove pointless cleanup labels
Ján Tomko [Tue, 10 Aug 2021 15:47:59 +0000 (17:47 +0200)] 
virsh: checkpoint: remove pointless cleanup labels

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agovirsh: checkpoint: use g_auto where possible
Ján Tomko [Tue, 10 Aug 2021 15:07:38 +0000 (17:07 +0200)] 
virsh: checkpoint: use g_auto where possible

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agovirsh: cmdCheckpointInfo: delete unused variables
Ján Tomko [Tue, 10 Aug 2021 15:38:49 +0000 (17:38 +0200)] 
virsh: cmdCheckpointInfo: delete unused variables

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agovirsh: snapshot: move variables inside the loop
Ján Tomko [Tue, 10 Aug 2021 17:20:30 +0000 (19:20 +0200)] 
virsh: snapshot: move variables inside the loop

Use g_auto to free them, instead of open-coding it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agovirsh: checkpoint: move variables inside the loop
Ján Tomko [Tue, 10 Aug 2021 17:26:45 +0000 (19:26 +0200)] 
virsh: checkpoint: move variables inside the loop

Use g_auto to free them instead of open-coding it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agovirsh: add cleanup function for virshDomainSnapshot
Ján Tomko [Tue, 10 Aug 2021 15:15:49 +0000 (17:15 +0200)] 
virsh: add cleanup function for virshDomainSnapshot

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agovirsh: add cleanup function for virshDomainCheckpoint
Ján Tomko [Tue, 10 Aug 2021 15:15:40 +0000 (17:15 +0200)] 
virsh: add cleanup function for virshDomainCheckpoint

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agovsh: table: define cleanup function
Ján Tomko [Tue, 10 Aug 2021 17:28:03 +0000 (19:28 +0200)] 
vsh: table: define cleanup function

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agovsh: use g_clear_pointer
Ján Tomko [Tue, 10 Aug 2021 15:09:30 +0000 (17:09 +0200)] 
vsh: use g_clear_pointer

Replace remaining uses of VIR_FREE with g_clear_pointer.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agovsh: remove pointless cleanup labels
Ján Tomko [Tue, 10 Aug 2021 15:12:02 +0000 (17:12 +0200)] 
vsh: remove pointless cleanup labels

Remove cleanup sections that are no longer needed, as well
as unnecessary 'ret' variables.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agovsh: use g_auto where possible
Ján Tomko [Tue, 10 Aug 2021 15:09:07 +0000 (17:09 +0200)] 
vsh: use g_auto where possible

Excluding vshCommandParse.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agovsh: cmdEcho: use separate variable for argument
Ján Tomko [Tue, 10 Aug 2021 15:10:34 +0000 (17:10 +0200)] 
vsh: cmdEcho: use separate variable for argument

Do not use 'arg' which is later used for an allocated string.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agovsh: do not cast away const
Ján Tomko [Tue, 10 Aug 2021 16:56:18 +0000 (18:56 +0200)] 
vsh: do not cast away const

Instead of using the same variable to store either a const pointer
or an allocated string, always make a copy.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agomeson: Always use the / operator to join paths
Andrea Bolognani [Tue, 10 Aug 2021 14:46:07 +0000 (16:46 +0200)] 
meson: Always use the / operator to join paths

This is the preferred way to do it, but there were a few
instances in which some of the path components had embedded
slashes instead.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agomeson: Use 'rst2html5' instead of 'rst2html' everywhere
Andrea Bolognani [Mon, 9 Aug 2021 14:48:58 +0000 (16:48 +0200)] 
meson: Use 'rst2html5' instead of 'rst2html' everywhere

We only use the HTML5 version these days.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agodomain_conf: Fix memory leak when free'ing virDomainObj
Luke Yue [Tue, 10 Aug 2021 13:47:21 +0000 (21:47 +0800)] 
domain_conf: Fix memory leak when free'ing virDomainObj

Free dom->deprecations when free'ing virDomainObj

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agoutil: virstring: Remove unused virStringListFreeCount
Peter Krempa [Wed, 4 Aug 2021 11:30:39 +0000 (13:30 +0200)] 
util: virstring: Remove unused virStringListFreeCount

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolxcContainerSetReadOnly: Refactor cleanup handling
Peter Krempa [Tue, 3 Aug 2021 13:46:46 +0000 (15:46 +0200)] 
lxcContainerSetReadOnly: Refactor cleanup handling

Turn 'mounts' into a proper GStrv after sorting so that automatic
cleanup can be used and shuffle around the cleanup steps so that jumps
can be avoided in favor of direct return of error code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuDomainUnshareNamespace: Use automatic memory clearing for string lists
Peter Krempa [Tue, 3 Aug 2021 11:01:04 +0000 (13:01 +0200)] 
qemuDomainUnshareNamespace: Use automatic memory clearing for string lists

'devMountsPath' and 'devMountsSavePath' are NULL terminated.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuNamespaceMknodPaths: Remove 'ndevMountsPath'
Peter Krempa [Tue, 3 Aug 2021 10:45:37 +0000 (12:45 +0200)] 
qemuNamespaceMknodPaths: Remove 'ndevMountsPath'

'devMountsPath' can be converted to an auto-cleared stringlist and thus
asking for the number of entries is not necessary.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuNamespacePrepareOneItem: Don't pass count of elements
Peter Krempa [Tue, 3 Aug 2021 10:43:19 +0000 (12:43 +0200)] 
qemuNamespacePrepareOneItem: Don't pass count of elements

The only caller is passing a NULL terminated string list as
'devMountsPath' thus we don't need to get the count of elements.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuNamespacePrepareOneItem: Restructure code to avoid temporary variables
Peter Krempa [Thu, 5 Aug 2021 15:00:45 +0000 (17:00 +0200)] 
qemuNamespacePrepareOneItem: Restructure code to avoid temporary variables

The value of 'next' is copied into 'item.file' so we can move the update
to the 'next' pointer earlier and move the VIR_APPEND_ELEMENT call to
where we figure out that we need to append the value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agonetwork: bridge: Store dnsmasq passthrough options in NULL-terminated string list
Peter Krempa [Mon, 21 Jun 2021 12:54:24 +0000 (14:54 +0200)] 
network: bridge: Store dnsmasq passthrough options in NULL-terminated string list

We always process the full list so there's no value in storing the count
separately.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: domain: Store passthrough arguments in NULL-terminated string list
Peter Krempa [Mon, 21 Jun 2021 12:54:24 +0000 (14:54 +0200)] 
qemu: domain: Store passthrough arguments in NULL-terminated string list

We always process the full list so there's no value in storing the count
separately.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: domain: Store capability overrides in NULL-terminated string list
Peter Krempa [Mon, 21 Jun 2021 12:54:24 +0000 (14:54 +0200)] 
qemu: domain: Store capability overrides in NULL-terminated string list

We always process the full list so there's no value in storing the count
separately.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: domain: Store passthrough environment variables in a struct
Peter Krempa [Mon, 21 Jun 2021 12:43:01 +0000 (14:43 +0200)] 
qemu: domain: Store passthrough environment variables in a struct

Previously they were stored in two separate arrays. This way it's
obvious when referencing the same one.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: firmware: Store machine types as a NULL-terminated string list
Peter Krempa [Wed, 16 Jun 2021 07:29:01 +0000 (09:29 +0200)] 
qemu: firmware: Store machine types as a NULL-terminated string list

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoremote: dispatch: Don't use virStringListFreeCount for NULL terminated lists
Peter Krempa [Mon, 14 Jun 2021 12:56:15 +0000 (14:56 +0200)] 
remote: dispatch: Don't use virStringListFreeCount for NULL terminated lists

Both virDomainAuthorizedSSHKeysGet and virDomainGetMessages return a
NULL-terminated string-list, so we can use g_auto(GStrv) to clear the
used memory on failures.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotestQemuAgentSSHKeys: Refactor cleanup
Peter Krempa [Mon, 14 Jun 2021 11:51:17 +0000 (13:51 +0200)] 
testQemuAgentSSHKeys: Refactor cleanup

Use automatic memory freeing for the 'qemuMonitorTest' object and the
list of keys so that the cleanup section can be removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirNetDevGetVirtualFunctions: Directly return virPCIVirtualFunctionList
Peter Krempa [Wed, 4 Aug 2021 15:37:50 +0000 (17:37 +0200)] 
virNetDevGetVirtualFunctions: Directly return virPCIVirtualFunctionList

Remove the conversion from virPCIVirtualFunctionList which encapsulates
the list of virtual functions to two disjunct arrays.

This greatly simplifies the fetching of the parameters as well as
cleanup in the caller.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirPCIGetVirtualFunctions: Fetch also network interface name if needed
Peter Krempa [Wed, 4 Aug 2021 15:37:44 +0000 (17:37 +0200)] 
virPCIGetVirtualFunctions: Fetch also network interface name if needed

'virNetDevGetVirtualFunctions' calls 'virPCIGetVirtualFunctions' and
then re-iterates the returned list to fetch the interface names for the
returned virtual functions.

If we move the fetching of the interface name into
virPCIGetVirtualFunctions we can simplify the code and remove a bunch of
impossible error states.

To accomplish this the function is renamed to
'virPCIGetVirtualFunctionsFull' while keeping a wrapper with original
name and if the physical port ID is passed the interface name is fetched
too without the need to re-convert the address into a sysfs link.

For now 'virNetDevGetVirtualFunctions' still converts the returned data
into two lists.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirPCIGetNetName: Make 'physPortID' argument const
Peter Krempa [Wed, 4 Aug 2021 15:54:42 +0000 (17:54 +0200)] 
virPCIGetNetName: Make 'physPortID' argument const

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirPCIGetVirtualFunctionIndex: Refactor cleanup
Peter Krempa [Wed, 4 Aug 2021 14:35:31 +0000 (16:35 +0200)] 
virPCIGetVirtualFunctionIndex: Refactor cleanup

The 'ret' variable and 'out' label can be removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirPCIGetVirtualFunctions: Simplify cleanup of returned data
Peter Krempa [Tue, 3 Aug 2021 14:45:36 +0000 (16:45 +0200)] 
virPCIGetVirtualFunctions: Simplify cleanup of returned data

Introduce a struct for holding the list of VFs returned by
virPCIGetVirtualFunctions so that we can employ automatic memory
clearing and also allow querying more information at once.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirNetDevGetVirtualFunctions: Remove 'max_vfs' argument
Peter Krempa [Wed, 4 Aug 2021 15:27:56 +0000 (17:27 +0200)] 
virNetDevGetVirtualFunctions: Remove 'max_vfs' argument

The only caller doesn't use it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agonodedev: look up mdevs by UUID and parent
Jonathon Jongsma [Fri, 16 Jul 2021 19:33:50 +0000 (14:33 -0500)] 
nodedev: look up mdevs by UUID and parent

Since UUID is not guaranteed to be unique by mdevctl, we may have more
than one nodedev with the same UUID. Therefore, we need to disambiguate
when looking up mdevs by specifying the UUID and parent address, which
mdevctl guarantees to be a unique combination.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agonodedev: Handle inactive mdevs with the same UUID
Jonathon Jongsma [Tue, 6 Jul 2021 18:41:28 +0000 (13:41 -0500)] 
nodedev: Handle inactive mdevs with the same UUID

Unfortunately, mdevctl supports defining more than one mdev with the
same UUID as long as they have different parent devices. (Only one of
these devices can be active at any given time).

This means that we can't use the UUID alone as a way to uniquely
identify mdev node devices. Append the parent address to ensure
uniqueness. For example:

    Before: mdev_88a6b868_46bd_4015_8e5b_26107f82da38
    After:  mdev_88a6b868_46bd_4015_8e5b_26107f82da38_0000_00_02_0

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

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agonodedev: add PostParse callback for nodedev parsing
Jonathon Jongsma [Fri, 16 Jul 2021 21:33:43 +0000 (16:33 -0500)] 
nodedev: add PostParse callback for nodedev parsing

This can be used similarly to other postparse callbacks in libvirt --
filling in additional information that can be determined by using the
information provided in the XML. In this case, we determine the address
of the parent device and cache it in the mdev caps so that we can use it
for generating a unique name and interacting with mdevctl.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agonodedev: Add parser validation for node devices
Jonathon Jongsma [Fri, 16 Jul 2021 18:46:52 +0000 (13:46 -0500)] 
nodedev: Add parser validation for node devices

At the moment, this is only for mediated devices. When a new mediated
device is created or defined, the xml is expected specify the nodedev
name of an existing device as its parent. We were not previously
validating this and were simply accepting any string here.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agonodedev: cache parent address in mdev caps
Jonathon Jongsma [Fri, 16 Jul 2021 18:15:54 +0000 (13:15 -0500)] 
nodedev: cache parent address in mdev caps

mdevctl can report multiple defined devices with the same UUID
but different parents, including parents that don't actually exist on
the host machine. Libvirt sets the parent to the 'computer' device for
all of the mdevs that have nonexistent parents. Because of this, it's
possible that there are multiple devices with the same UUID and the same
'computer' device as their parent, so the combination of uuid and parent
nodedev name is not guaranteed to be a unique name.

We need to ensure that each nodedev has a unique name. If we can't use
the UUID as a unique nodedev name, and we can't use the combination of
UUID and nodedev parent name, we need to find another solution. By
caching and using the parent name reported by mdevctl in combination
with the UUID, we can achieve a unique name. mdevctl guarantees that its
uuid/parent combination is unique.

This value will be used to set the mdev nodedev name in a following commit.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agonodedev: fix xml output for mdev parents in test suite
Jonathon Jongsma [Wed, 7 Jul 2021 20:01:20 +0000 (15:01 -0500)] 
nodedev: fix xml output for mdev parents in test suite

Commit 51fbbfdce8 attempted to get the proper nodedev name for the
parent of an defined mdev by traversing the filesystem and looking for a
device that had the appropriate sysfs path.  This works, but it would be
cleaner to to avoid mucking around in the filesystem and instead just
just examine the list of devices we have in memory.

We already had a function nodeDeviceFindAddressByName() which constructs
an address for parent device in a format that can be used with mdevctl.
So if we refactor this function into a a function that simply formats an
address for an arbitrary virNodeDeviceObj*, then we can use this
function as a predicate for our new virNodeDeviceObjListFind() function
from the previous commit. This will search our list of devices for one
whose address matches the address we get from mdevctl.

One nice benefit of this approach is that our test cases will now
display xml output with the proper parent name for mdevs (assuming that
we've added the appropriate mock parent devices to the test driver).
Previously they just displayed 'computer' for the parent because the
alternative would have required specially constructing a mock filesystem
environment with a sysfs that mapped to the appropriate parent.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agonodedev: add internal virNodeDeviceObjListFind()
Jonathon Jongsma [Thu, 15 Jul 2021 22:07:32 +0000 (17:07 -0500)] 
nodedev: add internal virNodeDeviceObjListFind()

This is a generic function that you can provide your own predicate
function to search for a particular device. It will be used in an
upcoming commit.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agosrc: stop checking virIdentityNew return value
Daniel P. Berrangé [Thu, 5 Aug 2021 18:03:19 +0000 (19:03 +0100)] 
src: stop checking virIdentityNew return value

This method will always succeed.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agorpm: add conditionals around post scripts
Daniel P. Berrangé [Thu, 5 Aug 2021 09:58:29 +0000 (10:58 +0100)] 
rpm: add conditionals around post scripts

The hypervisor drivers can be disabled in certain build scenarios, so
their corresponding post scripts need to match.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoutil: directly query KVM for TSC scaling support
Daniel P. Berrangé [Wed, 4 Aug 2021 17:05:59 +0000 (18:05 +0100)] 
util: directly query KVM for TSC scaling support

We currently query the host MSRs to determine if TSC scaling is
supported. This works OK when running privileged and can open
the /dev/cpu/0/msr. When unprivileged we fallback to querying
MSRs from /dev/kvm. This is incorrect because /dev/kvm only
reports accurate info for MSRs that are valid to use from inside
a guest.  The TSC scaling support MSR is not, thus we always end
up reporting lack of TSC scaling when unprivileged.

The solution to this is easy, because KVM can directly report
whether TSC scaling is available, which matches what QEMU will
do at startup.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/188
Reported-by: Roman Mohr <rmohr@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoRevert "remote: remove probing logic from virtproxyd dispatcher"
Daniel P. Berrangé [Wed, 4 Aug 2021 17:03:32 +0000 (18:03 +0100)] 
Revert "remote: remove probing logic from virtproxyd dispatcher"

This reverts commit 05bd8db60b35b7706100d9cbbaeb13992965e0f2.

It is true that the remote driver client now contains logic for probing
the driver to connect to when using modular daemons. This logic, however,
only runs when the remote driver is NOT running inside a daemon since we
don't want it activated inside libvirtd. Since the same remote driver
build is used in all daemons, we can't rely on it in virtproxyd either.
Thus we need to keep the virtproxyd probing logic

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirStorageBackendLogicalParseVolExtents: Remove 'cleanup' and 'ret'
Peter Krempa [Wed, 4 Aug 2021 10:21:22 +0000 (12:21 +0200)] 
virStorageBackendLogicalParseVolExtents: Remove 'cleanup' and 'ret'

The function was inconsistently using 'return -1' and 'goto cleanup;'
unify it by removing the cleanup label and 'ret' variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirStorageBackendLogicalParseVolExtents: Move 'extents' inside the loop
Peter Krempa [Wed, 4 Aug 2021 10:18:38 +0000 (12:18 +0200)] 
virStorageBackendLogicalParseVolExtents: Move 'extents' inside the loop

It's used only inside the loop filling the extents, move it there and
restructure the code so that 'extent.path' doesn't have to be freed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirStorageBackendLogicalParseVolExtents: Declare one variable per line
Peter Krempa [Wed, 4 Aug 2021 10:06:52 +0000 (12:06 +0200)] 
virStorageBackendLogicalParseVolExtents: Declare one variable per line

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agolxcNetworkParseDataIPs: Automatically free string list
Peter Krempa [Wed, 4 Aug 2021 10:00:17 +0000 (12:00 +0200)] 
lxcNetworkParseDataIPs: Automatically free string list

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirNetServerGetClients: Remove pointless cleanup
Peter Krempa [Wed, 4 Aug 2021 09:36:31 +0000 (11:36 +0200)] 
virNetServerGetClients: Remove pointless cleanup

'list' will always be NULL when reaching 'virObjectListFreeCount' thus
we can remove the call as well as the 'ret' variable which was only ever
equal to 'nclients' at the point when we returned the value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuProcessSetupHotpluggableVcpus: Use automatic memory freeing
Peter Krempa [Wed, 4 Aug 2021 09:33:35 +0000 (11:33 +0200)] 
qemuProcessSetupHotpluggableVcpus: Use automatic memory freeing

'bootHotplug' can be auto-freed when terminating the function and moving
the declaration of 'vcpuprops' to the loop which uses it along with
automatic freeing allows us to simplify cleanup in certain cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirNWFilterIncludeDefToRuleInst: Refactor cleanup
Peter Krempa [Wed, 4 Aug 2021 09:28:35 +0000 (11:28 +0200)] 
virNWFilterIncludeDefToRuleInst: Refactor cleanup

Use automatic memory freeing for 'tmpvars' and move the allocation of
tmpvars earlier so that we are guaranteed that 'obj' will always be
appended to 'inst->filters' and thus don't need cleanup for it.

By moving the reset of 'inst' to the block when virNWFilterDefToInst
fails we can get rid of the rest of the cleanup section and remove the
'ret' variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirNWFilterRuleDefToRuleInst: Restructure code to avoid cleanup
Peter Krempa [Wed, 4 Aug 2021 09:21:18 +0000 (11:21 +0200)] 
virNWFilterRuleDefToRuleInst: Restructure code to avoid cleanup

Construct the 'ruleinst->vars' hash table separately in a temporary
variable so that 'ruleinst' can be allocated on success. This allows us
to get rid of the cleanup section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirObjectEventCallbackListAddID: Remove pointless cleanup of 'cb'
Peter Krempa [Wed, 4 Aug 2021 09:17:36 +0000 (11:17 +0200)] 
virObjectEventCallbackListAddID: Remove pointless cleanup of 'cb'

'cb' is always NULL when 'virObjectEventCallbackListAddID' is called.
Remove the call.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirNWFilterRuleDefToRuleInst: Remove pointless assignment
Peter Krempa [Wed, 4 Aug 2021 09:14:18 +0000 (11:14 +0200)] 
virNWFilterRuleDefToRuleInst: Remove pointless assignment

'ruleinst' is NULLed by VIR_APPEND_ELEMENT

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuDomainAttachDeviceConfig: Remove pointless assignment
Peter Krempa [Wed, 4 Aug 2021 09:14:18 +0000 (11:14 +0200)] 
qemuDomainAttachDeviceConfig: Remove pointless assignment

'dev->data.rng' is NULLed by VIR_APPEND_ELEMENT

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirSecuritySELinuxContextListAppend: Remove unreachable cleanup
Peter Krempa [Wed, 4 Aug 2021 09:13:10 +0000 (11:13 +0200)] 
virSecuritySELinuxContextListAppend: Remove unreachable cleanup

'item' is always NULLed-out by VIR_APPEND_ELEMENT and 'ret' variable is
always 0 when used so both can be removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuDomainUSBAddressAddHubs: Refactor cleanup
Peter Krempa [Wed, 4 Aug 2021 09:08:49 +0000 (11:08 +0200)] 
qemuDomainUSBAddressAddHubs: Refactor cleanup

'hub' doesn't need to be freed any more because it's always consumed and
NULLed-out by VIR_APPEND element. This also makes the 'ret' variable
obsolete.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoxenParseXMDisk: Use automatic memory clearing and remove 'ret' variable
Peter Krempa [Tue, 3 Aug 2021 13:08:54 +0000 (15:08 +0200)] 
xenParseXMDisk: Use automatic memory clearing and remove 'ret' variable

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoprlsdkAddDomainVideoInfoCt: Remove pointless cleanup section
Peter Krempa [Tue, 3 Aug 2021 13:05:59 +0000 (15:05 +0200)] 
prlsdkAddDomainVideoInfoCt: Remove pointless cleanup section

'video' will only ever be NULL after the 'cleanup' label thus there's no
need to use 'virDomainVideoDefFree'. In fact we can fully remove the
cleanup section and 'ret' variable by returning directly from failure
points.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: alloc: Completely replace VIR_APPEND_ELEMENT_QUIET by VIR_APPEND_ELEMENT
Peter Krempa [Tue, 3 Aug 2021 13:04:55 +0000 (15:04 +0200)] 
util: alloc: Completely replace VIR_APPEND_ELEMENT_QUIET by VIR_APPEND_ELEMENT

VIR_APPEND_ELEMENT doesn't report any errors now so we can remove
VIR_APPEND_ELEMENT_QUIET and replace all uses by VIR_APPEND_ELEMENT

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: alloc: Reimplement VIR_APPEND_ELEMENT using virAppendElement
Peter Krempa [Tue, 3 Aug 2021 12:14:20 +0000 (14:14 +0200)] 
util: alloc: Reimplement VIR_APPEND_ELEMENT using virAppendElement

Use virAppendElement instead of virInsertElementsN to implement
VIR_APPEND_ELEMENT which allows us to remove error handling as the
only relevant errors were removed when switching to aborting memory
allocation functions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: alloc: Reimplement VIR_APPEND_ELEMENT_QUIET using virAppendElement
Peter Krempa [Wed, 4 Aug 2021 07:25:23 +0000 (09:25 +0200)] 
util: alloc: Reimplement VIR_APPEND_ELEMENT_QUIET using virAppendElement

For now it was an alias to VIR_APPEND_ELEMENT. Use virAppendElement
directly until VIR_APPEND_ELEMENT is refactored too and we'll be able to
get rid of VIR_APPEND_ELEMENT_QUIET completely.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: alloc: Reimplement VIR_APPEND_ELEMENT_COPY using virAppendElement
Peter Krempa [Tue, 3 Aug 2021 12:14:20 +0000 (14:14 +0200)] 
util: alloc: Reimplement VIR_APPEND_ELEMENT_COPY using virAppendElement

Use virAppendElement instead of virInsertElementsN to implement
VIR_APPEND_ELEMENT_COPY which allows us to remove error handling as the
only relevant errors were removed when switching to aborting memory
allocation functions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: alloc: Reimplement VIR_APPEND_ELEMENT_(COPY_)INPLACE using virAppendElement
Peter Krempa [Tue, 3 Aug 2021 12:14:20 +0000 (14:14 +0200)] 
util: alloc: Reimplement VIR_APPEND_ELEMENT_(COPY_)INPLACE using virAppendElement

VIR_APPEND_ELEMENT_INPLACE and VIR_APPEND_ELEMENT_COPY_INPLACE already
ignore the return value from 'virInsertElementsN' which allows a trivial
conversion to virAppendElement without the need for 'ignore_value'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: alloc: Introduce virAppendElement helper
Peter Krempa [Tue, 3 Aug 2021 12:11:23 +0000 (14:11 +0200)] 
util: alloc: Introduce virAppendElement helper

The new wrapper calls virInsertElementInternal with the appropriate
arguments without any checks which are unnecessary for appension. This
allows to have no return value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirInsertElementsN: Split out actual insertion code
Peter Krempa [Tue, 3 Aug 2021 11:36:56 +0000 (13:36 +0200)] 
virInsertElementsN: Split out actual insertion code

Split out the code doing the movement of the elements and insertion from
the range checks. This will help in adding an error-free version for
appension.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirInsertElementsN: Rename 'add' argument
Peter Krempa [Tue, 3 Aug 2021 11:28:17 +0000 (13:28 +0200)] 
virInsertElementsN: Rename 'add' argument

The idea of @add was that the insersion/appension macros would allow
adding more than one element but this feature was never implemented.

'add' is nowadays used as a dummy variable consuming the result of the
VIR_TYPEMATCH compile time check.

Make it obvious that we don't use 'add' by renaming it to
'typematchDummy', marking it as unused and replacing all occurences
where the value was used by literal '1'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: Don't leak cpu defs
Michal Privoznik [Fri, 30 Jul 2021 08:34:50 +0000 (10:34 +0200)] 
tests: Don't leak cpu defs

There are cpu definitions that are allocated in
qemuTestDriverInit() but are missing corresponding
virCPUDefFree() call in qemuTestDriverFree(). It's safe to call
the free function because the definitions contain a refcounter
and thus even if they were still in use the refcounter would be
just decreased.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoutil: fix typo
Ján Tomko [Fri, 18 Jun 2021 11:37:31 +0000 (13:37 +0200)] 
util: fix typo

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: virtiofs: kill the whole process group
Ján Tomko [Tue, 3 Aug 2021 14:56:41 +0000 (16:56 +0200)] 
qemu: virtiofs: kill the whole process group

Send TERM/KILL to virtiofsd and its child processes too
and do not exit until they are all dead.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
4 years agoutil: virPidFileForceCleanupPath: add group argument
Ján Tomko [Wed, 23 Jun 2021 09:34:57 +0000 (11:34 +0200)] 
util: virPidFileForceCleanupPath: add group argument

Add a version of virPidFileForceCleanupPath that takes
a 'group' bool argument and propagate it all the way
down to virProcessKillPainfullyDelay.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: introduce virProcessGroupGet
Ján Tomko [Tue, 3 Aug 2021 12:31:34 +0000 (14:31 +0200)] 
util: introduce virProcessGroupGet

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>