]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
4 years agoqemu: capabilities: Retire QEMU_CAPS_MACHINE_IOMMU
Peter Krempa [Mon, 19 Apr 2021 10:12:43 +0000 (12:12 +0200)] 
qemu: capabilities: Retire QEMU_CAPS_MACHINE_IOMMU

The feature is no longer asserted. Remove the checks related to it and
make the code work properly with QEMU_CAPS_DEVICE_INTEL_IOMMU.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu: capabilities: Probe QMP schema before probing commands
Peter Krempa [Thu, 8 Apr 2021 15:23:48 +0000 (17:23 +0200)] 
qemu: capabilities: Probe QMP schema before probing commands

All supported QEMU versions now support query-qmp-schema. In the future
it will be possible to use the output of query-qmp-schema to also detect
commands reliably.

Since we are at the point where we have the least amount of .replies
files needing changing for a long time, move the 'query-qmp-schema' bits
before 'query-commands' to prepare for the future.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu: monitor: Remove qemuMonitorSupportsActiveCommit
Peter Krempa [Wed, 7 Apr 2021 15:14:22 +0000 (17:14 +0200)] 
qemu: monitor: Remove qemuMonitorSupportsActiveCommit

Modern code uses QMP schema to query for active commit support.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu: monitor: Remove qemuMonitorGetEvents
Peter Krempa [Wed, 7 Apr 2021 15:14:22 +0000 (17:14 +0200)] 
qemu: monitor: Remove qemuMonitorGetEvents

Modern code uses QMP schema to query for supported event types.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu: capabilities: Always assume QEMU_CAPS_QUERY_QMP_SCHEMA
Peter Krempa [Wed, 7 Apr 2021 14:10:14 +0000 (16:10 +0200)] 
qemu: capabilities: Always assume QEMU_CAPS_QUERY_QMP_SCHEMA

All supported qemu versions have 'query-qmp-schema' so we can remove the
check whether it exists and all logic conntected to it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu: capabilities: Retire QEMU_CAPS_DEVICE_VIDEO_PRIMARY
Peter Krempa [Fri, 9 Apr 2021 14:18:37 +0000 (16:18 +0200)] 
qemu: capabilities: Retire QEMU_CAPS_DEVICE_VIDEO_PRIMARY

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuDomainValidateDevicePCISlotsChipsets: Remove unused @qemuCaps
Peter Krempa [Fri, 9 Apr 2021 14:17:27 +0000 (16:17 +0200)] 
qemuDomainValidateDevicePCISlotsChipsets: Remove unused @qemuCaps

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu_domain_address: Drop compatibility with pre-device vga specification for q35
Peter Krempa [Tue, 30 Mar 2021 17:02:01 +0000 (19:02 +0200)] 
qemu_domain_address: Drop compatibility with pre-device vga specification for q35

Remove the slot reservation for the vga card which doesn't make sense
with supported qemus any more for the q35 machine type.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu_domain_address: Drop compatibility with pre-device vga specification for i440fx
Peter Krempa [Tue, 30 Mar 2021 17:02:01 +0000 (19:02 +0200)] 
qemu_domain_address: Drop compatibility with pre-device vga specification for i440fx

Remove the slot reservation for the vga card which doesn't make sense
with supported qemus any more for the i440fx machine type.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu: command: Remove legacy '-vga' commandline formatter
Peter Krempa [Tue, 30 Mar 2021 16:58:15 +0000 (18:58 +0200)] 
qemu: command: Remove legacy '-vga' commandline formatter

All supported qemus now support using '-device' for adding a graphics
device.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuhotplugtest: Add also always-present capabilities
Peter Krempa [Fri, 9 Apr 2021 13:59:42 +0000 (15:59 +0200)] 
qemuhotplugtest: Add also always-present capabilities

Use virQEMUCapsInitQMPBasicArch in qemuHotplugCreateObjects so that we
also add the always-present capabilities to the set of capabilities used
for the hotplug test and fix fallout.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu: capabilities: Move rest of always present caps to virQEMUCapsInitQMPArch
Peter Krempa [Tue, 30 Mar 2021 15:40:49 +0000 (17:40 +0200)] 
qemu: capabilities: Move rest of always present caps to virQEMUCapsInitQMPArch

These conveniently don't have any test fallout.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuxml2(argv|xml)test: Retire QEMU_CAPS_DEVICE_VIDEO_PRIMARY from tests
Peter Krempa [Mon, 29 Mar 2021 11:47:15 +0000 (13:47 +0200)] 
qemuxml2(argv|xml)test: Retire QEMU_CAPS_DEVICE_VIDEO_PRIMARY from tests

All tests now get that capability via virQEMUCapsInitQMPBasicArch.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu: capabilities: Move setting QEMU_CAPS_DEVICE_VIDEO_PRIMARY to virQEMUCapsInitQMP...
Peter Krempa [Tue, 30 Mar 2021 15:48:46 +0000 (17:48 +0200)] 
qemu: capabilities: Move setting QEMU_CAPS_DEVICE_VIDEO_PRIMARY to virQEMUCapsInitQMPBasicArch

Until we clean up and remove all capabilities which no longer make sense
to have separately, we should use virQEMUCapsInitQMPBasicArch to set the
defaults as it's used by qemuxml2argvtest when testing with fake
capabilities.

This allows us to prevent testing dead code paths with the fake
capability tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuxml2argvtest: Remove tests for absence of QEMU_CAPS_DEVICE_VIDEO_PRIMARY
Peter Krempa [Mon, 29 Mar 2021 11:36:02 +0000 (13:36 +0200)] 
qemuxml2argvtest: Remove tests for absence of QEMU_CAPS_DEVICE_VIDEO_PRIMARY

All supported qemu versions now have the capability so testing the
absence doesn't make sense.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuxml2argvtest: Remove negative test case for 'net-vhostuser-multiq'
Peter Krempa [Tue, 30 Mar 2021 15:38:18 +0000 (17:38 +0200)] 
qemuxml2argvtest: Remove negative test case for 'net-vhostuser-multiq'

QEMU_CAPS_VHOSTUSER_MULTIQUEUE is now always enabled, so the negative
case doesn't make sense.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu: capabilities: Move setting of QEMU_CAPS_MACH_VIRT_GIC_VERSION to virQEMUCapsIni...
Peter Krempa [Tue, 30 Mar 2021 15:24:26 +0000 (17:24 +0200)] 
qemu: capabilities: Move setting of QEMU_CAPS_MACH_VIRT_GIC_VERSION to virQEMUCapsInitQMPBasicArch

Move it under AARCH 64, since it's a platform specific feature, thus it
will be removed from all other platforms.

Since virQEMUCapsInitQMPBasicArch is used in qemuxml2argv test to
initiate qemuCaps for tests with fake capabilities, all the tests gain
GIC support now.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuxml2argvtest: Remove negative test for gic v3/host
Peter Krempa [Tue, 30 Mar 2021 15:29:21 +0000 (17:29 +0200)] 
qemuxml2argvtest: Remove negative test for gic v3/host

QEMU_CAPS_MACH_VIRT_GIC_VERSION will be assumed for all aarch64 machines
starting from next commit, so this test will become invalid. Remove it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu: capabilities: Move setting of PPC specific flags to virQEMUCapsInitQMPBasicArch
Peter Krempa [Tue, 30 Mar 2021 15:15:06 +0000 (17:15 +0200)] 
qemu: capabilities: Move setting of PPC specific flags to virQEMUCapsInitQMPBasicArch

QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT and
QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT are now always asserted on PPC
machine types, move them to virQEMUCapsInitQMPBasicArch.

It's now always set for AARCH64, move it into the function setting basic
caps for the emulator.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuxml2argvtest: Remove negative test case 'pseries-features-htp-resize'
Peter Krempa [Wed, 7 Apr 2021 13:31:47 +0000 (15:31 +0200)] 
qemuxml2argvtest: Remove negative test case 'pseries-features-htp-resize'

All supported qemu versions now have the flag so the test doesn't make
sense any more.

The flag setting will be moved to virQEMUCapsInitQMPBasicArch which will
make this test fail.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu: capabilities: Move setting of QEMU_CAPS_CPU_AARCH64_OFF to virQEMUCapsInitQMPBa...
Peter Krempa [Tue, 30 Mar 2021 15:15:06 +0000 (17:15 +0200)] 
qemu: capabilities: Move setting of QEMU_CAPS_CPU_AARCH64_OFF to virQEMUCapsInitQMPBasicArch

It's now always set for AARCH64, move it into the function setting basic
caps for the emulator.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agovirQEMUCapsInitQMPVersionCaps: Remove unneeded version checks
Peter Krempa [Tue, 30 Mar 2021 14:26:52 +0000 (16:26 +0200)] 
virQEMUCapsInitQMPVersionCaps: Remove unneeded version checks

Now that minimum supported qemu version is 2.11, we can remove the
conditions.

Note that the check enabling QEMU_CAPS_TCG was for < 2.10.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agovirQEMUCapsInitProcessCaps: Remove obsolete version checks
Peter Krempa [Tue, 30 Mar 2021 13:13:35 +0000 (15:13 +0200)] 
virQEMUCapsInitProcessCaps: Remove obsolete version checks

We no longer have to mask out IOMMU and NVDIMM support as we no longer
support the broken qemu versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuBuildDeviceAddressStr: Remove unused 'qemuCaps'
Peter Krempa [Tue, 30 Mar 2021 14:42:54 +0000 (16:42 +0200)] 
qemuBuildDeviceAddressStr: Remove unused 'qemuCaps'

The qemuCaps is left for the device commandline formatters for now as it
might come in handy.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuAssignDeviceControllerAlias: Remove unused 'qemuCaps' argument
Peter Krempa [Tue, 30 Mar 2021 14:35:45 +0000 (16:35 +0200)] 
qemuAssignDeviceControllerAlias: Remove unused 'qemuCaps' argument

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agovirQEMUCapsHasPCIMultiBus: Remove logic for PPC multibus support check
Peter Krempa [Tue, 30 Mar 2021 13:09:27 +0000 (15:09 +0200)] 
virQEMUCapsHasPCIMultiBus: Remove logic for PPC multibus support check

All machine types which have PCI support multibus since qemu 2.0
according to the logic we had, thus we can remove all the machine type
and version checks which are now dead code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemucapabilitiesdata: Drop capability test data for qemu < 2.11
Peter Krempa [Fri, 26 Mar 2021 16:24:24 +0000 (17:24 +0100)] 
qemucapabilitiesdata: Drop capability test data for qemu < 2.11

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuxml2xmltest: Remove versioned tests for qemu < 2.11
Peter Krempa [Tue, 30 Mar 2021 13:51:53 +0000 (15:51 +0200)] 
qemuxml2xmltest: Remove versioned tests for qemu < 2.11

Drop all the cases pinned to unsupported versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemuxml2argvtest: Remove versioned tests for qemu < 2.11
Peter Krempa [Tue, 30 Mar 2021 13:51:53 +0000 (15:51 +0200)] 
qemuxml2argvtest: Remove versioned tests for qemu < 2.11

Drop all the cases pinned to unsupported versions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoNEWS: Mention that minimum supported qemu version was bumped to 2.11
Peter Krempa [Fri, 9 Apr 2021 13:24:18 +0000 (15:24 +0200)] 
NEWS: Mention that minimum supported qemu version was bumped to 2.11

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu: Formally deprecate support for qemu < 2.11
Peter Krempa [Tue, 30 Mar 2021 13:24:41 +0000 (15:24 +0200)] 
qemu: Formally deprecate support for qemu < 2.11

As of May 7 2021, rhel-8 will be out for two years, which means we no
longer have to support rhel-7 ancient qemu.

QEMU versions in our supported distros:

 RHEL-8: 2.12
 Debian Stable: 3.1
 OpenSuse LEAP 15.0 (SLES15 GA): 2.11
 OpenSuse LEAP 15.2: 4.2
 Ubuntu (Bionic): 2.11
 Ubuntu (Focal): 4.2

This means we can bring up the minimum supported version to 2.11.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agomeson: Declare GLIB_VERSION_* macros at configure
Michal Privoznik [Fri, 30 Apr 2021 05:10:41 +0000 (07:10 +0200)] 
meson: Declare GLIB_VERSION_* macros at configure

So far we have three places where glib version is recorded:
meson.build and then in config.h. The latter is so well hidden
that it's easy to miss when bumping minimal glib version in the
former. With a bit of python^Wmeson string magic
GLIB_VERSION_MIN_REQUIRED and GLIB_VERSION_MAX_ALLOWED macros can
be defined to match glib_version from meson.build.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoqemu_domainjob: Drop 'const' from strings in _qemuDomainJobObj
Michal Privoznik [Fri, 30 Apr 2021 05:07:57 +0000 (07:07 +0200)] 
qemu_domainjob: Drop 'const' from strings in _qemuDomainJobObj

These strings are not constant really. They are allocated in
qemuDomainObjBeginJobInternal() and freed in
qemuDomainReset*Job(). Freeing a pointer to const looks weird.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agovirDomainAudioSDLParse: Use virXMLProp*
Tim Wiederhake [Tue, 27 Apr 2021 11:12:57 +0000 (13:12 +0200)] 
virDomainAudioSDLParse: Use virXMLProp*

This strictens the parser to disallow negative values (interpreted as
`UINT_MAX + value + 1`) for attribute `bufferCount`.

`bufferCount` does not benefit from being referable as e.g. "-7" for
requesting 4294967289 buffers, as this value is distinctly out of range
for normal use.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainFeaturesDefParse: Use virXMLPropEnum
Tim Wiederhake [Tue, 27 Apr 2021 11:12:56 +0000 (13:12 +0200)] 
virDomainFeaturesDefParse: Use virXMLPropEnum

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainFeaturesDefParse: Use virXMLPropTristateSwitch
Tim Wiederhake [Tue, 27 Apr 2021 11:12:55 +0000 (13:12 +0200)] 
virDomainFeaturesDefParse: Use virXMLPropTristateSwitch

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainFeaturesDefParse: Use virXMLPropUInt
Tim Wiederhake [Tue, 27 Apr 2021 11:12:54 +0000 (13:12 +0200)] 
virDomainFeaturesDefParse: Use virXMLPropUInt

This strictens the parser to disallow negative values (interpreted as
`UINT_MAX + value + 1`) for attribute `retries`. UINT_MAX holds no
special significance for this attribute and is distinctly out of range
for normal use.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainSoundDefParseXML: Use virXMLProp*
Tim Wiederhake [Tue, 27 Apr 2021 11:12:53 +0000 (13:12 +0200)] 
virDomainSoundDefParseXML: Use virXMLProp*

This strictens the parser to disallow negative values (interpreted as
`UINT_MAX + value + 1`) for attribute `id`.

`id` must be greater than 0 and does not benefit from being referable as
e.g. "-7" for host audio backend 4294967289, as this value is distinctly
out of range for normal use.

Additionally, this patch fixes a use of NULL string with printf's %s
modifier if the `model` attribute is absent.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirnetdevbridge: Ignore EEXIST when adding an entry to fdb
Jiri Denemark [Fri, 30 Apr 2021 15:25:29 +0000 (17:25 +0200)] 
virnetdevbridge: Ignore EEXIST when adding an entry to fdb

When updating entries in a bridge forwarding database (i.e., when
macTableManager='libvirt' is configured for the bridge), we may end up
in a situation when the entry we want to add is already present. Let's
just ignore the error in such a case.

This fixes an error to resume a domain when fdb entries were not
properly removed when the domain was paused:

    virsh # resume test
    error: Failed to resume domain test
    error: error adding fdb entry for vnet2: File exists

For some reason, fdb entries are only removed when libvirt explicitly
stops CPUs, but nothing happens when we just get STOP event from QEMU.
An alternative approach would be to make sure we always remove the
entries regardless on why a domain was paused (e.g., during migration),
but that would be a significantly more disruptive change with possible
side effects.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agovirDomainActualNetDefParseXML: Use virXMLProp*
Tim Wiederhake [Fri, 23 Apr 2021 14:39:18 +0000 (16:39 +0200)] 
virDomainActualNetDefParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainControllerDefParseXML: Cosmetic changes
Tim Wiederhake [Fri, 23 Apr 2021 14:39:16 +0000 (16:39 +0200)] 
virDomainControllerDefParseXML: Cosmetic changes

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainControllerDefParseXML: Use virXMLProp*
Tim Wiederhake [Fri, 23 Apr 2021 14:39:15 +0000 (16:39 +0200)] 
virDomainControllerDefParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoPost-release version bump to 7.4.0
Jiri Denemark [Mon, 3 May 2021 09:08:50 +0000 (11:08 +0200)] 
Post-release version bump to 7.4.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoRelease of libvirt-7.3.0 v7.3.0
Jiri Denemark [Mon, 3 May 2021 09:02:29 +0000 (11:02 +0200)] 
Release of libvirt-7.3.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agomeson: Fix compatibility with Meson 0.58
Andrea Bolognani [Mon, 3 May 2021 07:06:34 +0000 (09:06 +0200)] 
meson: Fix compatibility with Meson 0.58

Builds failed with

  tests/meson.build:690:0: ERROR: List item must be one
  of <class 'str'>, not <class 'list'>

before this change.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
4 years agoconf: Fix heap corruption when hot-adding a lease
Peter Krempa [Sun, 2 May 2021 09:45:22 +0000 (11:45 +0200)] 
conf: Fix heap corruption when hot-adding a lease

Commit 28a86993162f7d2f ( v6.9.0-179-g28a8699316 ) incorrectly replaced
VIR_EXPAND_N by g_renew.

VIR_EXPAND_N has these two extra effects apart from reallocating memory:

1) The newly allocated memory is zeroed out
2) The number of elements in the array which is passed to VIR_EXPAND_N
   is increased.

This comes into play when used with virDomainLeaseInsertPreAlloced,
which expects that the array element count already includes the space
for the added 'lease', by plainly just assigning to
'leases[nleases - 1]'

Since g_renew does not increase the number of elements in the array
any existing code which calls virDomainLeaseInsertPreAlloced thus either
overwrites a lease definition or corrupts the heap if there are no
leases to start with.

To preserve existing functionality we revert the code back to using
VIR_EXPAND_N which at this point doesn't return any value, so other
commits don't need to be reverted.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1953577
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
4 years agoNEWS: Mention stuff I've dealt with for this release v7.3.0-rc2
Michal Privoznik [Wed, 28 Apr 2021 10:37:17 +0000 (12:37 +0200)] 
NEWS: Mention stuff I've dealt with for this release

Crème de la crème of my work for this release.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoNEWS: Mention notable changes
Peter Krempa [Tue, 27 Apr 2021 13:34:15 +0000 (15:34 +0200)] 
NEWS: Mention notable changes

Add entries for deprecation_behavior, improving of errors from virsh's
snapshot helpers and other bugfixes.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
4 years agoNEWS: mention persistent mediated devices
Jonathon Jongsma [Tue, 27 Apr 2021 13:33:06 +0000 (08:33 -0500)] 
NEWS: mention persistent mediated devices

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agoNEWS: qemu: add socket for virtiofs filesystems
Ján Tomko [Thu, 22 Apr 2021 11:38:09 +0000 (13:38 +0200)] 
NEWS: qemu: add socket for virtiofs filesystems

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
4 years agodocs: virtiofs: add section about externally-launched virtiofsd
Ján Tomko [Thu, 22 Apr 2021 11:37:04 +0000 (13:37 +0200)] 
docs: virtiofs: add section about externally-launched virtiofsd

Provide an exmple in a place more visible than formatdomain.html.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
4 years agodocs: document new socket attribute for virtiofs
Ján Tomko [Thu, 22 Apr 2021 11:36:35 +0000 (13:36 +0200)] 
docs: document new socket attribute for virtiofs

Describe the attribute and add an example.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
4 years agoUpdate translation files
Weblate [Tue, 27 Apr 2021 09:34:02 +0000 (11:34 +0200)] 
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>
4 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Tue, 27 Apr 2021 09:33:59 +0000 (11:33 +0200)] 
Translated using Weblate (Swedish)

Currently translated at 24.5% (2595 of 10581 strings)

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

Translated using Weblate (Swedish)

Currently translated at 24.3% (2575 of 10581 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>
4 years agoTranslated using Weblate (Korean)
simmon [Tue, 27 Apr 2021 09:33:58 +0000 (11:33 +0200)] 
Translated using Weblate (Korean)

Currently translated at 41.4% (4389 of 10581 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>
4 years agopo: Refresh potfile for v7.3.0 v7.3.0-rc1
Jiri Denemark [Tue, 27 Apr 2021 09:28:54 +0000 (11:28 +0200)] 
po: Refresh potfile for v7.3.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
4 years agonodedev: remove unnecessary checks for NULL cmd
Jonathon Jongsma [Wed, 21 Apr 2021 15:47:43 +0000 (10:47 -0500)] 
nodedev: remove unnecessary checks for NULL cmd

virCommandRun() already handles the case where the cmd argument is NULL,
so there's no need for the caller to check. Make all callers consistent
and remove unnecessary NULL checks.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agonodedev: handle failure to generate mdevctl cmd
Jonathon Jongsma [Tue, 20 Apr 2021 14:09:00 +0000 (09:09 -0500)] 
nodedev: handle failure to generate mdevctl cmd

Coverity complained that the 'default' case of the switch in
nodeDeviceGetMdevctlCommand() was falling through without initializing
'cmd'. Return NULL in this case even though it should never happen.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agonodedev: fix potential leak of command
Jonathon Jongsma [Tue, 20 Apr 2021 13:57:10 +0000 (08:57 -0500)] 
nodedev: fix potential leak of command

When returning early due to errors, cmd will be leaked. Use an autoptr
to handle these early returns without leaking memory.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: monitor: Remove qemuMonitorJobCancel
Peter Krempa [Tue, 20 Apr 2021 14:07:33 +0000 (16:07 +0200)] 
qemu: monitor: Remove qemuMonitorJobCancel

The API is unused since last commit. Remove it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMigrationSrcNBDCopyCancelled: Use do-while loop instead of jumping back
Peter Krempa [Tue, 20 Apr 2021 16:36:23 +0000 (18:36 +0200)] 
qemuMigrationSrcNBDCopyCancelled: Use do-while loop instead of jumping back

Jumping back in the code is an anti-pattern that should be avoided if
possible.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMigrationSrcNBDCopyCancelOne: Force-cancel disk copy jobs when aborting migration
Peter Krempa [Tue, 20 Apr 2021 15:08:07 +0000 (17:08 +0200)] 
qemuMigrationSrcNBDCopyCancelOne: Force-cancel disk copy jobs when aborting migration

We don't require that the data is consistent on the destination if
aborting the migration.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMigrationSrcNBDCopyCancel*: Rename 'check' to 'abortMigration'
Peter Krempa [Tue, 20 Apr 2021 15:05:47 +0000 (17:05 +0200)] 
qemuMigrationSrcNBDCopyCancel*: Rename 'check' to 'abortMigration'

Rename the parameter so that it's more clear what state we are in and
fix all callees.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuBlockJobRefreshJobs: Replace qemuMonitorJobCancel by qemuMonitorBlockJobCancel
Peter Krempa [Tue, 20 Apr 2021 14:34:02 +0000 (16:34 +0200)] 
qemuBlockJobRefreshJobs: Replace qemuMonitorJobCancel by qemuMonitorBlockJobCancel

We want to unify on one block job cancellation API. Use
qemuMonitorBlockJobCancel which has more features.

In case of job refresh, we are killing off any unknown jobs so we don't
care about their fate.

Another difference is that an possible error from the block job
cancellation might be reported, but we don't really care here ince
it's a very unlikely scenario and we also report a warning.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuBackupJobCancelBlockjobs: Replace qemuMonitorJobCancel by qemuMonitorBlockJobCancel
Peter Krempa [Tue, 20 Apr 2021 14:34:02 +0000 (16:34 +0200)] 
qemuBackupJobCancelBlockjobs: Replace qemuMonitorJobCancel by qemuMonitorBlockJobCancel

We want to unify on one block job cancellation API. Use
qemuMonitorBlockJobCancel which has more features.

In case of backup jobs we can cancel the jobs forcefully since the code
is on a cleanup path when the job fails.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuDomainBlockJobAbort: Don't use 'job-cancel' instead of 'block-job-cancel'
Peter Krempa [Wed, 21 Apr 2021 13:47:59 +0000 (15:47 +0200)] 
qemuDomainBlockJobAbort: Don't use 'job-cancel' instead of 'block-job-cancel'

'block-job-cancel' has one very important semantic difference to
'job-cancel', docummented in qemu as:

  Note that if you issue 'block-job-cancel' after 'drive-mirror' has indicated
  (via the event BLOCK_JOB_READY) that the source and destination are
  synchronized, then the event triggered by this command changes to
  BLOCK_JOB_COMPLETED, to indicate that the mirroring has ended and the
  destination now has a point-in-time copy tied to the time of the cancellation.

Since libvirt advertises the block copy job as having the synchronous
abort feature we must not use 'job-cancel' here.

Fixes: 4817b5ca1d0
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: monitor: Add 'force' argument for 'block-job-cancel' QMP command
Peter Krempa [Tue, 20 Apr 2021 12:14:51 +0000 (14:14 +0200)] 
qemu: monitor: Add 'force' argument for 'block-job-cancel' QMP command

In certain cases such as when aborting migration we don't really care
for completion of the blockjob. Add 'force' as parameter of
'block-job-cancel'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMonitorJSONBlockJobCancel: Refactor cleanup
Peter Krempa [Tue, 20 Apr 2021 14:16:56 +0000 (16:16 +0200)] 
qemuMonitorJSONBlockJobCancel: Refactor cleanup

Use automatic memory freeing and remove the cleanup section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemumonitorjsontest: Add test for 'qemuMonitorJSONBlockJobCancel'
Peter Krempa [Tue, 20 Apr 2021 14:14:56 +0000 (16:14 +0200)] 
qemumonitorjsontest: Add test for 'qemuMonitorJSONBlockJobCancel'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMigrationSrcBeginPhase: Don't offer 'nbd' in cookie if there are no disks to...
Peter Krempa [Tue, 13 Apr 2021 15:31:53 +0000 (17:31 +0200)] 
qemuMigrationSrcBeginPhase: Don't offer 'nbd' in cookie if there are no disks to migrate

Don't try to setup disk migration and the NBD stuff if we end up
migrating nothing.

The destination side has luckily no setup for the non-NBD cases so
omitting the element fully is okay.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Tested-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMigrationSrcRun: Don't attempt any storage migration if no disks will be migrated
Peter Krempa [Tue, 13 Apr 2021 15:17:42 +0000 (17:17 +0200)] 
qemuMigrationSrcRun: Don't attempt any storage migration if no disks will be migrated

Don't even try to setup storage migration if there are no eligible
disks.

This also fixes migration from older libvirts which didn't format an
empty <nbd/> element in the migration cookie if there weren't any disks
to migrate.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Tested-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMigrationSrcRun: Sanitize setting of cookieFlags and migrate_flags on storage...
Peter Krempa [Tue, 13 Apr 2021 14:59:38 +0000 (16:59 +0200)] 
qemuMigrationSrcRun: Sanitize setting of cookieFlags and migrate_flags on storage migration

Base the decision on the main API flags (VIR_MIGRATE_NON_SHARED_DISK,
QEMU_MONITOR_MIGRATE_NON_SHARED_INC) via a boolean 'storageMigration'
rather than juggling everything trhough 'migration_flags'.

After this patch 'migration_flags' is updated to contain the legacy
storage migration flags only when we'll be about to use it rather than
setting it and then resetting it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Tested-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMigrationSrcNBDStorageCopy: Don't pass migrate_flags
Peter Krempa [Tue, 13 Apr 2021 14:53:57 +0000 (16:53 +0200)] 
qemuMigrationSrcNBDStorageCopy: Don't pass migrate_flags

'migrate_flags' can be updated in the only caller and since
qemuMigrationSrcNBDStorageCopy already takes @flags which contains
VIR_MIGRATE_NON_SHARED_INC (used to set
 QEMU_MONITOR_MIGRATE_NON_SHARED_INC) we can completely remove the
parameter.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMigrationSrcNBDStorageCopy: Return error code on error
Peter Krempa [Tue, 13 Apr 2021 14:17:24 +0000 (16:17 +0200)] 
qemuMigrationSrcNBDStorageCopy: Return error code on error

In case the 'nbdURI' schema is not known the code would report an error
but wouldn't return failure.

Fixes: 49186372dbe
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemuMigrationCookieNBDXMLFormat: Format empty <nbd/> element
Peter Krempa [Tue, 13 Apr 2021 14:16:44 +0000 (16:16 +0200)] 
qemuMigrationCookieNBDXMLFormat: Format empty <nbd/> element

Commit 518be41aaa3 refactored qemuMigrationCookieNBDXMLFormat to use
virXMLFormatElement which in comparison to the previous code doesn't
format the element if it's empty.

Unfortunately some crusty bits of our migration code use questionable
logic to assert use of the old-style storage migration parameters which
breaks if no disks are being migrated and the <nbd/> element is not
present.

While later patches will fix the code, re-instate formatting of empty
<nbd/> for increased compatibility.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: xml: Introduce virXMLFormatElementEmpty
Peter Krempa [Tue, 13 Apr 2021 14:12:17 +0000 (16:12 +0200)] 
util: xml: Introduce virXMLFormatElementEmpty

Add a helper which will format an XML element with attributes and
children, but compared to virXMLFormatElement it also formats an empty
element if both buffers are empty.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Tested-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovirDomainDef: Change type of xen_passthrough_mode to virDomainXenPassthroughMode
Tim Wiederhake [Fri, 23 Apr 2021 15:39:21 +0000 (17:39 +0200)] 
virDomainDef: Change type of xen_passthrough_mode to virDomainXenPassthroughMode

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainDef: Change type of hyperv_stimer_direct to virTristateSwitch
Tim Wiederhake [Fri, 23 Apr 2021 15:39:20 +0000 (17:39 +0200)] 
virDomainDef: Change type of hyperv_stimer_direct to virTristateSwitch

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainSoundDef: Change type of model to virDomainSoundModel
Tim Wiederhake [Fri, 23 Apr 2021 15:39:18 +0000 (17:39 +0200)] 
virDomainSoundDef: Change type of model to virDomainSoundModel

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainGraphicsDefParseXML: Use virXMLProp*
Tim Wiederhake [Fri, 23 Apr 2021 15:39:17 +0000 (17:39 +0200)] 
virDomainGraphicsDefParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainGraphicsDefParseXMLDesktop: Use virXMLProp*
Tim Wiederhake [Fri, 23 Apr 2021 15:39:15 +0000 (17:39 +0200)] 
virDomainGraphicsDefParseXMLDesktop: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agovirDomainGraphicsDefParseXMLSDL: Use virXMLProp*
Tim Wiederhake [Fri, 23 Apr 2021 15:39:14 +0000 (17:39 +0200)] 
virDomainGraphicsDefParseXMLSDL: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
4 years agomeson: don't probe for -Werror if --werror is enabled
Daniel P. Berrangé [Thu, 8 Apr 2021 10:50:30 +0000 (11:50 +0100)] 
meson: don't probe for -Werror if --werror is enabled

Meson has its own mechanism to turn on -Werror with the --werror option.
If this is set, then there is no reason for libvirt to check for -Werror
itself.

We remove the summary line output because it is potentially misleading
when libvirt hasn't enabled -Werror, but meson has.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agomeson: honour meson warning_level option
Daniel P. Berrangé [Wed, 7 Apr 2021 17:20:49 +0000 (18:20 +0100)] 
meson: honour meson warning_level option

Meson defines a warning_level option which has the following behaviour
with C code

 0:  no warning flags
 1: -Wall
 2: -Wall -Wextra
 3: -Wall -Wextra -Wpedantic

Currently we add our extra warning flags unconditionally if the compiler
supports them, regardless of the meson warning_level setting. This has
effectively nullified the warning_level setting in meson, and also
results in meson printing these messages:

  meson.build:498: WARNING: Consider using the built-in warning_level option instead of using "-Wall".
  meson.build:498: WARNING: Consider using the built-in warning_level option instead of using "-Wextra".

Semantically we can think of our huge list of flags as being an "extra"
set of warnings, and thus we ought to only add them when meson would
itself use -Wextra. aka warning_level == 2 or 3.

In practice libvirt code can't be built with -Wpedantic so we can ignore
meson warning_level 3, and only add our flags when warning_level==2.

In doing this change, we no longer have to check -Wall/-Wextra ourselves
as we can assume meson already set them.

-W is an alias of -Wextra so it is removed too.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agomeson: avoid checking compiler flags twice
Daniel P. Berrangé [Thu, 8 Apr 2021 10:29:20 +0000 (11:29 +0100)] 
meson: avoid checking compiler flags twice

In several cases we check if a compiler flag is supported, and then add
it to the 'cc_flags' array. The entire 'cc_flags' array is then later
tested to see if each flag is supported, which duplicates the check in
some cases.

Move the check of cc_flags earlier, and for the extra flags append
directly to supported_cc_flags to avoid the duplicate check

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agomeson: merge all cc_flags arrays into one
Daniel P. Berrangé [Thu, 8 Apr 2021 10:23:03 +0000 (11:23 +0100)] 
meson: merge all cc_flags arrays into one

The split of arrays is fairly arbitrary and a hang over from the way we
had to structure lists of flags when we used GNULIB's compiler flag
checking m4 logic.

The separate lists leads to cases where we enable a flag in one list and
have contradictory setting in another list, which leads to confusion.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agomeson: remove obsolete comment about stack frame size
Daniel P. Berrangé [Thu, 8 Apr 2021 12:57:55 +0000 (13:57 +0100)] 
meson: remove obsolete comment about stack frame size

The virStrerror function no longer exists in libvirt so is not a
constraint. At the current stack limit of 4k, and default Linux
stack size of 8 MB, we have a recursion limit of 2048 in the
absolute worst case, and much higher in common case. Even with
smaller stack sizes, we're going to be fine as we don't deeply
recurse in code.

Thus it is not worth spending effort to optimize below our current
4k worst case limit. Removing the comment will stop encouraging
people to spend time on this in future.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agomeson: actually check for -Wframe-larger-than
Daniel P. Berrangé [Wed, 7 Apr 2021 17:19:32 +0000 (18:19 +0100)] 
meson: actually check for -Wframe-larger-than

All other warning flags are checked for compiler support, so we
shouldn't blindly assume this one always exists.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agomeson: get rid of list of unused warning flags
Daniel P. Berrangé [Wed, 7 Apr 2021 17:16:50 +0000 (18:16 +0100)] 
meson: get rid of list of unused warning flags

We're not using these warning flags with libvirt, and it is not worth
keeping them just to issue a warning if someone tries to enable them.
If someone does try to enable them, either libvirt will build cleanly
or it won't.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirDomainGraphicsDefParseXMLVNC: Use virXMLProp*
Tim Wiederhake [Fri, 23 Apr 2021 10:37:41 +0000 (12:37 +0200)] 
virDomainGraphicsDefParseXMLVNC: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainGraphicsDef: Change type of sharePolicy to virDomainGraphicsVNCSharePolicy
Tim Wiederhake [Fri, 23 Apr 2021 10:37:40 +0000 (12:37 +0200)] 
virDomainGraphicsDef: Change type of sharePolicy to virDomainGraphicsVNCSharePolicy

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainGraphicsListenDefParseXML: Use virXMLProp*
Tim Wiederhake [Fri, 23 Apr 2021 10:37:39 +0000 (12:37 +0200)] 
virDomainGraphicsListenDefParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainNetDefParseXML: Use virXMLProp*
Tim Wiederhake [Fri, 23 Apr 2021 10:37:38 +0000 (12:37 +0200)] 
virDomainNetDefParseXML: Use virXMLProp*

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainActualNetDef: Change type of type to virDomainNetType
Tim Wiederhake [Fri, 23 Apr 2021 10:37:36 +0000 (12:37 +0200)] 
virDomainActualNetDef: Change type of type to virDomainNetType

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainPCIControllerOpts: Change type of modelName to virDomainControllerPCIModelName
Tim Wiederhake [Fri, 23 Apr 2021 10:37:34 +0000 (12:37 +0200)] 
virDomainPCIControllerOpts: Change type of modelName to virDomainControllerPCIModelName

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirDomainControllerDef: Change type of ioeventfd to virTristateSwitch
Tim Wiederhake [Fri, 23 Apr 2021 10:37:33 +0000 (12:37 +0200)] 
virDomainControllerDef: Change type of ioeventfd to virTristateSwitch

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agovirXMLPropEnum: Fix return value
Tim Wiederhake [Fri, 23 Apr 2021 10:37:32 +0000 (12:37 +0200)] 
virXMLPropEnum: Fix return value

Function incorrectly returns 0 when property was successfully read.

Fixes: ab5d2776c925ec45eb54ec5432f5645cebb80c85
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
4 years agoqemu: Don't double free @node_cpus in qemuProcessSetupPid()
Michal Privoznik [Fri, 23 Apr 2021 08:05:50 +0000 (10:05 +0200)] 
qemu: Don't double free @node_cpus in qemuProcessSetupPid()

When placing vCPUs into CGroups the qemuProcessSetupPid() is
called which then enters a for() loop (around its middle) where
it calls virDomainNumaGetNodeCpumask() for each guest NUMA node.
But the latter returns only a pointer not new reference/copy and
thus the caller must not free it. But the variable is decorated
with g_autoptr() which leads to a double free.

Fixes: 2d37d8dbc987d1998b4ad8029ba324b6bfe49799
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agorpc: libssh2: Enable EC host keys
Bastian Germann [Sun, 28 Mar 2021 21:10:21 +0000 (23:10 +0200)] 
rpc: libssh2: Enable EC host keys

libssh2 has ECDSA and ED25519 support beginning with v1.9.0. libvirt cannot
make use of those because it will handle them as unknown key types.

Add support for those host key types.

Signed-off-by: Bastian Germann <bastiangermann@fishpost.de>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agovahDeinit: Fix memory leak
Tim Wiederhake [Thu, 22 Apr 2021 13:07:33 +0000 (15:07 +0200)] 
vahDeinit: Fix memory leak

Calling VIR_FREE on a virDomainDef* does not free its various contained
pointers.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>