]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
3 years agosrc: add driver support for networkDefineXMLFlags()
Kristina Hanicova [Mon, 23 Aug 2021 16:50:10 +0000 (18:50 +0200)] 
src: add driver support for networkDefineXMLFlags()

I have added new driver functions which define network with given
flags. I have also replaced definitions of the functions without
flags with function calls to the new ones.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovbox_network: add flags to vboxNetworkDefineCreateXML()
Kristina Hanicova [Mon, 23 Aug 2021 16:50:09 +0000 (18:50 +0200)] 
vbox_network: add flags to vboxNetworkDefineCreateXML()

I need to propagate flags for the next commit.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoapi: add public virNetworkDefineXMLFlags() and remote protocol
Kristina Hanicova [Mon, 23 Aug 2021 16:50:08 +0000 (18:50 +0200)] 
api: add public virNetworkDefineXMLFlags() and remote protocol

This new API allows to define network with given flags.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu: capabilities: remove pointless labels
Ján Tomko [Mon, 23 Aug 2021 14:35:02 +0000 (16:35 +0200)] 
qemu: capabilities: remove pointless labels

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
3 years agoqemu: capabilities: use g_auto
Ján Tomko [Mon, 23 Aug 2021 14:20:18 +0000 (16:20 +0200)] 
qemu: capabilities: use g_auto

Where easily possible, declare variables with g_auto to reduce
the amount of calls in cleanup sections.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
3 years agoqemu: refactor virQEMUCapsNewCopy
Ján Tomko [Mon, 23 Aug 2021 14:34:59 +0000 (16:34 +0200)] 
qemu: refactor virQEMUCapsNewCopy

Use g_auto and remove pointless labels.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
3 years agoqemu: refactor virQEMUCapsInit
Ján Tomko [Mon, 23 Aug 2021 14:23:47 +0000 (16:23 +0200)] 
qemu: refactor virQEMUCapsInit

Use g_auto and remove pointless labels.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
3 years agoqemu: refactor virQEMUCapsLoadFile
Ján Tomko [Mon, 23 Aug 2021 14:22:17 +0000 (16:22 +0200)] 
qemu: refactor virQEMUCapsLoadFile

Use g_auto and remove pointless labels.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
3 years agoqemu: refactor virQEMUCapsNewForBinaryInternal
Ján Tomko [Mon, 23 Aug 2021 14:21:18 +0000 (16:21 +0200)] 
qemu: refactor virQEMUCapsNewForBinaryInternal

Use g_auto and remove pointless labels.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
3 years agoconf: snapshot/checkpoint: Rewrite 'AlignDisk' logic to appease clang
Peter Krempa [Mon, 23 Aug 2021 12:14:55 +0000 (14:14 +0200)] 
conf: snapshot/checkpoint: Rewrite 'AlignDisk' logic to appease clang

New clang has a false-positive about value of 'olddisks' being unused
after being set. This is clearly wrong because we want to use
'g_autofree' to clear it later.

While I'm against modifying good code for the sake of bad static
analysis in this case it's not obvious that we depend on the lifetime of
'olddisks' being needed until the end of the function as we store
pointers into it into the hash table and later copy them out.

Rewrite the code by assigning to 'olddisks' earlier and then using
'olddisks' in the loop, so it's clear where the lifetime of the objects
ends, and this should also silence the warning.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovbox_network: fix possible memory leak in vboxNetworkDefineCreateXML()
Kristina Hanicova [Mon, 23 Aug 2021 14:33:41 +0000 (16:33 +0200)] 
vbox_network: fix possible memory leak in vboxNetworkDefineCreateXML()

virNetworkDef was not freed if the function failed in the first
two ifs, causing a possible memory leak.

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 agovirsh-snapshot: Don't leak @then in cmdSnapshotList()
Michal Privoznik [Mon, 23 Aug 2021 12:08:10 +0000 (14:08 +0200)] 
virsh-snapshot: Don't leak @then in cmdSnapshotList()

The variable is used inside a loop in which it's allocated in
each iteration. Bring it inside the loop so that g_autoptr()
kicks in each iteration.

Fixes: 3caa28dc50df7ec215713075d669b20bef6473a2
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotests: qemuxml2*test: switch to virTestRunLog
Ján Tomko [Fri, 20 Aug 2021 14:34:26 +0000 (16:34 +0200)] 
tests: qemuxml2*test: switch to virTestRunLog

This essentially reverts:
commit ca5c8e1dc7801854d856cfc62f2054ae753a40c3
    qemuxml2argvtest: Avoid conditions in test macro

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: cputests: introduce and use virTestRunLog
Ján Tomko [Fri, 20 Aug 2021 14:29:45 +0000 (16:29 +0200)] 
tests: cputests: introduce and use virTestRunLog

A helper that resets the log before each test and prints
it on failure.

It also takes the return variable as an argument,
so it can be used to eliminate number of branches
the compiler has to consider in the main function.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: cputest: remove unnecessary labels
Ján Tomko [Fri, 20 Aug 2021 14:12:04 +0000 (16:12 +0200)] 
tests: cputest: remove unnecessary labels

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: cputest: use g_autofree
Ján Tomko [Fri, 20 Aug 2021 14:05:08 +0000 (16:05 +0200)] 
tests: cputest: use g_autofree

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: cputest: use g_auto for virCPUDef
Ján Tomko [Fri, 20 Aug 2021 14:00:31 +0000 (16:00 +0200)] 
tests: cputest: use g_auto for virCPUDef

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: cputest: use g_auto for virCPUData
Ján Tomko [Fri, 20 Aug 2021 13:57:56 +0000 (15:57 +0200)] 
tests: cputest: use g_auto for virCPUData

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: cputest: use g_auto for virQEMUCaps
Ján Tomko [Fri, 20 Aug 2021 13:53:48 +0000 (15:53 +0200)] 
tests: cputest: use g_auto for virQEMUCaps

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: use g_auto in cpuTestMakeQEMUCaps
Ján Tomko [Thu, 19 Aug 2021 14:32:35 +0000 (16:32 +0200)] 
tests: use g_auto in cpuTestMakeQEMUCaps

Refactor to use automatic cleanup and remove the goto's.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu: monitor: define cleanup function for qemuMonitorCPUModelInfo
Ján Tomko [Thu, 19 Aug 2021 14:32:19 +0000 (16:32 +0200)] 
qemu: monitor: define cleanup function for qemuMonitorCPUModelInfo

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agorpm: Enable numactl on s390x
Michal Privoznik [Thu, 19 Aug 2021 14:24:43 +0000 (16:24 +0200)] 
rpm: Enable numactl on s390x

While s390x doesn't have NUMA nodes it has libnuma which is still
helpful as it parses sysfs for us and kernel emulates NUMA#0.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agovirhostmem: Handle numactl-less build in hugepages allocation/reporting
Michal Privoznik [Thu, 19 Aug 2021 13:54:31 +0000 (15:54 +0200)] 
virhostmem: Handle numactl-less build in hugepages allocation/reporting

When using 'virsh freepages' or 'virsh allocpages' then
virHostMemGetFreePages() or virHostMemAllocPages() is called,
respectively. But the following may happen: libvirt was built
without numactl support and thus a fake NUMA node was constructed
for capabilities, which means that startCell is going to be 0.
But we can't blindly pass startCell = 0 to virNumaGetPageInfo()
nor virNumaSetPagePoolSize() because they would operate over node
specific path (/sys/devices/system/node/nodeX) rather than NUMA
agnostic path (/sys/kernel/mm/hugepages/) and we are not
guaranteed that the former exists (kernel might have been built
without NUMA support).

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

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agovirhostmem: Let caller pass max NUMA node to virHostMemAllocPages
Michal Privoznik [Thu, 19 Aug 2021 13:55:19 +0000 (15:55 +0200)] 
virhostmem: Let caller pass max NUMA node to virHostMemAllocPages

In all three cases (LXC, QEMU and VBox drivers) the caller has
access to host capabilities and thus know the maximum NUMA node.
This means, that virHostMemAllocPages() doesn't have to query
it. Querying may fail if libvirt was compiled without numactl
support.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agovirhostmem: Let caller pass max NUMA node to virHostMemGetFreePages
Michal Privoznik [Thu, 19 Aug 2021 13:53:39 +0000 (15:53 +0200)] 
virhostmem: Let caller pass max NUMA node to virHostMemGetFreePages

In all three cases (LXC, QEMU and VBox drivers) the caller has
access to host capabilities and thus know the maximum NUMA node.
This means, that virHostMemGetFreePages() doesn't have to query
it. Querying may fail if libvirt was compiled without numactl
support.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoconf: Introduce virCapabilitiesHostNUMAGetMaxNode()
Michal Privoznik [Thu, 19 Aug 2021 13:21:41 +0000 (15:21 +0200)] 
conf: Introduce virCapabilitiesHostNUMAGetMaxNode()

This is just a small helper that will be used later.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agotests: virnetdev*: remove unnecessary labels
Ján Tomko [Fri, 20 Aug 2021 13:11:52 +0000 (15:11 +0200)] 
tests: virnetdev*: remove unnecessary labels

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: introduce testVirNetDevBandwidthParse
Ján Tomko [Fri, 20 Aug 2021 13:08:34 +0000 (15:08 +0200)] 
tests: introduce testVirNetDevBandwidthParse

The 'PARSE' macro does not use '#' or '##' directives,
or anything from outside of the macro other than the
cleanup label.

Turn it into a function.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: virnetdevbandwidthtest: use g_auto
Ján Tomko [Fri, 20 Aug 2021 12:58:13 +0000 (14:58 +0200)] 
tests: virnetdevbandwidthtest: use g_auto

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: virnetdevopenvswitch: use g_auto
Ján Tomko [Fri, 20 Aug 2021 12:43:29 +0000 (14:43 +0200)] 
tests: virnetdevopenvswitch: use g_auto

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agobuild: only build virnetdevopenvswitchtest on Linux
Ján Tomko [Fri, 20 Aug 2021 12:56:53 +0000 (14:56 +0200)] 
build: only build virnetdevopenvswitchtest on Linux

Now that it uses virnetdevbandwidthmock which we only
build on Linux.

Fixes: eb55e8a897a8c9d68664daa213b1a76b0cb3c05d
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemublocktest: Add test for creating a qcow2 on top of an luks-encrypted qcow2
Peter Krempa [Fri, 20 Aug 2021 11:25:19 +0000 (13:25 +0200)] 
qemublocktest: Add test for creating a qcow2 on top of an luks-encrypted qcow2

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: block: Use correct format name when formatting overlay of qcow2+luks
Peter Krempa [Fri, 20 Aug 2021 11:26:13 +0000 (13:26 +0200)] 
qemu: block: Use correct format name when formatting overlay of qcow2+luks

A logic bug in the code creating overlays on existing images resulted
into wrongly using "luks" instead of "qcow2" for the backing format if
the backing image is an luks-encrypted qcow2. The special format munging
is needed only for raw luks images.

In practice the impact is not as critical as to use encrypted images in
the backing chain the user must fully describe the backing chain
including backing images to provide encryption keys, which overrides the
metadata recorded in the qcow2 header.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirsh: add support for '--validate' option in define secret
Kristina Hanicova [Fri, 20 Aug 2021 12:30:40 +0000 (14:30 +0200)] 
virsh: add support for '--validate' option in define secret

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 agosecret_driver: allow VIR_SECRET_DEFINE_VALIDATE flag
Kristina Hanicova [Fri, 20 Aug 2021 12:30:39 +0000 (14:30 +0200)] 
secret_driver: allow VIR_SECRET_DEFINE_VALIDATE flag

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 agosecret_conf: add validation against schema in define
Kristina Hanicova [Fri, 20 Aug 2021 12:30:38 +0000 (14:30 +0200)] 
secret_conf: add validation against schema in define

We need to validate the XML against schema if option '--validate'
was passed to the virsh command. This patch also includes
propagation of flags into the virSecretDefParse() 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 agoapi: add virSecretDefineFlags
Kristina Hanicova [Fri, 20 Aug 2021 12:30:37 +0000 (14:30 +0200)] 
api: add virSecretDefineFlags

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 agovirsh: add support for '--validate' option in define interface
Kristina Hanicova [Fri, 20 Aug 2021 11:28:52 +0000 (13:28 +0200)] 
virsh: add support for '--validate' option in define interface

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: allow validation flag in interface define
Kristina Hanicova [Fri, 20 Aug 2021 11:28:51 +0000 (13:28 +0200)] 
src: allow validation flag in interface define

We need to validate the XML against schema if option 'validate'
was passed to the 'iface-define' virsh command. For that we need
to allow validation flag and propagate flags to parse 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 agoconf: add validation and propagate flags into virInterfaceDefParse()
Kristina Hanicova [Fri, 20 Aug 2021 11:28:50 +0000 (13:28 +0200)] 
conf: add validation and propagate flags into virInterfaceDefParse()

We need to know if validation flag is present in order to
validate given XML against schema in virXMLParse().

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 agoapi: add virInterfaceDefineFlags
Kristina Hanicova [Fri, 20 Aug 2021 11:28:49 +0000 (13:28 +0200)] 
api: add virInterfaceDefineFlags

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 agovirsh: add support for '--validate' option in define nwfilter
Kristina Hanicova [Fri, 20 Aug 2021 11:57:10 +0000 (13:57 +0200)] 
virsh: add support for '--validate' option in define nwfilter

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agonwfilter_driver: allow VIR_NWFILTER_DEFINE_VALIDATE flag
Kristina Hanicova [Fri, 20 Aug 2021 11:57:09 +0000 (13:57 +0200)] 
nwfilter_driver: allow VIR_NWFILTER_DEFINE_VALIDATE flag

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agonwfilter_conf: add validation against schema in define
Kristina Hanicova [Fri, 20 Aug 2021 11:57:08 +0000 (13:57 +0200)] 
nwfilter_conf: add validation against schema in define

This patch also includes propagation of flags into the
virNWFilterDefParse().

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoapi: add virNWFilterDefineFlags
Kristina Hanicova [Fri, 20 Aug 2021 11:57:07 +0000 (13:57 +0200)] 
api: add virNWFilterDefineFlags

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agonwfilter: add nwfilterDefineXMLFlags()
Kristina Hanicova [Fri, 20 Aug 2021 11:57:06 +0000 (13:57 +0200)] 
nwfilter: add nwfilterDefineXMLFlags()

I have added a new driver function which allows to define
nwfilter with given flags. I have also replaced definition of
nwfilterDefineXML() with function call to the new function.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoapi: add public virNWFilterDefineXMLFlags() and remote protocol
Kristina Hanicova [Fri, 20 Aug 2021 11:57:05 +0000 (13:57 +0200)] 
api: add public virNWFilterDefineXMLFlags() and remote protocol

This new API function allows to define nwfilter with given flags.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: use g_auto in qemuTestParseCapabilitiesArch
Ján Tomko [Fri, 20 Aug 2021 11:35:05 +0000 (13:35 +0200)] 
tests: use g_auto in qemuTestParseCapabilitiesArch

Refactor qemuTestParseCapabilitiesArch to use g_auto for cleanup.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agotests: use g_auto in testQemuGetCaps
Ján Tomko [Fri, 20 Aug 2021 11:36:00 +0000 (13:36 +0200)] 
tests: use g_auto in testQemuGetCaps

Refactor testQemuGetCaps to use g_auto for cleanup,
remove the error label and use g_steal_pointer for
the successful return path.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agovirsocket: Don't preserve errno in virSocketRecvFD()
Michal Privoznik [Fri, 20 Aug 2021 08:41:41 +0000 (10:41 +0200)] 
virsocket: Don't preserve errno in virSocketRecvFD()

When setting O_CLOEXEC flag on received FD fails the FD is closed
using VIR_FORCE_CLOSE(). But the call is wrapped in errno save
which is not necessary because VIR_FORCE_CLOSE() preserves  errno
value.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoch: monitor: unref mon->vm before vm
Ján Tomko [Thu, 19 Aug 2021 12:01:26 +0000 (14:01 +0200)] 
ch: monitor: unref mon->vm before vm

Do not access 'mon' after unref'ing it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agosyntax-check: remove _test_script_regex
Ján Tomko [Thu, 19 Aug 2021 12:12:57 +0000 (14:12 +0200)] 
syntax-check: remove _test_script_regex

Commit abab5c47f8060eddf0212084a1d70c4b1e3d92dd incorrectly
assumed we do not have any files that could be affected by

  sc_prohibit_reversed_compare_failure

due to the conditional assignment:

  _test_script_regex ?= \<init\.sh\>

so it removed the check.

Also remove the leftover assignment of test-lib.sh,
since any new code attempting to use the compare function
with reversed arguments should be rejected by review
for using shell instead of C or Python.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agosyntax-check: drop useless useless-if-before-free
Ján Tomko [Thu, 19 Aug 2021 12:01:14 +0000 (14:01 +0200)] 
syntax-check: drop useless useless-if-before-free

With most of new code using g_auto for cleanup, contributors
are used to most of the free fucntions handling NULL gracefully.

Also, despite finding some occurrences in current codebase:
  avoid_if_before_free
  ~/libvirt/src/ch/ch_monitor.c: if (mon->vm)
        virObjectUnref(mon->vm);
  ~/libvirt/src/util/virresctrl.c: if (a_type->masks[cache])
        virBitmapFree(a_type->masks[cache]);
the check passes succesfully, because the script's logic:

  Exit status:
    0   one or more matches
    1   no match
    2   an error

does not play nicely with xargs:

  xargs exits with the following status:
       0      if it succeeds
     123      if any invocation of the command exited with status 1-125

The list of functions is also out of date - e.g. qemuCapsFree has
been renamed since.

This also helps eliminate one more Perl script per our programming
languages strategy: https://libvirt.org/programming-languages.html

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agosyntax-check: replace vc-list-files
Ján Tomko [Thu, 19 Aug 2021 10:48:28 +0000 (12:48 +0200)] 
syntax-check: replace vc-list-files

Directly invoke git ls-tree instead of the wrapper file which also:
* checks for other versioning systems
* prepends the source directory to all output lines

Since there is no srcdir prefix in the output anymore, also drop
the extra 'sed' invocation that removes it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agosyntax-check: use VC_LIST_EXCEPT instead of VC_LIST
Ján Tomko [Thu, 19 Aug 2021 11:32:41 +0000 (13:32 +0200)] 
syntax-check: use VC_LIST_EXCEPT instead of VC_LIST

Three callers were using VC_LIST directly.

This is not wrong, because they exclude the always-excluded
files by only looking for C and/or header files.

But using VC_LIST here prevents switching it to outputting
relative paths.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agosyntax-check: assume we're using git
Ján Tomko [Thu, 19 Aug 2021 12:30:01 +0000 (14:30 +0200)] 
syntax-check: assume we're using git

Meson already checks whether we're using git before running
syntax check. This only affects direct invocation through make.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agofix error in printf format string
Zhenyu Ye [Thu, 19 Aug 2021 12:14:11 +0000 (20:14 +0800)] 
fix error in printf format string

Use %s to print NULLSTR(duri).

Reported-by: Peng Liang <liangpeng10@huawei.com>
Signed-off-by: Zhenyu Ye <yezhenyu2@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: add test on virNetDevOpenvswitchInterfaceSetQos and virNetDevOpenvswitchInterf...
Jinsheng Zhang [Tue, 17 Aug 2021 04:38:16 +0000 (12:38 +0800)] 
tests: add test on virNetDevOpenvswitchInterfaceSetQos and virNetDevOpenvswitchInterfaceClearQos

Test virNetDevOpenvswitchInterfaceSetQos and
virNetDevOpenvswitchInterfaceClearQos with dryrun method.

Signed-off-by: zhangjl02 <zhangjl02@inspur.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirnetdevopenvswitch: Fix qos cleaning residual on multi interfaces
Jinsheng Zhang [Tue, 17 Aug 2021 04:38:15 +0000 (12:38 +0800)] 
virnetdevopenvswitch: Fix qos cleaning residual on multi interfaces

Warn these error instead of return when removing qos or queues. This will
avoid residual qos clearance on multiple interfaces.

Signed-off-by: zhangjl02 <zhangjl02@inspur.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirnetdevopenvswitch: Introduce virNetDevOpenvswitchInterfaceClearTxQos and virNetDev...
Jinsheng Zhang [Tue, 17 Aug 2021 04:38:14 +0000 (12:38 +0800)] 
virnetdevopenvswitch: Introduce virNetDevOpenvswitchInterfaceClearTxQos and virNetDevOpenvswitchInterfaceClearRxQos

Separate virNetDevOpenvswitchInterfaceClearQos into two steps. When setting
qos, we can set only rx or tx and the other one should be cleared.

Signed-off-by: zhangjl02 <zhangjl02@inspur.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirnetdevopenvswitch: Extract common code block to a single function
Jinsheng Zhang [Tue, 17 Aug 2021 04:38:13 +0000 (12:38 +0800)] 
virnetdevopenvswitch: Extract common code block to a single function

Signed-off-by: zhangjl02 <zhangjl02@inspur.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirnetdevopenvswitch: Extract conversion parameters between virNetDevBandwidth and ovs
Jinsheng Zhang [Tue, 17 Aug 2021 04:38:12 +0000 (12:38 +0800)] 
virnetdevopenvswitch: Extract conversion parameters between virNetDevBandwidth and ovs

Signed-off-by: zhangjl02 <zhangjl02@inspur.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirnetdevopenvswitch: Add vmuuid notes on virNetDevOpenvswitchInterfaceSetQos
Jinsheng Zhang [Tue, 17 Aug 2021 04:38:11 +0000 (12:38 +0800)] 
virnetdevopenvswitch: Add vmuuid notes on virNetDevOpenvswitchInterfaceSetQos

Add vmuuid notes on virNetDevOpenvswitchInterfaceSetQos,
and change vmid to vmuuid.

Signed-off-by: Jinsheng Zhang <zhangjl02@inspur.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: Add missing test cases to vmx2xmltest
Martin Kletzander [Thu, 19 Aug 2021 07:55:53 +0000 (09:55 +0200)] 
tests: Add missing test cases to vmx2xmltest

Commit 42b2f35d36a9e was meant to test all four combinations of
serial-pipe-{server,client}-{app,vm} files, but did only add the files and by
mistake duplicated the tests.  Those were later removed as duplicates, so add
them back in.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotests: Test BlkioParameters related functions for test driver
Luke Yue [Thu, 19 Aug 2021 10:04:31 +0000 (18:04 +0800)] 
tests: Test BlkioParameters related functions for test driver

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agotest_driver: Implement virDomainSetBlkioParameters
Luke Yue [Thu, 19 Aug 2021 10:04:30 +0000 (18:04 +0800)] 
test_driver: Implement virDomainSetBlkioParameters

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agotest_driver: Implement virDomainGetBlkioParameters
Luke Yue [Thu, 19 Aug 2021 10:04:29 +0000 (18:04 +0800)] 
test_driver: Implement virDomainGetBlkioParameters

Signed-off-by: Luke Yue <lukedyue@gmail.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agotests: Drop vmx2xml- prefix for vmx2xml test cases
Michal Privoznik [Wed, 18 Aug 2021 12:35:57 +0000 (14:35 +0200)] 
tests: Drop vmx2xml- prefix for vmx2xml test cases

These XMLs live in a separate directory, there's no need for them
to have a special prefix in addition. Dinding proper file based on
vmx2xmltest.c is also needlessly complicated.

The steps used for mass rename are similar to v4.0.0-rc1~186.

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 agovmx2xmltest: Deduplicate DO_TEST*() arguments
Michal Privoznik [Wed, 18 Aug 2021 12:30:33 +0000 (14:30 +0200)] 
vmx2xmltest: Deduplicate DO_TEST*() arguments

In majority of DO_TEST() and DO_TEST_FAIL() calls the input vmx
file name is the same as the output XML file. Therefore, it's not
necessary to provide the same string twice. For the rest, where
the output XML file is different we can use symlinks to the
expected output.

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 agovmx2xmltest: Drop duplicate testcases
Michal Privoznik [Wed, 18 Aug 2021 12:26:29 +0000 (14:26 +0200)] 
vmx2xmltest: Drop duplicate testcases

There are three test cases are called twice. This is needless.
Drop redundant calls.

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 agovirsh: Support vhostuser in attach-interface
Michal Privoznik [Tue, 17 Aug 2021 11:03:04 +0000 (13:03 +0200)] 
virsh: Support vhostuser in attach-interface

Recently, I wanted to attach an vhost-user interface but found
out that attach-interface command doesn't support it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agovshStringToArray: Rewrite using 'g_strsplit'
Peter Krempa [Wed, 11 Aug 2021 13:04:14 +0000 (15:04 +0200)] 
vshStringToArray: Rewrite using 'g_strsplit'

Use 'g_strsplit' to split the strings and then concatenate back when the
escape sequence (',,') is used.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirsh: Add testing for vshStringToArray
Peter Krempa [Wed, 11 Aug 2021 13:22:59 +0000 (15:22 +0200)] 
virsh: Add testing for vshStringToArray

Add a '--split' switch for the 'virsh echo' command and add few test
cases to the virshtest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirsh: cmdEcho: Rewrite with new buffer helpers
Peter Krempa [Wed, 11 Aug 2021 09:10:12 +0000 (11:10 +0200)] 
virsh: cmdEcho: Rewrite with new buffer helpers

Remove the need for temporary strings by filling the output buffer
directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirsh: cmdEcho: Make '--xml' and '--shell' mutually exclusive
Peter Krempa [Wed, 11 Aug 2021 08:36:04 +0000 (10:36 +0200)] 
virsh: cmdEcho: Make '--xml' and '--shell' mutually exclusive

Initialize the flags earlier and use VSH_EXCLUSIVE_OPTIONS_VAR to
declare the conflicting options as exclusive.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirshtest: Don't use both '--xml' and '--shell' for 'virsh echo'
Peter Krempa [Wed, 11 Aug 2021 09:03:59 +0000 (11:03 +0200)] 
virshtest: Don't use both '--xml' and '--shell' for 'virsh echo'

Escaping for both shell and XML makes no sense. Use one at time so that
we can forbid use of both.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirsh: Un-document 'virsh echo'
Peter Krempa [Wed, 11 Aug 2021 13:17:38 +0000 (15:17 +0200)] 
virsh: Un-document 'virsh echo'

Note that it's for internal testing use and remove the manpage entry.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2xmltesttest: Avoid conditions in test macro
Peter Krempa [Tue, 17 Aug 2021 14:35:20 +0000 (16:35 +0200)] 
qemuxml2xmltesttest: Avoid conditions in test macro

Pass a pointer to the 'ret' variable to the test executor itself and
update it there to improve compile times of the test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2argvtest: Avoid conditions in test macro
Peter Krempa [Tue, 17 Aug 2021 14:35:20 +0000 (16:35 +0200)] 
qemuxml2argvtest: Avoid conditions in test macro

Pass a pointer to the 'ret' variable to the test executor itself and
update it there to improve compile times of the test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotestutilsqemu: Improve error propagation from 'testQemuInfoSetArgs'
Peter Krempa [Tue, 17 Aug 2021 13:30:44 +0000 (15:30 +0200)] 
testutilsqemu: Improve error propagation from 'testQemuInfoSetArgs'

Previously we've ran into problems when 'testQemuInfoSetArgs' failed as
calling the actual test executor could lead to a crash if the data
wasn't prepared but reporting an error doesn't play nicely with our test
output which is handled by 'virTestRun'.

To avoid the issue (and as a side effect improve compilation times of
the test files) split up testQemuInfoSetArgs into two functions.

The first is still called 'testQemuInfoSetArgs' and just blindly
populates arguments into a sub-struct of testQemuInfo. This function no
longer reports errors

A new function 'testQemuInfoInitArgs' which is meant to be called from
the test executor then checks errors and prepares the test data. This
one can fail and the test will be marked as failed appropriately.

A nice side effect is that this vastly improves compile times of
qemuxml2xmltest and qemuxml2argvtest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotestutilsqemu: Introduce struct to hold data valid for all test runs
Peter Krempa [Tue, 17 Aug 2021 14:26:58 +0000 (16:26 +0200)] 
testutilsqemu: Introduce struct to hold data valid for all test runs

We pass multiple caching objects to individual tests which don't change.
To prevent always having to pass them individually to
'testQemuInfoSetArgs' introduce 'struct testQemuConf' which will hold
all of them and just the struct will be passed to the tests.

Additionally this will make the conf available from inside the test run.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotestQemuInfoSetArgs: Move argument fetching to the loop
Peter Krempa [Tue, 17 Aug 2021 12:24:13 +0000 (14:24 +0200)] 
testQemuInfoSetArgs: Move argument fetching to the loop

Since the last patch removed the hack which needed lookahead to see
whether all QEMU_CAPS_ were parsed we can move the fetching of the
arguments into the loop.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotestQemuInfoSetArgs: Remove hack for double QEMU_CAPS_LAST in caps list
Peter Krempa [Tue, 17 Aug 2021 12:09:16 +0000 (14:09 +0200)] 
testQemuInfoSetArgs: Remove hack for double QEMU_CAPS_LAST in caps list

The callers don't use it any more. Remove it to avoid fragility of the
test suite.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotestutilsqemu: Ensure that ARG_* macros are out of range of QEMU_CAPS_*
Peter Krempa [Tue, 17 Aug 2021 11:51:11 +0000 (13:51 +0200)] 
testutilsqemu: Ensure that ARG_* macros are out of range of QEMU_CAPS_*

Both are used in the same parser. Using offset values ensures that
errors are caught earlier.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2xmltest: Remove 'NONE' macro
Peter Krempa [Tue, 17 Aug 2021 11:46:55 +0000 (13:46 +0200)] 
qemuxml2xmltest: Remove 'NONE' macro

There's one last user. Use QEMU_CAPS_LAST explicitly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2xmltest: Add 'DO_TEST_NOCAPS' to replace 'DO_TEST("blah", NONE);'
Peter Krempa [Tue, 17 Aug 2021 08:35:53 +0000 (10:35 +0200)] 
qemuxml2xmltest: Add 'DO_TEST_NOCAPS' to replace 'DO_TEST("blah", NONE);'

Add a explicit version of our test invocation macro for tests which use
no capabilities.

This reduces the usage of the somewhat anonymous 'NONE' macro and will
lead to simplification of the code later.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2xmltest: Remove hack for qemuCaps allocation
Peter Krempa [Tue, 17 Aug 2021 13:12:21 +0000 (15:12 +0200)] 
qemuxml2xmltest: Remove hack for qemuCaps allocation

Since qemuCaps are now always allocated we don't need to pass
ARG_QEMU_CAPS, QEMU_CAPS_LAST to force the allocation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2xmltest: Rename DO_TEST_INTERNAL to DO_TEST_FULL and fix users
Peter Krempa [Mon, 16 Aug 2021 15:02:16 +0000 (17:02 +0200)] 
qemuxml2xmltest: Rename DO_TEST_INTERNAL to DO_TEST_FULL and fix users

'DO_TEST_FULL' isn't a useful wrapper any more. Use the better name for
the main macro and replace all uses.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2xmltest: Add 'ARG_END' from higher level macros
Peter Krempa [Mon, 16 Aug 2021 13:57:08 +0000 (15:57 +0200)] 
qemuxml2xmltest: Add 'ARG_END' from higher level macros

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2argvtest: Add 'DO_TEST_FAILURE_NOCAPS' to replace 'DO_TEST_FAILURE("blah...
Peter Krempa [Tue, 17 Aug 2021 08:35:53 +0000 (10:35 +0200)] 
qemuxml2argvtest: Add 'DO_TEST_FAILURE_NOCAPS' to replace 'DO_TEST_FAILURE("blah", NONE);'

Add a explicit version of our test invocation macro for tests which use
no capabilities.

This removes the usage of the somewhat anonymous 'NONE' macro and will
lead to simplification of the code later.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2argvtest: Add 'DO_TEST_PARSE_ERROR_NOCAPS' to replace 'DO_TEST_PARSE_ERROR...
Peter Krempa [Tue, 17 Aug 2021 08:35:53 +0000 (10:35 +0200)] 
qemuxml2argvtest: Add 'DO_TEST_PARSE_ERROR_NOCAPS' to replace 'DO_TEST_PARSE_ERROR("blah", NONE);'

Add a explicit version of our test invocation macro for tests which use
no capabilities.

This reduces the usage of the somewhat anonymous 'NONE' macro and will
lead to simplification of the code later.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2argvtest: Add 'DO_TEST_NOCAPS' to replace 'DO_TEST("blah", NONE);'
Peter Krempa [Tue, 17 Aug 2021 08:35:53 +0000 (10:35 +0200)] 
qemuxml2argvtest: Add 'DO_TEST_NOCAPS' to replace 'DO_TEST("blah", NONE);'

Add a explicit version of our test invocation macro for tests which use
no capabilities.

This reduces the usage of the somewhat anonymous 'NONE' macro and will
lead to simplification of the code later.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2argvtest: Rename DO_TEST_INTERNAL to DO_TEST_FULL and fix users
Peter Krempa [Mon, 16 Aug 2021 15:02:16 +0000 (17:02 +0200)] 
qemuxml2argvtest: Rename DO_TEST_INTERNAL to DO_TEST_FULL and fix users

'DO_TEST_FULL' isn't a useful wrapper any more. Use the better name for
the main macro and replace all uses.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2argvtest: Add QEMU_CAPS_LAST in places where ARG_QEMU_CAPS is used
Peter Krempa [Mon, 16 Aug 2021 14:53:29 +0000 (16:53 +0200)] 
qemuxml2argvtest: Add QEMU_CAPS_LAST in places where ARG_QEMU_CAPS is used

The 'DO_TEST_FULL' macro was ending the argument list which was being
started in other macros. Move it so that 'ARG_QEMU_CAPS' and
'QEMU_CAPS_LAST' are always used in the same macro.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemustatusxml2xmltest: Remove hack for qemuCaps allocation
Peter Krempa [Tue, 17 Aug 2021 13:12:21 +0000 (15:12 +0200)] 
qemustatusxml2xmltest: Remove hack for qemuCaps allocation

Since qemuCaps are now always allocated we don't need the hack.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotestQemuInfoSetArgs: Always allocate 'info->qemuCaps'
Peter Krempa [Mon, 16 Aug 2021 14:42:18 +0000 (16:42 +0200)] 
testQemuInfoSetArgs: Always allocate 'info->qemuCaps'

Modify the logic so that 'info->qemuCaps' is populated, but empty even
when ARG_QEMU_CAPS was not used. The function still retains the
interlocking of fake caps with real caps.

A lot of the internal code expects qemuCaps to be populated and many
tests work this around by using ARG_QEMU_CAPS with no caps.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2argvtest: Fix broken invocation of "aarch64-tpm-wrong-model"
Peter Krempa [Tue, 17 Aug 2021 12:04:41 +0000 (14:04 +0200)] 
qemuxml2argvtest: Fix broken invocation of "aarch64-tpm-wrong-model"

The string "aarch64" is passed in place of capability flags. We were lucky
that the pointer was always more than QEMU_CAPS_LAST.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2argvtest: Fix broken invocation of "pseries-spaprvio-invalid"
Peter Krempa [Tue, 17 Aug 2021 12:04:41 +0000 (14:04 +0200)] 
qemuxml2argvtest: Fix broken invocation of "pseries-spaprvio-invalid"

The string "ppc64" is passed in place of capability flags. We were lucky
that the pointer was always more than QEMU_CAPS_LAST.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2argvtest: Add 'ARG_END' from higher level macros
Peter Krempa [Mon, 16 Aug 2021 13:57:08 +0000 (15:57 +0200)] 
qemuxml2argvtest: Add 'ARG_END' from higher level macros

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: capabilities: Remove virQEMUCapsSetList
Peter Krempa [Mon, 16 Aug 2021 14:29:24 +0000 (16:29 +0200)] 
qemu: capabilities: Remove virQEMUCapsSetList

Unused since 90540a37bee647d4f94d263a3ba1b39f2407880d

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