]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
3 years agoqemu: hotplug: Add wrapper for qemuMonitorAttachCharDev
Peter Krempa [Thu, 14 Oct 2021 13:53:48 +0000 (15:53 +0200)] 
qemu: hotplug: Add wrapper for qemuMonitorAttachCharDev

Add a simple wrapper for 'qemuMonitorAttachCharDev' named
'qemuHotplugChardevAttach' which will simplify the moving of the
character device property generator out of the monitor code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuBuildCommandLine: Properly check return value of qemuBuildShmemCommandLine
Peter Krempa [Wed, 3 Nov 2021 12:29:15 +0000 (13:29 +0100)] 
qemuBuildCommandLine: Properly check return value of qemuBuildShmemCommandLine

Use the customary '< 0' check for return value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu_process.c: use g_autoptr() in qemuProcessQMPInitMonitor
Daniel Henrique Barboza [Thu, 18 Nov 2021 14:20:23 +0000 (11:20 -0300)] 
qemu_process.c: use g_autoptr() in qemuProcessQMPInitMonitor

The 'xmlopt' parameter can be auto-unref by using g_autoptr().

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
3 years agodomain_conf.h: add autoptr cleanup func to virDomainXMLOptionPtr
Daniel Henrique Barboza [Thu, 18 Nov 2021 14:20:22 +0000 (11:20 -0300)] 
domain_conf.h: add autoptr cleanup func to virDomainXMLOptionPtr

This will enable code cleanups on code that still relies on
virObjectUnref() this pointer manually.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
3 years agocpu_x86.c: remove 'guest' param from x86Compute()
Daniel Henrique Barboza [Thu, 18 Nov 2021 14:20:19 +0000 (11:20 -0300)] 
cpu_x86.c: remove 'guest' param from x86Compute()

x86Compute() is a static function called only by virCPUx86Compare()
which passes NULL to the 'guest' parameter of x86Compute().

The last caller of x86Compute() that used it with 'guest' != NULL
was an API called 'cpuGuestData'. This API was dropped by commit
03fa904c0c0cb2 a few years ago. Since then all callers of x86Compute()
uses it with 'guest' = NULL.

Removing the 'guest' parameter allow us to remove a good chunk of
logic that isn't being used for awhile.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
3 years agospec: Explicitly provide locations for QEMU data
Andrea Bolognani [Mon, 15 Nov 2021 17:49:26 +0000 (18:49 +0100)] 
spec: Explicitly provide locations for QEMU data

These are the defaults, but we prefer to be explicit.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agomeson: Introduce qemu_datadir option
Andrea Bolognani [Mon, 15 Nov 2021 17:13:56 +0000 (18:13 +0100)] 
meson: Introduce qemu_datadir option

There is no guarantee that QEMU and libvirt have been configured
with the same prefix.

In particular, Homebrew on macOS will pass a different, private
prefix for each package version and then use symlinks to make
the files for a specific version appear in the usual locations.

This works perfectly fine as long as one package doesn't try to
go poking around another package's data - which is exactly what
libvirt needs to do in order to read and parse the QEMU interop
data.

qemu_datadir can now be explicitly provided to make this and
other uncommon scenarios work. The common scenario, where QEMU
and libvirt both use the same prefix, is unaffected.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Rename interop locations
Andrea Bolognani [Mon, 15 Nov 2021 17:03:44 +0000 (18:03 +0100)] 
qemu: Rename interop locations

Use abstract names that more closely match the Meson
nomenclature.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Set QEMU data location correctly
Andrea Bolognani [Mon, 15 Nov 2021 17:57:52 +0000 (18:57 +0100)] 
qemu: Set QEMU data location correctly

While datadir must live under prefix, there is no requirement
that its name must necessarily be "share": a different,
arbitrary name could have been provided by the user.

Fixes: 3c876d2428ee3abbb11a50698a9e225cffb72cbc
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agomeson: Define qemu_moddir correctly
Andrea Bolognani [Mon, 15 Nov 2021 17:16:40 +0000 (18:16 +0100)] 
meson: Define qemu_moddir correctly

We can't hardcode /usr here, because the user might have
configured whatever arbitrary prefix.

Everything appeared to be okay because when joining paths
Meson will drop any component that precedes an absolute path
and libdir happens to be absolute, but we should still do
things correctly instead of relying on this.

Fixes: 2ad009eadde27491ff4248f481560953776b2a87
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agospec: Don't create unnecessary directory
Andrea Bolognani [Tue, 16 Nov 2021 10:02:01 +0000 (11:02 +0100)] 
spec: Don't create unnecessary directory

The directory is already created by the build system, so we
don't need to create it explicitly in the spec file; moreover,
the path was incorrect, because it used datadir instead of
localstatedir.

Fixes: 4e041189f85bc1b0f8d5278c0cafdd4aba55beaf
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotests/qemuxml2*/graphics-spice-timeout: skip CPU model check
Daniel Henrique Barboza [Tue, 16 Nov 2021 17:21:11 +0000 (12:21 -0500)] 
tests/qemuxml2*/graphics-spice-timeout: skip CPU model check

Commit 65b0b746b516 changed spice tests to use latest caps. Before this
change, "FLAG_REAL_CAPS" wasn't being set in testQemuInfoInitArgs(). The
absence of this flag triggered the code path inside
testCompareXMLToArgv() that executed testUpdateQEMUCaps(). This function
will update the host CPU via virQEMUCapsUpdateHostCPUModel() into
virQEMUCapsInitHostCPUModel(). In this function,
virQEMUCapsInitCPUModel() would end up updating the hostCPU inside the
qemuCaps (via virQEMUCapsProbeHostCPU()). Before the forementioned
commit, the host CPU was being defaulted to x86_64, vendor Intel, for
the 'graphics-spice-timeout' test that is using the 'pc' machine type
and 'accel=kvm'.

Today, "FLAG_REAL_CAPS" is being set because we're using the latest caps
from x86_64. This means that the whole code path mentioned above is
skipped. qemuCaps are now being loaded via virQEMUCapsLoadCache()
directly. Without the handling being done by testUpdateQEMUCaps(), the
host CPU is being retrieved later on, down below
qemuProcessCreatePretendCmdPrepare() into qemuProcessUpdateGuestCPU().
The latter will attempt to update the domain cpu and executing a
virCPUCompare with the hostCPU and def->cpu.

All this logic ended up causing a failure of the
'graphics-spice-timeout' test in ppc64 and s390x hosts. This test is
being run with KVM acceleration, and the KVM driver for ppc64 and s390x
will return a default x86_64 CPU with vendor "AMD", making
virCPUCompare() fail with the following message:

"QEMU XML-2-ARGV graphics-spice-timeout.x86_64-latest   ... libvirt: CPU
Driver error : the CPU is incompatible with host CPU: host CPU vendor does
not match required CPU vendor Intel"

Fix this test by setting cpu check='none' and avoid the virCPUCompare()
that causes the problem for ppc64 and s390x hosts.

Note that this is a build fix. A more adequate fix would be to mock the
getHost() interface of the cpuDriverX86 for non-x86 hosts, allowing
'fullCPU' to be retrieved in qemuProcessUpdateGuestCPU(), and a proper
x86 CPU to be retrieved in the scenario described above.

Reported-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
3 years agodocs: Use new URLs for Go modules in downloads page
Andrea Bolognani [Tue, 16 Nov 2021 15:56:11 +0000 (16:56 +0100)] 
docs: Use new URLs for Go modules in downloads page

We've been using the new repositories for a few months now,
but the downloads page still points to the obsolete Go packages.

Fixes: 1832c0a02b3c9ceb518a4338cb3609fd7d1233a2
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoqemu: command: Use JSON for parameters of -audiodev
Peter Krempa [Tue, 9 Nov 2021 15:58:22 +0000 (16:58 +0100)] 
qemu: command: Use JSON for parameters of -audiodev

'-audiodev' as a modern implementation based on QAPI already takes JSON
as the argument. Convert our code to use it directly.

The declaration of the QAPI types can be found in
'qemu.git/qapi/audio.json'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: command: Use JSON for parameters of -compat
Peter Krempa [Mon, 8 Nov 2021 15:20:21 +0000 (16:20 +0100)] 
qemu: command: Use JSON for parameters of -compat

'-compat' as a modern implementation based on QAPI already takes JSON as
the argument. Convert our code to use it directly.

QEMU declares the ised QAPI types as:

{ 'enum': 'CompatPolicyInput',
  'data': [ 'accept', 'reject', 'crash' ] }

{ 'enum': 'CompatPolicyOutput',
  'data': [ 'accept', 'hide' ] }

{ 'struct': 'CompatPolicy',
  'data': { '*deprecated-input': 'CompatPolicyInput',
            '*deprecated-output': 'CompatPolicyOutput' } }

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoutil: json: Remove virJSONValueObjectCreate(VArgs)
Peter Krempa [Tue, 9 Nov 2021 15:32:43 +0000 (16:32 +0100)] 
util: json: Remove virJSONValueObjectCreate(VArgs)

The functions were obsoleted by virJSONValueObjectAdd(VArgs)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoReplace virJSONValueObjectCreateVArgs with virJSONValueObjectAddVArgs
Peter Krempa [Tue, 9 Nov 2021 15:31:35 +0000 (16:31 +0100)] 
Replace virJSONValueObjectCreateVArgs with virJSONValueObjectAddVArgs

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirsh: domain: Replace virJSONValueObjectCreate by virJSONValueObjectAdd
Peter Krempa [Mon, 8 Nov 2021 16:24:50 +0000 (17:24 +0100)] 
virsh: domain: Replace virJSONValueObjectCreate by virJSONValueObjectAdd

virJSONValueObjectAdd now works identically to virJSONValueObjectCreate
when used with a NULL argument. Replace all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: migration_params: Replace virJSONValueObjectCreate by virJSONValueObjectAdd
Peter Krempa [Mon, 8 Nov 2021 16:24:50 +0000 (17:24 +0100)] 
qemu: migration_params: Replace virJSONValueObjectCreate by virJSONValueObjectAdd

virJSONValueObjectAdd now works identically to virJSONValueObjectCreate
when used with a NULL argument. Replace all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirjsontest: Replace virJSONValueObjectCreate by virJSONValueObjectAdd
Peter Krempa [Mon, 8 Nov 2021 16:24:50 +0000 (17:24 +0100)] 
virjsontest: Replace virJSONValueObjectCreate by virJSONValueObjectAdd

virJSONValueObjectAdd now works identically to virJSONValueObjectCreate
when used with a NULL argument. Replace all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemublocktest: Replace virJSONValueObjectCreate by virJSONValueObjectAdd
Peter Krempa [Mon, 8 Nov 2021 16:24:50 +0000 (17:24 +0100)] 
qemublocktest: Replace virJSONValueObjectCreate by virJSONValueObjectAdd

virJSONValueObjectAdd now works identically to virJSONValueObjectCreate
when used with a NULL argument. Replace all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: command: Replace virJSONValueObjectCreate by virJSONValueObjectAdd
Peter Krempa [Mon, 8 Nov 2021 16:24:50 +0000 (17:24 +0100)] 
qemu: command: Replace virJSONValueObjectCreate by virJSONValueObjectAdd

virJSONValueObjectAdd now works identically to virJSONValueObjectCreate
when used with a NULL argument. Replace all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuDiskSourceGetProps: Initialize 'ret'
Peter Krempa [Tue, 9 Nov 2021 12:29:43 +0000 (13:29 +0100)] 
qemuDiskSourceGetProps: Initialize 'ret'

Upcomming patch will convert virJSONValueObjectCreate which didn't check
the value of the passed argument to virJSONValueObjectAdd which will and
this would lead to crashes.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: migration_cookie: Replace virJSONValueObjectCreate by virJSONValueObjectAdd
Peter Krempa [Mon, 8 Nov 2021 16:24:50 +0000 (17:24 +0100)] 
qemu: migration_cookie: Replace virJSONValueObjectCreate by virJSONValueObjectAdd

virJSONValueObjectAdd now works identically to virJSONValueObjectCreate
when used with a NULL argument. Replace all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: monitor: Replace virJSONValueObjectCreate by virJSONValueObjectAdd
Peter Krempa [Mon, 8 Nov 2021 16:24:50 +0000 (17:24 +0100)] 
qemu: monitor: Replace virJSONValueObjectCreate by virJSONValueObjectAdd

virJSONValueObjectAdd now works identically to virJSONValueObjectCreate
when used with a NULL argument. Replace all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: monitor_json: Replace virJSONValueObjectCreate by virJSONValueObjectAdd
Peter Krempa [Mon, 8 Nov 2021 16:24:50 +0000 (17:24 +0100)] 
qemu: monitor_json: Replace virJSONValueObjectCreate by virJSONValueObjectAdd

virJSONValueObjectAdd now works identically to virJSONValueObjectCreate
when used with a NULL argument. Replace all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: agent: Replace virJSONValueObjectCreate by virJSONValueObjectAdd
Peter Krempa [Mon, 8 Nov 2021 16:24:50 +0000 (17:24 +0100)] 
qemu: agent: Replace virJSONValueObjectCreate by virJSONValueObjectAdd

virJSONValueObjectAdd now works identically to virJSONValueObjectCreate
when used with a NULL argument. Replace all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: block: Replace virJSONValueObjectCreate by virJSONValueObjectAdd
Peter Krempa [Mon, 8 Nov 2021 16:24:50 +0000 (17:24 +0100)] 
qemu: block: Replace virJSONValueObjectCreate by virJSONValueObjectAdd

virJSONValueObjectAdd now works identically to virJSONValueObjectCreate
when used with a NULL argument. Replace all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirJSONValueObjectAddVArgs: Allocate new object if passed pointer is NULL
Peter Krempa [Tue, 9 Nov 2021 15:28:23 +0000 (16:28 +0100)] 
virJSONValueObjectAddVArgs: Allocate new object if passed pointer is NULL

Until now the code would crash if virJSONValueObjectAdd is used without
a valid object. Adding the functionality of allocating it if it's NULL
will allow us to replace all uses of virJSONValueObjectCreate with this
single function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirJSONValueObjectAddVArgs: Take double pointer
Peter Krempa [Tue, 9 Nov 2021 15:23:01 +0000 (16:23 +0100)] 
virJSONValueObjectAddVArgs: Take double pointer

Pass in the double pointer from the wrappers directly to
virJSONValueObjectAddVArgs, which will allow us to directly allocate the
new objects inside the function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirJSONValueObjectAdd: Convert @obj argument to double pointer
Peter Krempa [Mon, 8 Nov 2021 16:18:59 +0000 (17:18 +0100)] 
virJSONValueObjectAdd: Convert @obj argument to double pointer

Change the first argument to a double pointer so that later the function
can be unified with virJSONValueObjectCreate and fix all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoconf: device: compare drive address fields separately
Ján Tomko [Tue, 16 Nov 2021 13:46:39 +0000 (14:46 +0100)] 
conf: device: compare drive address fields separately

Commit 3210c8b04 introduced a separate field 'diskbus' for
internal use by the commandline formatter.

Adjust the check for address equality to compare the relevant
fields separately instead of the whole struct.

This means that the changes of the 'diskbus' field added
in commit 03ed14d2d4 no longer affect the outcome of the address
equality check.

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

Fixes: 3210c8b047534f7e1d3ccde7ea3bcf11e7c92ad9
Fixes: 03ed14d2d4a4e51568b1ee5a6e6c9c3371bb4d34
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Mon, 15 Nov 2021 20:16:05 +0000 (21:16 +0100)] 
Translated using Weblate (Swedish)

Currently translated at 28.9% (3018 of 10441 strings)

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

Translated using Weblate (Swedish)

Currently translated at 28.7% (2998 of 10441 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>
3 years agoTranslated using Weblate (Polish)
Piotr Drąg [Mon, 15 Nov 2021 20:16:04 +0000 (21:16 +0100)] 
Translated using Weblate (Polish)

Currently translated at 22.4% (2347 of 10441 strings)

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

Co-authored-by: Piotr Drąg <piotrdrag@gmail.com>
Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
3 years agoTranslated using Weblate (Korean)
simmon [Mon, 15 Nov 2021 20:16:04 +0000 (21:16 +0100)] 
Translated using Weblate (Korean)

Currently translated at 100.0% (10441 of 10441 strings)

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

Co-authored-by: simmon <simmon@nplob.com>
Signed-off-by: simmon <simmon@nplob.com>
3 years agoqemu: add DEVICE_UNPLUG_GUEST_ERROR event support
Daniel Henrique Barboza [Fri, 29 Oct 2021 19:54:26 +0000 (16:54 -0300)] 
qemu: add DEVICE_UNPLUG_GUEST_ERROR event support

The upcoming QEMU 6.2.0 implements a new event called
DEVICE_UNPLUG_GUEST_ERROR, a new event that reports generic device
unplug errors that were detected by the guest and reported back to QEMU.

This new event is going to be specially useful for pseries guests that
uses newer kernels (must have kernel commit 29c9a2699e71), which is the
case for Fedora 34 at this moment. These guests have the capability of
reporting CPU removal errors back to QEMU which, starting in 6.2.0, will
emit the DEVICE_UNPLUG_GUEST_ERROR event. Libvirt can use this event to
abort the device removal immediately instead of waiting for 'setvcpus'
timeout.

QEMU 6.2.0 is also going to emit DEVICE_UNPLUG_GUEST_ERROR for memory
hotunplug errors, both in pseries and ACPI guests. QEMU 6.1.0 reports
memory removal errors using the MEM_UNPLUG_ERROR event, which is going to
be deprecated by DEVICE_UNPLUG_GUEST_ERROR in 6.2.0. Given that
Libvirt wasn't handling the MEM_UNPLUG_ERROR event we don't need to
worry about it - adding support to DEVICE_UNPLUG_GUEST_ERROR will be
enough to cover all future cases.

This patch adds support to DEVICE_UNPLUG_GUEST_ERROR by adding the
minimal wiring required for Libvirt to be aware of it. The monitor
callback for this event will abort the pending removal operation of the
device reported by the "device" property of the event. Most of the heavy
lifting is already done by existing code that handles
QEMU_DOMAIN_UNPLUGGING_DEVICE_STATUS_GUEST_REJECTED, making our life
easier to abort the pending removal operation.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
3 years agotests: update QEMU and domain ppc64 capabilities for qemu 6.2
Daniel Henrique Barboza [Tue, 26 Oct 2021 17:37:06 +0000 (13:37 -0400)] 
tests: update QEMU and domain ppc64 capabilities for qemu 6.2

This patch updates domaincapsdata and qemucapabilitiesdata for ppc64
with qemu commit v6.1.0-1714-gc5b2f55981.

Changes in all 'ppc64-latest.ags' files were needed. The changes are
mundane despite the volume. For all 'ppc64-latest.args' files the
changes are:

- removing '-sandbox' command line;
- 'secret' and 'memory-backend-ram' objects are now using qom-type format;
- '-device' is now using qom-type format.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
3 years agovirsh: Remove unnecessary else branches
Michal Privoznik [Mon, 8 Nov 2021 15:09:48 +0000 (16:09 +0100)] 
virsh: Remove unnecessary else branches

In a few cases we call a public API, wrapped in an if() statement
with both branches written out explicitly. The error branch jumps
onto cleanup label, while the successful prints out a message.
Right after these ifs there's 'ret = true;' and the cleanup
label. The code is a bit more readable if only the error branch
is kept and printing happens at the same level as setting the ret
variable.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Kristína Hanicová <khanicov@redhat.com>
3 years agoexamples/dommigrate: Make retval portable
Michal Privoznik [Mon, 8 Nov 2021 12:33:09 +0000 (13:33 +0100)] 
examples/dommigrate: Make retval portable

Currently, the dommigrate example returns 0 or 1 for success or
failure state, respectively. Except for a few cases where it
forgot to change the @ret variable just before jumping onto the
'cleanup' label. Making the code follow our usual pattern
(initialize @ret to an error value and set it to success value
only at the end) fixes those cases. Also, using EXIT_SUCCESS and
EXIT_FAILURE is more portable (even though on my system they are
just an alias to values the example already uses).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Kristína Hanicová <khanicov@redhat.com>
3 years agoexamples/dommigrate: Don't set retval in usage()
Michal Privoznik [Mon, 8 Nov 2021 12:30:55 +0000 (13:30 +0100)] 
examples/dommigrate: Don't set retval in usage()

The usage() function should just print expected arguments. Make
the function return void then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Kristína Hanicová <khanicov@redhat.com>
3 years agovirNetDevVPortProfileParse: Use g_autofree
Michal Privoznik [Thu, 4 Nov 2021 12:38:02 +0000 (13:38 +0100)] 
virNetDevVPortProfileParse: Use g_autofree

Explicit calls to VIR_FREE() can be dropped then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Kristína Hanicová <khanicov@redhat.com>
3 years agoqemuMonitorOpen: Rework domain object refcounting
Michal Privoznik [Wed, 27 Oct 2021 12:41:58 +0000 (14:41 +0200)] 
qemuMonitorOpen: Rework domain object refcounting

Similarly to one of previous commits, there's no need to
increment domain object refcounter before unlocking it. Any
number of lock and unlock calls over domain object has no effect
on the refcounter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu_agent: Drop destroy callback
Michal Privoznik [Wed, 27 Oct 2021 11:35:16 +0000 (13:35 +0200)] 
qemu_agent: Drop destroy callback

After previous cleanups this callback is unused. Remove it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuAgentOpen: Rework domain object refcounting
Michal Privoznik [Wed, 27 Oct 2021 11:38:22 +0000 (13:38 +0200)] 
qemuAgentOpen: Rework domain object refcounting

Currently, when opening an agent socket the qemuConnectAgent()
increments domain object refcounter and calls qemuAgentOpen()
where the domain object pointer is simply stored inside
_qemuAgent struct. If qemuAgentOpen() fails, then it clears @cb
member only to avoid qemuProcessHandleAgentDestroy() being called
(which decrements the domain object refcounter) and the domain
object refcounter is then decreased explicitly in
qemuConnectAgent().

The same result can be achieved with much cleaner code: increment
the refcounter inside qemuAgentOpen() and drop the dance around
@cb.

Also, the comment in qemuConnectAgent() about holding an extra
reference is not correct. The thread that called
qemuConnectAgent() already holds a reference to the domain
object. No matter how many time the object is locked and unlocked
the reference counter can't be decreased.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu_agent: Rework domain object locking when opening agent
Michal Privoznik [Wed, 27 Oct 2021 11:38:05 +0000 (13:38 +0200)] 
qemu_agent: Rework domain object locking when opening agent

Just like qemuMonitorOpen(), hold the domain object locked
throughout the whole time of qemuConnectAgent() and unlock it
only for a brief time of actual connect() (because this is the
only part that has a potential of blocking).

The reason is that qemuAgentOpen() does access domain object
(well, its privateData) AND also at least one argument (@context)
depends on domain object. Accessing these without the lock is
potentially dangerous.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1845468#c12
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agonews: Mention the addition of virt-pki-query-dn binary
Martin Kletzander [Thu, 11 Nov 2021 14:59:48 +0000 (15:59 +0100)] 
news: Mention the addition of virt-pki-query-dn binary

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoAdd suggestions for virt-pki-query-dn usage
Martin Kletzander [Thu, 11 Nov 2021 14:56:05 +0000 (15:56 +0100)] 
Add suggestions for virt-pki-query-dn usage

To make it easier for users to figure out how the DN should be formatted.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agotools: Add virt-pki-query-dn binary
Martin Kletzander [Thu, 11 Nov 2021 14:35:38 +0000 (15:35 +0100)] 
tools: Add virt-pki-query-dn binary

With this program we do not have to depend on the output of `certtool -i`, which
changed the order of the fields at some point and the newest version is
incompatible with what libvirt expects in tls_allowed_dn_list configuration
option.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoRemove needless space
Martin Kletzander [Thu, 11 Nov 2021 14:55:45 +0000 (15:55 +0100)] 
Remove needless space

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agodocs: Simplify explanation of tls_allowed_dn_list wildcards
Martin Kletzander [Thu, 11 Nov 2021 14:44:58 +0000 (15:44 +0100)] 
docs: Simplify explanation of tls_allowed_dn_list wildcards

This removes a dead link, the need for users to understand a glib function and a
improper reference to fnmatch (as we only expand asterisks to any string).

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agorpc: Resize dname for longer DN from TLS certs
Martin Kletzander [Mon, 8 Nov 2021 15:04:57 +0000 (16:04 +0100)] 
rpc: Resize dname for longer DN from TLS certs

And to make that easier, allocate it on the heap.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agotests: Drop cleanup/error labels
Michal Privoznik [Mon, 1 Nov 2021 09:20:57 +0000 (10:20 +0100)] 
tests: Drop cleanup/error labels

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agotest: Use g_autofree more
Michal Privoznik [Mon, 1 Nov 2021 09:33:49 +0000 (10:33 +0100)] 
test: Use g_autofree more

This commit doesn't aim to extinguish every VIR_FREE() call, but
only those which were touched by the previous commit. The aim is
to drop cleanup/error labels.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agotests: Use g_autoptr(qemuMonitorTest)
Michal Privoznik [Mon, 1 Nov 2021 08:51:01 +0000 (09:51 +0100)] 
tests: Use g_autoptr(qemuMonitorTest)

Instead of calling qemuMonitorTestFree() explicitly, we can use
g_autoptr() and let it be called automagically.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agoqemuConnectStealCPUModelFromInfo: Drop needless 'cleanup' label
Michal Privoznik [Mon, 1 Nov 2021 09:37:11 +0000 (10:37 +0100)] 
qemuConnectStealCPUModelFromInfo: Drop needless 'cleanup' label

Previous commit rendered 'cleanup' label and @ret variable
redundant. The same result can be achieved by returning 0/-1
directly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agoqemu: Use g_autoptr(qemuMonitorCPUModelInfo)
Michal Privoznik [Mon, 1 Nov 2021 11:58:27 +0000 (12:58 +0100)] 
qemu: Use g_autoptr(qemuMonitorCPUModelInfo)

There are two instances of an explicit call to
qemuMonitorCPUModelInfoFree() which in fact can be turned into
g_auto().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agoPrefer g_auto(GStrv) over g_strfreev()
Michal Privoznik [Mon, 1 Nov 2021 09:34:10 +0000 (10:34 +0100)] 
Prefer g_auto(GStrv) over g_strfreev()

There are a few cases where a string list is freed by an explicit
call of g_strfreev(), but the same result can be achieved by
g_atuo(GStrv).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agoqemuagenttest: Don't leak virTypedParameter on failure
Michal Privoznik [Mon, 1 Nov 2021 09:34:33 +0000 (10:34 +0100)] 
qemuagenttest: Don't leak virTypedParameter on failure

There are two functions (testQemuAgentOSInfo() and
testQemuAgentTimezone()) which call virTypedParamsFree() only in
successful paths. If an error is met then those parameters would
be leaked. Fix this by placing the virTypedParamsFree() calls on
better place.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
3 years agoUse virSecretObjEndAPI() more
Michal Privoznik [Wed, 10 Nov 2021 09:01:02 +0000 (10:01 +0100)] 
Use virSecretObjEndAPI() more

Instead of explicit virObjectUnlock(obj) + virObjectUnref(obj)
combo the virSecretObjEndAPI() can be used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoUse virNodeDeviceObjEndAPI() more
Michal Privoznik [Wed, 10 Nov 2021 08:59:55 +0000 (09:59 +0100)] 
Use virNodeDeviceObjEndAPI() more

Instead of explicit virObjectUnlock(obj) + virObjectUnref(obj)
combo the virNodeDeviceObjEndAPI() can be used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoUse virNWFilterBindingObjEndAPI() more
Michal Privoznik [Wed, 10 Nov 2021 08:57:42 +0000 (09:57 +0100)] 
Use virNWFilterBindingObjEndAPI() more

Instead of explicit virObjectUnlock(obj) + virObjectUnref(obj)
combo the virNWFilterBindingObjEndAPI() can be used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoUse virInterfaceObjEndAPI() more
Michal Privoznik [Wed, 10 Nov 2021 08:56:29 +0000 (09:56 +0100)] 
Use virInterfaceObjEndAPI() more

Instead of explicit virObjectUnlock(obj) + virObjectUnref(obj)
combo the virInterfaceObjEndAPI() can be used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoUse virDomainObjEndAPI() more
Michal Privoznik [Wed, 10 Nov 2021 08:52:23 +0000 (09:52 +0100)] 
Use virDomainObjEndAPI() more

Instead of explicit virObjectUnlock(obj) + virObjectUnref(obj)
combo the virDomainObjEndAPI() can be used.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agolibxl: Free data returned from libxl_userdata_retrieve
Jim Fehlig [Thu, 28 Oct 2021 21:58:16 +0000 (15:58 -0600)] 
libxl: Free data returned from libxl_userdata_retrieve

Found via valgrind

==15016== 3,701 bytes in 2 blocks are definitely lost in loss record 975 of 1,009
==15016==    at 0x4C2A2AF: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==15016==    by 0x1FCD30CB: libxl_read_file_contents (in /usr/lib64/libxenlight.so.4.12.0)
==15016==    by 0x1FCCA58A: ??? (in /usr/lib64/libxenlight.so.4.12.0)
==15016==    by 0x1FCCA6C2: libxl_userdata_retrieve (in /usr/lib64/libxenlight.so.4.12.0)
==15016==    by 0x1FA42A5A: libxlReconnectDomain (libxl_driver.c:394)
==15016==    by 0x53BAC99: virDomainObjListHelper (virdomainobjlist.c:802)
==15016==    by 0x530842F: virHashForEach (virhash.c:575)
==15016==    by 0x53BC0E0: virDomainObjListForEach (virdomainobjlist.c:817)
==15016==    by 0x1FA423C4: libxlReconnectDomains (libxl_driver.c:468)
==15016==    by 0x1FA423C4: libxlStateInitialize (libxl_driver.c:778)
==15016==    by 0x54E8E9E: virStateInitialize (libvirt.c:657)
==15016==    by 0x12DBFA: daemonRunStateInit (remote_daemon.c:797)
==15016==    by 0x535BF79: virThreadHelper (virthread.c:206)

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu_process: continue to process fakereboot after restarting libvirtd
Bihong Yu [Mon, 25 Oct 2021 09:04:55 +0000 (17:04 +0800)] 
qemu_process: continue to process fakereboot after restarting libvirtd

During the vm rebooting, the vm could be paused if the libvirtd is
restarted for some reason, which is not expected. We need continue
fakereboot process if fakereboot flags is true and the vm is in
paused-user status.

Signed-off-by: Bihong Yu <yubihong@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu_process: set fakereboot flags false after processing fakereboot over
Bihong Yu [Mon, 25 Oct 2021 09:04:54 +0000 (17:04 +0800)] 
qemu_process: set fakereboot flags false after processing fakereboot over

During the vm rebooting, the vm could be shut down if the libvirtd is
restarted for some reason, which is not expected. We move set
fakereboot flags false after processing fakereboot over, so we can
ensure that fakereboot process have been executed.

Signed-off-by: Bihong Yu <yubihong@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu_block: Refactor qemuBlockExportAddNBD()
Kristina Hanicova [Tue, 26 Oct 2021 15:19:37 +0000 (17:19 +0200)] 
qemu_block: Refactor qemuBlockExportAddNBD()

This patch improves readability of the function and makes the
code look cleaner by removing the 'else' branches after return
and reordering of the 'if' branches.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu_command: do not use host-nodes for system memory
Pavel Hrdina [Tue, 9 Nov 2021 14:00:53 +0000 (15:00 +0100)] 
qemu_command: do not use host-nodes for system memory

Commit 88957116c9d3cb4705380c3702c9d4315fb500bb switched to use
memory-backend-* for regular VM memory as well. That change indirectly
started using 'host-nodes' for system memory which results in QEMU
calling mbind() to bind the system memory to specific NUMA node if the
VM XML contains the configuration similar to this:

  ...
  <numatune>
    <memory mode='strict' nodeset='0'/>
  </numatune>
  ...

Once the VM was started with that configuration it was no longer
possible to change the memory NUMA nodeset.

Fixes: 677c90cc1d1fcb3aba09b5d4f0f8f83099911775
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirnetsocket: pass HOME and XDG_RUNTIME_DIR to ssh
Дамјан Георгиевски [Tue, 2 Nov 2021 15:01:03 +0000 (16:01 +0100)] 
virnetsocket: pass HOME and XDG_RUNTIME_DIR to ssh

openssh supports environment variable expansion in its ssh_config
file[1]. These two environment variables can be used to
expand paths for ssh sockets and other files.

Ex.
```
Host *
 ControlMaster auto
 ControlPath ${XDG_RUNTIME_DIR}/ssh-%C.ctl
 IdentityAgent ${XDG_RUNTIME_DIR}/ssh-agent.socket
```

see also:
[1] https://man7.org/linux/man-pages/man5/ssh_config.5.html#ENVIRONMENT_VARIABLES
[2] https://gitlab.com/libvirt/libvirt/-/issues/232

Signed-off-by: Дамјан Георгиевски <gdamjan@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: add minor clarifications for librbd encryption
Or Ozeri [Sun, 31 Oct 2021 12:08:40 +0000 (07:08 -0500)] 
docs: add minor clarifications for librbd encryption

This should make the documentation less confusing mainly for
Ceph people.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotestVshTableHeader: Cleanup
Tim Wiederhake [Mon, 8 Nov 2021 11:49:16 +0000 (12:49 +0100)] 
testVshTableHeader: Cleanup

Remove unnecessary label and goto. This also fixes a bug where a
failure to create the table would result in the test passing.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotestLXCCapsInit: Cleanup
Tim Wiederhake [Mon, 8 Nov 2021 11:44:11 +0000 (12:44 +0100)] 
testLXCCapsInit: Cleanup

Remove unnecessary label and goto. Cleanup line breaks.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agofillXenCaps: Cleanup
Tim Wiederhake [Mon, 8 Nov 2021 11:25:45 +0000 (12:25 +0100)] 
fillXenCaps: Cleanup

Rework to remove unnecessary label and goto.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirSCSIVHostOpenVhostSCSI: Cleanup
Tim Wiederhake [Mon, 8 Nov 2021 11:03:43 +0000 (12:03 +0100)] 
virSCSIVHostOpenVhostSCSI: Cleanup

Remove unnecessary label, goto, and closing of not-open file descriptor.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirBufferAddBuffer: Cleanup
Tim Wiederhake [Mon, 8 Nov 2021 10:34:54 +0000 (11:34 +0100)] 
virBufferAddBuffer: Cleanup

Remove unnecessary label and goto.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirSaveCookieParse: Cleanup
Tim Wiederhake [Mon, 8 Nov 2021 10:19:15 +0000 (11:19 +0100)] 
virSaveCookieParse: Cleanup

Remove unnecessary label and goto.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirNetworkEventDispatchDefaultFunc: Cleanup
Tim Wiederhake [Mon, 8 Nov 2021 10:17:09 +0000 (11:17 +0100)] 
virNetworkEventDispatchDefaultFunc: Cleanup

Remove unnecessary label and goto.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirDomainCapsCPUModelsCopy: Cleanup
Tim Wiederhake [Mon, 8 Nov 2021 10:12:34 +0000 (11:12 +0100)] 
virDomainCapsCPUModelsCopy: Cleanup

Remove unnecessary label and goto.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirCHDomainObjBeginJob: Cleanup
Tim Wiederhake [Mon, 8 Nov 2021 10:09:37 +0000 (11:09 +0100)] 
virCHDomainObjBeginJob: Cleanup

Remove unnecessary label and goto.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoadminConnectListServers: Cleanup
Tim Wiederhake [Mon, 8 Nov 2021 10:05:29 +0000 (11:05 +0100)] 
adminConnectListServers: Cleanup

Remove unnecessary label and goto.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agobridge_driver: Drop needless fwd declarations
Michal Privoznik [Mon, 8 Nov 2021 10:04:37 +0000 (11:04 +0100)] 
bridge_driver: Drop needless fwd declarations

Some forward declarations in bridge_driver.c are not needed
really. They only create a noise when trying to jump onto the
correct tag. Drop them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemu: Invalidate capabilities cache on host cpuid mismatch
Tim Wiederhake [Mon, 2 Aug 2021 14:44:30 +0000 (16:44 +0200)] 
qemu: Invalidate capabilities cache on host cpuid mismatch

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

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirQEMUCapsCachePriv: Add host cpuid information
Tim Wiederhake [Fri, 15 Oct 2021 15:28:00 +0000 (17:28 +0200)] 
virQEMUCapsCachePriv: Add host cpuid information

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirQEMUCaps: Add host cpuid information
Tim Wiederhake [Mon, 2 Aug 2021 14:44:22 +0000 (16:44 +0200)] 
virQEMUCaps: Add host cpuid information

Many things can affect the availability of cpu flags (e.g. software
upgrades, kernel versions, kernel command line, etc.) and invalidate the
cached capabilities without notice. Add CPUID information to the
capabilities cache.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_x86: Implement virCPUDataGetHost for x86
Tim Wiederhake [Thu, 4 Nov 2021 13:43:31 +0000 (14:43 +0100)] 
cpu_x86: Implement virCPUDataGetHost for x86

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_x86: Add virCPUDataGetHost
Tim Wiederhake [Wed, 3 Nov 2021 16:26:58 +0000 (17:26 +0100)] 
cpu_x86: Add virCPUDataGetHost

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirhostcpu: Add virHostCPUGetCPUID
Tim Wiederhake [Thu, 4 Nov 2021 13:27:08 +0000 (14:27 +0100)] 
virhostcpu: Add virHostCPUGetCPUID

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_ppc64: Implement virCPUDataNewCopy for ppc64
Tim Wiederhake [Mon, 11 Oct 2021 10:34:23 +0000 (12:34 +0200)] 
cpu_ppc64: Implement virCPUDataNewCopy for ppc64

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_arm: Implement virCPUDataNewCopy for arm
Tim Wiederhake [Mon, 11 Oct 2021 10:31:36 +0000 (12:31 +0200)] 
cpu_arm: Implement virCPUDataNewCopy for arm

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_x86: Implement virCPUDataNewCopy for x86
Tim Wiederhake [Thu, 7 Oct 2021 11:56:53 +0000 (13:56 +0200)] 
cpu_x86: Implement virCPUDataNewCopy for x86

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu: Add virCPUDataNewCopy
Tim Wiederhake [Thu, 7 Oct 2021 11:46:44 +0000 (13:46 +0200)] 
cpu: Add virCPUDataNewCopy

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_ppc64: Implement virCPUDataIsIdentical for ppc64
Tim Wiederhake [Mon, 11 Oct 2021 10:21:04 +0000 (12:21 +0200)] 
cpu_ppc64: Implement virCPUDataIsIdentical for ppc64

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_arm: Implement virCPUDataIsIdentical for arm
Tim Wiederhake [Mon, 11 Oct 2021 09:52:22 +0000 (11:52 +0200)] 
cpu_arm: Implement virCPUDataIsIdentical for arm

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_arm: No need to protect macro definitions
Tim Wiederhake [Mon, 11 Oct 2021 09:51:55 +0000 (11:51 +0200)] 
cpu_arm: No need to protect macro definitions

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_x86: Implement virCPUDataIsIdentical for x86
Tim Wiederhake [Wed, 6 Oct 2021 13:16:11 +0000 (15:16 +0200)] 
cpu_x86: Implement virCPUDataIsIdentical for x86

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu: Add virCPUDataIsIdentical
Tim Wiederhake [Wed, 6 Oct 2021 12:53:05 +0000 (14:53 +0200)] 
cpu: Add virCPUDataIsIdentical

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu: Split up virCPUDataParse
Tim Wiederhake [Wed, 13 Oct 2021 10:56:51 +0000 (12:56 +0200)] 
cpu: Split up virCPUDataParse

This makes it possible to call virCPUDataParse with a xmlNodePtr,
which will be required by a later patch.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu: Change virCPUArchDataParse to take xmlNodePtr
Tim Wiederhake [Wed, 13 Oct 2021 10:53:43 +0000 (12:53 +0200)] 
cpu: Change virCPUArchDataParse to take xmlNodePtr

The function does not need a full xmlXPathContextPtr any longer and a
later patch will require a call to this function with only a xmlNodePtr
available.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_x86: Add x86ParseDataItemList
Tim Wiederhake [Tue, 12 Oct 2021 17:51:04 +0000 (19:51 +0200)] 
cpu_x86: Add x86ParseDataItemList

Factor out duplicated code from x86FeatureParse and virCPUx86DataParse.
This also consolidates error messages.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agocpu_x86: Simplify x86ParseMSR
Tim Wiederhake [Tue, 12 Oct 2021 15:45:32 +0000 (17:45 +0200)] 
cpu_x86: Simplify x86ParseMSR

... by using virXMLProp*() helpers. These only require a xmlNodePtr and
do not need a xmlXPathContextPtr. Reflect that in the function signature.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>