]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
19 months agoci: helper: Add a job argparse subparser
Erik Skultety [Thu, 24 Aug 2023 09:07:09 +0000 (11:07 +0200)]
ci: helper: Add a job argparse subparser

The idea behind this subcommand is to follow whatever build job we have
defined in the GitLab CI pipeline, so that we only have a single source
of truth for the recipes. Adds 'shell' as an extra option for
interactive container build debugging.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: helper: Add an action to run the container workload via lcitool
Erik Skultety [Thu, 24 Aug 2023 13:21:44 +0000 (15:21 +0200)]
ci: helper: Add an action to run the container workload via lcitool

Just like with the other CLI sub-commands, add an action to run a
GitLab spec job in a local container via lcitool.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: helper: Rework _lcitool_run method logic
Erik Skultety [Thu, 24 Aug 2023 11:21:12 +0000 (13:21 +0200)]
ci: helper: Rework _lcitool_run method logic

This method wasn't even utilized before this patch. This patch adds all
the necessary logic to successfully execute a container workload via
lcitool (which will later allow us to ditch ci/Makefile). Because
container executions via lcitool creates the following inside the
container:

    $ ls
    script datadir

where 'datadir' is the workload directory (in this case a local git
repo clone) and 'script' is the code that runs whatever the workload is
over 'datadir'.

In order to satisfy the ^above, our helper generates a trivial
temporary 'script' that will source ci/build.sh and run whatever was
specified as --job essentially to simulate the exact steps a GitLab
pipeline job would go through.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: helper: Add a helper to create a local repo clone Pythonic way
Erik Skultety [Thu, 24 Aug 2023 09:13:59 +0000 (11:13 +0200)]
ci: helper: Add a helper to create a local repo clone Pythonic way

A proper Python equivalent of 'git clone --local'.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: helper: Add Python code hangling git clones
Erik Skultety [Thu, 24 Aug 2023 08:24:12 +0000 (10:24 +0200)]
ci: helper: Add Python code hangling git clones

This helper will be utilized by a future patch which will add the
lcitool container execution logic. The reason why the required_deps
decorator isn't being used here is because this is a property.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: helper: Add a required_deps higher order helper/decorator
Erik Skultety [Thu, 24 Aug 2023 08:28:55 +0000 (10:28 +0200)]
ci: helper: Add a required_deps higher order helper/decorator

Since we'll depend on GitPython for repo cloning, we need to make sure
to emit a user friendly error if the module is not installed. This
patch introduces a helper which future patches will use as a decorator.
Inspiration for this helper has been taken out of lcitool where we use
an identical helper for this purpose.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: helper: Add --lcitool-path CLI option
Erik Skultety [Thu, 24 Aug 2023 08:33:43 +0000 (10:33 +0200)]
ci: helper: Add --lcitool-path CLI option

We'll soon be relying solely on lcitool so we need to be able to run it
from a user-provided location if it's not installed in a known
location.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: helper: Don't make ':' literal a static part of the image tag
Erik Skultety [Thu, 24 Aug 2023 08:32:24 +0000 (10:32 +0200)]
ci: helper: Don't make ':' literal a static part of the image tag

':' is just a connecting character, we can add it to the appropriate
place later in the Python script later, but it doesn't make sense to be
part of the image 'tag' string.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: helper: Drop _lcitool_get_targets method
Erik Skultety [Thu, 24 Aug 2023 09:12:27 +0000 (11:12 +0200)]
ci: helper: Drop _lcitool_get_targets method

This method unused anywhere, so drop it.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months ago.gitlab-ci.yml: Convert the potfile job to the build.sh usage
Erik Skultety [Thu, 24 Aug 2023 14:05:41 +0000 (16:05 +0200)]
.gitlab-ci.yml: Convert the potfile job to the build.sh usage

Individual shell command executions are replaced by respective
functions in the ci/build.sh base script. This will make sure we use
the same recipes in GitLab jobs as well as in local executions.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months ago.gitlab-ci.yml: Convert the codestyle job to the build.sh usage
Erik Skultety [Thu, 24 Aug 2023 14:05:41 +0000 (16:05 +0200)]
.gitlab-ci.yml: Convert the codestyle job to the build.sh usage

Individual shell command executions are replaced by respective
functions in the ci/build.sh base script. This will make sure we use
the same recipes in GitLab jobs as well as in local executions.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months ago.gitlab-ci.yml: Convert the website build job to the build.sh usage
Erik Skultety [Thu, 24 Aug 2023 14:05:41 +0000 (16:05 +0200)]
.gitlab-ci.yml: Convert the website build job to the build.sh usage

Individual shell command executions are replaced by respective
functions in the ci/build.sh base script. This will make sure we use
the same recipes in GitLab jobs as well as in local executions.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months ago.gitlab-ci.yml: Convert the cross build job to the build.sh usage
Erik Skultety [Thu, 24 Aug 2023 14:05:41 +0000 (16:05 +0200)]
.gitlab-ci.yml: Convert the cross build job to the build.sh usage

Individual shell command executions are replaced by respective
functions in the ci/build.sh base script. This will make sure we use
the same recipes in GitLab jobs as well as in local executions.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months ago.gitlab-ci.yml: Convert the native build job to the build.sh usage
Erik Skultety [Thu, 24 Aug 2023 14:05:16 +0000 (16:05 +0200)]
.gitlab-ci.yml: Convert the native build job to the build.sh usage

Individual shell command executions are replaced by respective
functions in the ci/build.sh base script. This will make sure we use
the same recipes in GitLab jobs as well as in local executions.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months ago.gitlab-ci.yml: Add 'after_script' stage to prep for artifact collection
Erik Skultety [Wed, 1 Feb 2023 10:11:32 +0000 (11:11 +0100)]
.gitlab-ci.yml: Add 'after_script' stage to prep for artifact collection

This is one of the preparation steps that if not done would otherwise
collide with local container executions where we:
1) don't collect artifacts
2) are not limited by GitLab's environment and hence moving build
   artifacts to unusual places would only cause confusion when doing
   local build inspection in an interactive container shell session

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: Rename build.sh -> jobs.sh
Erik Skultety [Mon, 11 Sep 2023 13:28:52 +0000 (15:28 +0200)]
ci: Rename build.sh -> jobs.sh

After the recent changes, this script no longer executes any logic
anymore, it merely defines the jobs run in the GitLab environment. In
order to use it, one has to source the file in the environment and then
run one of the job "functions". For that, the 'build.sh' name is no
longer descriptive enough and 'jobs.sh' feels more suitable and less
misleading.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: build.sh: Drop MESON_ARGS definition from global level
Erik Skultety [Fri, 25 Aug 2023 14:22:43 +0000 (16:22 +0200)]
ci: build.sh: Drop MESON_ARGS definition from global level

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: build.sh: Drop direct invocation of meson/ninja commands
Erik Skultety [Thu, 24 Aug 2023 13:49:19 +0000 (15:49 +0200)]
ci: build.sh: Drop direct invocation of meson/ninja commands

We've moved all invocations to the respective helper function which
we'll execute both from gitlab CI jobs and local environments so we
don't need to have them on the global level as it would also not work
with "sourcing" this file to populate the environment with function
definitions.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: build.sh: Drop changing working directory to CI_CONT_DIR
Erik Skultety [Thu, 24 Aug 2023 13:41:38 +0000 (15:41 +0200)]
ci: build.sh: Drop changing working directory to CI_CONT_DIR

Firstly, this would mangle with "sourcing" this file in either
execution environment later down the road. Secondly, we won't need this
as future ci/helper patches will generate a throwaway script that will
take care of a correct execution of a build job in a similar fashion as
if the job ran in a GitLab environment.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: build.sh: Add a wrapper function over the 'website' job
Erik Skultety [Thu, 24 Aug 2023 13:49:19 +0000 (15:49 +0200)]
ci: build.sh: Add a wrapper function over the 'website' job

This helper is a shell function transcript of its original GitLab CI
counterpart.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: build.sh: Add a wrapper function over the 'rpmbuild' job
Erik Skultety [Thu, 24 Aug 2023 13:49:19 +0000 (15:49 +0200)]
ci: build.sh: Add a wrapper function over the 'rpmbuild' job

This helper is a shell function transcript of its original GitLab CI
counterpart.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: build.sh: Add a wrapper function over the 'potfile' job
Erik Skultety [Thu, 24 Aug 2023 13:48:46 +0000 (15:48 +0200)]
ci: build.sh: Add a wrapper function over the 'potfile' job

This helper is a shell function transcript of its original GitLab CI
counterpart. There's one notable difference such that we pass '-j1' to
the meson compile command otherwise we'd have to execute the 'run_build'
function twice, passing 'libvirt-pot-dep' and 'libvirt-pot' targets
in a serial manner.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: build.sh: Add a wrapper function over the 'codestyle' job
Erik Skultety [Thu, 24 Aug 2023 13:49:19 +0000 (15:49 +0200)]
ci: build.sh: Add a wrapper function over the 'codestyle' job

This helper is a shell function transcript of its original GitLab CI
counterpart.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: build.sh: Add a wrapper function over the 'test' job
Erik Skultety [Thu, 24 Aug 2023 13:48:46 +0000 (15:48 +0200)]
ci: build.sh: Add a wrapper function over the 'test' job

This helper is a shell function transcript of its original GitLab CI
counterpart.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: build.sh: Add a helper function to create the dist tarball
Erik Skultety [Thu, 24 Aug 2023 13:47:48 +0000 (15:47 +0200)]
ci: build.sh: Add a helper function to create the dist tarball

This helper function does not correspond to a particular GitLab job, it
just logically separates the necessary step of creating a dist tarball
from the RPM build job that takes over.
One notable change here is the need to update git's file index which
causes issues in local container executions which rely on a shallow
copy of the libvirt repo created as:

    $ git clone --local

Even if all changes have been committed, git often complained
otherwise. Updating the index in a GitLab environment is a NOP.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: build.sh: Add a wrapper function over the 'build' job
Erik Skultety [Thu, 24 Aug 2023 13:46:53 +0000 (15:46 +0200)]
ci: build.sh: Add a wrapper function over the 'build' job

This helper is a shell function transcript of its original GitLab CI
counterpart.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: build.sh: Add a wrapper function over meson's setup
Erik Skultety [Thu, 24 Aug 2023 13:44:52 +0000 (15:44 +0200)]
ci: build.sh: Add a wrapper function over meson's setup

The reason for this wrapper is that all job functions introduced in
future patches will refer to this one instead of open-coding the same
'meson setup' invocation N times. It also prevents 'setup' to be called
multiple times as some future job functions might actually do just that
in a transitive manner.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: build.sh: Add a wrapper function executing 'shell' commands
Erik Skultety [Thu, 24 Aug 2023 13:45:44 +0000 (15:45 +0200)]
ci: build.sh: Add a wrapper function executing 'shell' commands

This would normally be not needed at all, but the problem here is the
Shell-in-YAML which GitLab interprets. It outputs every command that
appears as a line in the 'script' segment in a color-coded fashion for
easy identification of problems. Well, that useful feature is lost when
there's indirection and one script calls into another in which case it
would only output the respective script name which would make failure
investigation harder. This simple helper tackles that by echoing the
command to be run by any script/function with a color escape sequence
so that we don't lose track of the *actual* shell commands being run as
part of the GitLab job pipelines. An example of what the output then
might look like:
    [RUN COMMAND]: 'meson compile -C build install-web'

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: build.sh: Don't mention that MESON_ARGS are available via CLI
Erik Skultety [Thu, 24 Aug 2023 13:43:13 +0000 (15:43 +0200)]
ci: build.sh: Don't mention that MESON_ARGS are available via CLI

Previous patches have removed the code that allowed injecting arbitrary
meson arguments, same for ninja args.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: build.sh: Add GIT_ROOT env helper variable
Erik Skultety [Fri, 25 Aug 2023 14:12:32 +0000 (16:12 +0200)]
ci: build.sh: Add GIT_ROOT env helper variable

We'll use this one in many of the job functions future patches will
introduce, it's a neat shortcut to avoid using relative paths.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agoci: build.sh: Add variables from .gitlab-ci.yml
Erik Skultety [Thu, 24 Aug 2023 13:42:45 +0000 (15:42 +0200)]
ci: build.sh: Add variables from .gitlab-ci.yml

These are common variables we wish to use in containerized environments
both in GitLab and locally. Having these defined in a single place
rather than twice is highly preferable.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
19 months agomanpage: virsh: Note that 'virsh undefine --remove-all-storage' doesn't remove backin...
Peter Krempa [Thu, 7 Sep 2023 11:03:14 +0000 (13:03 +0200)]
manpage: virsh: Note that 'virsh undefine --remove-all-storage' doesn't remove backing images

Removing a backing image could break other image chains as it's
theoretically possible to share backing chains.

As --storage/--remove-all-storage is fully implemented in virsh as a
helper option, which enumerates and deletes VM's volumes. We do not plan
to make it any more complicated.

Document that backing chains are not removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
19 months agovirutil: Check retval of capng_apply()
Michal Privoznik [Mon, 11 Sep 2023 08:34:43 +0000 (10:34 +0200)]
virutil: Check retval of capng_apply()

Inside of virSetUIDGIDWithCaps() there's a naked call to
capng_apply(), i.e. without any retval check. This is potentially
dangerous as capng_apply() may fail. Do the check and report an
error.

This also fixes the build on bleeding edge distros - like Fedora
rawhide - where the function is declared with 'warn unused
result' [1].

1: https://github.com/stevegrubb/libcap-ng/commit/a0743c335c9a16a2fda9b25120a5523742119e47

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
19 months agolxc_container: Check retval of capng_get_caps_process()
Michal Privoznik [Mon, 11 Sep 2023 08:47:01 +0000 (10:47 +0200)]
lxc_container: Check retval of capng_get_caps_process()

Added in v0.6.5~14 the call to capng_get_caps_process() inside of
lxcContainerDropCapabilities() is not really explained in the
commit message. But looking into the libcap-ng sources it's to
initialize the internal state of the library.

But with recent libcap-ng commit [1] (which some bleeding edge
distros - like Fedora rawhide - already picked up) the function
has been marked as 'warn unused result'. Well, check for its
retval then.

1: https://github.com/stevegrubb/libcap-ng/commit/a0743c335c9a16a2fda9b25120a5523742119e47

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
19 months agoch: Fix cloud-hypervisor version processing
Praveen K Paladugu [Fri, 8 Sep 2023 22:29:08 +0000 (17:29 -0500)]
ch: Fix cloud-hypervisor version processing

Refactor the version processing logic in ch driver to support versions
from non-release cloud-hypervisor binaries. This version also supports
versions with branch prefixes in them.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
19 months agovirnetdevopenvswitch: Propagate OVS error messages
Michal Privoznik [Fri, 8 Sep 2023 08:55:37 +0000 (10:55 +0200)]
virnetdevopenvswitch: Propagate OVS error messages

When configuring OVS interfaces/bridges we spawn 'ovs-vsctl' with
appropriate arguments and if it exited with a non-zero status we
report a generic error message, like "Unable to add port vnet0 to
OVS bridge ovsbr0". This is all cool, but the real reason why
operation failed is hidden in (debug) logs because that's where
virCommandRun() reports it unless caller requested otherwise.

This is a bit clumsy because then we have to ask users to turn on
debug logs and reproduce the problem again, e.g. [1].

Therefore, in cases where an error is reported to the user - just
read ovs-vsctl's stderr and include it in the error message. For
other cases (like VIR_DEBUG/VIR_WARN) - well they are meant to
end up in (debug) logs anyway.

1: https://mail.openvswitch.org/pipermail/ovs-discuss/2023-September/052640.html
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
19 months agoTranslated using Weblate (Korean)
김인수 [Fri, 8 Sep 2023 03:21:16 +0000 (05:21 +0200)]
Translated using Weblate (Korean)

Currently translated at 100.0% (10411 of 10411 strings)

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

Co-authored-by: 김인수 <simmon@nplob.com>
Signed-off-by: 김인수 <simmon@nplob.com>
19 months agovirsh-snapshot: Avoid passing NULL to qsort() in virshSnapshotListCollect()
Michal Privoznik [Thu, 7 Sep 2023 08:56:01 +0000 (10:56 +0200)]
virsh-snapshot: Avoid passing NULL to qsort() in virshSnapshotListCollect()

If a domain has no snapshots and 'virsh snapshot-list' is called,
this gets all the way down to virshSnapshotListCollect() which
then collects all snapshots (none), and passes them to qsort()
which doesn't like being called with NULL:

  extern void qsort (void *__base, size_t __nmemb, size_t __size,
                     __compar_fn_t __compar) __nonnull ((1, 4));

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/533
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
19 months agocpu_map: Add cpu model EPYC Genoa
Tim Wiederhake [Wed, 6 Sep 2023 11:13:34 +0000 (13:13 +0200)]
cpu_map: Add cpu model EPYC Genoa

This was added in qemu commit 166b174188.
No additional features had to be added to libvirt.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
19 months agocpu_map: Ignore all vmx-* features in sync_qemu_features_i386.py
Tim Wiederhake [Wed, 6 Sep 2023 11:09:57 +0000 (13:09 +0200)]
cpu_map: Ignore all vmx-* features in sync_qemu_features_i386.py

The script that synchronizes cpu models from qemu,
sync_qemu_models_i386.py, ignores all features that begin with
"vmx-". Do the same for synchronizing cpu features so we do not
have to track irrelevant features individually.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
20 months agorpm: Install client-qemu with main package
Andrea Bolognani [Wed, 6 Sep 2023 09:22:40 +0000 (11:22 +0200)]
rpm: Install client-qemu with main package

The libvirt package is a sort of catch-all that brings in all
daemon drivers as well as the client package, so it makes sense
for it do drag in the QEMU-specific clients as well.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
20 months agoqemu: capabilities: Remove 'virQEMUCapsAddCPUDefinitions'
Peter Krempa [Thu, 31 Aug 2023 20:40:29 +0000 (22:40 +0200)]
qemu: capabilities: Remove 'virQEMUCapsAddCPUDefinitions'

The function was used only to fill the cpu models into fake
capabilities, whic no longer exists.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Remove cpu model faking for fake-caps tests
Peter Krempa [Thu, 31 Aug 2023 20:38:48 +0000 (22:38 +0200)]
qemuxml2argvtest: Remove cpu model faking for fake-caps tests

Now that all fake-caps testing was removed we can also remove the
filling of the fake caps by cpu models.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemu: capabilities: Unexport 'virQEMUCapsAddMachine'
Peter Krempa [Thu, 31 Aug 2023 09:49:53 +0000 (11:49 +0200)]
qemu: capabilities: Unexport 'virQEMUCapsAddMachine'

It's no longer needed in tests as we are no longer adding fake machines.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agotestutilsqemu: Unexport 'testQemuCapsInit'
Peter Krempa [Thu, 31 Aug 2023 07:45:38 +0000 (09:45 +0200)]
testutilsqemu: Unexport 'testQemuCapsInit'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agotestutilsqemu: Drop infrastructure for fake-caps testing
Peter Krempa [Thu, 31 Aug 2023 07:44:10 +0000 (09:44 +0200)]
testutilsqemu: Drop infrastructure for fake-caps testing

Remove all the code for adding fake machines into the testing capability
cache as we no longer have any machines in it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemustatusxml2xmltest: Remove capabilities infrastructure
Peter Krempa [Thu, 31 Aug 2023 20:35:07 +0000 (22:35 +0200)]
qemustatusxml2xmltest: Remove capabilities infrastructure

The status XML doesn't require any capabilities to be parsed and
formatted back. Remove all qemuCaps related code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agotestutilsqemu: Drop fake machine capability data for 'x86_64'
Peter Krempa [Mon, 3 Apr 2023 11:35:18 +0000 (13:35 +0200)]
testutilsqemu: Drop fake machine capability data for 'x86_64'

Now that all tests were converted to use real capabilities we can drop
x86_64 from the tooling to create fake capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Modernize rest of the test cases
Peter Krempa [Mon, 4 Sep 2023 12:15:35 +0000 (14:15 +0200)]
qemuxml2argvtest: Modernize rest of the test cases

The rest of the test cases has no change in the output now that we've
assumed some flags.

Remove the fake-caps test macros after conversion.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Modernize 'cpu-exact' cases
Peter Krempa [Fri, 1 Sep 2023 13:28:18 +0000 (15:28 +0200)]
qemuxml2argvtest: Modernize 'cpu-exact' cases

Use real capabilities, but select the fake 'Haswell' host CPU for test
stability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Modernize 'cpu-(no)fallback' test
Peter Krempa [Tue, 5 Sep 2023 11:04:31 +0000 (13:04 +0200)]
qemuxml2argvtest: Modernize 'cpu-(no)fallback' test

Previously without modern capabilities the test was relying on a CPU
model which was not entered into a fake list of supported cpus.

With real capabilities we have to pick a CPU model which is supported by
libvirt but in some version is not supported by qemu. I've picked
EPYC-Milan, which was introduced into qemu-6.0.

This test configures a CPU which is equivalent to EPYC-Rome by disabling
features from EPYC-Milan and uses a versioned real caps test to check it
against a qemu which doesn't support EPYC-Milan.

With real capabilities though, we can also do a positive test case by
using a version whic doesh support it. I've specifically not used the
LATEST caps so that it doesn't change once capabilities are bumped.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Modernize 'cpu-strict' case
Peter Krempa [Fri, 1 Sep 2023 14:18:12 +0000 (16:18 +0200)]
qemuxml2argvtest: Modernize 'cpu-strict' case

Use the fake Haswell processor definition and augment the list of
features to make the test pass.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Modernize 'cpu-minimum' cases
Peter Krempa [Fri, 1 Sep 2023 13:28:18 +0000 (15:28 +0200)]
qemuxml2argvtest: Modernize 'cpu-minimum' cases

Use real capabilities, but select the fake 'Haswell' host CPU for test
stability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Modernize 'cpu-Haswell' test cases
Peter Krempa [Fri, 1 Sep 2023 11:57:23 +0000 (13:57 +0200)]
qemuxml2argvtest: Modernize 'cpu-Haswell' test cases

Modernize all test cases which set 'Haswell' as the host cpu model.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Modernize test cases using 'host-model' CPU
Peter Krempa [Mon, 4 Sep 2023 11:47:42 +0000 (13:47 +0200)]
qemuxml2argvtest: Modernize test cases using 'host-model' CPU

Modernize test cases using 'host-mode' cpu type, where the actual CPU
doesn't isn't important.

As using the host cpu from the 'latest' capabilities data would cause
test churn in case the host cpu changes in the future, convert them
using the overriden Haswell cpu.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Consolidate and modernize CPU topology testing
Peter Krempa [Fri, 1 Sep 2023 12:41:42 +0000 (14:41 +0200)]
qemuxml2argvtest: Consolidate and modernize CPU topology testing

Move the 'smp-dies' test case into 'cpu-topology4' and remove
unnecessary cruft.

Remove cpu definition from 'cpu-topology2' as it's not relevant to the
test case.

Remove 'smp' case as it's covered by the rest.

Use real capabilities for all of them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Modernize migration/restore tests
Peter Krempa [Fri, 1 Sep 2023 12:17:45 +0000 (14:17 +0200)]
qemuxml2argvtest: Modernize migration/restore tests

As these were using DO_TEST_FULL the churn-reducing patches didn't
influence these.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Properly modernize 'clock-hpet-off' test case
Peter Krempa [Mon, 4 Sep 2023 13:49:50 +0000 (15:49 +0200)]
qemuxml2argvtest: Properly modernize 'clock-hpet-off' test case

Since qemu-8.0 a new way to disable 'hpet' via -machine was added.
Properly test both branches with real capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Assume QEMU_CAPS_QXL_VRAM64, QEMU_CAPS_(QXL|VGA)_VGAMEM for fake...
Peter Krempa [Tue, 5 Sep 2023 12:42:04 +0000 (14:42 +0200)]
qemuxml2argvtest: Assume QEMU_CAPS_QXL_VRAM64, QEMU_CAPS_(QXL|VGA)_VGAMEM for fake-caps tests

Assume the features modern qemus have to bring the test data closer
to the 'latest' real-caps versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Assume QEMU_CAPS_USB_HOST_HOSTDEVICE and QEMU_CAPS_DEVICE_QEMU_XHCI...
Peter Krempa [Tue, 5 Sep 2023 12:42:04 +0000 (14:42 +0200)]
qemuxml2argvtest: Assume QEMU_CAPS_USB_HOST_HOSTDEVICE and QEMU_CAPS_DEVICE_QEMU_XHCI for fake-caps tests

Assume the two features modern qemus have to bring the test data closer
to the 'latest' real-caps versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Assume QEMU_CAPS_CPU_MIGRATABLE and QEMU_CAPS_SMP_DIES for fake...
Peter Krempa [Tue, 5 Sep 2023 12:42:04 +0000 (14:42 +0200)]
qemuxml2argvtest: Assume QEMU_CAPS_CPU_MIGRATABLE and QEMU_CAPS_SMP_DIES for fake-caps tests

Assume the two features modern qemus have to bring the test data closer
to the 'latest' real-caps versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Assume QEMU_CAPS_DEVICE_PCIE_ROOT_PORT for fake-caps tests
Peter Krempa [Tue, 5 Sep 2023 12:42:04 +0000 (14:42 +0200)]
qemuxml2argvtest: Assume QEMU_CAPS_DEVICE_PCIE_ROOT_PORT for fake-caps tests

Assume the support for the 'pcie-root-port' all modern qemus have to
bring the test data closer to the 'latest' real-caps versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Assume QEMU_CAPS_PIIX3_USB_UHCI for all fake-caps tests
Peter Krempa [Thu, 31 Aug 2023 12:20:39 +0000 (14:20 +0200)]
qemuxml2argvtest: Assume QEMU_CAPS_PIIX3_USB_UHCI for all fake-caps tests

To minimize further churn when coverting to real capabilities, assume
that all fake-caps machines support the piix3 USB controller.

Since we already have solid testing of USB controllers, this will have
effect only in cases when it's not relevant to the test itself.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Consolidate testing of 'xhci' controllers
Peter Krempa [Thu, 31 Aug 2023 15:07:38 +0000 (17:07 +0200)]
qemuxml2argvtest: Consolidate testing of 'xhci' controllers

Rename the 'usb-controller-explicit-(unavailable-)q35' test case to
'usb-controller-nec-xhci'. Since this also covers what
'usb-controller-xhci' was testing the latter is removed.

Other 'usb-xhci' test cases which were using the NEC controller are also
renamed to contain the name.

In case of 'usb-controller-qemu-xhci' the negative test case is deleted
as we don't need two cases for missing explicitly specified controller
and the positive case is modernized to use real capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Improve default usb controller testing
Peter Krempa [Thu, 31 Aug 2023 14:00:48 +0000 (16:00 +0200)]
qemuxml2argvtest: Improve default usb controller testing

Improve testing of an explicitly requested USB controller without a
model being provided.

For this purpose the 'usb-controller' case is renamed to
'usb-controller-default-i440fx'; 'usb-controller-default-q35' is moved
up to form a group. In both cases tests are covnerted to use
DO_TEST_CAPS_LATEST.

A new 'usb-controller-default-isapc' negative test case is added for
symmetry.

The negative test case 'usb-controller-default-unavailable-q35' is
converted to use latest caps, but stripping the default controller
instead of using fake caps. Additionally for symmetry
'usb-controller-default-unavailable-i440fx' is added although that
doesn't cause failure, but rather a graceful downgrade to use '-usb'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Add tests for auto-added USB controllers
Peter Krempa [Thu, 31 Aug 2023 13:47:00 +0000 (15:47 +0200)]
qemuxml2argvtest: Add tests for auto-added USB controllers

There are per-machine type variations on which usb controller will be
picked on an x86_64 machine. Add test cases where a USB controller is
completely missing to cover all 3 cases ('isapc', 'pc', 'q35') when an
USB controller is not explicitly requested by the user.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Consolidate tests for usb controllers
Peter Krempa [Thu, 31 Aug 2023 12:45:13 +0000 (14:45 +0200)]
qemuxml2argvtest: Consolidate tests for usb controllers

Move all controller related tests together and consolidate naming of the
test cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Enable 'seccomp' sandbox in all fake caps tests
Peter Krempa [Thu, 31 Aug 2023 09:43:43 +0000 (11:43 +0200)]
qemuxml2argvtest: Enable 'seccomp' sandbox in all fake caps tests

In order to minimize further churn, make all fake-caps test assume that
the seccomp sandbox is supported.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agotestutilsqemu: Always populate default ram id, default cpu, ACPI support for fake...
Peter Krempa [Thu, 31 Aug 2023 09:36:01 +0000 (11:36 +0200)]
testutilsqemu: Always populate default ram id, default cpu, ACPI support for fake machines

Enable a few defaults that will decrease churn when converting tests to
real capabilities.

Since the fake machines are added only for x86_64 at this point we can
assume that ACPI is present via -machine.

In case of the default ram id assume the same. Additionally the logic
was broken as fake capabilities don't have a version so the default RAM
was never actually populated into fake caps tests.

For CPU we add 'qemu64' as that is the default picked by qemu.

We also assume that qemu requires an explicit backend for -numa, which
is the case for modern machines.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Modernize 'numatune' tests
Peter Krempa [Thu, 31 Aug 2023 13:18:11 +0000 (15:18 +0200)]
qemuxml2argvtest: Modernize 'numatune' tests

The 'numatune-memory' case is completely dropped as it's sufficiently
covered by 'numatune-memnode'.

The positive fake-caps version of 'numatune-memnode' is dropped as it's
covered by the two existing real caps invocations.

'numatune-memory-invalid-nodeset', 'numatune-memnode-invalid-mode',
'numatune-memnode-nocpu', 'numatune-memnodes-problematic' parsing error
negative cases are converted to use latest capabilities.

'numatune-static-nodeset-exceed-hostnode' commandline generation failure
negative case is converted to use latest capabilities.

'numatune-memnode-no-memory', 'numatune-distances',
'numatune-auto-nodeset-invalid', 'numatune-auto-prefer' positive cases
are converted to use latest capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Modernize negative testing for hugepages
Peter Krempa [Thu, 31 Aug 2023 12:58:30 +0000 (14:58 +0200)]
qemuxml2argvtest: Modernize negative testing for hugepages

Use proper version for negative case of 'hugepages-memaccess3'

QEMU allowed to configure a memory backend for default ram since
qemu-5.2. Fix the test to use real capability data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agovirQEMUCapsAddCPUDefinitions: Fill in cpu type in data and node it's used only in...
Peter Krempa [Thu, 31 Aug 2023 12:07:05 +0000 (14:07 +0200)]
virQEMUCapsAddCPUDefinitions: Fill in cpu type in data and node it's used only in tests

'virQEMUCapsAddCPUDefinitions' is used solely to populate fake cpu
models for the fake-caps tests. Note that and also populate the 'type'
field so that default cpu type can be propagated properly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Enable JSON syntax for -device, -object, and -netdev for all fake...
Peter Krempa [Thu, 31 Aug 2023 08:56:28 +0000 (10:56 +0200)]
qemuxml2argvtest: Enable JSON syntax for -device, -object, and -netdev for all fake-caps tests

To minimize upcoming churn in test data when they will be converted to
latest capabilities enable JSON syntax for -device, -object, and -netdev
for all fake caps test files. Doing this should also help git track
renames of the files better as there will be more of consistent context
present.

We can do this safely as internally we generate JSON first and then
back-convert it into the old-style commandline if given qemu doesn't
support it. This means that all generated content will be the same.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Remove FLAG_SKIP_LEGACY_CPUS
Peter Krempa [Thu, 31 Aug 2023 11:49:51 +0000 (13:49 +0200)]
qemuxml2argvtest: Remove FLAG_SKIP_LEGACY_CPUS

Remove the notion of legacy cpus as there are no test cases using it any
more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Use real caps for 'cpu-host-model-nofallback' test case
Peter Krempa [Thu, 31 Aug 2023 11:33:55 +0000 (13:33 +0200)]
qemuxml2argvtest: Use real caps for 'cpu-host-model-nofallback' test case

Similarly to 'cpu-host-model' add a real capability invocation for each
version we support and remove the old fake caps invocation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Use real caps for 'cpu-host-model-fallback' test case
Peter Krempa [Thu, 31 Aug 2023 11:33:55 +0000 (13:33 +0200)]
qemuxml2argvtest: Use real caps for 'cpu-host-model-fallback' test case

Similarly to 'cpu-host-model' add a real capability invocation for each
version we support and remove the old fake caps invocation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Use proper version in negative 'virtio-options-memballoon-freepage...
Peter Krempa [Fri, 1 Sep 2023 11:47:30 +0000 (13:47 +0200)]
qemuxml2argvtest: Use proper version in negative 'virtio-options-memballoon-freepage-reporting' case

The feature is supported since qemu-5.1. Use real qemu-5.0 caps for the
test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Remove fake-caps invocations of tests which also real caps version
Peter Krempa [Fri, 1 Sep 2023 11:07:38 +0000 (13:07 +0200)]
qemuxml2argvtest: Remove fake-caps invocations of tests which also real caps version

Drop tests which already are tested with real caps, thus the fake caps
version doesn't bring much value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Remove duplicated test invocations
Peter Krempa [Fri, 1 Sep 2023 11:03:01 +0000 (13:03 +0200)]
qemuxml2argvtest: Remove duplicated test invocations

Few tests were invoked multiple times either with identical or
equivalent config. Remove those invocations.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Simplify invocation of GIC tests
Peter Krempa [Fri, 1 Sep 2023 08:04:18 +0000 (10:04 +0200)]
qemuxml2argvtest: Simplify invocation of GIC tests

Change DO_TEST_GIC so that it accepts the version and switch it to use
DO_TEST_CAPS_ARCH_VER_FULL internally which will ensure that the output
filenames conform to the format we use for real capabilities.

This also allows us to convert a few of versioned tests to use this
improved macro.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Remove old chardev tests
Peter Krempa [Fri, 19 Nov 2021 15:18:37 +0000 (16:18 +0100)]
qemuxml2argvtest: Remove old chardev tests

All tests have already a real capability variant.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Add missing versioned test cases for 'cpu-host-model'
Peter Krempa [Thu, 31 Aug 2023 11:15:46 +0000 (13:15 +0200)]
qemuxml2argvtest: Add missing versioned test cases for 'cpu-host-model'

We've forgot to add test invocations with real caps for qemu versions
starting with 6.2.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemu_capabilities: Retire QEMU_CAPS_DEVICE_VFIO_PCI
Peter Krempa [Tue, 5 Sep 2023 13:37:50 +0000 (15:37 +0200)]
qemu_capabilities: Retire QEMU_CAPS_DEVICE_VFIO_PCI

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemu: Always assume support for QEMU_CAPS_DEVICE_VFIO_PCI
Peter Krempa [Tue, 5 Sep 2023 13:34:44 +0000 (15:34 +0200)]
qemu: Always assume support for QEMU_CAPS_DEVICE_VFIO_PCI

The 'display' option for the 'vfio-pci' device was added in qemu-2.12
and can't be compiled out. Assume support for the flag.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemu: capabilities: Retire QEMU_CAPS_CPU_CACHE
Peter Krempa [Mon, 4 Sep 2023 14:30:44 +0000 (16:30 +0200)]
qemu: capabilities: Retire QEMU_CAPS_CPU_CACHE

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemu: Always assume support for QEMU_CAPS_CPU_CACHE
Peter Krempa [Mon, 4 Sep 2023 14:24:52 +0000 (16:24 +0200)]
qemu: Always assume support for QEMU_CAPS_CPU_CACHE

All supported qemu versions have this feature and it can't be compiled
out. The logic is a bit more complex in this instance as the flag is
asserted if:

    if (ARCH_IS_X86(qemuCaps->arch) &&
        virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION)) {
        virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_CACHE);
    }

Now QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION is available since qemu-2.8 but
only on certain architectures, thus we need to keep the flag itself, but
x86_64 is one of them.

The flag can be also assumed as qemuValidateDomainDefCpu rejects any
cache config on non-x86 arches.

Remove any use of the capability and drop the impossible test cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Drop 'monitor-json' case
Peter Krempa [Thu, 31 Aug 2023 08:25:15 +0000 (10:25 +0200)]
qemuxml2argvtest: Drop 'monitor-json' case

QMP monitor is the only thing we support at this point, thus all other
tests test the same thing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: testAddCPUModels: Remove non-x86_64 fake cpu models
Peter Krempa [Thu, 31 Aug 2023 11:47:39 +0000 (13:47 +0200)]
qemuxml2argvtest: testAddCPUModels: Remove non-x86_64 fake cpu models

At this point only x86_64 is using fake machines, and for real machines
we don't populate the fake cpu models. Thus we can remove everything
non-x86_64.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemuxml2argvtest: Clean up host CPU if overriden
Peter Krempa [Fri, 1 Sep 2023 13:41:10 +0000 (15:41 +0200)]
qemuxml2argvtest: Clean up host CPU if overriden

If a test uses ARG_CAPS_HOST_CPU_MODEL feature we override the global
host cpu model to the selected CPU but don't clear it afterwards. This
can trip up fake caps tests following a test which uses this feature.

This does not happen with real caps, because unless overriden, the host
cpu from capabilities is always populated as the host cpu.

Clear the CPU on cleanup.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemu: capabilities: Preserve location of the default machine type when stripping...
Peter Krempa [Fri, 1 Sep 2023 19:43:22 +0000 (21:43 +0200)]
qemu: capabilities: Preserve location of the default machine type when stripping aliases for tests

Internally the preferred machine which is 'pc' for x86_64 must be kept
in the first place in the array of machines. This was not the case when
stripping the machine aliases for use in tests (so that test output
stays stable) where we've created a new entry for the alias. This means
that the original name (e.g. pc-i440fx-8.1) stayed in the first place.

To fix this we now swap the names around and create a new entry at the
end for the specific type. Additionally the default flag is not
propagated to the copy.

This is also visible now in the output of 'qemuxml2xmltest' as the test
cases which use the default machine type return to 'pc' instead of the
more specific name.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemu: capabilities: Retire QEMU_CAPS_ICH9_DISABLE_S* and QEMU_CAPS_ICH9_DISABLE_S...
Peter Krempa [Fri, 1 Sep 2023 15:00:35 +0000 (17:00 +0200)]
qemu: capabilities: Retire QEMU_CAPS_ICH9_DISABLE_S* and QEMU_CAPS_ICH9_DISABLE_S* capabilities

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoqemu: Always assume support for QEMU_CAPS_PIIX_DISABLE_S* and QEMU_CAPS_ICH9_DISABLE_S*
Peter Krempa [Fri, 1 Sep 2023 14:57:34 +0000 (16:57 +0200)]
qemu: Always assume support for QEMU_CAPS_PIIX_DISABLE_S* and QEMU_CAPS_ICH9_DISABLE_S*

The support for PIIX power management was added in qemu commit
v1.0-3094-g459ae5ea5a and the suport for ICH9 power management was added
in qemu commit v2.2.0-542-g6ac0d8d44c and both can't be compiled out.

This means we can always assume support for these features. Remove the
validation and impossible tests. Move relevant bits from
'q35-pm-disable' to 'q35' test case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agosecurityselinuxlabeltest: Convert to testQemuInsertRealCaps
Peter Krempa [Tue, 5 Sep 2023 15:02:33 +0000 (17:02 +0200)]
securityselinuxlabeltest: Convert to testQemuInsertRealCaps

Use the modern infrastructure to populate capabilities cache with real
capabilities instead of the faked one which will be soon removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agostorage_util: Drop getDeviceType()
Michal Privoznik [Tue, 5 Sep 2023 07:14:11 +0000 (09:14 +0200)]
storage_util: Drop getDeviceType()

The sole purpose of getDeviceType() is to parse a file that
contains one integer (and a newline character). Well, we already
have a function for that: virFileReadValueInt(). Use the latter
and drop the former.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoch: Use proper format directive for @i in virCHProcessSetupIOThreads()
Michal Privoznik [Tue, 5 Sep 2023 10:19:53 +0000 (12:19 +0200)]
ch: Use proper format directive for @i in virCHProcessSetupIOThreads()

The @i variable inside of virCHProcessSetupIOThreads() is a
typical loop counter - it's declared as size_t. But when passed
to VIR_DEBUG an invalid format directive is used (%ld). Fix that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoch: Use int for @niothreads in virCHMonitorGetIOThreads()
Michal Privoznik [Tue, 5 Sep 2023 10:17:19 +0000 (12:17 +0200)]
ch: Use int for @niothreads in virCHMonitorGetIOThreads()

The @niothreads inside of virCHMonitorGetIOThreads() is declared
as of size_t type. This would work, except the variable is then
passed to VIR_DEBUG with incorrect format directive (%ld) and
returned.  But the function returns an int not size_t. Fix the
variable declaration and format directive.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agoch: Use uint for @maxvcpus in virCHDomainRefreshThreadInfo()
Michal Privoznik [Tue, 5 Sep 2023 10:13:39 +0000 (12:13 +0200)]
ch: Use uint for @maxvcpus in virCHDomainRefreshThreadInfo()

The @maxvcpus variable inside of virCHDomainRefreshThreadInfo()
holds retval of virDomainDefGetVcpusMax() which returns an
unsigned int. Also, the variable is then passed to VIR_WARN()
with incorrect format directive (%ld). Switch variable to uint
and fix the format directive.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
20 months agofix virCgroupGetMemoryStat arguments order
Dmitry Frolov [Mon, 4 Sep 2023 11:44:48 +0000 (14:44 +0300)]
fix virCgroupGetMemoryStat arguments order

Reviewing the sources, I noticed that, argumets order in
virCgroupGetMemoryStat() function call does not correspond
to the function declaration:
-instead of   *activeAnon, &meminfo->inactive_anon is passed;
-instead of *inactiveAnon,   &meminfo->active_anon is passed;
-instead of   *activeFile, &meminfo->inactive_file is passed;
-instead of *inactiveFile,   &meminfo->active_file is passed.

Fixes: e634c7cd0d ("lxc: Use virCgroupGetMemoryStat")
Signed-off-by: Dmitry Frolov <frolov@swemel.ru>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
20 months agoconf: Generate MAC address instead of keeping all zeroes
Martin Kletzander [Fri, 1 Sep 2023 14:51:59 +0000 (16:51 +0200)]
conf: Generate MAC address instead of keeping all zeroes

When we parse <mac address="00:00:00:00:00:00"/> we keep that in memory
and pass it down to the hypervisor. However, that MAC address is not
strictly valid as it is not marked as locally administered (bit 0x02)
but it is not even globally unique. It is also used for loopback device
on Linux, for example. And QEMU sees such MAC address just as "not
specified" and generates a new one that libvirt does not even know
about. So to make the overall experience better we now generate it if
the supplied one is all clear.

Resolves: https://issues.redhat.com/browse/RHEL-974

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
20 months agobuild: Fix logic bug determining whether running with optimization
Peter Krempa [Mon, 4 Sep 2023 12:30:48 +0000 (14:30 +0200)]
build: Fix logic bug determining whether running with optimization

The conversion from ternary to a 'if' clause was wrong and thus didn't
properly increase the stack size where needed but only where not
actually needed.

Fixes: b68faa99d9f16c2f504b23737040d25d072ee85d
Signed-off-by: Peter Krempa <pkrempa@redhat.com>