]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
3 years agolibxl: Remove needless labels
Michal Privoznik [Fri, 14 Jan 2022 12:49:54 +0000 (13:49 +0100)]
libxl: Remove needless labels

After previous cleanups some labels are needless: they contain
nothing but a return statement. Drop such labels and return
directly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoxen_xl.c: Use g_autoptr() for virCPUDef
Michal Privoznik [Fri, 14 Jan 2022 08:37:29 +0000 (09:37 +0100)]
xen_xl.c: Use g_autoptr() for virCPUDef

In xenParseXLVnuma() the @cpu variable is freed explicitly.
However, when switched to g_autoptr(virCPUDef) the explicit call
can be removed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoxen_xl.c: Use g_autofree more
Michal Privoznik [Fri, 14 Jan 2022 08:37:26 +0000 (09:37 +0100)]
xen_xl.c: Use g_autofree more

There are few places inside src/libxl/xen_xl.c that can benefit
from g_autofree. Let them use automatic memory freeing.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolibxl: Allocate @libxldisk in xenParseXLDisk() on stack
Michal Privoznik [Fri, 14 Jan 2022 08:51:39 +0000 (09:51 +0100)]
libxl: Allocate @libxldisk in xenParseXLDisk() on stack

In xenParseXLDisk() the @libxldisk variable (which is type of
libxl_device_disk) is allocated on heap. But this is not
necessary as nothing in the function needs that approach.

Allocate the variable on the stack and drop corresponding
VIR_FREE() call.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolibxl: Don't use a static buffer in xenParseXLVnuma()
Michal Privoznik [Fri, 14 Jan 2022 08:36:21 +0000 (09:36 +0100)]
libxl: Don't use a static buffer in xenParseXLVnuma()

The xenParseXLVnuma() function is responsible for parsing 'vnuma'
part of XL config and setting corresponding values in
virDomainDef. While doing so it uses a static buffer which is set
to data we are interested in and then parsing the buffer further
(e.g. string to integer conversion, bitmap parsing, and so on).
Well, the data we are interested in are already in a string
(@data) which can be used directly rendering this intermediary
buffer needless.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirconf: Make virConfSetValue() clear consumed pointer
Michal Privoznik [Fri, 14 Jan 2022 09:11:42 +0000 (10:11 +0100)]
virconf: Make virConfSetValue() clear consumed pointer

The way that virConfSetValue() works (and the way it is even
documented) is that the @value pointer is always consumed.
However, since the first order pointer is passed it leaves
callers in a pickle situation - they always have to set pointer
to NULL after calling virConfSetValue() to avoid touching it.

Let's switch @value to a double pointer and clear it inside the
function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agosrc: Declare and use g_autoptr(virConfValue)
Michal Privoznik [Fri, 14 Jan 2022 09:28:52 +0000 (10:28 +0100)]
src: Declare and use g_autoptr(virConfValue)

This commit declares g_autoptr() function for virConfValue type.
At the same time, it switches variable declarations to use it.
Also, in a few places we might have freed a variable twice, for
instance in xenFormatXLDomainNamespaceData(). This is because
virConfSetValue() consumes passed pointer (@value) even in case
of failure and thus any code that uses virConfSetValue() must
refrain from touching @value and it must not call
virConfFreeValue().

This semantic is not obvious and will be addressed in one of
future commits.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoxen_xl: Check for virConfSetValue() retval
Michal Privoznik [Fri, 14 Jan 2022 09:36:42 +0000 (10:36 +0100)]
xen_xl: Check for virConfSetValue() retval

There's one case where the return value of virConfSetValue() is
not checked for and it's in xenFormatXLInputDevs() function.
Let's fix that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirconf: Report an error in when virConfSetValue() fails
Michal Privoznik [Fri, 14 Jan 2022 09:35:17 +0000 (10:35 +0100)]
virconf: Report an error in when virConfSetValue() fails

Callers of virConfSetValue() don't report any error, they just
pass the error blindly. Therefore, report an error when
virConfSetValue() is about to fail.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agostorage_file: Declare virStorageSourceParseRBDColonString only in one header
Michal Privoznik [Fri, 7 Jan 2022 13:10:03 +0000 (14:10 +0100)]
storage_file: Declare virStorageSourceParseRBDColonString only in one header

The virStorageSourceParseRBDColonString() function is declared in
src/storage_file/storage_source.h and
src/storage_file/storage_source_backingstore.h but implemented
only in the .c that corresponds to the latter header file.
Therefore, drop declaration from storage_source.h as the function
is not implemented in its corresponding .c file.

Leftover from: 2d29a3a9d86b5f95a859888283e6caa98593b1d2
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: capabilities: Re-enable JSON syntax for -device
Peter Krempa [Thu, 13 Jan 2022 15:59:56 +0000 (16:59 +0100)]
qemu: capabilities: Re-enable JSON syntax for -device

Now that qemu fixed device unplug when JSON syntax is used with -device
we can re-enable the feature.

Since the old capability string representation is condemned by
suggesting filtering it as a workaround we must introduce a new string.
To achieve this the original capability position is renamed to
X_QEMU_CAPS_DEVICE_JSON_BROKEN_HOTPLUG and a new position with the
original name QEMU_CAPS_DEVICE_JSON is introduced to prevent us having
to change the rest of the code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotests: qemucapabilities: Add test data for the qemu-7.0 development cycle
Peter Krempa [Thu, 13 Jan 2022 14:50:10 +0000 (15:50 +0100)]
tests: qemucapabilities: Add test data for the qemu-7.0 development cycle

Update to commit v6.2.0-874-g1cd2ad11d3

Notable changes are:
- added flag noting that use of JSON syntax for -device was fixed
- 'dbus' backend for graphics and character devices added
- virtio-mem added 'node' property
- 'clusters' added to CPU topology
- 'open-timeout' property for NBD protocol backend
- 'wheel-left' and 'wheel-right' event types for 'input-send-event'
- increased default resolution to '1280x800' on 'virtio-gpu'
- SGX property 'section-size' changed to 'sections' incompatibly
  (unused luckily)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2(argv|xml)data: x86-kvm-32-on-64: Add machine type
Peter Krempa [Thu, 13 Jan 2022 15:14:42 +0000 (16:14 +0100)]
qemuxml2(argv|xml)data: x86-kvm-32-on-64: Add machine type

The machine type doesn't change the test result and prevents tests being
changed every time we are about to update real capabilities to a new
qemu.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotests: Report expected monitor command for simulated commands
Michal Privoznik [Tue, 30 Nov 2021 17:16:32 +0000 (18:16 +0100)]
tests: Report expected monitor command for simulated commands

There are two tests currently that simulate QMP talk:
qemucapabilitiestest and qemuhotplugtest. In both cases they
check whether currently executed command is the one for which
reply was provided. If not an error message is reported. However,
the error message contains only the actual command and not the
expected one. This makes it harder to navigate through .replies
files.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Fri, 14 Jan 2022 22:16:33 +0000 (23:16 +0100)]
Translated using Weblate (Swedish)

Currently translated at 30.5% (3191 of 10455 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 agoqemu: split handling of distinct firmware enum conversions
Daniel P. Berrangé [Mon, 10 Jan 2022 18:03:42 +0000 (13:03 -0500)]
qemu: split handling of distinct firmware enum conversions

The qemuFirmwareOSInterfaceTypeFromOsDefFirmware method
was added to convert from virDomainOsDefFirmware to the
qemuFirmwareOSInterface enum.

It was later also used to convert from virDomainLoader
to qemuFirmwareOSInterface in:

  commit 8e1804f9f66f13ca1412d22bf1a957b6d55a2365
  Author: Michal Prívozník <mprivozn@redhat.com>
  Date:   Tue Dec 17 17:45:50 2019 +0100

    qemu_firmware: Try to autofill for old style UEFI specification

This caused compile errors with clang due to passing a
mis-matched enum type. These were later silenced by
stripping the enum types:

  commit 8fcee47807d29008632a7ad918cbe93ac0a20597
  Author: Michal Prívozník <mprivozn@redhat.com>
  Date:   Wed Jan 8 09:42:47 2020 +0100

    qemu_firmware: Accept int in qemuFirmwareOSInterfaceTypeFromOsDefFirmware()

This is still rather confusing to humans reading the
code. It is clearer to just define a separate helper
method for the virDomainLoader type conversion.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agodocs: use virYesNo definition in more schemas
Daniel P. Berrangé [Mon, 10 Jan 2022 11:08:01 +0000 (11:08 +0000)]
docs: use virYesNo definition in more schemas

A few places are still using an expend yes/no choice instead of the
common virYesNo definition.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agodocs: split example for <os> schema
Daniel P. Berrangé [Mon, 10 Jan 2022 10:49:19 +0000 (10:49 +0000)]
docs: split example for <os> schema

The docs illustration for the <os> schema contains a mixture of
incompatible configuration options. This is rather confusing and
misleading to users. Splitting the illustration into four separate
examples clarifies the situation.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agomeson: Detect rst2html5 and rst2man only when needed
Ivan Teterevkov [Thu, 13 Jan 2022 08:40:56 +0000 (08:40 +0000)]
meson: Detect rst2html5 and rst2man only when needed

Detect these commands in docs/meson.build, i.e. only when
users enable documentation.

Signed-off-by: Ivan Teterevkov <ivan.teterevkov@nutanix.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
3 years agovirDomainSnapshotRedefinePrep: Don't do partial redefine
Peter Krempa [Wed, 12 Jan 2022 16:00:22 +0000 (17:00 +0100)]
virDomainSnapshotRedefinePrep: Don't do partial redefine

'virDomainSnapshotRedefinePrep' does everything needed for a redefine
when the snapshot exists but not when we are defining metadata for a new
snapshot. This gives us weird semantics.

Extract the code for replacing the definition of an existing snapshot
into a new helper 'virDomainSnapshotReplaceDef' and refactor all
callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainSnapshotAssignDef: Clear second argument when it is consumed
Peter Krempa [Wed, 12 Jan 2022 14:52:04 +0000 (15:52 +0100)]
virDomainSnapshotAssignDef: Clear second argument when it is consumed

Rather than callers second-guessing when the snapshot definition is
assigned turn it into a double pointer and clear it on success.

Fix callers to work with the new semantics.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuDomainSnapshotLoad: Refactor handling of snapshot definition object
Peter Krempa [Wed, 12 Jan 2022 15:40:03 +0000 (16:40 +0100)]
qemuDomainSnapshotLoad: Refactor handling of snapshot definition object

Move the variable holding the snapshot definition into the loop and use
automatic clearing for it. Adjust the code for parity.

Note that the clearing of 'snapdef' on success of
'virDomainSnapshotAssignDef' will be refactored in upcoming patches.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuSnapshotCreate: Standardize handling of the reference on @snapdef
Peter Krempa [Wed, 12 Jan 2022 15:35:01 +0000 (16:35 +0100)]
qemuSnapshotCreate: Standardize handling of the reference on @snapdef

As with qemuSnapshotRedefine, make an extra reference in a temporary
autocleaned variable and use that instead of refing the definition after
it's stolen.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuSnapshotCreate: Use 'snapdef' instead of 'def'
Peter Krempa [Wed, 12 Jan 2022 15:12:27 +0000 (16:12 +0100)]
qemuSnapshotCreate: Use 'snapdef' instead of 'def'

'def' is commonly used for domain definition.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotestDomainSnapshotCreateXML: Extract snapshot redefinition code
Peter Krempa [Wed, 12 Jan 2022 14:40:55 +0000 (15:40 +0100)]
testDomainSnapshotCreateXML: Extract snapshot redefinition code

The test driver code was copied from qemu but wasn't refactored
recently. Split out the redefinition code similarly to what qemu driver
did.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainSnapshotRedefineValidate: Don't modify the snapshot definition
Peter Krempa [Wed, 12 Jan 2022 14:08:25 +0000 (15:08 +0100)]
virDomainSnapshotRedefineValidate: Don't modify the snapshot definition

It is not expected that a function with 'Validate' in the name actually
modifies the validated object, even worse when it even modifies another
object and the ultimatively worst bit is that it doesn't undo the mess
if the validation fails midway.

Move the stealing of the domain definition from the definition of a
snapshot being redefined into the caller along with the call to
virDomainSnapshotAlignDisks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainSnapshotRedefinePrep: Use 'snapdef' for snapshot definition object
Peter Krempa [Wed, 12 Jan 2022 13:56:04 +0000 (14:56 +0100)]
virDomainSnapshotRedefinePrep: Use 'snapdef' for snapshot definition object

We use this variable name to distinguish it from the domain definition.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainSnapshotRedefineValidate: Unexport
Peter Krempa [Wed, 12 Jan 2022 13:28:21 +0000 (14:28 +0100)]
virDomainSnapshotRedefineValidate: Unexport

The function isn't used outside of src/conf/snapshot_conf.c as of
57d252c74

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainSnapshotAlignDisks: Allow alternate domain definition when redefining
Peter Krempa [Wed, 12 Jan 2022 13:20:04 +0000 (14:20 +0100)]
virDomainSnapshotAlignDisks: Allow alternate domain definition when redefining

Due to historical reasons we allow users to redefine an existing
snapshot without providing the domain definition which would correspond
to it. In such case we'd use the domain definition from the snapshot
that is being redefined.

To prevent callers from doing complex moving of the domain definition
object back and forth between the snapshot definitions we can add an
argument to virDomainSnapshotAlignDisks which will allow us to pass in
the alternate definition if the one from the snapshot is missing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainSnapshotAlignDisks: Move 'require_match' selection logic inside
Peter Krempa [Wed, 12 Jan 2022 12:49:44 +0000 (13:49 +0100)]
virDomainSnapshotAlignDisks: Move 'require_match' selection logic inside

'require_match' set to true is only needed for internal snapshots taken
by hypervisors (qemu) which don't have a way to control which disks take
part in the snapshot (savevm).

To de-clutter callers we can change the argument to mean 'this code path
requires uniform snapshot for internal snapshots'.

Change the argument and fix the callers. For now all callers pass 'true'
but any new hypervisor or even usage in qemu is not going to share the
limitation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainSnapshotAlignDisks: Convert @default_snapshot to virDomainSnapshotLocation
Peter Krempa [Wed, 12 Jan 2022 11:52:16 +0000 (12:52 +0100)]
virDomainSnapshotAlignDisks: Convert @default_snapshot to virDomainSnapshotLocation

Use the appropriate type for the variable and fix all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainSnapshotAlignDisks: Improve function comment
Peter Krempa [Wed, 12 Jan 2022 11:46:19 +0000 (12:46 +0100)]
virDomainSnapshotAlignDisks: Improve function comment

Add description of arguments, reword the description for clarity, and
fix improper argument names mentioned in the existing description.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainSnapshotRedefineValidate: Fix validation of VIR_DOMAIN_SNAPSHOT_CREATE_DISK_...
Peter Krempa [Wed, 12 Jan 2022 10:02:49 +0000 (11:02 +0100)]
virDomainSnapshotRedefineValidate: Fix validation of VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY flag

External snapshot with memory is created without using the
VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY flag, but rather with properly
configuring the XML. When redefining the code should be checking the
same thing as by definition an external snapshot with memory is not a
disk-only snapshot.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainMomentAssignDef: Simplify error handling
Peter Krempa [Wed, 12 Jan 2022 09:28:23 +0000 (10:28 +0100)]
virDomainMomentAssignDef: Simplify error handling

Remove error handling from the call to 'virDomainMomentObjNew' as it
can't return NULL and replace 'virHashAddEntry' by 'g_hash_table_insert'
as we've already checked that snapshot with such name doesn't exist in
the hash table. This removes handling for two impossible errors.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: add index for isa-serial device using target.port
Divya Garg [Thu, 13 Jan 2022 07:33:41 +0000 (23:33 -0800)]
qemu: add index for isa-serial device using target.port

VM XML accepts target.port but this does not get passed while
building the QEMU command line for this VM.

Signed-off-by: Divya Garg <divya.garg@nutanix.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoAdd the port allocation logic for isa-serial devices.
Divya Garg [Thu, 13 Jan 2022 07:33:40 +0000 (23:33 -0800)]
Add the port allocation logic for isa-serial devices.

This commit takes care of following cases:
-> Check availability of requested ports.
  ->The total number of requested ports should not be more than
    VIR_MAX_ISA_SERIAL_PORTS.
  ->The ports requested should be less than VIR_MAX_ISA_SERIAL_PORTS.
  ->VIR_MAX_ISA_SERIAL_PORTS should correspond to MAX_ISA_SERIAL_PORTS
    specified in QEMU code commit def337ffda34d331404bd7f1a42726b71500df22.
-> Prevent duplicate device assignments to the same port.
-> In case no ports are provided in the XML, this patch scans the list of unused
   isa-serial indices to automatically assign available ports for this VM.

Signed-off-by: Divya Garg <divya.garg@nutanix.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirInterfaceDefParse: Simplify and cleanup
Tim Wiederhake [Wed, 12 Jan 2022 12:41:39 +0000 (13:41 +0100)]
virInterfaceDefParse: Simplify and cleanup

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirInterfaceDefParseXML: Simplify and cleanup
Tim Wiederhake [Wed, 12 Jan 2022 12:41:25 +0000 (13:41 +0100)]
virInterfaceDefParseXML: Simplify and cleanup

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirInterfaceDefParseIfAdressing: Simplify and cleanup
Tim Wiederhake [Wed, 12 Jan 2022 12:40:00 +0000 (13:40 +0100)]
virInterfaceDefParseIfAdressing: Simplify and cleanup

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirInterfaceDefParseProtoIPv6: Simplify and cleanup
Tim Wiederhake [Wed, 12 Jan 2022 12:39:08 +0000 (13:39 +0100)]
virInterfaceDefParseProtoIPv6: Simplify and cleanup

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirInterfaceDefParseProtoIPv4: Simplify and cleanup
Tim Wiederhake [Wed, 12 Jan 2022 12:38:50 +0000 (13:38 +0100)]
virInterfaceDefParseProtoIPv4: Simplify and cleanup

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirInterfaceDefParseDhcp: Simplify and cleanup
Tim Wiederhake [Wed, 12 Jan 2022 12:07:51 +0000 (13:07 +0100)]
virInterfaceDefParseDhcp: Simplify and cleanup

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirInterfaceDefParseIP: Simplify and cleanup
Tim Wiederhake [Wed, 12 Jan 2022 11:49:38 +0000 (12:49 +0100)]
virInterfaceDefParseIP: Simplify and cleanup

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirInterfaceDefParseXML: Inline trivial virInterfaceDefParseName
Tim Wiederhake [Wed, 12 Jan 2022 11:28:49 +0000 (12:28 +0100)]
virInterfaceDefParseXML: Inline trivial virInterfaceDefParseName

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoconf: interface: Remove ret and goto
Tim Wiederhake [Tue, 11 Jan 2022 16:41:56 +0000 (17:41 +0100)]
conf: interface: Remove ret and goto

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoconf: interface: Use g_auto
Tim Wiederhake [Tue, 11 Jan 2022 16:29:22 +0000 (17:29 +0100)]
conf: interface: Use g_auto

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoconf: interface: Preparation for g_auto
Tim Wiederhake [Tue, 11 Jan 2022 16:54:56 +0000 (17:54 +0100)]
conf: interface: Preparation for g_auto

These changes make the g_auto-ification in the next commit clearer.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirInterfaceDefDevFormat: Add missing error handling
Tim Wiederhake [Wed, 12 Jan 2022 11:17:39 +0000 (12:17 +0100)]
virInterfaceDefDevFormat: Add missing error handling

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoPost-release version bump to 8.1.0
Jiri Denemark [Fri, 14 Jan 2022 14:17:26 +0000 (15:17 +0100)]
Post-release version bump to 8.1.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3 years agoRelease of libvirt-8.0.0
Jiri Denemark [Fri, 14 Jan 2022 14:03:30 +0000 (15:03 +0100)]
Release of libvirt-8.0.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Thu, 13 Jan 2022 21:16:32 +0000 (22:16 +0100)]
Translated using Weblate (Swedish)

Currently translated at 30.3% (3175 of 10455 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 agovirt-ssh-helper: Move manual page to section 8
Andrea Bolognani [Thu, 13 Jan 2022 13:42:21 +0000 (14:42 +0100)]
virt-ssh-helper: Move manual page to section 8

While sections are somewhat loosely defined and thus the choice
is not quite a clear-cut one, section 8 might be a slightly
better fit in this case.

Suggested-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoPrint errors on daemon startup if logging setup fails
Martin Kletzander [Thu, 13 Jan 2022 13:41:03 +0000 (14:41 +0100)]
Print errors on daemon startup if logging setup fails

Fixes: a873924e36b28c5b125621e35b32beb6b077bcc8
https://bugzilla.redhat.com/show_bug.cgi?id=2039652

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoNEWS: Mention propagation of sub-cluster allocation on snapshots and block-copy
Peter Krempa [Thu, 13 Jan 2022 12:13:56 +0000 (13:13 +0100)]
NEWS: Mention propagation of sub-cluster allocation on snapshots and block-copy

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
3 years agoNEWS: Document my contributions for upcoming release
Michal Privoznik [Wed, 12 Jan 2022 14:52:06 +0000 (15:52 +0100)]
NEWS: Document my contributions for upcoming release

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
3 years agodocs: tpm: Clarify omission or removal of active_pcr_banks node
Stefan Berger [Wed, 12 Jan 2022 15:49:52 +0000 (10:49 -0500)]
docs: tpm: Clarify omission or removal of active_pcr_banks node

Add a sentence to the active_pcr_banks node documentation that clarifies
that when the active_pcr_banks node is removed from the XML or when it
is omitted that the set of active PCR banks is not changed anymore.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2039246
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
3 years agodocs: minor fix in launchSecurity
Boris Fiuczynski [Tue, 11 Jan 2022 09:03:32 +0000 (10:03 +0100)]
docs: minor fix in launchSecurity

Correcting XML element.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agoqemuSnapshotRedefine: Fix use of snapshot definition after free
Peter Krempa [Wed, 12 Jan 2022 09:31:59 +0000 (10:31 +0100)]
qemuSnapshotRedefine: Fix use of snapshot definition after free

Commit f4aae9726df factored out the snapshot redefinition code into a
separate function, but didn't account for the fact that the code is
consuming the reference to the snapshot definition and by moving the
code away the caller (qemuSnapshotCreateXML) now frees the definition
which didn't happen before as we cleared the pointer.

Fix it by increasing the reference locally. Later patches will refactor
the code so that it's more obvious what's happening.

Fixes: f4aae9726df
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2039651
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuSnapshotRedefine: Rename 'def' to 'snapdef'
Peter Krempa [Wed, 12 Jan 2022 15:15:19 +0000 (16:15 +0100)]
qemuSnapshotRedefine: Rename 'def' to 'snapdef'

'def' is commonly used to refer to domain definition. Most of the
snapshot code uses 'snapdef' for the snapshot definition.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuSnapshotCreate: Don't insert snapshot into list with VIR_DOMAIN_SNAPSHOT_CREATE_N...
Peter Krempa [Tue, 11 Jan 2022 09:28:45 +0000 (10:28 +0100)]
qemuSnapshotCreate: Don't insert snapshot into list with VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA

Our approach to snapshots without metadata was to insert them to the
snapshot list and then later remove them from the list when the flag is
present.

This quirky logic was broken in a recent refactor of the snapshot code
causing that the snapshot stayed inserted in the snapshot list.

Recent refactor of the snapshot code didn't faithfully relocate this
logic to the new function.

Rather than attempting to restore the quirky logic of adding and then
removing the object, don't add the snapshot into the list at all when
the user doesn't want metadata.

We achieve this by creating a temporary 'virDomainMomentObj' wrapper
which is not inserted into the list and using that instead of calling
virDomainSnapshotAssignDef.

Fixes: 9bad0fb809b
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2039131
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoconf: moment: Export helpers to create the virDomainMoment wrapper
Peter Krempa [Tue, 11 Jan 2022 09:27:11 +0000 (10:27 +0100)]
conf: moment: Export helpers to create the virDomainMoment wrapper

Export 'virDomainMomentObjNew' and 'virDomainMomentObjFree' and define
the latter as autoptr cleanup function for 'virDomainMomentObj'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirdomainmomentobjlist.h: Convert to modern header style
Peter Krempa [Tue, 11 Jan 2022 09:09:12 +0000 (10:09 +0100)]
virdomainmomentobjlist.h: Convert to modern header style

Format the function prototypes the same way as in the .c file.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoTranslated using Weblate (Ukrainian)
Yuri Chornoivan [Wed, 12 Jan 2022 10:44:50 +0000 (11:44 +0100)]
Translated using Weblate (Ukrainian)

Currently translated at 100.0% (10455 of 10455 strings)

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

Co-authored-by: Yuri Chornoivan <yurchor@ukr.net>
Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
3 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Wed, 12 Jan 2022 10:44:49 +0000 (11:44 +0100)]
Translated using Weblate (Swedish)

Currently translated at 30.2% (3160 of 10455 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 (Korean)
simmon [Wed, 12 Jan 2022 10:44:48 +0000 (11:44 +0100)]
Translated using Weblate (Korean)

Currently translated at 99.5% (10410 of 10455 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 agoUpdate translation files
Weblate [Wed, 12 Jan 2022 10:44:46 +0000 (11:44 +0100)]
Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

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

Co-authored-by: Weblate <noreply@weblate.org>
Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
3 years agoreport error when virProcessGetStatInfo() is unable to parse data
Ani Sinha [Tue, 11 Jan 2022 10:20:43 +0000 (15:50 +0530)]
report error when virProcessGetStatInfo() is unable to parse data

Currently virProcessGetStatInfo() always returns success and only logs error
when it is unable to parse the data. Make this function actually report the
error and return a negative value in this error scenario.

Fix the callers so that they do not override the error generated.
Also fix non-linux implementation of this function so as to report error.

Signed-off-by: Ani Sinha <ani@anisinha.ca>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoFix some typos
Tim Wiederhake [Mon, 10 Jan 2022 14:48:54 +0000 (15:48 +0100)]
Fix some typos

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
3 years agopo: Refresh potfile for v8.0.0
Jiri Denemark [Mon, 10 Jan 2022 09:47:00 +0000 (10:47 +0100)]
po: Refresh potfile for v8.0.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Mon, 10 Jan 2022 08:39:56 +0000 (09:39 +0100)]
Translated using Weblate (Swedish)

Currently translated at 30.1% (3147 of 10439 strings)

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

Translated using Weblate (Swedish)

Currently translated at 29.9% (3129 of 10439 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 agomeson: Fix yajl workaround
Andrea Bolognani [Sat, 8 Jan 2022 10:36:47 +0000 (11:36 +0100)]
meson: Fix yajl workaround

Meson reports

  WARNING: pkgconfig variable 'cflags' not defined for dependency yajl.

which makes sense, because "cflags" is not one of the variables
reported by

  $ pkg-config --print-variables yajl

and

  $ pkg-config --variable=cflags yajl

doesn't work either.

The breakage was introduced when we switched from calling
pkg-config directly to using get_pkgconfig_variable() in 7.5.0
and, somehow, it went undetected until now.

Use "includedir", which is a proper pkg-config variable,
instead.

Fixes: c32c5ca29aeb63d329e2c1e60e249246c010f2f3
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
3 years agoNEWS: Mention device hot-unplug regression with qemu-6.2 and workarounds for it
Peter Krempa [Mon, 3 Jan 2022 15:17:30 +0000 (16:17 +0100)]
NEWS: Mention device hot-unplug regression with qemu-6.2 and workarounds for it

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Revert to using non-JSON commandline for -device
Peter Krempa [Mon, 3 Jan 2022 14:50:49 +0000 (15:50 +0100)]
qemu: Revert to using non-JSON commandline for -device

When -device is configured via JSON a bug [1] is triggered in qemu were
the DEVICE_DELETED event for the removal of the device frontend is no
longer delivered to libvirt. Without the DEVICE_DELETED event we don't
remove the corresponding entries in the VM XML.

Until qemu will be fixed we must stop using the JSON syntax for -device.

This patch removes the detection of the capability. The capability is
used only during startup of a fresh VM so we don't need to consider any
compaitibility steps for existing VMs.

For users who wish to use 'libvirt-7.9' and 'libvirt-7.10' with
'qemu-6.2' there are two possible workarounds:

 - filter out the 'device.json' qemu capability '/etc/libvirt/qemu.conf':

   capability_filters = [ "device.json" ]

 - filter out the 'device.json' qemu capability via qemu namespace XML:

   <domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
     [...]
     <qemu:capabilities>
       <qemu:del capability='device.json'/>
     </qemu:capabilities>
   </domain>

We must never again use the same capability name as we are now
instructing users to filter it as a workaround so once qemu is fixed
we'll need to pick a new capability value for it.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=2036669

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2035237
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirt-ssh-helper: Add manual page
Andrea Bolognani [Fri, 10 Dec 2021 14:56:29 +0000 (15:56 +0100)]
virt-ssh-helper: Add manual page

We don't usually provide manual pages for internal tools,
but in the case of virt-ssh-helper the command is installed
inside the default $PATH and so it's likely that the user
will stumble upon it by using the shell's completion feature
when invoking another virt-* command, which makes it a good
idea to provide at least a minimal manual page.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodo not report generic OPERATION_FAILED error when calling virConnectOpenAuth()
Ani Sinha [Thu, 6 Jan 2022 17:07:06 +0000 (22:37 +0530)]
do not report generic OPERATION_FAILED error when calling virConnectOpenAuth()

virConnectOpenAuth() calls virConnectOpenInternal(). This later function
generates fine grained errors arising from various failure conditions that are
more accurate than a "catch all" broader VIR_ERR_OPERATION_FAILED error that
the callers of this function generates. Remove the broader error so that more
specific errors can be caught and processed.

Signed-off-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Thu, 30 Dec 2021 13:16:29 +0000 (14:16 +0100)]
Translated using Weblate (Swedish)

Currently translated at 29.8% (3111 of 10439 strings)

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

Translated using Weblate (Swedish)

Currently translated at 29.2% (3051 of 10439 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 agosrc: Don't check for retval of some glib functions
Michal Privoznik [Fri, 7 Jan 2022 07:52:57 +0000 (08:52 +0100)]
src: Don't check for retval of some glib functions

There are a few glib functions that abort on OOM and thus there's
no point in checking their retval against NULL. Nevertheless, we
do have those checks in a few places. Remove them.

Generated using the following spatch:

  @@
  expression x;
  identifier n;
  expression r;
  @@
  (
    x = g_strdup_printf(...);
  | x = g_strdup_vprintf(...);
  | x = g_strdup(...);
  | x = g_strndup(...);
  | x = g_new0(...);
  | x = g_realloc(...);
  )
    ... when != x
  - if(!x)
  (
  -   return r;
  |
  -   goto n;
  )

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirprocess: Provide non-Linux stubs for virProcessGet{Stat,Sched}Info
Michal Privoznik [Thu, 6 Jan 2022 19:13:08 +0000 (20:13 +0100)]
virprocess: Provide non-Linux stubs for virProcessGet{Stat,Sched}Info

Both virProcessGetStatInfo() and virProcessGetSchedInfo() are
Linux centric. Provide stubs for non-Linux platforms.

Fixes: d73852c49962fbfe652fc7bec595a3f242faf847
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoutil: Improve log output parsing errors
Martin Kletzander [Wed, 5 Jan 2022 13:05:58 +0000 (14:05 +0100)]
util: Improve log output parsing errors

Suggested-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemuTestCapsCacheInsert: Rewrite caps cache insertion
Peter Krempa [Wed, 5 Jan 2022 19:53:18 +0000 (20:53 +0100)]
qemuTestCapsCacheInsert: Rewrite caps cache insertion

Until now we did 2 weird things when inserting the qemuCaps used for
individual test cases into the capability cache:

1) we inserted the same caps for all emulators
2) we always (expensively) copied them

Now when real capabilities are used we don't touch them at all just
simply inser them. This allows us one big optimization, by trading a
copy for just a virObjectRef as we can borrow the caps object to the
cache.

For fake caps we still copy them as we insert the fake machine types
into them, but second big optimization is to insert the capabilities
only for the architecture they belong to.

Additionally this commit also ensures that all other entries in the
cache for the binary are poisoned by empty caps so that it's obvious
that the test is doing the right thing.

Apart from this making actually more sense this shaves off more than 40%
of runtime from qemuxml2argvtest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuTestCapsCacheInsert: Extract code for populating fake machine types
Peter Krempa [Tue, 4 Jan 2022 16:11:30 +0000 (17:11 +0100)]
qemuTestCapsCacheInsert: Extract code for populating fake machine types

Separate the code to aid further refactors.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2argvtest: Convert 'missing-machine' to DO_TEST_CAPS_LATEST
Peter Krempa [Wed, 5 Jan 2022 21:46:50 +0000 (22:46 +0100)]
qemuxml2argvtest: Convert 'missing-machine' to DO_TEST_CAPS_LATEST

Emulator binary change is needed to use the latest caps properly. The
comment is no longer needed, the expected error is recorded in the 'err'
file.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2argvtest: Enable qemuxml2argv version of 'blkdeviotune' test
Peter Krempa [Wed, 5 Jan 2022 21:38:24 +0000 (22:38 +0100)]
qemuxml2argvtest: Enable qemuxml2argv version of 'blkdeviotune' test

Also ensure that the emulator and architecture are correct for
DO_TEST_CAPS_LATEST.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2(xml|argv)test: Test real state of things with 'x86-kvm-32-on-64'
Peter Krempa [Wed, 5 Jan 2022 21:19:40 +0000 (22:19 +0100)]
qemuxml2(xml|argv)test: Test real state of things with 'x86-kvm-32-on-64'

As demonstrated by the qemuxml2xmltest DO_TEST_CAPS_LATEST data based on
the 'x86-kvm-32-on-64' test case the post parse CPU selection code which
fills in the CPU into the definition does not have exactly the same
logic as we used to have when the cpu model was picked when formatting
the commandline.

Change the qemuxml2argv test to use DO_TEST_CAPS_LATEST too as it
doesn't really make sense to test this on fake data.

In addition to 'latest' versions, this also adds second invocation
locked to qemu-4.1.0 which demonstrates the old behaviour.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2argvtest: Don't insert capabilities into cache twice
Peter Krempa [Tue, 4 Jan 2022 17:21:36 +0000 (18:21 +0100)]
qemuxml2argvtest: Don't insert capabilities into cache twice

Fake capabilities are inserted twice, as in a few tests the architecture
is not present in the XML (testing filling in of the architecture).
Since we already know which architecture will be picked we don't need to
be adding the capabilities twice.

This doesn't impact the tests as they use the same approach to determine
the default arch.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2argvdata: Use proper arch and emulator for aarch64 real capability tests
Peter Krempa [Tue, 4 Jan 2022 15:36:46 +0000 (16:36 +0100)]
qemuxml2argvdata: Use proper arch and emulator for aarch64 real capability tests

Upcoming patches will modify how we populate the capability cache in
tests to be more sane. This also means that the emulator binary and
architecture used in the test files using real capabilities must match
what the real capabilities have.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2argvdata: Use proper arch and emulator for x86 real capability tests
Peter Krempa [Tue, 4 Jan 2022 15:36:46 +0000 (16:36 +0100)]
qemuxml2argvdata: Use proper arch and emulator for x86 real capability tests

Upcoming patches will modify how we populate the capability cache in
tests to be more saner. This also means that the emulator binary and
architecture used in the test files using real capabilities must match
what the real capabilities have.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotestutilsqemu: Remove unused fake-caps x86 machine types
Peter Krempa [Wed, 5 Jan 2022 08:21:14 +0000 (09:21 +0100)]
testutilsqemu: Remove unused fake-caps x86 machine types

None of our tests reference 'isapc', and 'pc-i440fx-2.6'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agosecurityselinuxlabeldata: Purge unneeded versioned machine type
Peter Krempa [Thu, 6 Jan 2022 09:03:42 +0000 (10:03 +0100)]
securityselinuxlabeldata: Purge unneeded versioned machine type

Use 'pc' instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuhotplugtestdomains: Remove unnecessary use of versioned pc machine types
Peter Krempa [Wed, 5 Jan 2022 18:34:32 +0000 (19:34 +0100)]
qemuhotplugtestdomains: Remove unnecessary use of versioned pc machine types

The specific machine type is not important for the test. We can use 'pc'
instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotests: qemuxml2argvdata: Purge versioned i440fx machine types from fake-caps tests
Peter Krempa [Wed, 5 Jan 2022 10:52:04 +0000 (11:52 +0100)]
tests: qemuxml2argvdata: Purge versioned i440fx machine types from fake-caps tests

Use the 'pc' alias for them as it's equivalent.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2(argv|xml)test: Unify usage of DO_TEST_CAPS_LATEST
Peter Krempa [Wed, 5 Jan 2022 09:23:42 +0000 (10:23 +0100)]
qemuxml2(argv|xml)test: Unify usage of DO_TEST_CAPS_LATEST

The qemuxml2argv invocation of some tests used DO_TEST_CAPS_LATEST while
the qemuxml2xmltest invocation uses fake caps. Unify them on
DO_TEST_CAPS_LATEST.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2(argv|xml)test: Enable 'controller-usb-order' for qemuxml2argv and convert...
Peter Krempa [Wed, 5 Jan 2022 12:01:10 +0000 (13:01 +0100)]
qemuxml2(argv|xml)test: Enable 'controller-usb-order' for qemuxml2argv and convert it to latest caps

Since introduction in fc03eb53c0bf3f654 there wasn't a qemuxml2argv
version. As we are touching the files convert them to
DO_TEST_CAPS_LATEST directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2xmltest: Replace 'interface-server' by 'net-server' test case
Peter Krempa [Wed, 5 Jan 2022 11:35:40 +0000 (12:35 +0100)]
qemuxml2xmltest: Replace 'interface-server' by 'net-server' test case

According to commit 52222568490 the test case was added to verify that
the '<address>' element is covered by the schema. The test was not
registered for qemuxml2argvtest though. We can use 'net-server' instead
as it has the same type. On the other hand that one was not registered
for qemuxml2xmltest.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotests: qemuxml2argvdata: Remove specific q35 machine types from fake-caps tests
Peter Krempa [Wed, 5 Jan 2022 09:19:36 +0000 (10:19 +0100)]
tests: qemuxml2argvdata: Remove specific q35 machine types from fake-caps tests

Use q35 instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotests: qemuxml2argvdata: Remove use of 'pc-1.0' and 'pc-1.2' machine types
Peter Krempa [Wed, 5 Jan 2022 08:28:31 +0000 (09:28 +0100)]
tests: qemuxml2argvdata: Remove use of 'pc-1.0' and 'pc-1.2' machine types

There's nothing special about the tests requiring to use very old
machine types. Most usage is cargo-culted from other tests. Switch all
the tests to use 'pc' instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotestutilsqemu: Remove unused non-x86 fake machine types
Peter Krempa [Tue, 4 Jan 2022 15:10:31 +0000 (16:10 +0100)]
testutilsqemu: Remove unused non-x86 fake machine types

For tests with fake capabilities we fill in a bunch of machine types
which the tests might use. For now there's a random collection of
machine types which are not actually used. Purge the unused ones for
non-x86 machines.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuxml2argvtest: Remove redundant floppy controller tests
Peter Krempa [Wed, 5 Jan 2022 09:07:41 +0000 (10:07 +0100)]
qemuxml2argvtest: Remove redundant floppy controller tests

The two test cases were added to avoid regressions such as fixed in
17dff3584855e9. Nowadays the code is much simpler and any Q35 machine
will trigger the explicit FDC.

Remove the '2.11' machine type version and turn the '2.9' version into a
generic q35 machine.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuDomainNeedsFDC: Simplify and improve checking if a machine needs FDC
Peter Krempa [Wed, 5 Jan 2022 08:51:22 +0000 (09:51 +0100)]
qemuDomainNeedsFDC: Simplify and improve checking if a machine needs FDC

Commit c7f3a1f7870 turned qemuDomainMachineNeedsFDC() effectively into
qemuDomainIsQ35. Use it instead as it also matches the non-canonicalized
'q35'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuProcessPrepareQEMUCaps: Don't clear QEMU_CAPS_CHARDEV_FD_PASS_COMMANDLINE
Peter Krempa [Tue, 4 Jan 2022 14:13:45 +0000 (15:13 +0100)]
qemuProcessPrepareQEMUCaps: Don't clear QEMU_CAPS_CHARDEV_FD_PASS_COMMANDLINE

All the fd-passing setup of chardevs which this hack meant to disable
was moved to the host-preparation phase which is skipped for formatting
of non-real commandlines.

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