Re: [libvirt PATCH 1/3] xenParseHypervisorFeatures: Fix memory leak

2021-04-16 Thread Jim Fehlig
On 4/16/21 2:25 AM, Peter Krempa wrote: On Thu, Apr 15, 2021 at 17:08:26 +0200, Tim Wiederhake wrote: Fixes: b523e22521a Signed-off-by: Tim Wiederhake --- src/libxl/xen_common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c index

[libvirt PATCH 13/17] storage: use virFindFileInPath to validate presence of mkfs

2021-04-16 Thread Pavel Hrdina
Future patch will remove MKFS define as we will no longer check it during compilation. Signed-off-by: Pavel Hrdina --- src/storage/storage_backend_fs.c | 24 +--- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/storage/storage_backend_fs.c

[libvirt PATCH 17/17] meson: optional_programs should be used only for building libvirt

2021-04-16 Thread Pavel Hrdina
Drop code that creates defines with program paths and update the comment to reflect current usage of optional_programs. Signed-off-by: Pavel Hrdina --- meson.build | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/meson.build b/meson.build index

[libvirt PATCH 14/17] virfile: introduce virFindFileInPathFull()

2021-04-16 Thread Pavel Hrdina
Extend virFindFileInPath to search in custom extra paths as well. Some binaries that libvirt needs are not usually in $PATH so we need to have a way to look for these as well. Signed-off-by: Pavel Hrdina --- src/libvirt_private.syms | 2 +- src/util/virfile.c | 16 ++--

[libvirt PATCH 16/17] meson: drop check for runtime binary dependencies

2021-04-16 Thread Pavel Hrdina
These binaries are used only during runtime so technically there is no need to check for them while compiling libvirt. Usually the location is the same while compiling and running but it may not be true. In addition they are not strictly required to compile the code so this way developers don't

[libvirt PATCH 11/17] meson: don't check collie as program for sheepdog

2021-04-16 Thread Pavel Hrdina
Upstream sheepdog changed collie to dog back in 2013 in version 0.7.0. Looking into repology that version is no longer used by any distribution supported by libvirt. Signed-off-by: Pavel Hrdina --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build

[libvirt PATCH 09/17] virnetdev: move virNetDevSetRootQDisc to virnetdevbandwidth

2021-04-16 Thread Pavel Hrdina
The function in question uses "tc" binary so virnetdevbandwidth feels like better place for it. Signed-off-by: Pavel Hrdina --- src/libvirt_private.syms | 2 +- src/qemu/qemu_domain.c| 3 ++- src/util/virnetdev.c | 46

[libvirt PATCH 05/17] virdnsmasq: remove binaryPath argument from dnsmasqCapsNewFromBinary

2021-04-16 Thread Pavel Hrdina
We always pass DNSMASQ so there is no need for the argument at all. Signed-off-by: Pavel Hrdina --- src/network/bridge_driver.c | 4 ++-- src/util/virdnsmasq.c | 4 ++-- src/util/virdnsmasq.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git

[libvirt PATCH 07/17] tests: introduce virfirewallmock

2021-04-16 Thread Pavel Hrdina
This will allow us to run tests using firewall on hosts where the mocked binaries are not available/installed instead of skipping these tests. Signed-off-by: Pavel Hrdina --- src/util/virfile.h | 3 ++- tests/meson.build | 1 + tests/virfirewallmock.c | 34

[libvirt PATCH 15/17] qemu_conf: use virFindFileInPathFull for runtime binaries

2021-04-16 Thread Pavel Hrdina
Following patches will stop detecting the full path during compilation so we will need to do it here. Signed-off-by: Pavel Hrdina --- src/qemu/qemu_conf.c | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index

[libvirt PATCH 12/17] bhyvexml2argvtest: use virCommandToStringFull to strip command path

2021-04-16 Thread Pavel Hrdina
Currently the tests would fail if the bhyve commands are installed in different path then /usr/bin. Strip the command path to not depend on the host environment. Signed-off-by: Pavel Hrdina --- tests/bhyvexml2argvdata/bhyvexml2argv-acpiapic.args | 2 +-

[libvirt PATCH 10/17] tests: testutilsqemu: move virFindFileInPath into domaincapsmock

2021-04-16 Thread Pavel Hrdina
Having the function on mock library reflect more closely what we usually do in tests. Signed-off-by: Pavel Hrdina --- tests/domaincapsmock.c | 16 tests/testutilsqemu.c | 15 --- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git

[libvirt PATCH 04/17] virdnsmasq: remove binaryPath argument from dnsmasqCapsNewFromBuffer

2021-04-16 Thread Pavel Hrdina
We always pass DNSMASQ so there is no need for the argument at all. Signed-off-by: Pavel Hrdina --- src/util/virdnsmasq.c | 4 ++-- src/util/virdnsmasq.h | 3 +-- tests/networkxml2conftest.c | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git

[libvirt PATCH 08/17] tests: use virfirewallmock instead of hasNetfilterTools

2021-04-16 Thread Pavel Hrdina
Instead of checking for specific error that the binaries are not available mock the virFindFileInPath function. This way we don't have to skip these tests on host where the binaries are missing. Signed-off-by: Pavel Hrdina --- tests/networkxml2firewalltest.c | 16 ++--

[libvirt PATCH 06/17] virfirewall: use virFindFileInPath instead of virFileIsExecutable

2021-04-16 Thread Pavel Hrdina
Following patches will make this change necessary as we will stop detecting the full path during compile time. Signed-off-by: Pavel Hrdina --- src/util/virfirewall.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c index

[libvirt PATCH 02/17] virdnsmasq: drop unused dnsmasqCapsNewFromFile function

2021-04-16 Thread Pavel Hrdina
Instead of removing binaryPath let's drop the function completely as it is not used anywhere. Signed-off-by: Pavel Hrdina --- src/libvirt_private.syms | 1 - src/util/virdnsmasq.c| 30 -- src/util/virdnsmasq.h| 2 -- 3 files changed, 33 deletions(-) diff

[libvirt PATCH 03/17] virdnsmasq: drop unused dnsmasqCapsRefresh function

2021-04-16 Thread Pavel Hrdina
Instead of removing binaryPath let's drop the function completely as it is not used anywhere. Signed-off-by: Pavel Hrdina --- src/libvirt_private.syms | 1 - src/util/virdnsmasq.c| 17 - src/util/virdnsmasq.h| 1 - 3 files changed, 19 deletions(-) diff --git

[libvirt PATCH 00/17] drop meson checks for runtime binaries

2021-04-16 Thread Pavel Hrdina
Recent attempt to add a lot of meson options to specify different runtime paths motivated me enough to cleanup this from meson. Pavel Hrdina (17): bridge_driver: fix comment about dnsmasqCaps virdnsmasq: drop unused dnsmasqCapsNewFromFile function virdnsmasq: drop unused

[libvirt PATCH 01/17] bridge_driver: fix comment about dnsmasqCaps

2021-04-16 Thread Pavel Hrdina
We will never call dnsmasqCapsRefresh() so reflect what actually happens. Signed-off-by: Pavel Hrdina --- src/network/bridge_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 1172dbbc18..706a557ee8 100644

Re: [libvirt PATCH v2 09/12] tests: nodedev: Make the mdevctl test function and helper generic

2021-04-16 Thread Laine Stump
On 4/13/21 4:39 PM, Jonathon Jongsma wrote: From: Erik Skultety Now that we have a generic mdevctl command generator, we can unify the test infrastructure as well. Signed-off-by: Erik Skultety Reviewed-by: Laine Stump

Re: [libvirt PATCH v2 07/12] nodedev: driver: Create a generic mdevctl command translator

2021-04-16 Thread Laine Stump
On 4/13/21 4:39 PM, Jonathon Jongsma wrote: From: Erik Skultety Currently there are dedicated wrappers to construct mdevctl command. These are mostly fine except for the one that translates both "start" and "define" commands, only because mdevctl takes the same set of arguments. Instead, keep

Re: [libvirt PATCH v2 08/12] nodedev: Remove GetMdevctl*Command() wrappers

2021-04-16 Thread Laine Stump
On 4/13/21 4:39 PM, Jonathon Jongsma wrote: These per-command generator functions were only exposed in the header to allow the commandline generation to be tested. Now that we have a generic mdevctl command generator, we can get rid of the per-command wrappers and reduce the noise in the header.

Re: [libvirt PATCH v2 04/12] nodedev: driver: Swap virMdevctlStart and virMdevctlCreate

2021-04-16 Thread Laine Stump
On 4/13/21 4:39 PM, Jonathon Jongsma wrote: From: Erik Skultety "start" in libvirt means - "take this object and create an instance out of it" "create" in libvirt most of the time means - "take and XML description, make an object out of it and use it to create an instance" This gets

Re: [libvirt PATCH v2 03/12] tests: nodedev: switch all test macros to accept a filename

2021-04-16 Thread Laine Stump
On 4/13/21 4:39 PM, Jonathon Jongsma wrote: Rather than specifying a UUID string to some test macros, just pass a filename to an xml definition. This helps work toward unifying the test macros and making it more maintainable. Signed-off-by: Jonathon Jongsma Reviewed-by: Laine Stump

[PATCH 02/25] util: xml: Introduce virXMLParseStringCtxtRoot

2021-04-16 Thread Peter Krempa
Use the new macro instead of virXMLParseStringCtxt in places where the root node is being validated. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 9 + src/conf/storage_conf.c | 16 +--- src/util/virxml.h | 4 3 files changed, 10 insertions(+), 19

[PATCH 22/25] conf: domain: Convert virDomainDiskDef's 'snapshot' to unsigned int

2021-04-16 Thread Peter Krempa
Unfortunately virDomainSnapshotLocation is declared in snapshot_conf.h which includes domain_conf.h. To avoid a circular dependency use 'unsigned int' for now. Use XML parser can use virXMLPropEnum. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 15 +++

[PATCH 17/25] conf: domain: Move checks from virDomainDiskDefParseXML to virDomainDiskDefValidate

2021-04-16 Thread Peter Krempa
Move the rest of the validations to the vaidation code. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 44 -- src/conf/domain_validate.c | 44 ++ 2 files changed, 44 insertions(+), 44 deletions(-) diff --git

[PATCH 13/25] conf: Move disk target 'ioemu:' stripping to virDomainDiskDefPostParse

2021-04-16 Thread Peter Krempa
Modifications of the data such as this one don't belong into the parser. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ce0931c160..2803055204

[PATCH 11/25] conf: Move disk vendor and product pritability check to domain_validate

2021-04-16 Thread Peter Krempa
Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 12 src/conf/domain_validate.c | 37 +++-- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c8c0476a42..0738bf7f1f

[PATCH 10/25] conf: Move code from virDomainDiskDefParseValidate to virDomainDiskDefValidate

2021-04-16 Thread Peter Krempa
Unify the two distinct disk definition validators. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 143 + src/conf/domain_validate.c | 125 src/conf/domain_validate.h | 2 + 3 files changed, 128 insertions(+),

[PATCH 06/25] conf: domain: Split out source validation part from virDomainDiskDefParseValidate

2021-04-16 Thread Peter Krempa
Separate the validation of the source so that it can be reused once we split up the XML parser too. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 82 +++--- 1 file changed, 46 insertions(+), 36 deletions(-) diff --git a/src/conf/domain_conf.c

[PATCH 25/25] conf: domain: Refactor virDomainDiskDefParseXML

2021-04-16 Thread Peter Krempa
Use the new virXMLProp helpers and XPath queries to get rid of the old style of iteration through element children. Note that in case of def->blockio.logical_block_size, def->blockio.physical_block_size and def->rotation_rate the wraparound behaviour of 'virStrToLong_ui' was _not_ forward ported

[PATCH 24/25] conf: domain: Convert virDomainDiskDef's 'device' to virDomainDiskDevice

2021-04-16 Thread Peter Krempa
Use the appropriate type for the variable and refactor the XML parser to parse it correctly using virXMLPropEnum. Changes to other places using switch statements were required. Signed-off-by: Peter Krempa --- src/bhyve/bhyve_command.c | 3 +++ src/conf/domain_conf.c | 9 ++---

[PATCH 23/25] conf: domain: Convert virDomainDiskDef's 'bus' to virDomainDiskBus

2021-04-16 Thread Peter Krempa
Use the appropriate type for the variable and refactor the XML parser to parse it correctly using virXMLPropEnum. Changes to other places using switch statements were required. Signed-off-by: Peter Krempa --- src/bhyve/bhyve_command.c | 9 + src/bhyve/bhyve_domain.c | 12

[PATCH 20/25] conf: domain: Convert virDomainDiskDef's 'sgio' to virDomainDeviceSGIO

2021-04-16 Thread Peter Krempa
Use the appropriate type for the variable and refactor the XML parser to parse it correctly using virXMLPropEnum. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 13 +++-- src/conf/domain_conf.h | 2 +- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git

[PATCH 21/25] conf: domain: Convert virDomainDiskDef's 'model' to virDomainDiskModel

2021-04-16 Thread Peter Krempa
Use the appropriate type for the variable and refactor the XML parser to parse it correctly using virXMLPropEnum. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 8 ++-- src/conf/domain_conf.h | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git

[PATCH 19/25] conf: domain: Convert virDomainDiskDef's 'rawio' to virTristateBool

2021-04-16 Thread Peter Krempa
Use the appropriate type for the variable and refactor the XML parser to parse it correctly using virXMLPropEnum. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 14 +++--- src/conf/domain_conf.h | 2 +- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git

[PATCH 16/25] conf: domain: Move default setting from virDomainDiskDefParseXML to virDomainDiskDefPostParse

2021-04-16 Thread Peter Krempa
Move the setting of read-only state, the default disk bus and setting of 'snapshot' state for read-only disks to the post parse callback to clean up the disk parser. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 50 +++--- 1 file changed, 27

[PATCH 15/25] vmx: Mark CDROM disk elements as read-only

2021-04-16 Thread Peter Krempa
Mark it explicitly as read only in accordance with the comment outlining configuration. Signed-off-by: Peter Krempa --- src/vmx/vmx.c| 3 +++ tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml | 1 +

[PATCH 09/25] virDomainDiskDefValidate: Consolidate conditions

2021-04-16 Thread Peter Krempa
Consolidate the checks for '' and viritio queues under already existing blocks which have the same condition. Signed-off-by: Peter Krempa --- src/conf/domain_validate.c | 26 -- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/conf/domain_validate.c

[PATCH 08/25] conf: domain: Remove VIR_DOMAIN_DEF_PARSE_DISK_SOURCE parser flag

2021-04-16 Thread Peter Krempa
There's no code which would assert it at this point. Remove the flag. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 47 -- src/conf/domain_conf.h | 14 ++--- 2 files changed, 28 insertions(+), 33 deletions(-) diff --git

[PATCH 07/25] conf: domain: Split out parsing of source data from XML parser

2021-04-16 Thread Peter Krempa
Extract all code related to parsing data which ends up in the 'src' member of a virDomainDiskDef. This allows to use the new function directly in virDomainDiskDefParseSource and removes the use of the VIR_DOMAIN_DEF_PARSE_DISK_SOURCE parser flag. Signed-off-by: Peter Krempa ---

[PATCH 05/25] conf: domain: Introduce an internal variant of virDomainDiskDefNew

2021-04-16 Thread Peter Krempa
The XML element parser is going to be modified so that the virStorageSource bits are pre-parsed. Add virDomainDiskDefNewSource, which uses an existing 'src' pointer. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 29 ++--- 1 file changed, 18 insertions(+), 11

[PATCH 03/25] conf: domain: Introduce virDomainDiskDefParseSource

2021-04-16 Thread Peter Krempa
Add a helper function which will parse the source portion of a . The idea is to replace *virDomainDiskDefParse with VIR_DOMAIN_DEF_PARSE_DISK_SOURCE with the new helper in the future. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 30 ++

[PATCH 00/25] conf: domain: Refactor virDomainDiskDefParseXML

2021-04-16 Thread Peter Krempa
Split out all default setting and validation code into appropriate functions and convert the XML parser to contemporary helpers. Peter Krempa (25): virXMLParseHelper: Add root XML node name validation capability util: xml: Introduce virXMLParseStringCtxtRoot conf: domain: Introduce

[PATCH 12/25] conf: Move checks from virDomainDiskDefPostParse to virDomainDiskDefValidate

2021-04-16 Thread Peter Krempa
The moved code contains only checks and does not modify the parsed document so it doesn't belong into the PostParse code. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 19 --- src/conf/domain_validate.c | 18 ++ 2 files changed, 18 insertions(+),

[PATCH 04/25] qemu: driver: Use virDomainDiskDefParseSource in qemuDomainBlockCopy

2021-04-16 Thread Peter Krempa
qemuDomainBlockCopy needs just the source portion of the disk but uses the disk parser for it. Since we have a specific function now, refactor the code to avoid having to deal with the unused virDomainDiskDef. Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 9 ++--- 1 file changed,

[PATCH 18/25] conf: domain: Convert virDomainDiskDef's 'removable' to virTristateSwitch

2021-04-16 Thread Peter Krempa
Use the appropriate type for the variable and refactor the XML parser to parse it correctly using virXMLPropEnum. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 15 +-- src/conf/domain_conf.h | 2 +- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git

[PATCH 14/25] conf: domain: Introduce VIR_DOMAIN_DISK_BUS_NONE

2021-04-16 Thread Peter Krempa
Add a disk bus value represending no selected bus. This will help split up the XML parser. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 3 ++- src/conf/domain_conf.h | 1 + src/conf/domain_validate.c | 1 + src/qemu/qemu_alias.c | 1 +

[PATCH 01/25] virXMLParseHelper: Add root XML node name validation capability

2021-04-16 Thread Peter Krempa
Some callers want to validate the root XML node name. Add the capability to the parser helper to prevent open-coding. Signed-off-by: Peter Krempa --- src/util/virxml.c | 18 -- src/util/virxml.h | 13 +++-- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git

Re: [libvirt PATCH] spec: Merge -bash-completion and -admin into -client

2021-04-16 Thread Kashyap Chamarthy
On Thu, Apr 15, 2021 at 11:20:14AM +0200, Andrea Bolognani wrote: > The former is ridiculously tiny and doesn't have any use on > its own, so it hardly warrants the overhead of an additional > package; the latter is also very small and, just like virsh, > is something that you likely want to have

Re: [libvirt PATCHv1 3/4] conf: add socket for virtiofs filesystems

2021-04-16 Thread Michal Privoznik
On 3/31/21 8:55 PM, Ján Tomko wrote: Allow passing a socket of an externally launched virtiofsd to the vhost-user-fs device. https://bugzilla.redhat.com/show_bug.cgi?id=1855789 Signed-off-by: Ján Tomko --- docs/schemas/domaincommon.rng | 11 ++

Re: [libvirt PATCHv1 0/4] qemu: support unmanaged virtiofsd

2021-04-16 Thread Michal Privoznik
On 3/31/21 8:55 PM, Ján Tomko wrote: Connect the vhost-user-fs device to a socket path configured in the XML. Starting and stopping the virtiofsd daemon on that socket is the user's responsibility. Ján Tomko (4): conf: fs: fill out accessmode in post-parse conf: fs: allow missing

Re: [libvirt PATCH 0/2] introduce 'restrictive' mode in numatune

2021-04-16 Thread Martin Kletzander
Sorry for not putting you in Cc on the original patch, I was too much in a rush. If this works and looks OK to you, then let me know. Thanks. On Fri, Apr 16, 2021 at 02:42:23PM +0200, Martin Kletzander wrote: Resent patches with some fixes v5:

[libvirt PATCH 2/2] qemu: Add support for 'restrictive' mode in numatune

2021-04-16 Thread Martin Kletzander
From: Luyao Zhong Reviewed-by: Daniel Henrique Barboza Signed-off-by: Luyao Zhong Signed-off-by: Martin Kletzander --- src/qemu/qemu_command.c | 5 ++- src/qemu/qemu_process.c | 32 ...emnode-restrictive-mode.x86_64-latest.args |

[libvirt PATCH 1/2] conf, docs, schema: Add support for 'restrictive' mode in numatune

2021-04-16 Thread Martin Kletzander
From: Luyao Zhong This allows users to restrict memory nodes without setting any specific memory policy, then 'restrictive' mode is useful. Reviewed-by: Daniel Henrique Barboza Signed-off-by: Luyao Zhong Signed-off-by: Martin Kletzander --- docs/formatdomain.rst | 7

[libvirt PATCH 0/2] introduce 'restrictive' mode in numatune

2021-04-16 Thread Martin Kletzander
Resent patches with some fixes v5: https://listman.redhat.com/archives/libvir-list/2021-April/msg00450.html Luyao Zhong (2): conf, docs, schema: Add support for 'restrictive' mode in numatune qemu: Add support for 'restrictive' mode in numatune docs/formatdomain.rst

Re: [PATCH 0/2] conf: Convert 'tray_status' and 'startupPolicy' of virDomainDiskDef to enums

2021-04-16 Thread Peter Krempa
On Fri, Apr 16, 2021 at 14:22:32 +0200, Tim Wiederhake wrote: > On Fri, 2021-04-16 at 13:50 +0200, Peter Krempa wrote: > > I was testing how virXMLPropEnum works when used on converted types, > > so > > I've converted these. > > > > Peter Krempa (2): > > conf: domain: Convert virDomainDiskDef's

[libvirt PATCH 10/10] virInterfaceLinkParseXML: Use virXMLProp*

2021-04-16 Thread Tim Wiederhake
Signed-off-by: Tim Wiederhake --- src/conf/device_conf.c | 26 ++ 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 1ce31e9234..a2893fec6f 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c

Re: [PATCH 0/2] conf: Convert 'tray_status' and 'startupPolicy' of virDomainDiskDef to enums

2021-04-16 Thread Tim Wiederhake
On Fri, 2021-04-16 at 13:50 +0200, Peter Krempa wrote: > I was testing how virXMLPropEnum works when used on converted types, > so > I've converted these. > > Peter Krempa (2): > conf: domain: Convert virDomainDiskDef's 'tray_status' to > virDomainDiskTray > conf: domain: Convert

[libvirt PATCH 02/10] virDomainBackupDefParse: Use virXMLProp*

2021-04-16 Thread Tim Wiederhake
Signed-off-by: Tim Wiederhake --- src/conf/backup_conf.c | 17 +++-- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c index 859609946f..898725aac7 100644 --- a/src/conf/backup_conf.c +++ b/src/conf/backup_conf.c @@ -222,8

[libvirt PATCH 03/10] virZPCIDeviceAddressParseXML: Use virXMLProp*

2021-04-16 Thread Tim Wiederhake
Signed-off-by: Tim Wiederhake --- src/conf/device_conf.c | 33 +++-- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 6a4b14cfda..8d3d012e4a 100644 --- a/src/conf/device_conf.c +++

[libvirt PATCH 07/10] virDomainDeviceVirtioSerialAddressParseXML: Use virXMLProp*

2021-04-16 Thread Tim Wiederhake
Signed-off-by: Tim Wiederhake --- src/conf/device_conf.c | 25 ++--- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 5a98cd8c0f..587f966398 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@

[libvirt PATCH 04/10] virPCIDeviceAddressParseXML: Use virXMLProp*

2021-04-16 Thread Tim Wiederhake
Signed-off-by: Tim Wiederhake --- src/conf/device_conf.c | 47 +++--- 1 file changed, 12 insertions(+), 35 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 8d3d012e4a..951b7a348e 100644 --- a/src/conf/device_conf.c +++

[libvirt PATCH 09/10] virDomainDeviceUSBAddressParseXML: Use virXMLProp*

2021-04-16 Thread Tim Wiederhake
Signed-off-by: Tim Wiederhake --- src/conf/device_conf.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index f7bf2de6f1..1ce31e9234 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -403,19 +403,16

[libvirt PATCH 05/10] virDomainDeviceCCWAddressParseXML: Use virXMLProp*

2021-04-16 Thread Tim Wiederhake
Signed-off-by: Tim Wiederhake --- src/conf/device_conf.c | 51 +- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 951b7a348e..621ff1b476 100644 --- a/src/conf/device_conf.c +++

[libvirt PATCH 00/10] Refactor more XML parsing boilerplate code

2021-04-16 Thread Tim Wiederhake
For background, see https://listman.redhat.com/archives/libvir-list/2021-April/msg00668.html Tim Wiederhake (10): virDomainBackupDiskDefParseXML: Use virXMLProp* virDomainBackupDefParse: Use virXMLProp* virZPCIDeviceAddressParseXML: Use virXMLProp* virPCIDeviceAddressParseXML: Use

[libvirt PATCH 08/10] virDomainDeviceCcidAddressParseXML: Use virXMLProp*

2021-04-16 Thread Tim Wiederhake
Signed-off-by: Tim Wiederhake --- src/conf/device_conf.c | 17 - 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 587f966398..f7bf2de6f1 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -362,24

[libvirt PATCH 06/10] virDomainDeviceDriveAddressParseXML: Use virXMLProp*

2021-04-16 Thread Tim Wiederhake
Signed-off-by: Tim Wiederhake --- src/conf/device_conf.c | 33 - 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 621ff1b476..5a98cd8c0f 100644 --- a/src/conf/device_conf.c +++

[libvirt PATCH 01/10] virDomainBackupDiskDefParseXML: Use virXMLProp*

2021-04-16 Thread Tim Wiederhake
Signed-off-by: Tim Wiederhake --- src/conf/backup_conf.c | 40 ++-- 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c index 2de77a59c0..859609946f 100644 --- a/src/conf/backup_conf.c +++

Re: [libvirt PATCH] nodedev: Fix possible NULL pointer dereference on vfiogroup opening

2021-04-16 Thread Ján Tomko
On a Tuesday in 2021, Erik Skultety wrote: Coverity report: 1193g_autofree char *vfiogroup = 1194virMediatedDeviceGetIOMMUGroupDev(def->caps->data.mdev.uuid); >>> CID 317619: Null pointer dereferences (NULL_RETURNS) >>> Dereferencing a pointer that might be "NULL"

[PATCH 1/2] conf: domain: Convert virDomainDiskDef's 'tray_status' to virDomainDiskTray

2021-04-16 Thread Peter Krempa
Use the appropriate type for the variable and refactor the XML parser to parse it correctly using virXMLPropEnum. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 13 +++-- src/conf/domain_conf.h | 2 +- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git

[PATCH 0/2] conf: Convert 'tray_status' and 'startupPolicy' of virDomainDiskDef to enums

2021-04-16 Thread Peter Krempa
I was testing how virXMLPropEnum works when used on converted types, so I've converted these. Peter Krempa (2): conf: domain: Convert virDomainDiskDef's 'tray_status' to virDomainDiskTray conf: domain: Convert virDomainDiskDef's 'startupPolicy' to virDomainStartupPolicy

Re: [libvirt PATCH v6 0/8] Refactor XML parsing boilerplate code

2021-04-16 Thread Peter Krempa
On Fri, Apr 16, 2021 at 11:41:44 +0200, Tim Wiederhake wrote: [...] > Tim Wiederhake (8): > virxml: Add virXMLPropTristateBool > virxml: Add virXMLPropTristateSwitch > virxml: Add virXMLPropInt > virxml: Add virXMLPropUInt > virxml: Add virXMLPropEnum I've rebased these on top of the

[PATCH 2/2] conf: domain: Convert virDomainDiskDef's 'startupPolicy' to virDomainStartupPolicy

2021-04-16 Thread Peter Krempa
Use the appropriate type for the variable and refactor the XML parser to parse it correctly using virXMLPropEnum. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 18 -- src/conf/domain_conf.h | 2 +- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git

Re: [PATCH 0/5] util: xml: cleanup virxml.h and virXMLParseHelper

2021-04-16 Thread Tim Wiederhake
On Fri, 2021-04-16 at 10:07 +0200, Peter Krempa wrote: > Peter Krempa (5): > util: virxml: Fix formatting of virxml.h > virXMLParseHelper: Sync argument names between declaration and > definition > util: xml: Register autoptr cleanup function for 'xmlParserCtxt' > virXMLParseHelper:

Re: [libvirt][PATCH v5 0/3] introduce 'restrictive' mode in numatune

2021-04-16 Thread Martin Kletzander
On Tue, Apr 13, 2021 at 02:38:05PM +0800, Luyao Zhong wrote: Before this patch set, numatune only has three memory modes: static, interleave and prefered. These memory policies are ultimately set by mbind() system call. Memory policy could be 'hard coded' into the kernel, but none of above

[libvirt PATCH v6 7/8] virDomainIOThreadIDDefParseXML: Use virXMLProp*

2021-04-16 Thread Tim Wiederhake
Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- src/conf/domain_conf.c | 14 +++--- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a0fb7731d9..858ef5db9d 100644 --- a/src/conf/domain_conf.c +++

[libvirt PATCH v6 4/8] virxml: Add virXMLPropUInt

2021-04-16 Thread Tim Wiederhake
Convenience function to return the value of an unsigned integer XML attribute. Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- src/libvirt_private.syms | 1 + src/util/virxml.c| 60 src/util/virxml.h| 8 ++ 3 files

[libvirt PATCH v6 2/8] virxml: Add virXMLPropTristateSwitch

2021-04-16 Thread Tim Wiederhake
Convenience function to return the value of an on / off XML attribute. Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- src/libvirt_private.syms | 1 + src/util/virxml.c| 44 src/util/virxml.h| 6 ++ 3 files changed, 51

[libvirt PATCH v6 6/8] virNetworkForwardNatDefParseXML: Use virXMLProp*

2021-04-16 Thread Tim Wiederhake
Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- src/conf/network_conf.c | 16 +++- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index f0f5ef6f42..17835ac8d3 100644 --- a/src/conf/network_conf.c +++

[libvirt PATCH v6 8/8] virCPUDefParseXML: Use virXMLProp*

2021-04-16 Thread Tim Wiederhake
Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- src/conf/cpu_conf.c | 14 +++--- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index c095ab0e89..c7bea8ae00 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c

[libvirt PATCH v6 5/8] virxml: Add virXMLPropEnum

2021-04-16 Thread Tim Wiederhake
Convenience function to return the value of an enum XML attribute. Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- src/libvirt_private.syms | 1 + src/util/virxml.c| 48 src/util/virxml.h| 8 +++ 3 files changed, 57

[libvirt PATCH v6 3/8] virxml: Add virXMLPropInt

2021-04-16 Thread Tim Wiederhake
Convenience function to return the value of an integer XML attribute. Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- src/libvirt_private.syms | 1 + src/util/virxml.c| 53 src/util/virxml.h| 8 ++ 3 files changed, 62

[libvirt PATCH v6 0/8] Refactor XML parsing boilerplate code

2021-04-16 Thread Tim Wiederhake
This series lays the groundwork for replacing some recurring boilerplate code in src/conf/ regarding the extraction of XML attribute values. For an on / off attribute, the boilerplate code looks roughly like this, g_autofree char *str = NULL; if (str = virXMLPropString(node, "x")) { int

[libvirt PATCH v6 1/8] virxml: Add virXMLPropTristateBool

2021-04-16 Thread Tim Wiederhake
Convenience function to return the value of a yes / no XML attribute. Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- src/libvirt_private.syms | 1 + src/util/virxml.c| 44 src/util/virxml.h| 12 +++ 3 files changed,

Re: [libvirt PATCH v5 1/8] virxml: Add virXMLPropTristateBool

2021-04-16 Thread Peter Krempa
On Thu, Apr 08, 2021 at 13:19:51 +0200, Tim Wiederhake wrote: > Convenience function to return the value of a yes / no XML attribute. > > Signed-off-by: Tim Wiederhake > --- > src/libvirt_private.syms | 1 + > src/util/virxml.c| 49 >

Re: [libvirt PATCH 3/3] virQEMUCapsSetHostModel: Fix memory leak

2021-04-16 Thread Peter Krempa
On Thu, Apr 15, 2021 at 17:08:28 +0200, Tim Wiederhake wrote: > virQEMUCapsSetHostModel is called by virQEMUCapsInitHostCPUModel, > which in turn is typically called twice (for KVM and QEMU), e.g. in > virQEMUCapsLoadCache and virQEMUCapsNewForBinaryInternal. > > The second call leaks memory

Re: [libvirt PATCH 1/3] xenParseHypervisorFeatures: Fix memory leak

2021-04-16 Thread Peter Krempa
On Thu, Apr 15, 2021 at 17:08:26 +0200, Tim Wiederhake wrote: Fixes: b523e22521a > Signed-off-by: Tim Wiederhake > --- > src/libxl/xen_common.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c > index 12a44280cb..ad5a3de116 100644 > ---

Re: [libvirt PATCH 2/3] virDomainFeaturesDefParse: Fix memory leak

2021-04-16 Thread Peter Krempa
On Thu, Apr 15, 2021 at 17:08:27 +0200, Tim Wiederhake wrote: Fixes: 94013ee04e3 > Signed-off-by: Tim Wiederhake > --- > src/conf/domain_conf.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Peter Krempa

[PATCH 3/5] util: xml: Register autoptr cleanup function for 'xmlParserCtxt'

2021-04-16 Thread Peter Krempa
Signed-off-by: Peter Krempa --- src/util/virxml.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/virxml.h b/src/util/virxml.h index fce1c28e89..b1feeeb164 100644 --- a/src/util/virxml.h +++ b/src/util/virxml.h @@ -283,6 +283,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(xmlDoc, xmlFreeDoc);

[PATCH 5/5] virXMLParseHelper: Refactor cleanup

2021-04-16 Thread Peter Krempa
Switch @xml and @pctxt to g_autofree and get rid of the "error" and "cleanup" labels. Signed-off-by: Peter Krempa --- src/util/virxml.c | 22 +++--- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/util/virxml.c b/src/util/virxml.c index 029b3d646e..58d640546f

[PATCH 4/5] virXMLParseHelper: Rework error reporting

2021-04-16 Thread Peter Krempa
Move the reporting of parsing error on the error path of the parser as other code paths report their own errors already. Additionally prefer printing the 'url' as document name if provided instead of "[inline data]" as that usually gives a better hint at least which kind of XML is being parsed.

[PATCH 0/5] util: xml: cleanup virxml.h and virXMLParseHelper

2021-04-16 Thread Peter Krempa
Peter Krempa (5): util: virxml: Fix formatting of virxml.h virXMLParseHelper: Sync argument names between declaration and definition util: xml: Register autoptr cleanup function for 'xmlParserCtxt' virXMLParseHelper: Rework error reporting virXMLParseHelper: Refactor cleanup

[PATCH 2/5] virXMLParseHelper: Sync argument names between declaration and definition

2021-04-16 Thread Peter Krempa
Signed-off-by: Peter Krempa --- src/util/virxml.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virxml.h b/src/util/virxml.h index 84fa4f4baf..fce1c28e89 100644 --- a/src/util/virxml.h +++ b/src/util/virxml.h @@ -101,7 +101,7 @@ virXMLParseHelper(int domcode,

[PATCH 1/5] util: virxml: Fix formatting of virxml.h

2021-04-16 Thread Peter Krempa
Remove the "block" formatting of function declarations and use uniform spacing. Signed-off-by: Peter Krempa --- src/util/virxml.h | 192 +++--- 1 file changed, 112 insertions(+), 80 deletions(-) diff --git a/src/util/virxml.h b/src/util/virxml.h index

Re: [libvirt PATCH v5 8/8] virCPUDefParseXML: Use virXMLProp*

2021-04-16 Thread Peter Krempa
On Thu, Apr 08, 2021 at 13:19:58 +0200, Tim Wiederhake wrote: > Signed-off-by: Tim Wiederhake > --- > src/conf/cpu_conf.c | 14 +++--- > 1 file changed, 3 insertions(+), 11 deletions(-) Reviewed-by: Peter Krempa

Re: [libvirt PATCH v5 7/8] virDomainIOThreadIDDefParseXML: Use virXMLProp*

2021-04-16 Thread Peter Krempa
On Thu, Apr 08, 2021 at 13:19:57 +0200, Tim Wiederhake wrote: > Signed-off-by: Tim Wiederhake > --- > src/conf/domain_conf.c | 14 +++--- > 1 file changed, 3 insertions(+), 11 deletions(-) Reviewed-by: Peter Krempa

Re: [libvirt PATCH v5 6/8] virNetworkForwardNatDefParseXML: Use virXMLProp*

2021-04-16 Thread Peter Krempa
On Thu, Apr 08, 2021 at 13:19:56 +0200, Tim Wiederhake wrote: > Signed-off-by: Tim Wiederhake > --- > src/conf/network_conf.c | 16 +++- > 1 file changed, 3 insertions(+), 13 deletions(-) Reviewed-by: Peter Krempa

Re: [libvirt PATCH v5 5/8] virxml: Add virXMLPropEnum

2021-04-16 Thread Peter Krempa
On Thu, Apr 08, 2021 at 13:19:55 +0200, Tim Wiederhake wrote: > Convenience function to return the value of an enum XML attribute. > > Signed-off-by: Tim Wiederhake > --- > src/libvirt_private.syms | 1 + > src/util/virxml.c| 51 >

  1   2   >