Commit Graph

42549 Commits

Author SHA1 Message Date
Peter Krempa
351f2b10de virDomainIOThreadIDDefParseXML: Refactor cleanup
Automatically free 'iothrid' and remove all the cleanup cruft.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-07 10:06:18 +02:00
Peter Krempa
129f9b8f4a conf: Define autoptr func for virDomainIOThreadIDDef
Register virDomainIOThreadIDDefFree to do the cleanup.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-07 10:06:18 +02:00
Peter Krempa
f5eb6d0ad9 virXMLPropUInt: Always initialize @result
Compilers aren't able to see whether @result is set or not and thus
don't warn of a potential use of uninitialized value. Always set @result
to prevent uninitialized use.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-07 10:06:18 +02:00
Peter Krempa
84960ca118 virDomainDiskDefDriverParseXML: Fix usage of virXMLPropUInt
VIR_XML_PROP_NONE has value of 0 so it's pointless to include it in an
binary-or expression.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-07 10:06:18 +02:00
Peter Krempa
e9bf68848c virDomainVcpuParse: Assign default vcpus count based on return value of virXMLPropUInt
Assign the vcpu count when virXMLPropUInt returns '0' meaning that the
cpu count was not present in the XML. This will allow to always
initialize the value of @result in virXMLPropUInt to prevent use of
uninitialized values.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-07 10:06:18 +02:00
Peter Krempa
d919d9bbcd virXMLPropULongLong: Always initialize @result
Compilers aren't able to see whether @result is set or not and thus
don't warn of a potential use of uninitialized value. Always set @result
to prevent uninitialized use.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-07 10:06:18 +02:00
Peter Krempa
0420c325ce util: xml: Extract implementation of xml property -> enum parsing to a common helper
virXMLPropTristateBool/virXMLPropTristateSwitch/virXMLPropEnum can be
implemented using the same internal code. Extract it into a new function
called virXMLPropEnumInternal, which will also simplify adding versions
of these functions with a custom default value.

This way we'll be able to always initialize @result so that unused value
bugs can be prevented.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-07 10:06:18 +02:00
Tim Wiederhake
4ef4476d3a virDomainResctrlMonDefParse: Use virXMLProp*
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-06 13:54:40 +02:00
Tim Wiederhake
d897ae3cb4 virDomainCachetuneDefParseCache: Use virXMLProp*
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-06 13:54:40 +02:00
Tim Wiederhake
232c01ec4f virDomainVcpuParse: Use virXMLProp*
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-06 13:54:39 +02:00
Tim Wiederhake
8e0efc8f72 virDomainDef: Change type of placement_mode to virDomainCpuPlacementMode
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-06 13:54:39 +02:00
Tim Wiederhake
a6a8d9b09f virDomainSchedulerParseCommonAttrs: Use virXMLProp*
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-06 13:54:38 +02:00
Tim Wiederhake
124357c17a virDomainIOThreadPinDefParseXML: Use virXMLProp*
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-06 13:54:36 +02:00
Tim Wiederhake
762c7822b9 virDomainVcpuPinDefParseXML: Use virXMLProp*
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-06 13:54:35 +02:00
Tim Wiederhake
3b7bc307d5 virDomainMemoryDefParseXML: Use virXMLProp*
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-06 13:54:34 +02:00
Tim Wiederhake
550981ce97 virDomainPerfEventDefParseXML: Use virXMLProp*
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-06 13:54:33 +02:00
Tim Wiederhake
7bc4f10807 virDomainRedirFilterUSBDevDefParseXML: Use g_auto*
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-06 13:54:33 +02:00
Tim Wiederhake
54fb0b9e95 virDomainRedirFilterUSBDevDefParseXML: 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>
2021-05-06 12:34:42 +02:00
Tim Wiederhake
0ed95ae926 virDomainShmemDef: Use g_auto*
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>
2021-05-06 12:34:42 +02:00
Tim Wiederhake
9cc23ee498 conf: domain: Register autoptr cleanup function for virDomainShmemDef
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>
2021-05-06 12:34:42 +02:00
Tim Wiederhake
567efa85c2 virDomainShmemDefParseXML: 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>
2021-05-06 12:34:42 +02:00
Tim Wiederhake
c0e5c370c8 virDomainShmemDef: Change type of role to virDomainShmemRole
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>
2021-05-06 12:34:42 +02:00
Tim Wiederhake
b3a6daa36d virDomainShmemDef: Change type of model to virDomainShmemModel
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>
2021-05-06 12:34:41 +02:00
Tim Wiederhake
cacde05ad3 virDomainMemballoonDefParseXML: 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>
2021-05-06 12:34:41 +02:00
Tim Wiederhake
dcf5d641ec virDomainMemballoonDef: Change type of model to virDomainMemballoonModel
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>
2021-05-06 12:34:41 +02:00
Tim Wiederhake
38180f87f5 virDomainAudioCommonParse: Use virXMLProp*
This strictens the parser to disallow negative values (interpreted as
`UINT_MAX + value + 1`) for attributes `voices` (typically 1),
`bufferLength` (measured in milliseconds), `frequency` (in Hz, typically
44100), and `channels` (typically 2 for stereo).

None of these properties benefit from or have a sensible use-case for
wrap-around behavior.

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>
2021-05-06 12:34:41 +02:00
Tim Wiederhake
c9876ccf56 virDomainAudioIOCommon: Change type of format to virDomainAudioFormat
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>
2021-05-06 12:34:41 +02:00
Tim Wiederhake
bb94b3d28d virDomainGraphicsDefParseXMLSpice: Use virXMLProp*
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-06 12:16:32 +02:00
Tim Wiederhake
4ecf7ff393 virDomainGraphicsDefParseXMLSpice: Make name and mode mandatory
Attributes are mandatory and were incorrectly made optional recently.

Fixes: 2a5e16398e
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-06 12:16:32 +02:00
Tim Wiederhake
4647ac4205 virDomainGraphicsDefParseXMLSpice: Fix variable type
Fixes: 2a5e16398e
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-06 12:16:32 +02:00
Andrea Bolognani
69c8d5954e spec: Drop supported_platform variable
It's only used in one place, and it's nicer to keep the error
message close to the check that causes it to be emitted.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-06 11:06:08 +02:00
Andrea Bolognani
0f601d2f86 spec: Bump min_fedora and min_rhel
According to our platform support policy

  https://libvirt.org/platforms.html

RHEL 7 and all versions of Fedora older than 33 are going to
be out of scope by the time libvirt 7.4.0 is released.

Dropping RHEL 7 in particular allows us to greatly simplify
many parts of the spec file.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-06 11:06:06 +02:00
Andrea Bolognani
d9f4470549 spec: Don't disable LTO in Fedora 34
The bug that caused this to be added

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

has since been resolved.

Reverts: a16c0402ba
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-06 11:06:00 +02:00
Michal Privoznik
a573f21f32 virDomainVideoDriverDefParseXML: Allow zero value for @vgaconf
It was always allowed, but in a very unusual and weird way. Just
look at the original commit that introduced it (78fc843c7b).
Also, we document that "io" value is accepted (which translates
to VIR_DOMAIN_VIDEO_VGACONF_IO with value of zero).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-05-06 09:10:30 +02:00
Michal Privoznik
1edf9f7b0a virDomainChrSourceDefParseXML: Fix attribute names for nmdm type
While reworking the patch I've mistakenly mangled the attribute
names for VIR_DOMAIN_CHR_TYPE_NMDM.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-05-06 09:10:30 +02:00
Daniel P. Berrangé
68e8fbe6b1 gitlab: enable debug output for test suite
When CI jobs fail on the test suite, we don't see much helpful
information by default:

stderr:
TEST: bhyvexml2argvtest
      ......!!.............!......!........... 40
      ........................!......          71  FAIL
Some tests failed. Run them using:
VIR_TEST_DEBUG=1 VIR_TEST_RANGE=7-8,22,29,65
/tmp/cirrus-ci-build/build/meson-private/dist-build/tests/bhyvexml2argvtest

Following the instructions to re-run the test with VIR_TEST_DEBUG=1 is
quite unfriendly when we could have had that set for CI already.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-05-05 14:45:34 +01:00
Peter Krempa
7f71a641d0 virDomainVideoDriverDefParseXML: Fix use of uninitialized variable
Commit fc7e1b2f03 which refactored the
video driver parse helper introduced a use of uninitialized variable,
which caused test failure at least when compiled with clang.

Pass 'def->vgaconf' directly to virXMLPropEnum. 'def' needs to be
converted to use g_autofree to handle error scenarios.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2021-05-05 14:08:29 +02:00
Tim Wiederhake
4a4c2a4f24 virDomainFSDefParseXML: Remove unused variables
Fixes: 8f05664ed3
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-05-05 14:04:41 +02:00
Andrea Bolognani
d35003aee7 ci: Drop CentOS 7
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-05-05 13:25:21 +02:00
Andrea Bolognani
eabfb73356 ci: Drop Fedora 32
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-05-05 13:25:20 +02:00
Andrea Bolognani
b488200a92 ci: Add Fedora 34
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-05-05 13:25:19 +02:00
Andrea Bolognani
7f2f7ef23b ci: Add FreeBSD 13
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-05-05 13:25:17 +02:00
Andrea Bolognani
103d019a4f ci: Add openSUSE Tumbleweed
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-05-05 13:25:16 +02:00
Andrea Bolognani
a3fef27fb5 ci: Refresh contents
Notable changes:

  * the CentOS Stream 8 container is now using a proper base
    image instead of starting from a CentOS 8 image and then
    adding the CentOS Stream 8 repositories on top;

  * distributions that have a perl-base package are now using
    that one instead of the regular perl package, which
    contains a bunch of features we don't need, resulting in
    smaller containers.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-05-05 13:25:14 +02:00
Andrea Bolognani
043adb8b50 ci: Rename CentOS Stream 8 and openSUSE Leap 15.2 containers
The names have been recently changed in libvirt-ci to be more
accurate, so we should follow along.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-05-05 13:25:12 +02:00
Andrea Bolognani
12dda05b7d ci: Remove Fedora Rawhide dwarf4 hack
It's no longer needed.

Reverts: e603efb6ec
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-05-05 13:25:03 +02:00
Kristina Hanicova
8391cfbc2d Refactoring virDomainVideoDefParseXML() to use XPath
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-05 09:12:15 +02:00
Kristina Hanicova
fc7e1b2f03 Refactoring virDomainVideoDriverDefParseXML() to use XPath
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-05 09:12:14 +02:00
Kristina Hanicova
bcce7f2e3a conf: Propagate xmlXPathContextPtr into virDomainVideoDriverDefParseXML()
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-05 09:12:14 +02:00
Kristina Hanicova
2a5e16398e Refactoring virDomainGraphicsDefParseXMLSpice() to use XPath
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-05-05 09:12:13 +02:00