]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
2 years agosecurity: make it possible to set SELinux label of child process from its binary
Laine Stump [Wed, 1 Mar 2023 20:34:32 +0000 (15:34 -0500)] 
security: make it possible to set SELinux label of child process from its binary

Normally when a child process is started by libvirt, the SELinux label
of that process is set to virtd_t (plus an MCS range). In at least one
case (passt) we need for the SELinux label of a child process label to
match the label that the binary would have transitioned to
automatically if it had been run standalone (in the case of passt,
that label is passt_t).

This patch modifies virSecuritySELinuxSetChildProcessLabel() (and all
the functions above it in the call chain) so that the toplevel
function can set a new argument "useBinarySpecificLabel" to true. If
it is true, then virSecuritySELinuxSetChildProcessLabel() will call
the new function virSecuritySELinuxContextSetFromFile(), which uses
the selinux library function security_compute_create() to determine
what would be the label of the new process if it had been run
standalone (rather than being run by libvirt) - the MCS range from the
normally-used label is added to this newly derived label, and that is
what is used for the new process rather than whatever is in the
domain's security label (which will usually be virtd_t).

In order to easily verify that nothing was broken by these changes to
the call chain, all callers currently set useBinarySpecificPath =
false, so all behavior should be completely unchanged. (The next
patch will set it to true only for the case of running passt.)

https://bugzilla.redhat.com/2172267
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agosecurity: make args to virSecuritySELinuxContextAddRange() const
Laine Stump [Wed, 8 Mar 2023 17:50:38 +0000 (12:50 -0500)] 
security: make args to virSecuritySELinuxContextAddRange() const

Neither of these are modified anywhere in the function, and the
function will soon be called with an arg that actually is a const.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoutil: add an API to retrieve the resolved path to a virCommand's binary
Laine Stump [Wed, 1 Mar 2023 16:34:24 +0000 (11:34 -0500)] 
util: add an API to retrieve the resolved path to a virCommand's binary

The binary to be exec'ed by virExec() is stored in
virCommand::args[0], and is resolved to a full absolute path (stored
in a local of virExec() just prior to execve().

Since we will have another use for the full absolute path, lets make
an API to resolve/retrieve the absolute path, and cache it in
virCommand::binaryPath so we only have to do the resolution once.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agolibxl: Add support for custom firmware path in config converter
Jim Fehlig [Mon, 13 Feb 2023 21:30:31 +0000 (14:30 -0700)] 
libxl: Add support for custom firmware path in config converter

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agolibxl: Support specifying a custom firmware path
Jim Fehlig [Fri, 10 Feb 2023 21:22:19 +0000 (14:22 -0700)] 
libxl: Support specifying a custom firmware path

libxl added support for specifying custom firmware paths long ago. The
functionality exists in all Xen version supported by libvirt. This patch
adds support for user-specified efi firmware paths in the libxl driver.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoapparmor: Enable passt support
Andrea Bolognani [Tue, 7 Mar 2023 18:20:09 +0000 (19:20 +0100)] 
apparmor: Enable passt support

passt provides an AppArmor abstraction that covers all the
inner details of its operation, so we can simply import that
and add the libvirt-specific parts on top: namely, passt
needs to be able to create a socket and pid file, while
the libvirt daemon needs to be able to kill passt.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoTranslated using Weblate (Russian)
Ján Tomko [Wed, 8 Mar 2023 19:06:16 +0000 (20:06 +0100)] 
Translated using Weblate (Russian)

Currently translated at 89.6% (9338 of 10416 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/ru/

Co-authored-by: Jan Tomko <jtomko@redhat.com>
Signed-off-by: Jan Tomko <jtomko@redhat.com>
2 years agoTranslated using Weblate (Chinese (Simplified) (zh_CN))
Ludek Janda [Wed, 8 Mar 2023 19:06:16 +0000 (20:06 +0100)] 
Translated using Weblate (Chinese (Simplified) (zh_CN))

Currently translated at 99.5% (10373 of 10416 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/zh_CN/

Translated using Weblate (Japanese)

Currently translated at 99.5% (10369 of 10416 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/ja/

Translated using Weblate (Chinese (Simplified) (zh_CN))

Currently translated at 99.5% (10373 of 10416 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/zh_CN/

Co-authored-by: Ludek Janda <ljanda@redhat.com>
Signed-off-by: Ludek Janda <ljanda@redhat.com>
2 years agoqemu: implement QEMU NBD source reconnect delay attribute
Christian Nautze [Mon, 27 Feb 2023 11:15:33 +0000 (12:15 +0100)] 
qemu: implement QEMU NBD source reconnect delay attribute

Currently it's only possible to set this parameter during domain
creation via QEMU commandline passthrough feature.
With the new delay attribute it's also possible to set this
parameter if you want to attach a new NBD disk
using "virsh attach-device domain device.xml" e.g.:

  <disk type='network' device='disk'>
    <driver name='qemu' type='raw'/>
    <source protocol='nbd' name='foo'>
      <host name='example.org' port='6000'/>
      <reconnect delay='10'/>
    </source>
    <target dev='vdb' bus='virtio'/>
  </disk>

Signed-off-by: Christian Nautze <christian.nautze@exoscale.ch>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemuAppendLoadparmMachineParm: add loadparm from hostdev
Eric Farman [Fri, 10 Mar 2023 02:38:09 +0000 (03:38 +0100)] 
qemuAppendLoadparmMachineParm: add loadparm from hostdev

Commit 54fa1b44afc ("conf: Add loadparm boot option for a boot device")
added the ability to specify a loadparm parameter on a <boot/> tag, while
commit 29ba41c2d40 ("qemu: Add loadparm to qemu command line string")
added that value to the QEMU "-machine" command line parameters.

Unfortunately, the latter commit only looked at disks and network
devices for boot information, even though anything with
VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT could potentially have this tag.
In practice, a <hostdev> tag pointing to a passthrough (SCSI or DASD)
disk device can be used in this way, which means the loadparm is
accepted, but not given to QEMU.

Correct this, and add some XML/argv tests.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: tpm: Pass --logfile to swtpm_setup for incoming migration
Eiichi Tsukata [Fri, 10 Mar 2023 04:59:18 +0000 (04:59 +0000)] 
qemu: tpm: Pass --logfile to swtpm_setup for incoming migration

Good to have for debugging in case something wrong happens during
incoming migration.

Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agodomainsnapshot: add snapshotDeleteInProgress to RNG schema
Pavel Hrdina [Wed, 8 Mar 2023 12:02:37 +0000 (13:02 +0100)] 
domainsnapshot: add snapshotDeleteInProgress to RNG schema

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

Fixes: 565bcb5d79dddaf1d0d14cffe1f3ae78d76b10a0
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu_snapshot: fix external snapshot deletion for non-active snapshots
Pavel Hrdina [Thu, 2 Mar 2023 22:48:08 +0000 (23:48 +0100)] 
qemu_snapshot: fix external snapshot deletion for non-active snapshots

For shutoff VMs we don't have the storage source backing chain
populated so it will fail this check and error out. Move it to
part that is done only when VM is running.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoqemu_snapshot: properly ignore disks with manual snapshot
Pavel Hrdina [Wed, 1 Mar 2023 11:51:21 +0000 (12:51 +0100)] 
qemu_snapshot: properly ignore disks with manual snapshot

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoFix some typos
Tim Wiederhake [Thu, 9 Mar 2023 13:09:16 +0000 (14:09 +0100)] 
Fix some typos

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
2 years agotest: regenerate virtio-blob expected outputs
Jonathon Jongsma [Wed, 8 Mar 2023 23:04:29 +0000 (17:04 -0600)] 
test: regenerate virtio-blob expected outputs

Somehow the tests didn't get regenerated after rebasing, which broke the
build.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
2 years agoqemu: Implement 'blob' support for virtio gpu
Jonathon Jongsma [Wed, 23 Feb 2022 21:06:55 +0000 (15:06 -0600)] 
qemu: Implement 'blob' support for virtio gpu

This can improve performance for some guests since it reduces copying of
display data between host and guest. Requires udmabuf on the host.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Add capability for virtio-gpu.blob
Jonathon Jongsma [Fri, 11 Feb 2022 22:56:41 +0000 (16:56 -0600)] 
qemu: Add capability for virtio-gpu.blob

Capability to determine whether this qemu supports the 'blob' option for
virtio-gpu.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: add support for 'blob' in virtio video device
Jonathon Jongsma [Wed, 9 Feb 2022 21:13:09 +0000 (15:13 -0600)] 
conf: add support for 'blob' in virtio video device

Add the ability to enable blob resources for the virtio video device.
This will accelerate the display path due to less or no copying of pixel
data.

Blob resource support can be enabled with e.g.:

    <video>
      <model type='virtio' blob='on'/>
    </video>

Some additional background information about blob resources:
https://lists.freedesktop.org/archives/dri-devel/2020-August/275972.html
https://www.kraxel.org/blog/2021/05/virtio-gpu-qemu-graphics-update/

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

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: use enum variable for video type
Jonathon Jongsma [Thu, 10 Feb 2022 16:51:00 +0000 (10:51 -0600)] 
conf: use enum variable for video type

Rather than storing the video type as an integer, use the proper enum
type within the struct.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: switch to virXMLProp* functions for parsing video
Jonathon Jongsma [Tue, 8 Feb 2022 22:42:05 +0000 (16:42 -0600)] 
conf: switch to virXMLProp* functions for parsing video

In virDomainVideoModelDefParseXML(), use the virXMLProp* functions
rather than reimplementing them with virXPath* functions.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoutil: add virXMLPropUIntDefault() function
Jonathon Jongsma [Tue, 8 Nov 2022 20:12:32 +0000 (14:12 -0600)] 
util: add virXMLPropUIntDefault() function

This function allows you to specify a default value to return if the
property is not found rather than always setting *result to 0.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: Refactor video model parsing
Jonathon Jongsma [Tue, 8 Feb 2022 19:19:58 +0000 (13:19 -0600)] 
conf: Refactor video model parsing

Factor out a separate function to parse out the <model> element for
video devices.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: explicitly set VIR_DOMAIN_VIDEO_TYPE_DEFAULT to 0
Jonathon Jongsma [Mon, 7 Nov 2022 15:34:55 +0000 (09:34 -0600)] 
conf: explicitly set VIR_DOMAIN_VIDEO_TYPE_DEFAULT to 0

Ensure that new virDomainVideoDef objects have their 'type' set to
VIR_DOMAIN_VIDEO_TYPE_DEFAULT and remove places that this value is set
after construction. Since virDomainVideoDefNew() uses g_new0() allocate
the instance, all fields are initialized to 0.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoutil: do not report errors in virPidFileForceCleanupPathFull
Ján Tomko [Tue, 7 Mar 2023 14:50:18 +0000 (15:50 +0100)] 
util: do not report errors in virPidFileForceCleanupPathFull

Use the quiet version of virPidFileAcquirePath and remove the error
reset, since there's nothing to reset anymore.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoutil: add quiet parameter to virPidFileAcquirePathFull
Ján Tomko [Tue, 7 Mar 2023 14:43:40 +0000 (15:43 +0100)] 
util: add quiet parameter to virPidFileAcquirePathFull

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoutil: virPidFileAcquirePath: remove waitForLock argument
Ján Tomko [Tue, 7 Mar 2023 13:49:33 +0000 (14:49 +0100)] 
util: virPidFileAcquirePath: remove waitForLock argument

None of the callers need it anymore.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoleaseshelper: use virPidFileAcquirePathFull
Ján Tomko [Tue, 7 Mar 2023 13:40:47 +0000 (14:40 +0100)] 
leaseshelper: use virPidFileAcquirePathFull

The only caller that actually wants to wait for the lock.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoutil: introduce virPidFileAcquirePathFull
Ján Tomko [Tue, 7 Mar 2023 13:38:20 +0000 (14:38 +0100)] 
util: introduce virPidFileAcquirePathFull

For now, add the 'Full' suffix to virPidFileAcquirePath and make
virPidFileAcquirePath a 'wrapper' around it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoutil: remove waitForLock from virPidFileAcquire
Ján Tomko [Tue, 7 Mar 2023 15:07:20 +0000 (16:07 +0100)] 
util: remove waitForLock from virPidFileAcquire

The parameter was added for consistency with virPidFileAcquirePath.
However, all callers of virPidFileAcquire pass false.

Remove the argument.

Partially-reverts: 2250a2b5d21c3b3529727f38a99cba22f84024f7
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agovirSCSIHostFindByPCI: Fix link detection
Michal Privoznik [Wed, 8 Mar 2023 07:42:19 +0000 (08:42 +0100)] 
virSCSIHostFindByPCI: Fix link detection

Inside of virSCSIHostFindByPCI() there's a loop which iterates of
entries of "/sys/class/scsi_host" directory trying to identify
all symlinks (which then point to a SCSI device, but that's not
important right now). But the way virFileIsLink() is called can
never return a truthful reply - because it's called over
dent->d_name instead of full path. Fix this by moving the
virFileIsLink() call and passing constructed path into it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirscsihost: Drop needless labels
Michal Privoznik [Wed, 8 Mar 2023 07:57:35 +0000 (08:57 +0100)] 
virscsihost: Drop needless labels

After previous cleanups, we're left with a couple of needless
labels, that contain nothing but a return statement. Drop those.

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