[PATCH RESEND 19/20] virpci.c: use virPCIDeviceAddressPtr in virPCIDeviceListDel()

2021-01-18 Thread Daniel Henrique Barboza
This change will allow us to remove PCI devices from a list without the need of a PCI Device object, which will be need in the next patch. Signed-off-by: Daniel Henrique Barboza --- src/hypervisor/virhostdev.c | 7 --- src/util/virpci.c | 6 +++--- src/util/virpci.h | 2

[PATCH RESEND 16/20] virpci.c: use virPCIDeviceAddressPtr in virPCIDeviceListFindIndex()

2021-01-18 Thread Daniel Henrique Barboza
We're going to need a way to remove a PCI Device from a list without having a valid virPCIDevicePtr, because the device is missing from the host. This means that virPCIDevicesListDel() must operate with a PCI Device address instead. Turns out that virPCIDevicesListDel() and its related functions

[PATCH RESEND 14/20] virhostdev.c: add virHostdevIsPCIDevice() helper

2021-01-18 Thread Daniel Henrique Barboza
Add a helper to quickly determine if a hostdev is a PCI device, instead of doing a tedius 'if' check with hostdev mode and subsys type. Signed-off-by: Daniel Henrique Barboza --- src/hypervisor/virhostdev.c | 12 +--- src/hypervisor/virhostdev.h | 2 ++ src/libvirt_private.syms| 1

[PATCH RESEND 20/20] virhostdev.c: remove missing PCI devs from hostdev manager

2021-01-18 Thread Daniel Henrique Barboza
virHostdevReAttachPCIDevices() is called when we want to re-attach a list of hostdevs back to the host, either on the shutdown path or via a 'virsh detach-device' call. This function always count on the existence of the device in the host to work, but this can lead to problems. For example, a

[PATCH RESEND 11/20] qemu_driver.c: modernize qemuNodeDeviceReAttach()

2021-01-18 Thread Daniel Henrique Barboza
Add virObjectUnref an autoptr cleanup func for virNodeDevice, then remove all unref and free calls from qemuNodeDeviceReAttach(). Signed-off-by: Daniel Henrique Barboza --- src/datatypes.h| 2 ++ src/qemu/qemu_driver.c | 32 2 files changed, 14

[PATCH RESEND 12/20] libxl_driver.c: modernize libxlNodeDeviceReAttach()

2021-01-18 Thread Daniel Henrique Barboza
Use g_auto* wherever we can and remove the 'cleanup' label. Signed-off-by: Daniel Henrique Barboza --- src/libxl/libxl_driver.c | 37 ++--- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index

[PATCH RESEND 15/20] qemu_cgroup.c: skip absent PCI devices in qemuTeardownHostdevCgroup()

2021-01-18 Thread Daniel Henrique Barboza
There is no need to bother with cgroup tearing down for absent PCI devices, given that their entries in the sysfs are already gone. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_cgroup.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/src/qemu/qemu_cgroup.c

[PATCH RESEND 18/20] virpci.c: use virPCIDeviceAddressPtr in virPCIDeviceListSteal()

2021-01-18 Thread Daniel Henrique Barboza
Signed-off-by: Daniel Henrique Barboza --- src/hypervisor/virhostdev.c | 8 +--- src/util/virpci.c | 6 +++--- src/util/virpci.h | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c index

[PATCH RESEND 03/20] domain_driver.c: use PCI address with virDomainDriverNodeDeviceGetPCIInfo()

2021-01-18 Thread Daniel Henrique Barboza
Instead of receiving 4 uints in order and write domain/bus/slot/function, receive a virPCIDeviceAddressPtr instead and write into it. This change will allow us to simplify the API for virPCIDeviceNew() in the next patch. Signed-off-by: Daniel Henrique Barboza --- src/hypervisor/domain_driver.c

[PATCH RESEND 17/20] virpci.c: use virPCIDeviceAddressPtr in virPCIDeviceListFind()

2021-01-18 Thread Daniel Henrique Barboza
Signed-off-by: Daniel Henrique Barboza --- src/hypervisor/virhostdev.c | 12 src/util/virpci.c | 16 src/util/virpci.h | 2 +- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/hypervisor/virhostdev.c

[PATCH RESEND 08/20] security_dac.c: modernize hostdev label set/restore functions

2021-01-18 Thread Daniel Henrique Barboza
Use g_auto* cleanup to avoid free() calls. Signed-off-by: Daniel Henrique Barboza --- src/security/security_dac.c | 49 +++-- 1 file changed, 14 insertions(+), 35 deletions(-) diff --git a/src/security/security_dac.c b/src/security/security_dac.c index

[PATCH RESEND 09/20] dac, selinux: skip setting/restoring label for absent PCI devices

2021-01-18 Thread Daniel Henrique Barboza
If the underlying PCI device of a hostdev does not exist in the host (e.g. a SR-IOV VF that was removed while the domain was running), skip security label handling for it. This will avoid errors that happens during qemuProcessStop() time, where a VF that was being used by the domain is not

[PATCH RESEND 13/20] virsh-domain.c: modernize cmdDetachDevice()

2021-01-18 Thread Daniel Henrique Barboza
Use g_auto* pointers to avoid the need of a cleanup label. The type of the pointer 'virDomainPtr dom' was changed to its alias 'virshDomainPtr' to allow the use of g_autoptr(). Signed-off-by: Daniel Henrique Barboza --- tools/virsh-domain.c | 18 ++ 1 file changed, 6

[PATCH RESEND 07/20] security_selinux.c: modernize set/restore hostdev subsys label functions

2021-01-18 Thread Daniel Henrique Barboza
Use g_auto* cleanup to avoid free() calls. Signed-off-by: Daniel Henrique Barboza --- src/security/security_selinux.c | 54 ++--- 1 file changed, 16 insertions(+), 38 deletions(-) diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index

[PATCH RESEND 06/20] virhostdev.c: virHostdevGetPCIHostDevice() now reports missing device

2021-01-18 Thread Daniel Henrique Barboza
Gitlab issue #72 [1] reports that removing SR-IOVs VFs before removing the devices from the running domains can have strange consequences. QEMU might be able to hotunplug the device inside the guest, but Libvirt will not be aware of that, and then the guest is now inconsistent with the domain

[PATCH RESEND 04/20] virpci.c: simplify virPCIDeviceNew() signature

2021-01-18 Thread Daniel Henrique Barboza
The current virPCIDeviceNew() signature, receiving 4 uints in sequence (domain, bus, slot, function), is not neat. We already have a way to represent a PCI address in virPCIDeviceAddress that is used in the code. Aside from the test files, most of virPCIDeviceNew() callers have access to a

[PATCH RESEND 05/20] virpci: introduce virPCIDeviceExists()

2021-01-18 Thread Daniel Henrique Barboza
We're going to add logic to handle the case where a previously existing PCI device does not longer exist in the host. The logic was copied from virPCIDeviceNew(), which verifies if a PCI device exists in the host, returning NULL and throwing an error if it doesn't. The NULL is used for other

[PATCH RESEND 10/20] libvirt-nodedev.c: remove return value from virNodeDeviceFree()

2021-01-18 Thread Daniel Henrique Barboza
The function returns -1 on error, but no caller is actually checking the return value. Making it 'void' makes more sense with its current use. Signed-off-by: Daniel Henrique Barboza --- include/libvirt/libvirt-nodedev.h | 2 +- src/libvirt-nodedev.c | 15 +++ 2 files

[PATCH RESEND 01/20] virpci, domain_audit: use virPCIDeviceAddressAsString()

2021-01-18 Thread Daniel Henrique Barboza
There is no need to open code the PCI address string format when we have a function that does exactly that. Signed-off-by: Daniel Henrique Barboza --- src/conf/domain_audit.c | 6 +- src/util/virpci.c | 6 ++ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git

[PATCH RESEND 02/20] qemu, lxc: move NodeDeviceGetPCIInfo() function to domain_driver.c

2021-01-18 Thread Daniel Henrique Barboza
libxlNodeDeviceGetPCIInfo() and qemuNodeDeviceGetPCIInfo() are equal. Let's move the logic to a new virDomainDriverNodeDeviceGetPCIInfo() info to be used by libxl_driver.c and qemu_driver.c. Signed-off-by: Daniel Henrique Barboza --- src/hypervisor/domain_driver.c | 33

[PATCH RESEND 00/20] handle missing SR-IOV VF hostdevs during running domains

2021-01-18 Thread Daniel Henrique Barboza
This is the rebased version of https://www.redhat.com/archives/libvir-list/2021-January/msg00028.html with master at 57b1ddcaaa5b5. No changes made aside from trivial conflicts fixes. I also removed the military jargon from the previous subject to make it clear what this series is doing.

[PATCH] meson: fix vstorage driver build

2021-01-18 Thread Nikolay Shirokovskiy
It breaks on using - in VSTORAGE-MOUNT definition with: In file included from ../config.h:19:0, from ../src/util/viraudit.c:22: ./meson-config.h:180:17: error: ISO C99 requires whitespace after the macro name [-Werror] #define VSTORAGE-MOUNT "/usr/bin/vstorage-mount" ^

[libvirt PATCH] qemu_validate: Allow kvm hint-dedicated on non-passthrough VMs

2021-01-18 Thread Tim Wiederhake
A VM defined similar to: ... ... is currently invalid, as hint-dedicated is only allowed if cpu mode is host-passthrough. This restriction is unnecessary, see https://bugzilla.redhat.com/show_bug.cgi?id=1857671. Signed-off-by: Tim Wiederhake --- src/qemu/qemu_validate.c | 11

Re: [PATCH 2/2] conf: Move generation of NVDIMM UUID into post parse callback

2021-01-18 Thread Peter Krempa
On Mon, Jan 18, 2021 at 15:15:54 +0100, Michal Privoznik wrote: > It's better to fill in missing values in post parse callbacks > than during parsing. > > Signed-off-by: Michal Privoznik > --- > src/conf/domain_conf.c | 35 ++- > 1 file changed, 22 insertions(+),

Re: [PATCH 1/2] conf: Turn @uuid member of _virDomainMemoryDef struct into a pointer

2021-01-18 Thread Peter Krempa
On Mon, Jan 18, 2021 at 15:15:53 +0100, Michal Privoznik wrote: > The _virDomainMemoryDef structure has @uuid member which is > needed for PPC64 guests. No other architectures use it. Since the > member is VIR_UUID_BUFLEN bytes long, the structure is > unnecessary big. If the member is just a

[PATCH 0/2] Move generation of NVDIMM UUID into post parse callback

2021-01-18 Thread Michal Privoznik
I've noticed this while working on virtio-pmem-pci patches. Michal Prívozník (2): conf: Turn @uuid member of _virDomainMemoryDef struct into a pointer conf: Move generation of NVDIMM UUID into post parse callback src/conf/domain_conf.c | 47 +

[PATCH 2/2] conf: Move generation of NVDIMM UUID into post parse callback

2021-01-18 Thread Michal Privoznik
It's better to fill in missing values in post parse callbacks than during parsing. Signed-off-by: Michal Privoznik --- src/conf/domain_conf.c | 35 ++- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c

[PATCH 1/2] conf: Turn @uuid member of _virDomainMemoryDef struct into a pointer

2021-01-18 Thread Michal Privoznik
The _virDomainMemoryDef structure has @uuid member which is needed for PPC64 guests. No other architectures use it. Since the member is VIR_UUID_BUFLEN bytes long, the structure is unnecessary big. If the member is just a pointer then we can also replace some calls of virUUIDIsValid() with plain

Re: [PATCH] storage: Linstor support

2021-01-18 Thread Andrea Bolognani
On Mon, 2021-01-18 at 14:12 +0100, Peter Krempa wrote: > On Fri, Jan 15, 2021 at 08:16:47 +0100, Rene Peinthor wrote: > > +#define LINSTORCLI "linstor" > > This should be defined via the build system once you detect where the > program is located, to prevent PATH env variable from playing a role

Re: [PATCH] storage: Linstor support

2021-01-18 Thread Peter Krempa
On Fri, Jan 15, 2021 at 08:16:47 +0100, Rene Peinthor wrote: > Implement a LINSTOR backend storage driver. > The Linstor client needs to be installed and it needs to be configured > on the nodes used by the controller. > > It supports most pool/vol commands, except for pool-build/pool-delete >

[PATCH] storage: Linstor support

2021-01-18 Thread Rene Peinthor
Implement a LINSTOR backend storage driver. The Linstor client needs to be installed and it needs to be configured on the nodes used by the controller. It supports most pool/vol commands, except for pool-build/pool-delete and provides a block device in RAW file mode. Linstor supports more than

Re: [PATCH v2] spec: Add the man pages of split daemons

2021-01-18 Thread Daniel P . Berrangé
On Sat, Jan 16, 2021 at 03:16:18PM +0800, Han Han wrote: > Fix the errors from commit a7cafa7bc2 when build RPMs from spec file: > error: Installed (but unpackaged) file(s) found: >/usr/share/man/man8/virtinterfaced.8.gz >/usr/share/man/man8/virtlxcd.8.gz >

Re: [libvirt PATCH] meson: Fix build with -Dtest_coverage=true

2021-01-18 Thread Pavel Hrdina
On Mon, Jan 18, 2021 at 09:23:34AM +0100, Jiri Denemark wrote: > As can be seen in commit 8a62a1592ae00eab4eb153c02661e56b9d8d9032 (from > autoconf era), the coverage flags have to be used also when linking > objects. However, this was not reflected when we switched to meson. > > Signed-off-by:

[libvirt PATCH] meson: Fix build with -Dtest_coverage=true

2021-01-18 Thread Jiri Denemark
As can be seen in commit 8a62a1592ae00eab4eb153c02661e56b9d8d9032 (from autoconf era), the coverage flags have to be used also when linking objects. However, this was not reflected when we switched to meson. Signed-off-by: Jiri Denemark --- src/meson.build | 1 +