]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
2 years agovirSCSIHostFindByPCI: Decrease scope of some variables
Michal Privoznik [Wed, 8 Mar 2023 07:52:32 +0000 (08:52 +0100)] 
virSCSIHostFindByPCI: Decrease scope of some variables

Inside of virSCSIHostFindByPCI() there're some variables that are
used from a while() loop exclusively. Bring their declaration
into the loop.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirscsihost: use g_autofree more
Michal Privoznik [Wed, 8 Mar 2023 07:48:36 +0000 (08:48 +0100)] 
virscsihost: use g_autofree more

Remove some obvious uses of VIR_FREE() in favor of automatic
cleanup. This also means, that some variables affected are
brought into the inner most block, so that automatic cleanup is
effective.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoremote: add mutex when freeing private callbacks
Mike Pontillo [Tue, 7 Mar 2023 17:57:56 +0000 (17:57 +0000)] 
remote: add mutex when freeing private callbacks

This commit resolves illegal memory accesses observed via:

  remoteClientFreePrivateCallbacks()
  remoteClientCloseFunc()
  virNetServerClientCloseLocked()
  virNetServerProcessClients()
  daemonServerProcessClients()
  virHashForEach()
  virNetDaemonRun()
  main()

Signed-off-by: Mike Pontillo <mpontillo@digitalocean.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu: capabilities: Remove unused virQEMUCapsInitQMPBasicArch
Peter Krempa [Mon, 6 Mar 2023 20:27:33 +0000 (21:27 +0100)] 
qemu: capabilities: Remove unused virQEMUCapsInitQMPBasicArch

The function doesn't set any capability and we don't want to add
arch-dependent always-peresent capabilities in the future.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Retire QEMU_CAPS_LOADPARM
Peter Krempa [Mon, 6 Mar 2023 20:25:15 +0000 (21:25 +0100)] 
qemu: capabilities: Retire QEMU_CAPS_LOADPARM

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuAppendLoadparmMachineParm: Format 'loadparm' based on architecture
Peter Krempa [Mon, 6 Mar 2023 20:22:42 +0000 (21:22 +0100)] 
qemuAppendLoadparmMachineParm: Format 'loadparm' based on architecture

Check the architecture of the guest rather than relying on
QEMU_CAPS_LOADPARM which is set based on architecture.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Retire QEMU_CAPS_AES_KEY_WRAP and QEMU_CAPS_DEA_KEY_WRAP
Peter Krempa [Mon, 6 Mar 2023 20:19:51 +0000 (21:19 +0100)] 
qemu: capabilities: Retire QEMU_CAPS_AES_KEY_WRAP and QEMU_CAPS_DEA_KEY_WRAP

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuAppendKeyWrapMachineParms: Format "keywrap" arguments based on architecture
Peter Krempa [Mon, 6 Mar 2023 19:55:25 +0000 (20:55 +0100)] 
qemuAppendKeyWrapMachineParms: Format "keywrap" arguments based on architecture

Use the guest architecture to decide whether to format
'aes-key-wrap'/'dea-key-wrap' rather than
QEMU_CAPS_AES_KEY_WRAP/QEMU_CAPS_DEA_KEY_WRAP which were set based on
architecture.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Remove always asserted s390 capabilities
Peter Krempa [Mon, 6 Mar 2023 15:29:06 +0000 (16:29 +0100)] 
qemuxml2argvtest: Remove always asserted s390 capabilities

QEMU_CAPS_AES_KEY_WRAP, QEMU_CAPS_DEA_KEY_WRAP and QEMU_CAPS_LOADPARM
are always asserted via virQEMUCapsInitQMPBasicArch thus don't need to
be explicitly enabled by tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Retire QEMU_CAPS_MACH_VIRT_GIC_VERSION
Peter Krempa [Mon, 6 Mar 2023 15:25:53 +0000 (16:25 +0100)] 
qemu: capabilities: Retire QEMU_CAPS_MACH_VIRT_GIC_VERSION

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: command: Replace caps check for QEMU_CAPS_MACH_VIRT_GIC_VERSION by arch check
Peter Krempa [Mon, 6 Mar 2023 15:11:38 +0000 (16:11 +0100)] 
qemu: command: Replace caps check for QEMU_CAPS_MACH_VIRT_GIC_VERSION by arch check

QEMU_CAPS_MACH_VIRT_GIC_VERSION is always asserted for VIR_ARCH_AARCH64.

Note that this patch is a direct conversion of the logic originally
residing in the capabilities code. A better coversion would be (based on
whether it is available for just AARCH64 or also ARM) to base it on the
guest architecture.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Don't set QEMU_CAPS_MACH_VIRT_GIC_VERSION
Peter Krempa [Mon, 6 Mar 2023 15:04:56 +0000 (16:04 +0100)] 
qemuxml2argvtest: Don't set QEMU_CAPS_MACH_VIRT_GIC_VERSION

testUpdateQEMUCaps calls virQEMUCapsInitQMPBasicArch which already sets
it. Purge the capability from the testing code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Retire QEMU_CAPS_NO_HPET
Peter Krempa [Mon, 6 Mar 2023 15:00:43 +0000 (16:00 +0100)] 
qemu: capabilities: Retire QEMU_CAPS_NO_HPET

All uses were replaced by an explicit architecture check.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: command: Format '-no-hpet' based on architecture check
Peter Krempa [Mon, 6 Mar 2023 14:57:54 +0000 (15:57 +0100)] 
qemu: command: Format '-no-hpet' based on architecture check

Rather than asserting a capability based on architecture, format the
fallback parameter based on the presence of the newer capability and an
explicit architecture check.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Retire QEMU_CAPS_NO_ACPI
Peter Krempa [Mon, 6 Mar 2023 14:32:11 +0000 (15:32 +0100)] 
qemu: capabilities: Retire QEMU_CAPS_NO_ACPI

The capability is based on a platform check rather than what given qemu
supports.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: command: Replace check using QEMU_CAPS_NO_ACPI with architecture check
Peter Krempa [Mon, 6 Mar 2023 14:30:33 +0000 (15:30 +0100)] 
qemu: command: Replace check using QEMU_CAPS_NO_ACPI with architecture check

QEMU_CAPS_NO_ACPI is asserted based on architecture, so it can be
replaced by a non-capability check.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoNEWS: Mention bug in validation of HPET timer
Peter Krempa [Mon, 6 Mar 2023 14:53:53 +0000 (15:53 +0100)] 
NEWS: Mention bug in validation of HPET timer

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: validate: Fix logic for validating presence of the HPET timer
Peter Krempa [Mon, 6 Mar 2023 14:38:15 +0000 (15:38 +0100)] 
qemu: validate: Fix logic for validating presence of the HPET timer

Commit 24cc9cda826 switched over to use -machine hpet, but one of the
steps it did was to clear the QEMU_CAPS_NO_HPET capability.

The validation check still uses the old capability though which means
that for configs which would explicitly enable HPET we'd report an error.

Since HPET is an x86(_64) platform specific device, convert the
validation check to an architecture check as all supported qemu versions
actually support it.

Modify a test case to request HPET to catch posible future problems.

Fixes: 24cc9cda826
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotestutilsqemu: Drop support for fake-caps testing of 'arm' architecture
Peter Krempa [Thu, 2 Mar 2023 15:58:06 +0000 (16:58 +0100)] 
testutilsqemu: Drop support for fake-caps testing of 'arm' architecture

All tests were converted to use real capabilities so there's no need to
support the infrastructure for fake tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: qemuxml2argvdata: Port 'qemu-system-arm' cases with fake tests to 'qemu-system...
Peter Krempa [Fri, 3 Mar 2023 13:38:25 +0000 (14:38 +0100)] 
tests: qemuxml2argvdata: Port 'qemu-system-arm' cases with fake tests to 'qemu-system-aarch64'

'qemu-system-aarch64' is superset of the soon to be deprecated
'qemu-system-arm' binary. We can move over all of our fake-caps tests to
real caps on aarch64.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Retire QEMU_CAPS_CPU_AARCH64_OFF
Peter Krempa [Fri, 3 Mar 2023 13:55:08 +0000 (14:55 +0100)] 
qemu: capabilities: Retire QEMU_CAPS_CPU_AARCH64_OFF

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Always assume QEMU_CAPS_CPU_AARCH64_OFF
Peter Krempa [Fri, 3 Mar 2023 13:52:54 +0000 (14:52 +0100)] 
qemu: Always assume QEMU_CAPS_CPU_AARCH64_OFF

We always assert the flag for aarch64 qemus and in qemu the 'aarch64'
cpu property doesn't seem to be optional.

Remove checks and remove impossible test case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotestutilsqemu: Drop support for fake-caps testing of 'ppc' architecture
Peter Krempa [Thu, 2 Mar 2023 15:58:06 +0000 (16:58 +0100)] 
testutilsqemu: Drop support for fake-caps testing of 'ppc' architecture

All tests were converted to use real capabilities so there's no need to
support the infrastructure for fake tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvdata: Convert test cases for 'ppc' architecture to latest caps
Peter Krempa [Fri, 3 Mar 2023 13:17:06 +0000 (14:17 +0100)] 
qemuxml2argvdata: Convert test cases for 'ppc' architecture to latest caps

Convert the 'ppc-dtb' and 'ppce500-serial' to use real capabilities
albeit captured from a non-native machine. Thus the XML needs to be
converted to use virt type 'qemu'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: qemu: Add 'ppc' machine caps based on 'qemu-system-ppc' on fedora
Peter Krempa [Fri, 3 Mar 2023 13:09:00 +0000 (14:09 +0100)] 
tests: qemu: Add 'ppc' machine caps based on 'qemu-system-ppc' on fedora

The data are obtained from a x86_64 machine thus don't really represent
physical hardware, but it's better than nothing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotestutilsqemu: Drop support for fake-caps testing of 'riscv64' architecture
Peter Krempa [Thu, 2 Mar 2023 15:58:06 +0000 (16:58 +0100)] 
testutilsqemu: Drop support for fake-caps testing of 'riscv64' architecture

All tests were converted to use real capabilities so there's no need to
support the infrastructure for fake tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2(argv|xml)test: Convert last fake-caps riscv64 tests to real caps
Peter Krempa [Fri, 3 Mar 2023 07:12:39 +0000 (08:12 +0100)] 
qemuxml2(argv|xml)test: Convert last fake-caps riscv64 tests to real caps

Preserve testing of the MMIO use case in case when GPEX is complied out
of qemu.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotestutilsqemu: Introduce ARG_QEMU_CAPS_DEL, to mask out flags from real caps
Peter Krempa [Fri, 3 Mar 2023 12:11:51 +0000 (13:11 +0100)] 
testutilsqemu: Introduce ARG_QEMU_CAPS_DEL, to mask out flags from real caps

In certain cases we want to use as-real capabilities as possible but
that doesn't allow testing certain fallback scenarios of features that
can be complied out of QEMU.

ARG_QEMU_CAPS_DEL can be used similarly to ARG_QEMU_CAPS but the flag
arguments are actually masked out of the resulting caps.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotestutilsqemu: Rework setting of fake capabilities
Peter Krempa [Fri, 3 Mar 2023 12:07:41 +0000 (13:07 +0100)] 
testutilsqemu: Rework setting of fake capabilities

Rather that populate a virQEMUCaps object we now populate a bitmap with
the fake capabilities and transfer it into the virQEMUCaps later.

This unifies the code paths between the fully fake caps tests and real
caps + fake flags.

Also the same approach will be used in upcomming patch to add
possibility to mask out flags from real capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuTestCapsCacheInsertImpl: Require that callers always pass capabilities
Peter Krempa [Fri, 3 Mar 2023 11:42:05 +0000 (12:42 +0100)] 
qemuTestCapsCacheInsertImpl: Require that callers always pass capabilities

There's just one case when we're populating the cache with empty caps so
that can allocate a dummy virQEMUCaps object rather than having the
logic inside qemuTestCapsCacheInsertImpl.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Remove return value checks from calls to virQEMUCapsNewCopy
Peter Krempa [Fri, 3 Mar 2023 09:38:50 +0000 (10:38 +0100)] 
qemu: Remove return value checks from calls to virQEMUCapsNewCopy

The function now can't fail.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Remove return value from virQEMUCapsAccelCopy
Peter Krempa [Fri, 3 Mar 2023 09:36:40 +0000 (10:36 +0100)] 
qemu: capabilities: Remove return value from virQEMUCapsAccelCopy

The function now always returns 0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Remove return value from virQEMUCapsHostCPUDataCopy
Peter Krempa [Fri, 3 Mar 2023 09:34:58 +0000 (10:34 +0100)] 
qemu: capabilities: Remove return value from virQEMUCapsHostCPUDataCopy

The function can't fail at this point. Remove the last outstanding
pointless error check and turn the return type into 'void'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: cpu: Remove NULL check from virCPUDefCopy
Peter Krempa [Fri, 3 Mar 2023 09:33:09 +0000 (10:33 +0100)] 
conf: cpu: Remove NULL check from virCPUDefCopy

Make all callers always pass a valid pointer which in turn allows us to
remove return value check from the callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: cpu: Remove NULL check from virCPUDefCopyWithoutModel
Peter Krempa [Fri, 3 Mar 2023 09:21:44 +0000 (10:21 +0100)] 
conf: cpu: Remove NULL check from virCPUDefCopyWithoutModel

Make all callers always pass a valid pointer which in turn allows us to
remove return value check from the callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agocpu: Remove return value from virCPUDefCopyModel(Filter)
Peter Krempa [Fri, 3 Mar 2023 09:04:47 +0000 (10:04 +0100)] 
cpu: Remove return value from virCPUDefCopyModel(Filter)

The functions were always returning 0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: domain: Restructure control flow in qemuDomainFixupCPUs
Peter Krempa [Fri, 3 Mar 2023 08:59:16 +0000 (09:59 +0100)] 
qemu: domain: Restructure control flow in qemuDomainFixupCPUs

Do the two fixups of CPU as one block and split up the return value
checks to separate conditions. This will make the upcoming refactors
simpler.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Remove return value from virQEMUCaps(SEV|SGX)InfoCopy
Peter Krempa [Fri, 3 Mar 2023 08:46:10 +0000 (09:46 +0100)] 
qemu: capabilities: Remove return value from virQEMUCaps(SEV|SGX)InfoCopy

Both functions always return 0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Don't make callers check return of virQEMUCapsNew(Binary)
Peter Krempa [Fri, 3 Mar 2023 08:27:45 +0000 (09:27 +0100)] 
qemu: capabilities: Don't make callers check return of virQEMUCapsNew(Binary)

The allocation of the object itself can't fail. What can fail is the
creation of the class on a programming error. Rather than punting the
error up the stack abort() directly on the first occurence as the error
can't be fixed during runtime.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotestutilsqemu: Drop support for fake-caps testing of 'riscv32' architecture
Peter Krempa [Thu, 2 Mar 2023 15:58:06 +0000 (16:58 +0100)] 
testutilsqemu: Drop support for fake-caps testing of 'riscv32' architecture

All tests were converted to use real capabilities so there's no need to
support the infrastructure for fake tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotestutilsqemu: Unify array for filling fake machine types
Peter Krempa [Thu, 2 Mar 2023 15:51:18 +0000 (16:51 +0100)] 
testutilsqemu: Unify array for filling fake machine types

Both 'kvm_machines' and 'qemu_machines' now have the same members so we
can simply drop kvm_machines.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotestutilsqemu: Drop support for fake-caps testing of 'sparc' architecture
Peter Krempa [Thu, 2 Mar 2023 15:58:06 +0000 (16:58 +0100)] 
testutilsqemu: Drop support for fake-caps testing of 'sparc' architecture

All tests were converted to use real capabilities so there's no need to
support the infrastructure for fake tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Convert 'sparc-minimal' case to DO_TEST_CAPS_ARCH_LATEST
Peter Krempa [Thu, 2 Mar 2023 15:53:47 +0000 (16:53 +0100)] 
qemuxml2argvtest: Convert 'sparc-minimal' case to DO_TEST_CAPS_ARCH_LATEST

Convert the only outstanding test case for a 'sparc' machine to modern
test infrastructure.

'sparc' machine type also needs to be added to the list of supported
arches in testQemuGetLatestCaps.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuTestCapsCacheInsert*: Directly insert real capabilities
Peter Krempa [Thu, 2 Mar 2023 16:59:09 +0000 (17:59 +0100)] 
qemuTestCapsCacheInsert*: Directly insert real capabilities

Real capabilities populate the binary name, while fake don't. We can
directly insert the capabilities using the real binary name.

This will allow to remove 'qemu_emulators' entries once all tests are
converted to real capabilties.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuTestCapsCacheInsert*: Drop the file cache rather than poisoning it
Peter Krempa [Thu, 2 Mar 2023 16:44:21 +0000 (17:44 +0100)] 
qemuTestCapsCacheInsert*: Drop the file cache rather than poisoning it

Make callers use virFileCacheClear to clear the cache before populating
it rather than trying to overwrite what's in it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Fix serial-unix-missing-source case
Peter Krempa [Thu, 2 Mar 2023 16:50:07 +0000 (17:50 +0100)] 
qemuxml2argvtest: Fix serial-unix-missing-source case

Use x86_64 emulator and machine and remove the nocaps version of the
test.

Fixes: 80a37e96a95
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoutil: virfilecache: Introduce virFileCacheClear for usage in tests
Peter Krempa [Thu, 2 Mar 2023 16:32:28 +0000 (17:32 +0100)] 
util: virfilecache: Introduce virFileCacheClear for usage in tests

In tests we need to be able to populate the cache with a deterministic
set of entries. This means we need to drop the contents of the cache
between runs to prevent spillage between test cases.

virFileCacheClear drops all entries from the hash table used for the
cache.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: qemu: Move testing of default cache and disk source with space to 'sata-device'
Peter Krempa [Thu, 2 Mar 2023 12:15:50 +0000 (13:15 +0100)] 
tests: qemu: Move testing of default cache and disk source with space to 'sata-device'

Integrate the two special cases used for schema testing into the more
useful qemuxml2argvtest, whose input data is still tested against the
schema.

Add also a xml output variant.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: domainschemadata: Drop redundant tests
Peter Krempa [Thu, 2 Mar 2023 09:43:01 +0000 (10:43 +0100)] 
tests: domainschemadata: Drop redundant tests

The schema tested by removed test cases is tested by other, more useful,
test cases:

 - 'maxMemory'
    - qemuxmlargvdata/memory-hotplug*
 - 'backingChains'
    - qemuxmlargvdata/disk-backing-chains*
 - 'timers'
    - qemuxml2argvdata/kvm-pit-delay.xml
    - qemuxml2argvdata/clock-catchup.xml
 - 'qemu-simple-description-title.xml'
    - 'qemuxml2argvdata/minimal.xml

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: Undo recent breakages
Andrea Bolognani [Mon, 6 Mar 2023 14:25:22 +0000 (15:25 +0100)] 
tests: Undo recent breakages

Turns out that those overrides I recently removed where actually
there for a reason, and there was a motivation behind creating
the driver config as unprivileged too O:-)

Until a solution that can both ensure predictable output and
avoid code duplication is developed, go back to the previous
approach.

Fixes: 2f56f69f7f7e ("tests: Create privileged config for QEMU driver")
Fixes: 0f49b6cc6b81 ("tests: Drop no longer necessary overrides")
Fixes: 0b464cd84ff3 ("tests: Drop more QEMU driver config overrides")
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2 years agotests: Drop more QEMU driver config overrides
Andrea Bolognani [Thu, 2 Mar 2023 18:05:53 +0000 (19:05 +0100)] 
tests: Drop more QEMU driver config overrides

These are allegedly necessary to keep the output consistent,
but now that we're using a privileged config for the driver we
get the desired behavior out of the box, and as a bonus the
paths match what you would actually see on a regular host.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agotests: Set SASLdirs to default values
Andrea Bolognani [Thu, 2 Mar 2023 19:40:55 +0000 (20:40 +0100)] 
tests: Set SASLdirs to default values

We use standard paths for almost everything else.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agotests: Set TLSx509certdirs to default values
Andrea Bolognani [Thu, 2 Mar 2023 17:34:19 +0000 (18:34 +0100)] 
tests: Set TLSx509certdirs to default values

For almost all directories, the value we set matches the one
a standard deployment would use, but in a couple of cases they
deviate from that. Keep things consistent.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agotests: Set more TLSx509certdirs
Andrea Bolognani [Thu, 2 Mar 2023 17:35:31 +0000 (18:35 +0100)] 
tests: Set more TLSx509certdirs

We were missing a couple.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agotests: Move more QEMU driver settings to common code
Andrea Bolognani [Thu, 2 Mar 2023 17:31:00 +0000 (18:31 +0100)] 
tests: Move more QEMU driver settings to common code

None of these settings is specific to the xml2argv test. Moving
them to the common code ensures the behavior of the QEMU driver
is consistent across all QEMU tests.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agotests: Add convenience variable for QEMU driver config
Andrea Bolognani [Thu, 2 Mar 2023 18:48:23 +0000 (19:48 +0100)] 
tests: Add convenience variable for QEMU driver config

This makes the code less clunky.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agotests: Drop no longer necessary overrides
Andrea Bolognani [Thu, 2 Mar 2023 17:11:35 +0000 (18:11 +0100)] 
tests: Drop no longer necessary overrides

Creating a privileged config ensures these are already set
correctly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agotests: Create privileged config for QEMU driver
Andrea Bolognani [Thu, 2 Mar 2023 16:59:01 +0000 (17:59 +0100)] 
tests: Create privileged config for QEMU driver

Our QEMU test suite effectively covers the qemu:///system
scenario, and we have to partially replace the unprivileged
config with its privileged equivalent after the fact to keep up
the illusion.

Instead of jumping through these extra hoops, we can simply
start with a privileged configuration matching the privileged
driver we're creating for test programs.

This change highlights that we were missing a couple of
overrides, specifically in the tests for passt and dbus. Now
that we're creating a privileged config, this kind of issue
shouldn't be able to slip into the test suite.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agotests: Set the QEMU driver as privileged in common code
Andrea Bolognani [Thu, 2 Mar 2023 16:54:19 +0000 (17:54 +0100)] 
tests: Set the QEMU driver as privileged in common code

Most test programs were already doing this, and moving it to
the common code ensures we see consistent behavior across all
QEMU tests.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agotests: Limit use of TLSx509secretUUIDs
Andrea Bolognani [Mon, 6 Mar 2023 12:43:01 +0000 (13:43 +0100)] 
tests: Limit use of TLSx509secretUUIDs

These are intended to be used for just a few specific tests,
but since we don't always free them up afterwards they could
end up accidentally affecting subsequent tests as well.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agotests: Limit use of SPICE TLS
Andrea Bolognani [Thu, 2 Mar 2023 19:23:37 +0000 (20:23 +0100)] 
tests: Limit use of SPICE TLS

Follow the example of other similar settings and only enable it
for the few test cases that are actually about the specific
functionality, disabling it immediately afterwards.

A few test cases that were completely unrelated to SPICE TLS no
longer see the effects of having the feature enabled.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agotests: Increase scope for SASLdirs
Andrea Bolognani [Thu, 2 Mar 2023 19:07:44 +0000 (20:07 +0100)] 
tests: Increase scope for SASLdirs

Just like TLSx509certdirs, these can be set throughout the
lifetime of the test program.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agotests: Drop unnecessary free
Andrea Bolognani [Thu, 2 Mar 2023 18:34:40 +0000 (19:34 +0100)] 
tests: Drop unnecessary free

The various TLSx509certdirs can be set throughout the lifetime
of the test program without issue.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agotests: Drop unnecessary configuration overrides
Andrea Bolognani [Thu, 2 Mar 2023 19:38:24 +0000 (20:38 +0100)] 
tests: Drop unnecessary configuration overrides

They are not used by the specific test.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agotests: Poison more XDG variables
Andrea Bolognani [Thu, 2 Mar 2023 16:59:06 +0000 (17:59 +0100)] 
tests: Poison more XDG variables

We use these in QEMU command lines, so we should poison them
to catch test suite issues.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoutil: json: Remove unused virJSONValueObjectAppendStringPrintf
Peter Krempa [Mon, 6 Mar 2023 09:09:19 +0000 (10:09 +0100)] 
util: json: Remove unused virJSONValueObjectAppendStringPrintf

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuBuildHostNetProps: Append aliases without virJSONValueObjectAppendStringPrintf
Peter Krempa [Mon, 6 Mar 2023 08:58:23 +0000 (09:58 +0100)] 
qemuBuildHostNetProps: Append aliases without virJSONValueObjectAppendStringPrintf

Format aliases into temporary strings and append them using
virJSONValueObjectAdd.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuBuildHostNetProps: Append ipv6 address using virJSONValueObjectAdd
Peter Krempa [Mon, 6 Mar 2023 08:56:42 +0000 (09:56 +0100)] 
qemuBuildHostNetProps: Append ipv6 address using virJSONValueObjectAdd

The 'ipv6-prefix' and 'ipv6-prefixlen' fields can be directly added
using virJSONValueObjectAdd rather than by two separate calls.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuBuildChannelGuestfwdNetdevProps: Don't use virJSONValueObjectAppendStringPrintf
Peter Krempa [Mon, 6 Mar 2023 08:46:40 +0000 (09:46 +0100)] 
qemuBuildChannelGuestfwdNetdevProps: Don't use virJSONValueObjectAppendStringPrintf

Use virJSONValueObjectAdd and format the string directly via
g_strdup_printf. In the end virJSONValueObjectAppendStringPrintf will be
removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuBuildHostNetProps: Don't use virJSONValueObjectAppendStringPrintf to format address
Peter Krempa [Mon, 6 Mar 2023 08:40:24 +0000 (09:40 +0100)] 
qemuBuildHostNetProps: Don't use virJSONValueObjectAppendStringPrintf to format address

Prefer virJSONValueObjectAdd which we already use internally combined
with local formatting of the string.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuBuildHostNetProps: Report proper errors for unhandled interface types
Peter Krempa [Mon, 6 Mar 2023 08:18:51 +0000 (09:18 +0100)] 
qemuBuildHostNetProps: Report proper errors for unhandled interface types

VIR_DOMAIN_NET_TYPE_NULL and VIR_DOMAIN_NET_TYPE_VDS are not implemented
for the qemu driver but the formatter code in 'qemuBuildHostNetProps'
didn't report an error for them and didn't even return from the function
when they were encountered.

This caused a crash in 'virJSONValueObjectAppendStringPrintf' which
does not tolerate NULL JSON object to append to when the unsupported
devices were used.

Properly report error when unhandled devices are encountered. This also
includes the case for VIR_DOMAIN_NET_TYPE_HOSTDEV, but that code path
should never be reached.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2175582
Fixes: bac6b266fb6a / 6457619d186
Fixes: 0225483adce
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoexamples: systemtap: Update to linux-6.3 (rc1)
Peter Krempa [Mon, 6 Mar 2023 10:17:42 +0000 (11:17 +0100)] 
examples: systemtap: Update to linux-6.3 (rc1)

The 'vmsa' struct was moved out of 'struct vcpu_svm' into the 'sev_es'
sub-struct in linux commit:

  commit b67a4cc35c9f726999fa29880713ce72d4e39e8d
  Author: Peter Gonda <pgonda@google.com>
  Date:   Thu Oct 21 10:42:59 2021 -0700

      KVM: SEV: Refactor out sev_es_state struct

      Move SEV-ES vCPU metadata into new sev_es_state struct from vcpu_svm.

Also update the line reference to have more margin.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoexamples: systemtap: Warn users to properly update 'amd-sev-es-vmsa.stp'
Peter Krempa [Mon, 6 Mar 2023 10:16:32 +0000 (11:16 +0100)] 
examples: systemtap: Warn users to properly update 'amd-sev-es-vmsa.stp'

The script references a very specific line in the kernel source code and
a very specific struct. Further changes to the kernel are likely going
to break it. Set the expectations by adding a warning to the reader.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoqemu: Use '-machine acpi=on/off' instead of deprecated '-no-acpi'
Peter Krempa [Mon, 27 Feb 2023 11:46:13 +0000 (12:46 +0100)] 
qemu: Use '-machine acpi=on/off' instead of deprecated '-no-acpi'

QEMU deprecated the '-no-acpi' option, thus we should switch to the
modern way to use '-machine'.

Certain ARM machine types don't support ACPI. Given our historically
broken design of using '<acpi/>' without attribute to enable ACPI and
qemu's default of enabling it without '-no-acpi' such configurations
would not work.

Now when qemu reports whether given machine type supports ACPI we can do
a better decision and un-break those configs. Unfortunately not
retroactively.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/297
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Introduce virQEMUCapsMachineSupportsACPI
Peter Krempa [Mon, 27 Feb 2023 14:44:57 +0000 (15:44 +0100)] 
qemu: capabilities: Introduce virQEMUCapsMachineSupportsACPI

The helper returns the 'acpi' flag for a given machine type.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Extract whether machine type supports ACPI
Peter Krempa [Mon, 27 Feb 2023 13:45:47 +0000 (14:45 +0100)] 
qemu: capabilities: Extract whether machine type supports ACPI

The return data from 'query-machines' now contains an 'acpi' field. If
the field is present we can use it to decide how to handle user's
setting of '<acpi/>' domain feature.

Add logic to extract the 'acpi' field and store it in machine type list
along with other properties.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Refactor XML parsing in virQEMUCapsLoadMachines
Peter Krempa [Mon, 27 Feb 2023 13:45:06 +0000 (14:45 +0100)] 
qemu: capabilities: Refactor XML parsing in virQEMUCapsLoadMachines

Use the appropriate virXMLProp* helpers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: qemucapabilitiesdata: Update capabilities for the qemu-8.0 dev cycle on x86_64
Peter Krempa [Wed, 1 Mar 2023 11:57:17 +0000 (12:57 +0100)] 
tests: qemucapabilitiesdata: Update capabilities for the qemu-8.0 dev cycle on x86_64

Update to v7.2.0-2146-g2946e1af27

Notable changes:

 - 'acpi' field in 'query-machines' added
 - 'SapphireRapids(-v1)' cpu model added
 - 'fsrs', 'fsrc', 'fzrm' cpu features added and available via TCG
 - 'fsrm' feature can be now emulated by qemu
 - 'smm-enabled' property added to 'ICH9-LPC' device
 - 'luks-any' encryption type for RBD blockdev backend and way to
    specify encryption options for parent image via 'parent'
 - 'xen-event-inject', 'xen-event-list' commands added
 - 'xen-xenstore', 'xen-gnttab', 'xen-evtchn', 'xen-overlay',
   'xen-platform'
 - 'i2c-echo' device added

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Retire unused QEMU_CAPS_IOTHREAD_POLLING
Peter Krempa [Thu, 23 Feb 2023 09:13:20 +0000 (10:13 +0100)] 
qemu: capabilities: Retire unused QEMU_CAPS_IOTHREAD_POLLING

We now always assume support for polling mode of iothreads.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Always assume support for QEMU_CAPS_IOTHREAD_POLLING
Peter Krempa [Thu, 23 Feb 2023 09:09:46 +0000 (10:09 +0100)] 
qemu: Always assume support for QEMU_CAPS_IOTHREAD_POLLING

iothread polling mode and the corresponding properties were added in
qemu-2.9 ( 0d9d86fb4df4882b ). We can always assume that qemu supports
them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Retire unused QEMU_CAPS_OBJECT_IOTHREAD
Peter Krempa [Thu, 23 Feb 2023 08:57:24 +0000 (09:57 +0100)] 
qemu: capabilities: Retire unused QEMU_CAPS_OBJECT_IOTHREAD

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Always assume support for iothreads
Peter Krempa [Thu, 23 Feb 2023 08:28:25 +0000 (09:28 +0100)] 
qemu: Always assume support for iothreads

iothreads were introduced in qemu-2.0 and can't be compiled out thus we
can always assume qemu supports them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: qemuxml2argvdata: Remove irrelevant <disk> from 'iothread-*' cases
Peter Krempa [Tue, 28 Feb 2023 14:35:12 +0000 (15:35 +0100)] 
tests: qemuxml2argvdata: Remove irrelevant <disk> from 'iothread-*' cases

Remove disks which are not necessary to demonstrate iothread config.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Modernize negative cputune-* cases
Peter Krempa [Thu, 23 Feb 2023 08:21:41 +0000 (09:21 +0100)] 
qemuxml2argvtest: Modernize negative cputune-* cases

Use latest caps for the tests even though the original test case didn't
need any capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2(argv|xmltest): Simplify testing of scheduler settings
Peter Krempa [Thu, 23 Feb 2023 08:07:50 +0000 (09:07 +0100)] 
qemuxml2(argv|xmltest): Simplify testing of scheduler settings

Remove the cputune-iothreads, cputune-iothreadsched-zeropriority,
cputune-iothreadsched test files by moving the relevant elements into
the cputune case as we can setup scheduler settings for multiple objects
and thus test everything in one go.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2(argv|xml)test: Modernize 'cputune' test cases
Peter Krempa [Wed, 22 Feb 2023 14:57:47 +0000 (15:57 +0100)] 
qemuxml2(argv|xml)test: Modernize 'cputune' test cases

Use DO_TEST_CAPS_LATEST for cputune-numatune, cputune-zero-shares,
cputune, and vcpu-placement-static cases. Do the necessary tweaks to
work with actual data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2xmltest: Modernize iothread CWW/SCSI test cases
Peter Krempa [Wed, 22 Feb 2023 14:37:52 +0000 (15:37 +0100)] 
qemuxml2xmltest: Modernize iothread CWW/SCSI test cases

The argv counterparts are already modernized.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Modernize the rest of 'iohtreads-*'
Peter Krempa [Wed, 22 Feb 2023 14:23:04 +0000 (15:23 +0100)] 
qemuxml2argvtest: Modernize the rest of 'iohtreads-*'

Use DO_TEST_CAPS_LATEST for the basic tests. The emulator needed to be
tweaked to work with the real caps data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2(argv|xml)test: Remove 'iothreads' case
Peter Krempa [Wed, 22 Feb 2023 14:16:24 +0000 (15:16 +0100)] 
qemuxml2(argv|xml)test: Remove 'iothreads' case

'iothreads-disk' covers everything that 'iothreads' did in addition to
actually using the iothread.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemuxml2argvtest: Remove 'iothreads-nocap'
Peter Krempa [Wed, 22 Feb 2023 14:10:07 +0000 (15:10 +0100)] 
qemuxml2argvtest: Remove 'iothreads-nocap'

All supported QEMU versions now support iothreads thus upcoming patches
will be removing the capability checks. Remove the 'iothreads-nocap'
case which will become invalid.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: virDomainDiskDefDriverParseXML: Drop unused XPath infrastructure
Peter Krempa [Thu, 23 Feb 2023 15:05:42 +0000 (16:05 +0100)] 
conf: virDomainDiskDefDriverParseXML: Drop unused XPath infrastructure

The function doesn't use XPath at all. Don't pass the context to it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agogendispatch: Drop 'aclapi' mode
Peter Krempa [Tue, 21 Feb 2023 14:57:01 +0000 (15:57 +0100)] 
gendispatch: Drop 'aclapi' mode

The separate API perms XML is no longer used. Remove the support for
generating it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodocs|access: Don't build the ACL flags into a separate XML
Peter Krempa [Tue, 21 Feb 2023 14:54:36 +0000 (15:54 +0100)] 
docs|access: Don't build the ACL flags into a separate XML

Since we now build it into the libvirt-api.xml or equivalents we don't
need the extra XML files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodocs/newapi.xsl: Take API flag data from libvirt-api.xml rather than access/libvirt...
Peter Krempa [Tue, 21 Feb 2023 14:05:44 +0000 (15:05 +0100)] 
docs/newapi.xsl: Take API flag data from libvirt-api.xml rather than access/libvirt-access.xml

Since now we embed the data in the libvirt API we don't need to source
it from the extra document.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoscripts/apibuild: Extract and format API ACLs
Peter Krempa [Tue, 21 Feb 2023 13:20:09 +0000 (14:20 +0100)] 
scripts/apibuild: Extract and format API ACLs

As an additional step before processing the API parse the protocol file
and extract all ACL definitions. This way we can distribute them for any
user of the libvirt API XML files. We will be also able to avoid another
call to gendispatch, which generates all this data into a standalone
XML.

The remote procedure to API name is inspired by what rpcgen does.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoapibuild: Add infrastructure for generating ACL flag info into function docs
Peter Krempa [Tue, 21 Feb 2023 13:06:02 +0000 (14:06 +0100)] 
apibuild: Add infrastructure for generating ACL flag info into function docs

If the user of the 'docBuilder' class provides a dict (key is API name,
value is a tuple of arrays (acls, aclfilters), use the dict to generate
ACL definitions into the function definition.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoremote_protocol: Fix list of supported ACL object names
Peter Krempa [Tue, 21 Feb 2023 13:04:54 +0000 (14:04 +0100)] 
remote_protocol: Fix list of supported ACL object names

Add missing and fix spelling of existing ones.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agosrc: Document virDomainInterfaceStats() limitation
Michal Privoznik [Mon, 6 Mar 2023 08:56:52 +0000 (09:56 +0100)] 
src: Document virDomainInterfaceStats() limitation

For unmanaged ethernet <interface/>, it is user's responsibility
to set up the interface. And as such it can be just anything.
Therefore, it's (almost) impossible for the
virDomainInterfaceStats() API to tell whether RX/TX values need
to be swapped or copied verbatim into the return structure.
Document this limitation.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoconf: Make macvtap ethernet share host view
Michal Privoznik [Wed, 1 Mar 2023 10:05:49 +0000 (11:05 +0100)] 
conf: Make macvtap ethernet share host view

When fetching stats for a domain's <interface/>, or when setting
up its QoS, we can face two situations:

1) the device "shares" the host view, meaning each packet
   sent/received on the interface by a domain is accounted for in
   the same category on the host, or

2) the device is at the other side, and a packet send by a
   domain, is in fact packet received on the host.

This fact affects whether we need to swap RX/TX values when
fetching stats, or setting up QoS. We have this convenient helper
function (virDomainNetTypeSharesHostView()), which returns to
which category given interface type falls into.

Now, for unmanaged type='ethernet' our options are quite limited,
because it's user's responsibility to set up the host side of the
interface. And it can be just anything. Fortunately, we have
another convenience function (virNetDevMacVLanIsMacvtap()), which
determines whether given interface is a macvtap (which is
notoriously known for falling into the first category).
Let's use it to help virDomainNetTypeSharesHostView() determine
the view more accurately.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2175449
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu: Remove duplicate user/group lookup
Andrea Bolognani [Wed, 1 Mar 2023 17:57:29 +0000 (18:57 +0100)] 
qemu: Remove duplicate user/group lookup

Commit 068efae5b1a9 created a copy of this code instead of
simply moving it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>