]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
2 years agoqemuxml2argvmock: Drop virNuma* mocks
Michal Privoznik [Tue, 7 Mar 2023 15:06:14 +0000 (16:06 +0100)] 
qemuxml2argvmock: Drop virNuma* mocks

Since qemuxml2argvtest is now using virnumamock, there's no need
for qemuxml2argvmock to offer reimplementation of virNuma*()
functions. Also, the comment about CLang and FreeBSD (introduced
in v4.3.0-40-g77ac204d14) is no longer true. Looks like noinline
attribute was the missing culprit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemuxml2argvdata: Extend vCPUs placement in memory-hotplug-dimm-addr.xml
Michal Privoznik [Tue, 7 Mar 2023 14:36:47 +0000 (15:36 +0100)] 
qemuxml2argvdata: Extend vCPUs placement in memory-hotplug-dimm-addr.xml

So far, the memory-hotplug-dimm-addr.xml test case pins its vCPUs
onto CPUs 0-1 which correspond to NUMA node #0 (per
tests/vircaps2xmldata/linux-basic/system/node/node0). Place vCPUs
onto nodes #1 and #2 too so that DIMM <memory/> device can
continue using thread-context after future patches. This
configuration, as-is currently, would make QEMU error out anyway.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemuxml2argvdata: Adjust maximum NUMA node used
Michal Privoznik [Tue, 7 Mar 2023 15:06:03 +0000 (16:06 +0100)] 
qemuxml2argvdata: Adjust maximum NUMA node used

We have couple of qemuxml2argvtest cases where up to 8 NUMA nodes
are assumed. These are used to check whether disjoint ranges of
host-nodes= is generated properly. Without prejudice to the
generality, we can rewrite corresponding XML files to use up to 4
NUMA nodes and still have disjoint ranges.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemuxml2argvtest: Use virnuma mock
Michal Privoznik [Tue, 7 Mar 2023 14:36:35 +0000 (15:36 +0100)] 
qemuxml2argvtest: Use virnuma mock

While no part of cmd line building process currently depends on a
host NUMA configuration, this will change soon. Use freshly
changed virnumamock from qemuxml2argvtest and make the mock read
NUMA data from vircaps2xmldata which seems to have the most rich
NUMA configuration.

This also means, we have to start building virnumamock
unconditionally. But this is not a problem, since nothing inside
of the mock relies on Linux specificity. The whole mock is merely
just reading files and parsing them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agovirnumamock: Introduce virNumaGetNodeOfCPU() mock
Michal Privoznik [Tue, 7 Mar 2023 14:44:41 +0000 (15:44 +0100)] 
virnumamock: Introduce virNumaGetNodeOfCPU() mock

Introduce a mock of virNumaGetNodeOfCPU() because soon we will
need virNumaCPUSetToNodeset() to return predictable results.
Also, fill in missing symlinks in vircaps2xmldata/.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agovirnuma: Introduce virNumaCPUSetToNodeset()
Michal Privoznik [Tue, 7 Mar 2023 13:05:27 +0000 (14:05 +0100)] 
virnuma: Introduce virNumaCPUSetToNodeset()

So far, we have a function that expands given list of NUMA nodes
into list of CPUs. But soon, we are going to need the inverse -
expand list of CPUs into list of NUMA nodes. Introduce
virNumaCPUSetToNodeset() for that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agovirnuma: Move virNumaNodesetToCPUset() out of WITH_NUMACTL
Michal Privoznik [Wed, 8 Mar 2023 09:10:00 +0000 (10:10 +0100)] 
virnuma: Move virNumaNodesetToCPUset() out of WITH_NUMACTL

Technically, there's nothing libnuma specific about
virNumaNodesetToCPUset(). It just implements a generic algorithm
over virNumaGetNodeCPUs() (which is then libnuma dependant).
Nevertheless, there's no need to have this function living inside
WITH_NUMACTL block. Any error returned from virNumaGetNodeCPUs()
(including the one that !WITH_NUMACTL stub returns) is propagated
properly.

Move the function out of the block into a generic one and drop
the !WITH_NUMACTL stub.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemu_alias: Fix backcompat console alias generation
Michal Privoznik [Tue, 14 Mar 2023 10:03:50 +0000 (11:03 +0100)] 
qemu_alias: Fix backcompat console alias generation

We have this crazy backwards compatibility when it comes to
serial and console devices. Basically, in same cases the very
first <console/> is just an alias to the very first <serial/>
device. This is to be seen at various places:

1) virDomainDefFormatInternalSetRootName() - when generating
   domain XML, the <console/> configuration is basically ignored
   and corresponding <serial/> config is formatted,

2) virDomainDefAddConsoleCompat() - which adds a copy of
   <serial/> or <console/> into virDomainDef in post parse.

And when talking to QEMU we need a special handling too, because
while <serial/> is generated on the cmd line, the <console/> is
not. And in a lot of place we get it right. Except for generating
device aliases. On domain startup the 'expected' happens and
devices get "serial0" and "console0" aliases, correspondingly.
This ends up in the status XML too. But due to aforementioned
trick when formatting domain XML, "serial0" ends up in both
'virsh dumpxml' and the status XML. But internally, both devices
have different alias. Therefore, detaching the device using
<console/> fails as qemuDomainDetachDeviceChr() tries to detach
"console0".

After the daemon is restarted and status XML is parsed, then
everything works suddenly. This is because in the status XML both
devices have the same alias.

Let's generate correct alias from the beginning.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2156300
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agoqemu_migration: Use VIR_DOMAIN_PAUSED_API_ERROR
Jiri Denemark [Wed, 1 Mar 2023 11:55:18 +0000 (12:55 +0100)] 
qemu_migration: Use VIR_DOMAIN_PAUSED_API_ERROR

Other APIs that internally use QEMU migration and need to temporarily
suspend a domain already report failure to resume vCPUs by setting
VIR_DOMAIN_PAUSED_API_ERROR state reason and emitting
VIR_DOMAIN_EVENT_SUSPENDED event with
VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR.

Let's do the same in qemuMigrationSrcRestoreDomainState for consistent
behavior.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoIntroduce VIR_DOMAIN_PAUSED_API_ERROR
Jiri Denemark [Tue, 28 Feb 2023 15:53:29 +0000 (16:53 +0100)] 
Introduce VIR_DOMAIN_PAUSED_API_ERROR

Some APIs (migration, save/restore, snapshot, ...) require a domain to
be suspended temporarily. In case resuming the domain fails, the domain
will be unexpectedly left paused when the API finishes. This situation
is reported via VIR_DOMAIN_EVENT_SUSPENDED event with
VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR detail. But we do not have a
corresponding reason for VIR_DOMAIN_PAUSED state and the reason would
remain set to the value used when the domain was paused. So the state
reason would suggest the operation is still running.

This patch changes the state reason to a new VIR_DOMAIN_PAUSED_API_ERROR
to make it clear the API that paused the domain already finished, but
failed to resume the domain.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoClarify VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR semantics
Jiri Denemark [Tue, 28 Feb 2023 14:49:29 +0000 (15:49 +0100)] 
Clarify VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR semantics

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoNEWS: Mention support for custom UEFI firmwar paths in Xen
Jim Fehlig [Mon, 13 Mar 2023 20:37:49 +0000 (14:37 -0600)] 
NEWS: Mention support for custom UEFI firmwar paths in Xen

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: remove unused argument
Ján Tomko [Mon, 13 Mar 2023 13:42:58 +0000 (14:42 +0100)] 
qemu: remove unused argument

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: relax shared memory check for vhostuser daemons
Ján Tomko [Mon, 13 Mar 2023 12:56:47 +0000 (13:56 +0100)] 
qemu: relax shared memory check for vhostuser daemons

For some vhostuser daemons, we validate that the guest memory is shared
with the host.

With earlier versions of QEMU, it was only possible to mark memory
as shared by defining an explicit NUMA topology.  Later, QEMU exposed
the name of the default memory backend (defaultRAMid) so we can mark
that memory as shared.

Since libvirt commit:
  commit bff2ad5d6b1f25da02802273934d2a519159fec7
    qemu: Relax validation for mem->access if guest has no NUMA
we already check for the case when user requests shared memory,
but QEMU did not expose defaultRAMid.

Drop the duplicit check from vhostuser device validation, to make
it pass on hotplug even after libvirtd restart.

This avoids the need to store the defaultRAMid, since we don't really
need it for anything after the VM has been already started.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agonews: Update for passt on SELinux/AppArmor support
Andrea Bolognani [Tue, 14 Mar 2023 09:44:38 +0000 (10:44 +0100)] 
news: Update for passt on SELinux/AppArmor support

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agorpm: Recommend passt-selinux
Andrea Bolognani [Tue, 14 Mar 2023 09:41:46 +0000 (10:41 +0100)] 
rpm: Recommend passt-selinux

Now that we have SELinux support for passt, we want things to
work out of the box and that requires having the passt-specific
SELinux bits installed.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2 years agodocs: downloads: Point to pkg.go.dev for go module releases
Peter Krempa [Tue, 14 Mar 2023 09:11:33 +0000 (10:11 +0100)] 
docs: downloads: Point to pkg.go.dev for go module releases

Currently the 'Releases' column pointed to the generic page about the
specific go module. Change the link to point to the respective
pkg.go.dev page for the module.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agodocs: downloads: Don't mention releases directory of libvirt-csharp
Peter Krempa [Tue, 14 Mar 2023 12:01:59 +0000 (13:01 +0100)] 
docs: downloads: Don't mention releases directory of libvirt-csharp

The releases directory is empty. Don't advertise it on our downloads
page.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agodocs: downloads: Drop link to sources of 'consoleproxy'
Peter Krempa [Tue, 14 Mar 2023 08:47:35 +0000 (09:47 +0100)] 
docs: downloads: Drop link to sources of 'consoleproxy'

The directory doesn't exist. The project also doesn't have any releases
on gitlab so there's nothing to replace it with.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agospec: Use 'download.libvirt.org' as source server
Peter Krempa [Tue, 14 Mar 2023 08:32:30 +0000 (09:32 +0100)] 
spec: Use 'download.libvirt.org' as source server

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agodocs: downloads: Replace 'libvirt.org/sources' by 'download.libvirt.org'
Peter Krempa [Tue, 14 Mar 2023 08:30:25 +0000 (09:30 +0100)] 
docs: downloads: Replace 'libvirt.org/sources' by 'download.libvirt.org'

We split off the downloads into a new subdomain. Link directly to it
instead of relying on redirects.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agodocs: java: Clean up links to source code
Peter Krempa [Tue, 14 Mar 2023 08:26:11 +0000 (09:26 +0100)] 
docs: java: Clean up links to source code

 - drop the link to the FTP server which doesn't exist any more
 - change links to libvirt.org/source to download.libvirt.org
 - change link to the maven repository to point to download.libvirt.org
 - change link to javadoc to the documentation generated via gitlab job
   in the libvirt-java project

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2 years agodocs: Fix searching in the wiki
Peter Krempa [Mon, 13 Mar 2023 12:10:17 +0000 (13:10 +0100)] 
docs: Fix searching in the wiki

Conversion of the wiki to static pages means that the integrated search
no longer functions. Use the same approach we have for other search to
simply defer to google.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agorpc: genprotocol: Always apply fixups to rpcgen's output
Peter Krempa [Wed, 8 Mar 2023 08:51:05 +0000 (09:51 +0100)] 
rpc: genprotocol: Always apply fixups to rpcgen's output

The platform check which determines when to apply the fixups mentions
all officially supported build targets (per docs/platforms.rst) thus
it's not really necessary.

Additionally while not explicitly written as supported the check does
not work properly when building with the MinGW toolchain on Windows as
it does not apply the needed transformations. They are necessary
there the same way as with MinGW on Linux.

https://gitlab.com/libvirt/libvirt/-/issues/453

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoUse G_N_ELEMENTS() more
Michal Privoznik [Mon, 13 Mar 2023 09:43:50 +0000 (10:43 +0100)] 
Use G_N_ELEMENTS() more

In a few places we still use the good old:

  sizeof(var) / sizeof(var[0])
  sizeof(var) / sizeof(int)

The G_N_ELEMENTS() macro is preferred though. In a few places we
don't link with glib, so provide the macro definition.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
2 years agoremote: fix typo in error message string
Daniel P. Berrangé [Mon, 13 Mar 2023 12:21:32 +0000 (12:21 +0000)] 
remote: fix typo in error message string

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoqemu: set SELinux label of passt process to its own binary's label
Laine Stump [Wed, 1 Mar 2023 20:58:24 +0000 (15:58 -0500)] 
qemu: set SELinux label of passt process to its own binary's label

set useBinarySpecificLabel = true when calling qemuSecurityCommandRun
for the passt process, so that the new process context will include
the binary-specific label that should be used for passt (passt_t)
rather than svirt_t (as would happen if useBinarySpecificLabel was
false). (The MCS part of the label, which is common to all child
processes related to a particular qemu domain instance, is also set).

Resolves: 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 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>