]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
2 years agoqemu_driver: add new stats worker qemuDomainGetStatsVm
Amneesh Singh [Wed, 7 Sep 2022 10:34:23 +0000 (16:04 +0530)]
qemu_driver: add new stats worker qemuDomainGetStatsVm

This patch adds a new worker qemuDomainGetStatsVm which reports the
stats returned by "query-stats" via qemuMonitorQueryStats for the VM
target.

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2 years agoqemu_driver: add the vCPU stats by KVM to the current stats
Amneesh Singh [Wed, 7 Sep 2022 10:34:22 +0000 (16:04 +0530)]
qemu_driver: add the vCPU stats by KVM to the current stats

This patch adds the stats queried by qemuMonitorQueryStats for vCPU and
add them according to their QOM device path

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2 years agoqemu_monitor: add qemuMonitorGetStatsByQOMPath
Amneesh Singh [Wed, 7 Sep 2022 10:34:21 +0000 (16:04 +0530)]
qemu_monitor: add qemuMonitorGetStatsByQOMPath

This function returns the virJSONValue object which has the
same qom_path as specified.

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2 years agoqemu_domain: add statsSchema to qemuDomainObjPrivate
Amneesh Singh [Wed, 7 Sep 2022 10:34:20 +0000 (16:04 +0530)]
qemu_domain: add statsSchema to qemuDomainObjPrivate

This patch adds a hashtable for storing the stats schema and a function
to refresh it by querying "query-stats-schemas" using
qemuMonitorQueryStatsSchema

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2 years agoqemu_capabilities: add "query-stats-schemas" QMP command to the QEMU capabilities
Amneesh Singh [Wed, 7 Sep 2022 10:34:19 +0000 (16:04 +0530)]
qemu_capabilities: add "query-stats-schemas" QMP command to the QEMU capabilities

Related: https://gitlab.com/libvirt/libvirt/-/issues/276

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2 years agoqemu_monitor: add qemuMonitorQueryStatsSchema
Amneesh Singh [Wed, 7 Sep 2022 10:34:18 +0000 (16:04 +0530)]
qemu_monitor: add qemuMonitorQueryStatsSchema

Related: https://gitlab.com/libvirt/libvirt/-/issues/276

This patch adds a simple API for "query-stats-schemas" QMP command

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2 years agoqemu_driver: Fix indentation in qemuDomainGetStatsVcpu
Martin Kletzander [Wed, 19 Oct 2022 12:41:39 +0000 (14:41 +0200)]
qemu_driver: Fix indentation in qemuDomainGetStatsVcpu

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2 years agocputestdata: Fix test data for EPYC 7502
Tim Wiederhake [Mon, 17 Oct 2022 09:09:03 +0000 (11:09 +0200)]
cputestdata: Fix test data for EPYC 7502

Commit 5c17a7ba41 introduced a new feature (ibrs) but did not update
existing cputestdata.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2 years agoNEWS: Mention new channel and redirdev devices in domcaps
Jim Fehlig [Mon, 17 Oct 2022 17:48:34 +0000 (11:48 -0600)]
NEWS: Mention new channel and redirdev devices in domcaps

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoconf: Add channel devices to domain capabilities
Jim Fehlig [Fri, 2 Sep 2022 22:22:31 +0000 (16:22 -0600)]
conf: Add channel devices to domain capabilities

As qemu becomes more modularized, it is important for libvirt to advertise
availability of the modularized functionality through capabilities. This
change adds channel devices to domain capabilities, allowing clients such
as virt-install to avoid using spicevmc channel devices when not supported
by the target qemu.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agodocs: formatdomain: fix since tag for TPM PCR banks
Ján Tomko [Mon, 17 Oct 2022 12:26:23 +0000 (14:26 +0200)]
docs: formatdomain: fix since tag for TPM PCR banks

Fixes: a5bbe1a8b6321852634817c423695e58518c4f4f
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: validate: Clarify error messages for unsupported 3d video acceleration
Peter Krempa [Fri, 14 Oct 2022 07:49:12 +0000 (09:49 +0200)]
qemu: validate: Clarify error messages for unsupported 3d video acceleration

The error message doesn't really convey the information that 3d
acceleration works only for the 'virtio' model and similarly the same
error would be reported if qemu doesn't support acceleration, which is
hard to debug.

Split and clarify the errors.

Noticed in https://gitlab.com/libvirt/libvirt/-/issues/388

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2 years agocapabilities: use g_autofree in capabilities.c
Jiang Jiacheng [Sat, 15 Oct 2022 09:18:01 +0000 (17:18 +0800)]
capabilities: use g_autofree in capabilities.c

Use g_autofree in capabilities.c for some pointers still using manual cleanup,
and remove unnecessary cleanup.

Signed-off-by: Jiang Jiacheng <jiangjiacheng@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agovirvhba.c: use g_autofree
ttxine [Sun, 16 Oct 2022 10:47:49 +0000 (13:47 +0300)]
virvhba.c: use g_autofree

Change strings to use g_autofree.

Signed-off-by: Maxim Kostin <ttxinee@outlook.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Create base hugepages path on memory hotplug
Michal Privoznik [Tue, 11 Oct 2022 14:48:38 +0000 (16:48 +0200)]
qemu: Create base hugepages path on memory hotplug

Users can play all sorts of games with mount points. For
instance, they can unmount and mount back a hugetlbfs and only
after that attempt to hotplug memory.

This has an unfortunate consequence though. During memory
hotplug, when qemuProcessBuildDestroyMemoryPaths() is called the
path is created with very restrictive mode (0700) because under
the hood g_mkdir_with_parents(path, 0700) is called.

Therefore, create the driver generic portion of the path
separately.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2134009
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2 years agoqemu: Separate out hugepages basedir making
Michal Privoznik [Tue, 11 Oct 2022 14:41:35 +0000 (16:41 +0200)]
qemu: Separate out hugepages basedir making

During its initialization, the QEMU driver iterates over
hugetlbfs mount points, creating the driver specific path in each
of them ($prefix/libvirt/qemu). This path is created with very
wide mode (0777) because per-domain directories are then created
under it.

Separate this code into a function so that it can be re-used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2 years agoqemu: Use command line to properly check for spice support
Jim Fehlig [Wed, 31 Aug 2022 23:10:55 +0000 (17:10 -0600)]
qemu: Use command line to properly check for spice support

domcapabilities reports spice graphics support even against a minimal
qemu installation without spice modules. Checking for 'query-spice'
in the list of qmp commands supported by qemu is not sufficient to
determine spice support. Checking the command line produces acurrate
results.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoconf: Add USB redirect devices to domain capabilities
Jim Fehlig [Tue, 30 Aug 2022 21:29:14 +0000 (15:29 -0600)]
conf: Add USB redirect devices to domain capabilities

As qemu becomes more modularized, it is important for libvirt to advertise
availability of the modularized functionality through capabilities. This
change adds USB redirect devices to domain capabilities, allowing clients
such as virt-install to avoid using redirdev devices when not supported
by the target qemu.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoschema: Re-structure schema for <filesystem> to avoid broken validation
Peter Krempa [Thu, 13 Oct 2022 12:01:24 +0000 (14:01 +0200)]
schema: Re-structure schema for <filesystem> to avoid broken validation

The validation of a '<filesystem type='mount'>' device fails if the
elements inside are not ordered in the order in the schema despite using
<interleave>. This is a bug in libxml2's validator as removing the
'<optional>' property from the definition of the 'type' attribute with
'mount' variable fixes the problem.

I've reported it as another instance of a seemingly related issue:

  https://gitlab.gnome.org/GNOME/libxml2/-/issues/131

Meanwhile libvirt can re-arrange the schema by extracting the common
bits into a new definition and referencing them from each of the choice
groups explicitly.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/392
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agotests: refactor pseries features parse failure tests
Daniel Henrique Barboza [Thu, 15 Sep 2022 16:22:08 +0000 (13:22 -0300)]
tests: refactor pseries features parse failure tests

The qemuxml2argvtest pseries-feature parse failure tests uses a symlink
to the pseries-features.xml test domain and control which feature it is
supposed to fail by excluding it from the capabilities list. The
advantage of this approach is that the same XML can be used in multiple
tests.

One downside is that any new pseries capability must be declared in all
existent tests, otherwise all other tests can break if this new
capability happens to be validated early in qemu_validate.c. Any new
parse_error test must declare all other existent capabilities.

Another downside is the fact that we're testing fairly improbable
scenarios: all pseries capabilities being tested here were introduced by
the same QEMU version, 4.2.0, at least as far as libvirt is aware of.
This means that it's no possible to have a scenario where, for example,
ccf-assist is not present but cfpc is. And last, but not the least, it's
getting in the way of our effort to convert all pseries tests to not use
explicit capabilities.

Changing all these tests to use DO_TEST_PARSE_ERROR_NOCAPS() will allow
us to test exactly what we want to test, which is the parse error given
for each feature if the binary does not have support for it. The XML
being used for each test can be simplified to just declare a single
feature. In the end we'll end up with more XML lines, but less
complexity inside qemuxml2argvtest.c.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2 years agotests: change qemuxml2argv pseries tests to TEST_CAPS_LATEST
Daniel Henrique Barboza [Tue, 13 Sep 2022 14:30:35 +0000 (11:30 -0300)]
tests: change qemuxml2argv pseries tests to TEST_CAPS_LATEST

Eliminate most of the pseries tests that are using explicit qemu caps
instead of CAPS_LATEST. The remaining tests will be handled in the next
patch.

The changes made are trivial: rename the .args/.err files to
ppc64-latest.(args/err) and do the required changes to match the newest
capabilities.

A notable expection were tests pseries-console-native,
pseries-serial-compat and pseries-serial+console-native. These are
aliases of the pseries-serial-native tests.  In this case we needed to
re-create the symlink accordingly.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2 years agotests: qemucapabilities: bump ppc64 caps with qemu 7.1.0
Daniel Henrique Barboza [Sat, 10 Sep 2022 10:26:50 +0000 (06:26 -0400)]
tests: qemucapabilities: bump ppc64 caps with qemu 7.1.0

No significant changes from the 7.0.0 capabilities.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2 years agoci: Install python RPMs from libvirt/libvirt-python CI artifacts
Peter Krempa [Mon, 10 Oct 2022 08:51:01 +0000 (10:51 +0200)]
ci: Install python RPMs from libvirt/libvirt-python CI artifacts

After addition of the new libvirt-client-qemu sub-package which is using
python bindings (thus creating a circular dependency between the libvirt
and libvirt-python projects) the integration jobs fail with:

  Error:
   Problem: conflicting requests
    - nothing provides python3-libvirt >= 8.9.0-1.el9 needed by libvirt-client-qemu-8.9.0-1.el9.x86_64

The libvirt-python project now provides the RPMs in artifacts:
 https://gitlab.com/libvirt/libvirt-python/-/merge_requests/96

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2 years agospec: change gettext requires to gettext-runtime for F37
Jens Petersen [Thu, 25 Aug 2022 07:56:50 +0000 (15:56 +0800)]
spec: change gettext requires to gettext-runtime for F37

See https://fedoraproject.org/wiki/Changes/GettextRuntimeSubpackage

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2 years agoqemu: Init address before qemuProcessShutdownOrReboot during reconnect process
Jiang Jiacheng [Wed, 28 Sep 2022 13:53:28 +0000 (21:53 +0800)]
qemu: Init address before qemuProcessShutdownOrReboot during reconnect process

When libvirt is restarted, the qemuProcessShutdownReboot command is
executed to restore the VM that is being restarted. In this case, a
coredump may occur when we hotplug a pci device since the PCI address
hasn't be inited yet. Moving the initialization of address to the front
of qemuProcessShutdownOrReboot to ensure that we have the address inited.

Signed-off-by: Jiang Jiacheng <jiangjiacheng@huawei.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Fix race condition when detaching a device
Pierre LIBEAU [Wed, 31 Aug 2022 12:22:51 +0000 (14:22 +0200)]
qemu: Fix race condition when detaching a device

If QEMU replies to device_del command with "DeviceNotFound"
error, then libvirt doesn't clean the device from the live
configuration.

This is because qemuMonitorDelDevice() returns -2 to
qemuDomainDeleteDevice() and instead of calling
qemuDomainRemoveDevice() the qemuDomainDetachDeviceLive() jumps
right onto cleanup label.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/359
Signed-off-by: Pierre LIBEAU <pierre.libeau@corp.ovh.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agocpu_map: Introduce Neoverse N1/N2/V1
Zhenyu Zhang [Thu, 29 Sep 2022 02:27:38 +0000 (22:27 -0400)]
cpu_map: Introduce Neoverse N1/N2/V1

Add Neoverse N1/N2/V1 as a supported cpu model.

Signed-off-by: Zhenyu Zhang <zhenyzha@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2 years agoci: potfile: Add 'variables' to definition
Peter Krempa [Tue, 11 Oct 2022 07:27:24 +0000 (09:27 +0200)]
ci: potfile: Add 'variables' to definition

The 'potfile' job is lacking the 'variables' section which defines the
'NAME' variable used by the 'image' property resulting in the 'potfile'
job failing with:

 Pulling docker image registry.gitlab.com/libvirt/libvirt/ci-:latest ...
 WARNING: Failed to pull image with policy "always": invalid reference format (manager.go:235:0s)
 ERROR: Job failed: failed to pull image "registry.gitlab.com/libvirt/libvirt/ci-:latest" with specified policies [always]: invalid reference format (manager.go:235:0s)

Fixes: 491d918502e50bf15c75d183bb41e3c0de5a0e1b
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Avoid memory leak in virQEMUCapsCPUDefsToModels
Michal Privoznik [Mon, 10 Oct 2022 13:37:17 +0000 (15:37 +0200)]
qemu: Avoid memory leak in virQEMUCapsCPUDefsToModels

The @vendor variable inside virQEMUCapsCPUDefsToModels() is
allocated, but never freed. But there is actually no need for it
to be allocated, because it merely passes a retval of
virCPUGetVendorForModel() (which returns a const string) to
virDomainCapsCPUModelsAdd() (which ten accepts the argument as
const string). Therefore, drop the g_strdup() call and fix the
type of the variable.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2 years agomeson: Bump minimal required meson version
Michal Privoznik [Fri, 7 Oct 2022 07:31:25 +0000 (09:31 +0200)]
meson: Bump minimal required meson version

Bump the minimal required version to 0.56.0. Looking into our CI
this is the oldest version we install.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoReplace dep.get_pkgconfig_variable() with dep.get_variable(pkgconfig:)
Michal Privoznik [Fri, 7 Oct 2022 07:48:00 +0000 (09:48 +0200)]
Replace dep.get_pkgconfig_variable() with dep.get_variable(pkgconfig:)

The get_pkgconfig_variable() method is deprecated in 0.56.0 and
we're recommended to use get_variable(pkgconfig : ...) instead.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agomeson: Replace external_program.path() with external_program.full_path()
Michal Privoznik [Fri, 7 Oct 2022 07:43:33 +0000 (09:43 +0200)]
meson: Replace external_program.path() with external_program.full_path()

The path() method is deprecated in 0.55.0 and we're recommended
to use full_path() instead. Interestingly, we were already doing
do in couple of places, but not all of them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agomeson: Replace meson.source_root() with meson.project_source_root()
Michal Privoznik [Fri, 7 Oct 2022 07:37:43 +0000 (09:37 +0200)]
meson: Replace meson.source_root() with meson.project_source_root()

The source_root() method is deprecated in 0.56.0 and we're
recommended to use project_source_root() instead.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agomeson: Replace meson.build_root() with meson.project_build_root()
Michal Privoznik [Fri, 7 Oct 2022 07:31:32 +0000 (09:31 +0200)]
meson: Replace meson.build_root() with meson.project_build_root()

The build_root() method is deprecated in 0.56.0 and we're
recommended to use project_build_root() instead.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoNEWS: Document CPU reporting improvements
Jiri Denemark [Fri, 30 Sep 2022 11:08:11 +0000 (13:08 +0200)]
NEWS: Document CPU reporting improvements

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirsh: Add completer for hypervisor-cpu-baseline --model
Jiri Denemark [Thu, 6 Oct 2022 15:12:24 +0000 (17:12 +0200)]
virsh: Add completer for hypervisor-cpu-baseline --model

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirsh: Add --model option for hypervisor-cpu-baseline
Jiri Denemark [Thu, 6 Oct 2022 14:29:32 +0000 (16:29 +0200)]
virsh: Add --model option for hypervisor-cpu-baseline

This option can be used as a shortcut for creating a single XML with
just a CPU model name and no features:

    $ virsh hypervisor-cpu-baseline --model Skylake-Server
    <cpu mode='custom' match='exact'>
      <model fallback='forbid'>Skylake-Server</model>
      <feature policy='disable' name='avx512f'/>
      <feature policy='disable' name='avx512dq'/>
      <feature policy='disable' name='clwb'/>
      <feature policy='disable' name='avx512cd'/>
      <feature policy='disable' name='avx512bw'/>
      <feature policy='disable' name='avx512vl'/>
      <feature policy='disable' name='pku'/>
    </cpu>

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu_capabilities: Translate CPU blockers
Jiri Denemark [Fri, 30 Sep 2022 15:59:06 +0000 (17:59 +0200)]
qemu_capabilities: Translate CPU blockers

Since commit "cpu_x86: Disable blockers from unusable CPU models"
(v3.8.0-99-g9c9620af1d) we explicitly disable CPU features reported by
QEMU as usability blockers for a particular CPU model when creating
baseline or host-model CPU definition. When QEMU changed canonical names
for some features (mostly those with '_' in their names), we forgot to
translate the blocker lists to names used by libvirt and the renamed
features would no longer be explicitly disabled in the created CPU model
even if they were reported as blockers by QEMU.

For example, on a host where EPYC CPU model has the following blockers

    <blocker name='sha-ni'/>
    <blocker name='mmxext'/>
    <blocker name='fxsr-opt'/>
    <blocker name='cr8legacy'/>
    <blocker name='sse4a'/>
    <blocker name='misalignsse'/>
    <blocker name='osvw'/>

we would fail to disable 'fxsr-opt':

    <cpu mode='custom' match='exact'>
      <model fallback='forbid'>EPYC</model>
      <feature policy='disable' name='sha-ni'/>
      <feature policy='disable' name='mmxext'/>
      <feature policy='disable' name='cr8legacy'/>
      <feature policy='disable' name='sse4a'/>
      <feature policy='disable' name='misalignsse'/>
      <feature policy='disable' name='osvw'/>
      <feature policy='disable' name='monitor'/>
    </cpu>

The 'monitor' feature is disabled even though it is not reported as a
blocker by QEMU because libvirt's definition of EPYC includes the
feature while it is missing in EPYC definition in QEMU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoDocument specifics of virConnectBaselineHypervisorCPU
Jiri Denemark [Fri, 7 Oct 2022 16:36:50 +0000 (18:36 +0200)]
Document specifics of virConnectBaselineHypervisorCPU

The API can be used to get usability blockers for an unusable CPU model,
which is not obvious. Let's explicitly document this behavior as it is
now mentioned in the documentation of domain capabilities XML.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodocs: Enhance documentation of CPU models in domain caps
Jiri Denemark [Fri, 7 Oct 2022 16:16:09 +0000 (18:16 +0200)]
docs: Enhance documentation of CPU models in domain caps

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agocpu_arm: Don't implement virCPUGetVendorForModel
Jiri Denemark [Thu, 29 Sep 2022 19:54:34 +0000 (21:54 +0200)]
cpu_arm: Don't implement virCPUGetVendorForModel

This patch is effectively a no-op, but I wanted to initialize
.getVendorForModel explicitly as implementing this function does not
even make sense on ARM. The CPU models in our CPU map are only used for
describing host CPU in capabilities XML and cannot be used for guest CPU
definition in domain XML anyway. The CPU models listed as supported in
domain capabilities XML are just passed through from QEMU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agocpu_ppc64: Implement virCPUGetVendorForModel
Jiri Denemark [Thu, 29 Sep 2022 19:51:22 +0000 (21:51 +0200)]
cpu_ppc64: Implement virCPUGetVendorForModel

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agocpu_x86: Implement virCPUGetVendorForModel
Jiri Denemark [Thu, 29 Sep 2022 19:40:40 +0000 (21:40 +0200)]
cpu_x86: Implement virCPUGetVendorForModel

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoIntroduce virCPUGetVendorForModel and use it in QEMU driver
Jiri Denemark [Thu, 29 Sep 2022 14:32:27 +0000 (16:32 +0200)]
Introduce virCPUGetVendorForModel and use it in QEMU driver

So far QEMU driver does not get CPU model vendor from QEMU directly and
it has to ask the CPU driver for the info stored in CPU map.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agodomain_capabilities: Add vendor attribute for CPU models
Jiri Denemark [Fri, 30 Sep 2022 09:46:29 +0000 (11:46 +0200)]
domain_capabilities: Add vendor attribute for CPU models

Even though several CPU models from various vendors are reported as
usable on a given host, user may still want to use only those that match
the host vendor. Currently the only place where users can check the
vendor of each CPU model is our CPU map, which is considered internal
and users should not really be using it directly. So to allow for such
filtering we now advertise the vendor of each CPU model in domain
capabilities.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: Do not pass qemuCaps to virQEMUCapsCPUFeature{To,From}QEMU
Jiri Denemark [Fri, 30 Sep 2022 16:34:05 +0000 (18:34 +0200)]
qemu: Do not pass qemuCaps to virQEMUCapsCPUFeature{To,From}QEMU

The only part of qemuCaps both functions are interested in is the CPU
architecture. Changing them to expect just virArch makes the functions
more reusable.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agocpu_ppc64: Avoid repeated loading of CPU map
Jiri Denemark [Fri, 30 Sep 2022 09:03:15 +0000 (11:03 +0200)]
cpu_ppc64: Avoid repeated loading of CPU map

The ppc64 CPU code still has to load and parse the CPU map everytime it
needs to look at it, which can make some operations pretty slow. Other
archs already switched to loading the CPU map once and keeping the
parsed structure in memory. Let's switch ppc64 as well.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: virDomainCapsCPUModelsAdd never fails
Jiri Denemark [Thu, 29 Sep 2022 14:30:19 +0000 (16:30 +0200)]
conf: virDomainCapsCPUModelsAdd never fails

Since the function always returns 0, we can just return void and make
callers simpler.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirNetServerProgramDispatchCall: Avoid calling xdr_free(_, NULL)
Michal Privoznik [Fri, 7 Oct 2022 11:05:03 +0000 (13:05 +0200)]
virNetServerProgramDispatchCall: Avoid calling xdr_free(_, NULL)

In recent commit of v8.8.0-41-g41eb0f446c I've suggested during
review to put both xdr_free() calls under error label, assuming
that xdr_free() accepts NULL and thus is a NOP when the control
jumps onto the label even before either of @arg or @ret was
allocated. Well, turns out, xdr_free() does no accept NULL and
thus we have to guard its call. But since @dispatcher is already
set by the time either of the variables is allocated, we can
replace the condition from 'if (dispatcher)' to 'if (arg)' and
'if (ret)'.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2 years agosrc: warn if client hits the max requests limit
Daniel P. Berrangé [Wed, 24 Aug 2022 15:15:24 +0000 (16:15 +0100)]
src: warn if client hits the max requests limit

Since they are simply normal RPC messages, the keep alive packets are
subject to the "max_client_requests" limit just like any API calls.

Thus, if a client hits the 'max_client_requests' limit and all the
pending API calls take a long time to complete, it may result in
keep-alives firing and dropping the client connection.

This has been seen by a number of users with the default value of
max_client_requests=5, by issuing 5 concurrent live migration
operations.

By printing a warning message when this happens, admins will be alerted
to the fact that their active clients are exceeding the default client
requests limit.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agotools: add virt-qemu-qmp-proxy for proxying QMP via libvirt QEMU guests
Daniel P. Berrangé [Fri, 27 May 2022 09:34:47 +0000 (10:34 +0100)]
tools: add virt-qemu-qmp-proxy for proxying QMP via libvirt QEMU guests

Libvirt provides QMP passthrough APIs for the QEMU driver and these are
exposed in virsh. It is not especially pleasant, however, using the raw
QMP JSON syntax. QEMU has a tool 'qmp-shell' which can speak QMP and
exposes a human friendly interactive shell. It is not possible to use
this with libvirt managed guest, however, since only one client can
attach to the QMP socket at any point in time. While it would be
possible to configure a second QMP socket for a VM, it may not be
an known requirement at the time the guest is provisioned.

The virt-qmp-proxy tool aims to solve this problem. It opens a UNIX
socket and listens for incoming client connections, speaking QMP on
the connected socket. It will forward any QMP commands received onto
the running libvirt QEMU guest, and forward any replies back to the
QMP client. It will also forward back events.

  $ virsh start demo
  $ virt-qmp-proxy demo demo.qmp &
  $ qmp-shell demo.qmp
  Welcome to the QMP low-level shell!
  Connected to QEMU 6.2.0

  (QEMU) query-kvm
  {
      "return": {
          "enabled": true,
          "present": true
      }
  }

Note this tool of course has the same risks as the raw libvirt
QMP passthrough. It is safe to run query commands to fetch information
but commands which change the QEMU state risk disrupting libvirt's
management of QEMU, potentially resulting in data loss/corruption in
the worst case. Any use of this tool will cause the guest to be marked
as tainted as an warning that it could be in an unexpected state.

Since this tool introduces a python dependency it is not desirable
to include it in any of the existing RPMs in libvirt. This tool is
also QEMU specific, so isn't appropriate to bundle with the generic
tools. Thus a new RPM is introduced 'libvirt-clients-qemu', to
contain additional QEMU specific tools, with extra external deps.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoci: refresh with latest lcitool manifest
Daniel P. Berrangé [Fri, 30 Sep 2022 08:50:04 +0000 (04:50 -0400)]
ci: refresh with latest lcitool manifest

This refresh switches the CI for contributors to be triggered by merge
requests. Pushing to a branch in a fork will no longer run CI pipelines,
in order to avoid consuming CI minutes. To regain the original behaviour
contributors can opt-in to a pipeline on push

   git push <remote> -o ci.variable=RUN_PIPELINE=1

This variable can also be set globally on the repository, through the
web UI options Settings -> CI/CD -> Variables, though this is not
recommended. Upstream repo pushes to branches will run CI.

The use of containers has changed in this update, with only the upstream
repo creating containers, in order to avoid consuming contributors'
limited storage quotas. A fork with existing container images may delete
them. Containers will be rebuilt upstream when pushing commits with CI
changes to the default branch. Any other scenario with CI changes will
simply install build pre-requisite packages in a throaway environment,
using the ci/buildenv/ scripts. These scripts may also be used on a
contributor's local machines.

With pipelines triggered by merge requests, it is also now possible to
workaround the inability of contributors to run pipelines if they have
run out of CI quota. A project member can trigger a pipeline from the
merge request, which will run in context of upstream, however, note
this should only be done after reviewing the code for any malicious
CI changes.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 years agoutil: xml: Remove virXMLParseStringCtxtRoot
Peter Krempa [Fri, 23 Sep 2022 13:38:49 +0000 (15:38 +0200)]
util: xml: Remove virXMLParseStringCtxtRoot

Remove the seldom used helper in favor of full virXMLParse.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotest_driver: Make callers of testOpenParse ensure the root element name
Peter Krempa [Fri, 23 Sep 2022 13:16:22 +0000 (15:16 +0200)]
test_driver: Make callers of testOpenParse ensure the root element name

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agosecurity: aa-helper: Use virXMLParse instead of virXMLParseString
Peter Krempa [Fri, 23 Sep 2022 13:11:59 +0000 (15:11 +0200)]
security: aa-helper: Use virXMLParse instead of virXMLParseString

Use the helper with more features to validate the root XML element name
instead of open-coding it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: savecookie: Remove virSaveCookieParseNode
Peter Krempa [Fri, 23 Sep 2022 13:03:19 +0000 (15:03 +0200)]
conf: savecookie: Remove virSaveCookieParseNode

The function provided just checking of the root XML node name which can
be easily moved into the caller wich doesn't do that already and
checking of the pointers which is trivial. Remove the helper.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoutil: xml: Remove virXMLParseCtxt
Peter Krempa [Fri, 23 Sep 2022 12:53:21 +0000 (14:53 +0200)]
util: xml: Remove virXMLParseCtxt

Convert the two outstanding uses to virXMLParseFileCtxt as they always
pass a filename and remove the helper macro.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoutil: xml: Remove virXMLParseFile
Peter Krempa [Fri, 23 Sep 2022 12:49:01 +0000 (14:49 +0200)]
util: xml: Remove virXMLParseFile

Most callers prefer using the XPath context. Convert the last user to
use virXMLParseFileCtxt and remove the helper macro.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoqemu: capabilities: Convert virQEMUCapsLoadCache to virXMLParse
Peter Krempa [Fri, 23 Sep 2022 12:47:12 +0000 (14:47 +0200)]
qemu: capabilities: Convert virQEMUCapsLoadCache to virXMLParse

Use virXMLParse so that the code doesn't have to explicitly allocate
an XPath context and validate the root element.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoutil: xml: Remove virXMLParseString
Peter Krempa [Fri, 23 Sep 2022 12:44:25 +0000 (14:44 +0200)]
util: xml: Remove virXMLParseString

Most callers use virXMLParseStringCtxt. Convert the last use case
and remove the helper.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirsh: Use proper helper for parsing XML in virshDumpXML
Peter Krempa [Fri, 23 Sep 2022 12:42:18 +0000 (14:42 +0200)]
virsh: Use proper helper for parsing XML in virshDumpXML

Use virXMLParseStringCtxt instead of virXMLParseString since the code
requires a XPath context anyways.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirDomainDefParseNode: Pass only the XPath context as argument
Peter Krempa [Fri, 23 Sep 2022 12:38:39 +0000 (14:38 +0200)]
virDomainDefParseNode: Pass only the XPath context as argument

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: domain: Simplify validation in virDomainDefParse
Peter Krempa [Fri, 23 Sep 2022 11:42:44 +0000 (13:42 +0200)]
conf: domain: Simplify validation in virDomainDefParse

Use virXMLParse's features to validate the top level element and fetch
the XPath context.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: domain: Remove virDomainObjParseNode
Peter Krempa [Fri, 23 Sep 2022 11:34:36 +0000 (13:34 +0200)]
conf: domain: Remove virDomainObjParseNode

virDomainObjParseFile is the only caller of virDomainObjParseNode.
The code can be merged into it, simplified by using virXMLParse and
the function removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: network: Provide only virNetworkDefParse
Peter Krempa [Fri, 23 Sep 2022 11:28:44 +0000 (13:28 +0200)]
conf: network: Provide only virNetworkDefParse

Replace virNetworkDefParseString/File by direct calls to
virNetworkDefParse.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: network: Remove virNetworkDefParseNode
Peter Krempa [Fri, 23 Sep 2022 11:17:25 +0000 (13:17 +0200)]
conf: network: Remove virNetworkDefParseNode

Both callers can be easily converted to call virNetworkDefParseXML
directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: interface: Remove virInterfaceDefParseFile
Peter Krempa [Fri, 23 Sep 2022 11:09:58 +0000 (13:09 +0200)]
conf: interface: Remove virInterfaceDefParseFile

The function was not used. Remove it and merge virInterfaceDefParse
into virInterfaceDefParseString.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: interface: Remove virInterfaceDefParseNode
Peter Krempa [Fri, 23 Sep 2022 11:07:36 +0000 (13:07 +0200)]
conf: interface: Remove virInterfaceDefParseNode

Both callers be easily made to call virInterfaceDefParseXML directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: nodedev: Provide only virNodeDeviceDefParse
Peter Krempa [Fri, 23 Sep 2022 09:52:23 +0000 (11:52 +0200)]
conf: nodedev: Provide only virNodeDeviceDefParse

Replace the thin wrappers virNodeDeviceDefParseString/File by directly
calling the main parser.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: node_device: Remove virNodeDeviceDefParseNode
Peter Krempa [Fri, 23 Sep 2022 08:44:13 +0000 (10:44 +0200)]
conf: node_device: Remove virNodeDeviceDefParseNode

Both callers be easily made to call virNodeDeviceDefParseXML directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: nwfilter: Provide only virNWFilterDefParse
Peter Krempa [Fri, 23 Sep 2022 08:36:36 +0000 (10:36 +0200)]
conf: nwfilter: Provide only virNWFilterDefParse

Replace virNWFilterDefParseString/File with the common function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: nwfilter: Remove virNWFilterDefParseNode
Peter Krempa [Fri, 23 Sep 2022 08:32:52 +0000 (10:32 +0200)]
conf: nwfilter: Remove virNWFilterDefParseNode

Use virXMLParse to fetch the XML context and validate the top level XML
element name so that virNWFilterDefParseNode is no longer needed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: backup: Remove virDomainBackupDefParseNode
Peter Krempa [Thu, 22 Sep 2022 16:02:50 +0000 (18:02 +0200)]
conf: backup: Remove virDomainBackupDefParseNode

Rename virDomainBackupDefParse to virDomainBackupDefParseXML and use
it in place of virDomainBackupDefParseNode. This is possible as
virXMLParse can be used to replace XPath context allocation and root
node checking.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: checkpoint: Remove virDomainCheckpointDefParseNode
Peter Krempa [Thu, 22 Sep 2022 15:56:53 +0000 (17:56 +0200)]
conf: checkpoint: Remove virDomainCheckpointDefParseNode

Replace all it does by properly using virXMLParse.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoprlsdkParseSnapshotTree: Simplify XML parsing code
Peter Krempa [Thu, 22 Sep 2022 15:53:04 +0000 (17:53 +0200)]
prlsdkParseSnapshotTree: Simplify XML parsing code

Use features of virXMLParse to validate root node and fetch XPath
context.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: secret: Provide only virSecretDefParse
Peter Krempa [Thu, 22 Sep 2022 15:42:00 +0000 (17:42 +0200)]
conf: secret: Provide only virSecretDefParse

Replace the virSecretDefParseFile/String shims by calls to
virSecretDefParse.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: secret: Refactor secretXMLParseNode
Peter Krempa [Thu, 22 Sep 2022 15:38:36 +0000 (17:38 +0200)]
conf: secret: Refactor secretXMLParseNode

Rename it to virSecretParseXML and move the root node validation and
context fetching into the caller (by properly calling virXMLParse).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: snapshot: Remove virDomainSnapshotDefParseNode
Peter Krempa [Thu, 22 Sep 2022 15:33:56 +0000 (17:33 +0200)]
conf: snapshot: Remove virDomainSnapshotDefParseNode

Check the root XML node name and fetch XPath context by properly
configuring virXMLParse. Callers can use virDomainSnapshotDefParse
instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: storage: Provide only virStorageVolDefParse
Peter Krempa [Thu, 22 Sep 2022 15:22:55 +0000 (17:22 +0200)]
conf: storage: Provide only virStorageVolDefParse

Remove the virStorageVolDefParseFile/String shim functions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: storage: Remove virStorageVolDefParseNode
Peter Krempa [Thu, 22 Sep 2022 15:17:21 +0000 (17:17 +0200)]
conf: storage: Remove virStorageVolDefParseNode

Proper use of virXMLParse replaces everything the function provides.
Callers can use virStorageVolDefParseXML instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: storage: Provide only virStoragePoolDefParse
Peter Krempa [Thu, 22 Sep 2022 15:08:16 +0000 (17:08 +0200)]
conf: storage: Provide only virStoragePoolDefParse

Replace the virStoragePoolDefParseString/File thin wrappers by
virStoragePoolDefParse.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: storage: Remove virStoragePoolDefParseNode
Peter Krempa [Thu, 22 Sep 2022 15:00:25 +0000 (17:00 +0200)]
conf: storage: Remove virStoragePoolDefParseNode

Replace it by proper use of virXMLParse to validate the root node and
allocate the context. The use in the test driver can be directly
replaced by virStoragePoolDefParseXML as both are validated.

The change to the storage driver isn't trivial though as it requires
careful xpath context juggling to parse the nested volumes properly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotestParseXMLDocFromFile: Validate that the replaced node is identical with parsed...
Peter Krempa [Thu, 22 Sep 2022 14:41:25 +0000 (16:41 +0200)]
testParseXMLDocFromFile: Validate that the replaced node is identical with parsed root

When replacing a definition node by contents of a file the root node in
the file must match the replaced node.

Enforce that by passing the original node name as the 'rootnode'
argument of virXMLParse.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotestParseXMLDocFromFile: Remove 'type' argument
Peter Krempa [Thu, 22 Sep 2022 14:38:42 +0000 (16:38 +0200)]
testParseXMLDocFromFile: Remove 'type' argument

virXMLParse ignores the 'url' argument which is what 'type' was passed
to it as when a filename is used as source for the XML.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotestParseXMLDocFromFile: Refactor control flow
Peter Krempa [Thu, 22 Sep 2022 14:22:53 +0000 (16:22 +0200)]
testParseXMLDocFromFile: Refactor control flow

Move few variables definitions closer to usage, add comments explaining
what's happening and simplify the control flow.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: networkportdef: Provide only virNetworkPortDefParse
Peter Krempa [Thu, 22 Sep 2022 14:09:27 +0000 (16:09 +0200)]
conf: networkportdef: Provide only virNetworkPortDefParse

Replace the two helpers virNetworkPortDefParseString/File with the
common helper.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: networkport: Remove virNetworkPortDefParseNode
Peter Krempa [Thu, 22 Sep 2022 14:04:10 +0000 (16:04 +0200)]
conf: networkport: Remove virNetworkPortDefParseNode

The function is exported but used only intenally, additionally
everything it did for the only caller can be replaced by properly using
virXMLParse.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agotests: qemuxml2argv: Use virXMLParse properly
Peter Krempa [Thu, 22 Sep 2022 13:58:16 +0000 (15:58 +0200)]
tests: qemuxml2argv: Use virXMLParse properly

Don't validate the root node and don't allocate a private XPath context
when virXMLParse can do that internally.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: nwfilterbinding: Provide only virNWFilterBindingDefParse
Peter Krempa [Thu, 22 Sep 2022 13:56:32 +0000 (15:56 +0200)]
conf: nwfilterbinding: Provide only virNWFilterBindingDefParse

Remove the virNWFilterBindingDefParseString/File thin wrappers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirNWFilterBindingDefParse: Properly use virXMLParse
Peter Krempa [Thu, 22 Sep 2022 13:47:40 +0000 (15:47 +0200)]
virNWFilterBindingDefParse: Properly use virXMLParse

Fetch the XPath context and validate the node by using virXMLParse's
features.

This allows to completely remove virNWFilterBindingDefParseNode as
all callers now properly validate the root element name and have a XPath
context handy.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirVBoxSnapshotConfGet(RW|RO)DisksPathsFromLibvirtXML: Refactor
Peter Krempa [Thu, 22 Sep 2022 13:26:13 +0000 (15:26 +0200)]
virVBoxSnapshotConfGet(RW|RO)DisksPathsFromLibvirtXML: Refactor

virVBoxSnapshotConfGetRWDisksPathsFromLibvirtXML and
virVBoxSnapshotConfGetRODisksPathsFromLibvirtXML were doing the same
thing, except for one XPath query.

Factor out the common code into a helper and bring it up to modern
standard.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovbox: snapshot_conf: Don't allocate XPath context explicitly
Peter Krempa [Thu, 22 Sep 2022 13:12:20 +0000 (15:12 +0200)]
vbox: snapshot_conf: Don't allocate XPath context explicitly

Use the one provided via virXMLParse.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agovirNWFilterBindingObjParse: Refactor XML parsing code
Peter Krempa [Thu, 22 Sep 2022 13:06:40 +0000 (15:06 +0200)]
virNWFilterBindingObjParse: Refactor XML parsing code

Remove the redundant root node checking and XPath context creation by
using virXMLParse properly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoconf: nwfilderbindigobj: Register automatic cleanup for virNWFilterBindingObj
Peter Krempa [Thu, 22 Sep 2022 12:59:23 +0000 (14:59 +0200)]
conf: nwfilderbindigobj: Register automatic cleanup for virNWFilterBindingObj

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoutil: xml: Expose all arguments of virXMLParseHelper in virXMLParse macro
Peter Krempa [Thu, 22 Sep 2022 12:30:53 +0000 (14:30 +0200)]
util: xml: Expose all arguments of virXMLParseHelper in virXMLParse macro

The generic helper also has helper code to validate the root element and
create an XPath context. Many places in the code duplicate code for
doing these operations.

Extend the helper to provide all arguments and fix all callers.

In many cases this patch refactors the passing of the 'validate'
field into a separate variable to avoid quirky looking arguments.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2 years agoci: integration: Update the perl CI job names
Erik Skultety [Thu, 6 Oct 2022 08:40:35 +0000 (10:40 +0200)]
ci: integration: Update the perl CI job names

libvirt-derived repos recently changed the way how and when CI
containers are built and for that a different naming scheme was adopted
to differentiate between the 2. Update the integration pipeline config
to reflect this change.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Wed, 5 Oct 2022 09:19:42 +0000 (11:19 +0200)]
Translated using Weblate (Swedish)

Currently translated at 48.1% (5022 of 10432 strings)

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

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2 years agoqemu: tpm: Remove TPM state after successful migration
Stefan Berger [Tue, 4 Oct 2022 13:38:14 +0000 (09:38 -0400)]
qemu: tpm: Remove TPM state after successful migration

This patch 'fixes' the behavior of the persistent_state TPM domain XML
attribute that intends to preserve the state of the TPM but should not
keep the state around on all the hosts a VM has been migrated to. It
removes the TPM state directory structure from the source host upon
successful migration when non-shared storage is used. Similarly, it
removes it from the destination host upon migration failure when
non-shared storage is used.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoqemu: Add UNDEFINE_TPM and UNDEFINE_KEEP_TPM flags
Stefan Berger [Tue, 4 Oct 2022 13:38:13 +0000 (09:38 -0400)]
qemu: Add UNDEFINE_TPM and UNDEFINE_KEEP_TPM flags

Add UNDEFINE_TPM and UNDEFINE_KEEP_TPM flags to qemuDomainUndefineFlags()
API and --tpm and --keep-tpm to 'virsh undefine'. Pass the
virDomainUndefineFlagsValues via qemuDomainRemoveInactive()
from qemuDomainUndefineFlags() all the way down to
qemuTPMEmulatorCleanupHost() and delete TPM storage there considering that
the UNDEFINE_TPM flag has priority over the persistent_state attribute
from the domain XML. Pass 0 in all other API call sites to
qemuDomainRemoveInactive() for now.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2 years agoutil: xml: Use common formatting of 'Bitwise-OR' in function param description
Peter Krempa [Mon, 3 Oct 2022 13:35:12 +0000 (15:35 +0200)]
util: xml: Use common formatting of 'Bitwise-OR' in function param description

Our public API docs use the hyphenated version with capital OR. Fix the
virXMLProp* helpers to use the same syntax.

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