Re: [libvirt] [PATCH] conf: utility function to update entry in def->nets array

2019-09-26 Thread Michal Privoznik
On 9/25/19 6:57 PM, Laine Stump wrote: A virDomainNetDef object in a domain's nets array might contain a virDomainHostdevDef, and when this is the case, the domain's hostdevs array will also have a pointer to this embedded hostdev (this is done so that internal functions that need to perform

Re: [libvirt] [PATCH 4/6] qemu_driver: use VIR_AUTOFREE() with strings 1/3

2019-09-26 Thread Erik Skultety
On Wed, Sep 18, 2019 at 11:56:56AM -0300, Daniel Henrique Barboza wrote: > VIR_AUTOFREE is a beautiful macro. Let's use it across the board > inside qemu_driver.c to make the code a bit tidier and smaller, > sparing VIR_FREE() calls and sometimes a whole 'cleanup' > label. > > This is a huge

Re: [libvirt] [PATCH 0/2] conf: refresh network ports missing from network driver

2019-09-26 Thread Michal Privoznik
On 9/22/19 1:59 AM, Laine Stump wrote: Patch 2/2 is the actual fix. 1/2 is just to make the fix simpler. NB: these two patches should also be included with the other patches for https://bugzilla.redhat.com/1745815 Laine Stump (2): conf: take advantage of VIR_AUTO* in

Re: [libvirt] [PATCH 1.5/3] conf: use VIR_AUTOPTR as much as possible for virNetworkPortDefPtr

2019-09-26 Thread Michal Privoznik
On 9/23/19 3:08 AM, Laine Stump wrote: Since the VIR_DEFINE_AUTOPTR_FUNC() was added for virNetworkPortDefPtr, I decided to convert all uses of virNetworkPortDefPtr that were appropriate to use VIR_AUTOPTR. This could be squashed into patch 1/2, or left separate, or just completely dropped.

Re: [libvirt] [PATCH 2/6] qemu_driver: use VIR_AUTOUNREF() with virQEMUDriverConfigPtr 2/3

2019-09-26 Thread Erik Skultety
On Wed, Sep 18, 2019 at 11:56:54AM -0300, Daniel Henrique Barboza wrote: > virQEMUDriverConfigPtr can be auto-unref for the great majority > of the uses made in qemu_driver, sparing us a virObjectUnref() > call and sometimes a whole 'cleanup' label. > > This patch changes virQEMUDriverConfigPtr

Re: [libvirt] [PATCH 6/6] qemu_driver: use VIR_AUTOFREE() with strings 3/3

2019-09-26 Thread Erik Skultety
On Wed, Sep 18, 2019 at 11:56:58AM -0300, Daniel Henrique Barboza wrote: > VIR_AUTOFREE is a beautiful macro. Let's use it across the board > inside qemu_driver.c to make the code a bit tidier and smaller, > sparing VIR_FREE() calls and sometimes a whole 'cleanup' > label. > > This is the last

Re: [libvirt] [PATCH 3/6] qemu_driver: use VIR_AUTOUNREF() with virQEMUDriverConfigPtr 3/3

2019-09-26 Thread Erik Skultety
On Wed, Sep 18, 2019 at 11:56:55AM -0300, Daniel Henrique Barboza wrote: > virQEMUDriverConfigPtr can be auto-unref for the great majority > of the uses made in qemu_driver, sparing us a virObjectUnref() > call and sometimes a whole 'cleanup' label. > > This patch changes virQEMUDriverConfigPtr

Re: [libvirt] [PATCH v3 08/11] driver.c: change URI validation to handle QEMU and vbox case

2019-09-26 Thread Daniel Henrique Barboza
On 9/25/19 7:58 PM, Cole Robinson wrote: On 9/25/19 9:50 AM, Daniel Henrique Barboza wrote: The existing QEMU and vbox URI path validation consider that a privileged user can use both a "/system" and a "/session" URI. This differs from all the other drivers that forbids the root user to use

Re: [libvirt] [PATCH v3 03/22] build-aux: rewrite po file minimizer in Python

2019-09-26 Thread Ján Tomko
On Thu, Sep 26, 2019 at 02:16:04PM +0100, Daniel P. Berrangé wrote: On Thu, Sep 26, 2019 at 12:39:39PM +0200, Erik Skultety wrote: On Tue, Sep 24, 2019 at 03:58:44PM +0100, Daniel P. Berrangé wrote: question 1) what's the benefit of compiling a regex and using it only once? Btw python does

Re: [libvirt] [PATCH v3 02/22] build-aux: rewrite augest test generator in Python

2019-09-26 Thread Ján Tomko
On Wed, Sep 25, 2019 at 03:17:10PM +0100, Daniel P. Berrangé wrote: On Wed, Sep 25, 2019 at 03:25:39PM +0200, Ján Tomko wrote: On Tue, Sep 24, 2019 at 03:58:43PM +0100, Daniel P. Berrangé wrote: > As part of an goal to eliminate Perl from libvirt build tools, > rewrite the augeas-gentest.pl

Re: [libvirt] [PATCH v2 5/7] qemu: driver: Move checkpoint-related code to qemu_checkpoint.c

2019-09-26 Thread Eric Blake
On 9/25/19 7:54 AM, Peter Krempa wrote: Move all extensive functions to a new file so that we don't just pile everything in the common files. This obviously isn't possible with straight code movement as we still need stubs in qemu_driver.c Additionally some functions e.g. for looking up a

Re: [libvirt] [PATCH v3 03/22] build-aux: rewrite po file minimizer in Python

2019-09-26 Thread Daniel P . Berrangé
On Thu, Sep 26, 2019 at 05:34:49PM +0200, Ján Tomko wrote: > On Thu, Sep 26, 2019 at 02:16:04PM +0100, Daniel P. Berrangé wrote: > > On Thu, Sep 26, 2019 at 12:39:39PM +0200, Erik Skultety wrote: > > > On Tue, Sep 24, 2019 at 03:58:44PM +0100, Daniel P. Berrangé wrote: > > > question 1) what's the

[libvirt] [PATCH 4/9] tests: qemumonitor: Add testing for the 'transaction' command and generators

2019-09-26 Thread Peter Krempa
Validate all the commands against the schema. Signed-off-by: Peter Krempa --- tests/qemumonitorjsontest.c | 39 + 1 file changed, 39 insertions(+) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index d0bbb1f674..8179e802c1 100644 ---

[libvirt] [PATCH 3/9] qemu: monitor: Add transaction generators for snapshot APIs

2019-09-26 Thread Peter Krempa
Unify with other code that generates parameters for the 'transaction' command. Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor.c | 21 + src/qemu/qemu_monitor.h | 11 +++ src/qemu/qemu_monitor_json.c | 35 +++

[libvirt] [PATCH 8/9] qemu: checkpoint: Fix rollback and access to unlocked 'vm' when deleting checkpoints

2019-09-26 Thread Peter Krempa
Delete/merge bitmaps when deleting checkpoints using a 'transaction' so that we don't have to deal with halfway-failed scenarios and also fix access to 'vm' while in the monitor lock. Signed-off-by: Peter Krempa --- src/qemu/qemu_checkpoint.c | 47 +++--- 1 file

[libvirt] [PATCH 7/9] qemu: monitor: unexport qemuMonitorJSONTransactionAdd

2019-09-26 Thread Peter Krempa
Now it's not used outside of qemu_monitor_json.c. Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor_json.c | 2 +- src/qemu/qemu_monitor_json.h | 4 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index

[libvirt] [PATCH 2/9] qemu: monitor: Add transaction generators for dirty bitmap APIs

2019-09-26 Thread Peter Krempa
Rather than generating the transaction contents in random places add a unified set of APIs to generate the contents for a 'transaction' for the dirty bitmap APIs. Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor.c | 48 src/qemu/qemu_monitor.h | 24

[libvirt] [PATCH 0/9] qemu: Refactor transaction actions handling and refactor checkpoint deletion

2019-09-26 Thread Peter Krempa
This should be applied on top of the checkpoints split. Pushing it requires the interlocking patches for checkpoints being merged as the bitmap removal QMP command is transactionable only since qemu 4.2. That is also the reason for the addition of the capabilities of qemu 4.2. Peter Krempa (9):

[libvirt] [PATCH 6/9] qemu: checkpoint: Replace open-coded transaction action generators

2019-09-26 Thread Peter Krempa
Use the generators provided by the monitor code instead. Signed-off-by: Peter Krempa --- src/qemu/qemu_checkpoint.c | 14 ++ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 30d1b6ae3a..04320b8e39 100644 ---

[libvirt] [PATCH 5/9] qemu: block: Replace snapshot transaction action generator

2019-09-26 Thread Peter Krempa
Use the new generator residing in the monitor code rather than directly using qemuMonitorJSONTransactionAdd. Signed-off-by: Peter Krempa --- src/qemu/qemu_block.c | 21 - 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/qemu/qemu_block.c

[libvirt] [PATCH v2 13/39] virpci: Introduce and use virPCIDeviceAddressGetIOMMUGroupDev

2019-09-26 Thread Michal Privoznik
Sometimes, we have a PCI address and not fully allocated virPCIDevice and yet we still want to know its /dev/vfio/N path. Introduce virPCIDeviceAddressGetIOMMUGroupDev() function exactly for that. Signed-off-by: Michal Privoznik --- src/libvirt_private.syms | 1 + src/qemu/qemu_domain.c | 10

[libvirt] [PATCH v2 07/39] qemu: Explicitly add/remove /dev/vfio/vfio to/from NS/CGroups

2019-09-26 Thread Michal Privoznik
In near future, the decision what to do with /dev/vfio/vfio with respect to domain namespace and CGroup is going to be moved out of qemuDomainGetHostdevPath() because there will be some other types of devices than hostdevs that need access to VFIO. All functions that I'm changing assume that

[libvirt] [PATCH v2 14/39] virHostdevPreparePCIDevices: Separate out function body

2019-09-26 Thread Michal Privoznik
In near future we will have a list of PCI devices we want to detach (held in virPCIDeviceListPtr) but we don't have virDomainHostdevDefPtr. That's okay because virHostdevPreparePCIDevices() works with virPCIDeviceListPtr mostly anyway. And in very few places where it needs virDomainHostdevDefPtr

[libvirt] [PATCH v2 09/39] qemuDomainGetHostdevPath: Drop @freeTmpPath

2019-09-26 Thread Michal Privoznik
The @freeTmpPath boolean is used to determine if @tmpPath holds an allocated memory or is a pointer to a constant string and therefore if it needs to be freed or not when returning from the function. Well, we can unify the way we set @tmpPath so that it always holds an allocated memory and thus

Re: [libvirt] [PATCH v2 1/7] qemu: Move, rename and export qemuDomObjFromDomain

2019-09-26 Thread Ján Tomko
On Wed, Sep 25, 2019 at 02:54:37PM +0200, Peter Krempa wrote: Move it to qemu_domain.c and rename it to qemuDomainObjFromDomain. This will allow reusing it after splitting out checkpoint code from qemu_driver.c. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 31 +

Re: [libvirt] [PATCH v2 6/7] qemu: domain: Move checkpoint related code to qemu_checkpoint.c

2019-09-26 Thread Eric Blake
On 9/25/19 7:54 AM, Peter Krempa wrote: Signed-off-by: Peter Krempa --- src/qemu/qemu_checkpoint.c | 185 ++--- src/qemu/qemu_checkpoint.h | 5 + src/qemu/qemu_domain.c | 162 +--- src/qemu/qemu_domain.h | 15 --- 4

Re: [libvirt] [PATCH 1.5/3] conf: use VIR_AUTOPTR as much as possible for virNetworkPortDefPtr

2019-09-26 Thread Laine Stump
On 9/26/19 2:52 AM, Michal Privoznik wrote: On 9/23/19 3:08 AM, Laine Stump wrote: Since the VIR_DEFINE_AUTOPTR_FUNC() was added for virNetworkPortDefPtr, I decided to convert all uses of virNetworkPortDefPtr that were appropriate to use VIR_AUTOPTR. This could be squashed into patch 1/2, or

Re: [libvirt] [PATCH v3 02/22] build-aux: rewrite augest test generator in Python

2019-09-26 Thread Peter Krempa
On Thu, Sep 26, 2019 at 16:40:54 +0100, Daniel Berrange wrote: > On Thu, Sep 26, 2019 at 05:35:46PM +0200, Ján Tomko wrote: > > On Wed, Sep 25, 2019 at 03:17:10PM +0100, Daniel P. Berrangé wrote: > > > On Wed, Sep 25, 2019 at 03:25:39PM +0200, Ján Tomko wrote: > > > > On Tue, Sep 24, 2019 at

[libvirt] [PATCH 9/9] qemu: monitor: Remove non-transaction based dirty bitmap APIs

2019-09-26 Thread Peter Krempa
We replaced them by use of transaction to simplify possible failure scenarios. Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor.c | 51 --- src/qemu/qemu_monitor.h | 19 -- src/qemu/qemu_monitor_json.c | 119 ---

Re: [libvirt] [PATCH v3 05/22] build-aux: rewrite whitespace checker in Python

2019-09-26 Thread Ján Tomko
On Tue, Sep 24, 2019 at 03:58:46PM +0100, Daniel P. Berrangé wrote: As part of an goal to eliminate Perl from libvirt build tools, rewrite the check-spacing.pl tool in Python. This was a straight conversion, manually going line-by-line to change the syntax from Perl to Python. Thus the overall

[libvirt] [PATCH v2 03/39] conf: Introduce virDomainDefHasMdevHostdev

2019-09-26 Thread Michal Privoznik
Signed-off-by: Michal Privoznik --- src/conf/domain_conf.c | 14 ++ src/conf/domain_conf.h | 3 +++ src/libvirt_private.syms | 1 + 3 files changed, 18 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index adf8455579..c1769f743b 100644 ---

[libvirt] [PATCH v2 04/39] qemu_hostdev: Introduce qemuHostdevNeedsVFIO()

2019-09-26 Thread Michal Privoznik
There are two types of host devices that require /dev/vfio/vfio access: 1) PCI devices with VFIO backend 2) Mediated devices Introduce a simple helper that returns true if passed @hostdev falls in either of the categories. Signed-off-by: Michal Privoznik --- src/qemu/qemu_hostdev.c | 9

[libvirt] [PATCH v2 11/39] qemuDomainGetHostdevPath: Don't include /dev/vfio/vfio in returned paths

2019-09-26 Thread Michal Privoznik
Now that all callers of qemuDomainGetHostdevPath() handle /dev/vfio/vfio on their own, we can safely drop handling in this function. In near future the decision whether domain needs VFIO file is going to include more device types than just virDomainHostdev. Signed-off-by: Michal Privoznik ---

[libvirt] [PATCH v2 02/39] virhostdev: Introduce and use virHostdevIsVFIODevice

2019-09-26 Thread Michal Privoznik
In some places we need to check if a hostdev has VFIO backend. Because of how complicated virDomainHostdevDef structure is, the check consists of three lines. Move them to a function and replace all checks with the function call. Signed-off-by: Michal Privoznik --- src/conf/domain_conf.c | 5

[libvirt] [PATCH v2 01/39] virhostdev: Fix const correctness of virHostdevIs{PCINet, SCSI, Mdev}Device()

2019-09-26 Thread Michal Privoznik
These functions do not change any of the passed hostdevs. They just read them. Signed-off-by: Michal Privoznik --- src/util/virhostdev.c | 6 +++--- src/util/virhostdev.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index

[libvirt] [PATCH v2 08/39] qemu_domain: Drop few useless checks in qemuDomainGetHostdevPath

2019-09-26 Thread Michal Privoznik
There are three cases where vir*DeviceGetPath() returns a const string. In these cases, the string is initialized in corresponding vir*DeviceNew() calls which fail if string couldn't be allocated. There's no point in checking the second time if the string is NULL. Signed-off-by: Michal Privoznik

[libvirt] [PATCH v2 00/39] Introduce NVMe support

2019-09-26 Thread Michal Privoznik
v2 of: https://www.redhat.com/archives/libvir-list/2019-July/msg00675.html As usual, you can find my patches on my github: https://github.com/zippy2/libvirt/tree/nvme_v3 https://travis-ci.org/zippy2/libvirt/builds/590033775 (Yeah, my branch is really called _v3 because reasons) diff to v1: -

[libvirt] [PATCH v2 12/39] qemu: Drop some 'cleanup' labels

2019-09-26 Thread Michal Privoznik
Previous patches rendered some of 'cleanup' labels needless. Drop them. Signed-off-by: Michal Privoznik --- src/qemu/qemu_cgroup.c | 25 --- src/qemu/qemu_domain.c | 56 +- 2 files changed, 32 insertions(+), 49 deletions(-) diff --git

[libvirt] [PATCH v2 05/39] qemu: Introduce qemuDomainNeedsVFIO

2019-09-26 Thread Michal Privoznik
Signed-off-by: Michal Privoznik --- src/qemu/qemu_domain.c | 9 + src/qemu/qemu_domain.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 824bca89f4..6502c6191c 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c

Re: [libvirt] [PATCH v3 02/22] build-aux: rewrite augest test generator in Python

2019-09-26 Thread Daniel P . Berrangé
On Thu, Sep 26, 2019 at 05:58:47PM +0200, Peter Krempa wrote: > On Thu, Sep 26, 2019 at 16:40:54 +0100, Daniel Berrange wrote: > > On Thu, Sep 26, 2019 at 05:35:46PM +0200, Ján Tomko wrote: > > > On Wed, Sep 25, 2019 at 03:17:10PM +0100, Daniel P. Berrangé wrote: > > > > On Wed, Sep 25, 2019 at

[libvirt] [PATCH v4 07/12] storage_driver.c: use virConnectValidateURIPath()

2019-09-26 Thread Daniel Henrique Barboza
Suggested-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- src/storage/storage_driver.c | 19 --- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index ce10b55ed0..d160ff34fe 100644 ---

[libvirt] [PATCH v4 05/12] node_device_driver.c: use virConnectValidateURIPath()

2019-09-26 Thread Daniel Henrique Barboza
Suggested-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- src/node_device/node_device_driver.c | 19 --- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c index

[libvirt] [PATCH v4 12/12] tests: add a test for driver.c:virConnectValidateURIPath()

2019-09-26 Thread Daniel Henrique Barboza
Signed-off-by: Daniel Henrique Barboza --- I've made this test file to make sure I wasn't messing up with the logic at patch 8. The idea of having this test seems okay, but probably I could do it shorter/cleaner. Feel free to discard it if it's not applicable or unnecessary. Adding this new

[libvirt] [PATCH v4 08/12] driver.c: change URI validation to handle QEMU and vbox case

2019-09-26 Thread Daniel Henrique Barboza
The existing QEMU and vbox URI path validation consider that a privileged user can use both a "/system" and a "/session" URI. This differs from all the other drivers that forbids the root user to use "/session" URI. Let's update virConnectValidateURIPath() to handle these cases as exceptions,

[libvirt] [PATCH v4 11/12] vbox_driver.c: use virConnectValidateURIPath()

2019-09-26 Thread Daniel Henrique Barboza
Suggested-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- src/vbox/vbox_driver.c | 16 ++-- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c index 1f31fa28df..d7e80828ab 100644 --- a/src/vbox/vbox_driver.c

[libvirt] [PATCH v4 04/12] bridge_driver.c: virConnectValidateURIPath()

2019-09-26 Thread Daniel Henrique Barboza
Suggested-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- src/network/bridge_driver.c | 19 --- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index c54be96407..c617bbb58f 100644 ---

[libvirt] [PATCH v4 10/12] vbox_common.c: use virConnectValidateURIPath()

2019-09-26 Thread Daniel Henrique Barboza
Suggested-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- src/vbox/vbox_common.c | 16 ++-- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index ddabcb80ca..d3b8fb625f 100644 --- a/src/vbox/vbox_common.c

Re: [libvirt] [PATCH] domain_conf: Unref video private data in virDomainVideoDefClear()

2019-09-26 Thread Erik Skultety
On Thu, Sep 26, 2019 at 05:01:24PM +0200, Michal Privoznik wrote: > On 9/26/19 4:42 PM, Erik Skultety wrote: > > On Thu, Sep 26, 2019 at 04:25:05PM +0200, Michal Privoznik wrote: > > > The private data for video definition is created in > > > virDomainVideoDefNew() and we attempt to free it in > >

Re: [libvirt] [PATCH v3 02/22] build-aux: rewrite augest test generator in Python

2019-09-26 Thread Daniel P . Berrangé
On Thu, Sep 26, 2019 at 05:35:46PM +0200, Ján Tomko wrote: > On Wed, Sep 25, 2019 at 03:17:10PM +0100, Daniel P. Berrangé wrote: > > On Wed, Sep 25, 2019 at 03:25:39PM +0200, Ján Tomko wrote: > > > On Tue, Sep 24, 2019 at 03:58:43PM +0100, Daniel P. Berrangé wrote: > > > > As part of an goal to

[libvirt] [PATCH v2 17/39] qemuMigrationSrcIsSafe: Rework slightly

2019-09-26 Thread Michal Privoznik
There are going to be more disk types that are considered unsafe with respect to migration. Therefore, move the error reporting call outside of if() body and rework if-else combo to switch(). Signed-off-by: Michal Privoznik --- src/qemu/qemu_migration.c | 25 - 1 file

[libvirt] [PATCH v2 18/39] schemas: Introduce disk type NVMe

2019-09-26 Thread Michal Privoznik
There is this class of PCI devices that act like disks: NVMe. Therefore, they are both PCI devices and disks. While we already have (and can assign a NVMe device to a domain successfully) we don't have disk representation. There are three problems with PCI assignment in case of a NVMe device: 1)

[libvirt] [PATCH v2 15/39] virHostdevReAttachPCIDevices: Separate out function body

2019-09-26 Thread Michal Privoznik
In near future we will have a list of PCI devices we want to re-attach to the host (held in virPCIDeviceListPtr) but we don't have virDomainHostdevDefPtr. That's okay because virHostdevReAttachPCIDevices() works with virPCIDeviceListPtr mostly anyway. And in very few places where it needs

[libvirt] [PATCH v2 37/39] qemu: Allow forcing VFIO when computing memlock limit

2019-09-26 Thread Michal Privoznik
With NVMe disks, one can start a blockjob with a NVMe disk that is not visible in domain XML (at least right away). Usually, it's fairly easy to override this limitation of qemuDomainGetMemLockLimitBytes() - for instance for hostdevs we temporarily add the device to domain def, let the function

[libvirt] [PATCH v2 25/39] virhostdevtest: Test virNVMeDevice assignment

2019-09-26 Thread Michal Privoznik
Signed-off-by: Michal Privoznik ACKed-by: Peter Krempa --- tests/virhostdevtest.c | 97 ++ 1 file changed, 97 insertions(+) diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c index 46627355c3..fde7f92bc4 100644 --- a/tests/virhostdevtest.c +++

[libvirt] [PATCH v2 21/39] domain_conf: Introduce virDomainDefHasNVMeDisk

2019-09-26 Thread Michal Privoznik
This function will return true if any of disks (or their backing chain) for given domain contains an NVMe disk. Signed-off-by: Michal Privoznik ACKed-by: Peter Krempa --- src/conf/domain_conf.c | 14 ++ src/conf/domain_conf.h | 3 +++ src/libvirt_private.syms | 1 + 3 files

Re: [libvirt] [PATCH] conf: utility function to update entry in def->nets array

2019-09-26 Thread Laine Stump
On 9/26/19 11:51 AM, Laine Stump wrote: On 9/26/19 3:28 AM, Michal Privoznik wrote: On 9/25/19 6:57 PM, Laine Stump wrote: diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0753904472..5f63c4f51e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -8786,8

Re: [libvirt] [PATCH v2 2/7] conf: Drop pointless 'domain' argument from virDomainCheckpointRedefinePrep

2019-09-26 Thread Ján Tomko
On Wed, Sep 25, 2019 at 02:54:38PM +0200, Peter Krempa wrote: 'vm' is passed in which contains the definition which contains the UUID so we don't need another parameter for this. Signed-off-by: Peter Krempa --- src/conf/checkpoint_conf.c | 7 +++ src/conf/checkpoint_conf.h | 3 +--

[libvirt] [PATCH v2 34/39] qemu: Generate command line of NVMe disks

2019-09-26 Thread Michal Privoznik
Now, that we have everything prepared, we can generate command line for NVMe disks. Signed-off-by: Michal Privoznik --- src/qemu/qemu_block.c | 25 - src/qemu/qemu_command.c | 3 ++ src/qemu/qemu_process.c | 7 +++

[libvirt] [PATCH v2 39/39] virsh: Introduce nvme disk to domblklist

2019-09-26 Thread Michal Privoznik
This is slightly more complicated because NVMe disk source is not a simple attribute to element. The format in which the PCI address and namespace ID are printed is the same as QEMU accepts them: nvme://:XX:XX.X/X Signed-off-by: Michal Privoznik --- tools/virsh-domain-monitor.c | 31

Re: [libvirt] [PATCH 3/6] qemu_driver: use VIR_AUTOUNREF() with virQEMUDriverConfigPtr 3/3

2019-09-26 Thread Daniel Henrique Barboza
On 9/26/19 6:18 AM, Erik Skultety wrote: On Wed, Sep 18, 2019 at 11:56:55AM -0300, Daniel Henrique Barboza wrote: virQEMUDriverConfigPtr can be auto-unref for the great majority of the uses made in qemu_driver, sparing us a virObjectUnref() call and sometimes a whole 'cleanup' label. This

Re: [libvirt] [PATCH] domain_conf: Unref video private data in virDomainVideoDefClear()

2019-09-26 Thread Erik Skultety
On Thu, Sep 26, 2019 at 04:25:05PM +0200, Michal Privoznik wrote: > The private data for video definition is created in > virDomainVideoDefNew() and we attempt to free it in > virDomainVideoDefFree(). This seems to work, except > the free function calls clear function which zeroes > out the whole

[libvirt] [PATCH v4 01/12] src/driver.c: add virConnectValidateURIPath()

2019-09-26 Thread Daniel Henrique Barboza
The code to validate the URI path is repeated across several files. This patch creates a common validation code to be used across all of them. Suggested-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- src/driver.c | 26 ++ src/driver.h

[libvirt] [PATCH v4 03/12] interface_backend_udev.c: use virConnectValidateURIPath()

2019-09-26 Thread Daniel Henrique Barboza
Suggested-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- src/interface/interface_backend_udev.c | 19 --- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c index

[libvirt] [PATCH v4 02/12] interface_backend_netcf.c: use virConnectValidateURIPath()

2019-09-26 Thread Daniel Henrique Barboza
Suggested-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- src/interface/interface_backend_netcf.c | 19 --- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c index

[libvirt] [PATCH v4 00/12] remove repetition of URI path validation

2019-09-26 Thread Daniel Henrique Barboza
This is a code repetition that I crossed a few times, then I noticed that Cole Robinson suggested a solution for it in the wiki. Here it is. changes from v3: - patch 8: fix the exception logic, move the code formatting to patch 1 - patch 9: use lowcase 'qemu' - patch 12: (optional) test case I

[libvirt] [PATCH v4 09/12] qemu_driver.c: use virConnectValidateURIPath()

2019-09-26 Thread Daniel Henrique Barboza
Suggested-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_driver.c | 20 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0c65414a1a..cf9c06f274 100644 ---

[libvirt] [PATCH v4 06/12] secret_driver.c: use virConnectValidateURIPath()

2019-09-26 Thread Daniel Henrique Barboza
Suggested-by: Cole Robinson Signed-off-by: Daniel Henrique Barboza --- src/secret/secret_driver.c | 19 --- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c index 7512a51c74..ed3bd3c751 100644 ---

Re: [libvirt] [PATCH] domain_conf: Unref video private data in virDomainVideoDefClear()

2019-09-26 Thread Michal Privoznik
On 9/26/19 4:42 PM, Erik Skultety wrote: On Thu, Sep 26, 2019 at 04:25:05PM +0200, Michal Privoznik wrote: The private data for video definition is created in virDomainVideoDefNew() and we attempt to free it in virDomainVideoDefFree(). This seems to work, except the free function calls clear

Re: [libvirt] [PATCH v2 4/7] qemu: driver: Remove misplaced qemuDomainObjEndJob in qemuDomainCheckpointGetXMLDesc

2019-09-26 Thread Eric Blake
On 9/25/19 7:54 AM, Peter Krempa wrote: The code that gets the job to refresh disk sizes was not merged yet so remove this artifact. Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 3 --- 1 file changed, 3 deletions(-) Reviewed-by: Eric Blake diff --git

Re: [libvirt] [PATCH v2 5/7] qemu: driver: Move checkpoint-related code to qemu_checkpoint.c

2019-09-26 Thread Peter Krempa
On Thu, Sep 26, 2019 at 10:38:11 -0500, Eric Blake wrote: > On 9/25/19 7:54 AM, Peter Krempa wrote: > > Move all extensive functions to a new file so that we don't just pile > > everything in the common files. This obviously isn't possible with > > straight code movement as we still need stubs in

[libvirt] [PATCH v2 20/39] virstoragefile: Introduce virStorageSourceChainHasNVMe

2019-09-26 Thread Michal Privoznik
This function will return true if there's a storage source of type VIR_STORAGE_TYPE_NVME, or false otherwise. Signed-off-by: Michal Privoznik ACKed-by: Peter Krempa --- src/libvirt_private.syms | 1 + src/util/virstoragefile.c | 14 ++ src/util/virstoragefile.h | 2 ++ 3 files

[libvirt] [PATCH v2 22/39] util: Introduce virNVMeDevice module

2019-09-26 Thread Michal Privoznik
This module will be used by virHostdevManager and it's inspired by virPCIDevice module. They are very similar except instead of what makes a NVMe device: PCI address AND namespace ID. This means that a NVMe device can appear in a domain multiple times, each time with a different namespace.

[libvirt] [PATCH v2 19/39] conf: Format and parse NVMe type disk

2019-09-26 Thread Michal Privoznik
To simplify implementation, some restrictions are added. For instance, an NVMe disk can't go to any bus but virtio and has to be type of 'disk' and can't have startupPolicy set. Signed-off-by: Michal Privoznik --- src/conf/domain_conf.c | 96 ++

[libvirt] [PATCH v2 23/39] virhostdev: Include virNVMeDevice module

2019-09-26 Thread Michal Privoznik
Now that we have virNVMeDevice module (introduced in previous commit), let's use it int virHostdev to track which NVMe devices are free to be used by a domain and which are taken. Signed-off-by: Michal Privoznik --- src/libvirt_private.syms | 5 + src/util/virhostdev.c| 332

[libvirt] [PATCH v2 16/39] virpci: Introduce virPCIDeviceAddressCopy

2019-09-26 Thread Michal Privoznik
This helper is cleaner than plain memcpy() because one doesn't have to look into virPCIDeviceAddress struct to see if it contains any strings / pointers. Signed-off-by: Michal Privoznik ACKed-by: Peter Krempa --- src/libvirt_private.syms | 1 + src/util/virpci.c| 14 ++

[libvirt] [PATCH v2 26/39] qemu: prepare NVMe devices too

2019-09-26 Thread Michal Privoznik
The qemu driver has its own wrappers around virHostdev module (so that some arguments are filled in automatically). Extend these to include NVMe devices too. Signed-off-by: Michal Privoznik ACKed-by: Peter Krempa --- src/qemu/qemu_hostdev.c | 49 ++---

[libvirt] [PATCH v2 27/39] qemu: Take NVMe disks into account when calculating memlock limit

2019-09-26 Thread Michal Privoznik
We have this beautiful function that does crystal ball divination. The function is named qemuDomainGetMemLockLimitBytes() and it calculates the upper limit of how much locked memory is given guest going to need. The function bases its guess on devices defined for a domain. For instance, if there

[libvirt] [PATCH v2 29/39] qemu: Mark NVMe disks as 'need VFIO'

2019-09-26 Thread Michal Privoznik
There are couple of places where a domain with a VFIO device gets special treatment: in CGroups when enabling/disabling access to /dev/vfio/vfio, and when creating/removing nodes in domain mount namespace. Well, a NVMe disk is a VFIO device too. Fortunately, we have this qemuDomainNeedsVFIO()

[libvirt] [PATCH v2 24/39] virpcimock: Introduce NVMe driver and devices

2019-09-26 Thread Michal Privoznik
The device configs (which are actually the same one config) come from a NVMe disk of mine. Signed-off-by: Michal Privoznik ACKed-by: Peter Krempa --- tests/virpcimock.c | 3 +++ tests/virpcitestdata/-01-00.0.config | Bin 0 -> 4096 bytes

[libvirt] [PATCH v2 28/39] qemu: Create NVMe disk in domain namespace

2019-09-26 Thread Michal Privoznik
If a domain has an NVMe disk configured, then we need to create /dev/vfio/* paths in domain's namespace so that qemu can open them. Signed-off-by: Michal Privoznik --- src/qemu/qemu_domain.c | 69 +++--- 1 file changed, 52 insertions(+), 17 deletions(-) diff

Re: [libvirt] [PATCH 1/9] DO NOT PUSH: tests: add qemu capabilities data for qemu 4.2

2019-09-26 Thread Jiri Denemark
On Thu, Sep 26, 2019 at 18:05:14 +0200, Peter Krempa wrote: > Currently I don't indend to push this as I'm waiting for some qemu > patches to be merged to allow detection of blockdev. > > This patch is necessary so that qemu's 'transaction' supports also > deletion of bitmaps which will be

Re: [libvirt] [PATCH v2 7/7] qemu: driver: Don't pull in qemu_monitor_json.h directly

2019-09-26 Thread Eric Blake
On 9/25/19 7:54 AM, Peter Krempa wrote: There's nothing that uses it directly now. Also not allowing direct use will promote our layering. Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 1 - 1 file changed, 1 deletion(-) Reviewed-by: Eric Blake diff --git

[libvirt] [PATCH 1/8] qemu: checkpoint: Refactor cleanup in qemuCheckpointCreateXML

2019-09-26 Thread Peter Krempa
Use VIR_AUTO* helpers and get rid of the 'cleanup' label. Signed-off-by: Peter Krempa --- src/qemu/qemu_checkpoint.c | 22 +- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 30d1b6ae3a..4430f69911

[libvirt] [PATCH 2/8] qemu: checkpoint: Remove open-ended TODOs

2019-09-26 Thread Peter Krempa
Once somebody is motivated enough to add the support for the quiesce flag or offline checkpoint deletion they are welcome to do so but we don't need to have a reminder. Signed-off-by: Peter Krempa --- src/qemu/qemu_checkpoint.c | 3 --- 1 file changed, 3 deletions(-) diff --git

[libvirt] [PATCH 0/8] qemu: Lock-out checkpoints until backups are ready

2019-09-26 Thread Peter Krempa
See patch 6/8 for the reasoning. This series applies on top of the v2 of splitting checkpoints into a separate file. Peter Krempa (8): qemu: checkpoint: Refactor cleanup in qemuCheckpointCreateXML qemu: checkpoint: Remove open-ended TODOs qemu: Simplify argument list of

[libvirt] [PATCH 4/8] qemu: Don't repeat virDomainObjEndAPI in qemuDomainBlockPull

2019-09-26 Thread Peter Krempa
Add a 'cleanup' label and use jumps as we do in other places. Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 71503898e4..3ad1699eb1 100644 ---

[libvirt] [PATCH 7/8] qemu: Aggregate interlocking of blockjobs by checkpoints in one place

2019-09-26 Thread Peter Krempa
Rather than having to fix 5 places once we support the combination add a function called by all the blockjob/snapshot APIs. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 21 + src/qemu/qemu_domain.h | 4 src/qemu/qemu_driver.c | 25 +

[libvirt] [PATCH 8/8] qemu: domain: Base block job interlocking on QEMU_CAPS_INCREMENTAL_BACKUP

2019-09-26 Thread Peter Krempa
The QEMU_CAPS_INCREMENTAL_BACKUP will be enabled once all bits of the incremental backup feature work as expected which means also properly interacting with blockjobs and snapshots. Thus we can allow blockjobs and snapshots if QEMU_CAPS_INCREMENTAL_BACKUP is present even when checkpoints exist.

[libvirt] [PATCH 6/8] qemu: checkpoint: Forbid creating checkpoints until we support backups

2019-09-26 Thread Peter Krempa
Checkpoints by themselves are not very useful for anything else than testing the few bitmap interactions that are currently implemented. It's very unlikely that anybody used this feature and thus we can disable it until we have a more complete implementation ready. Additionally the code for

[libvirt] [PATCH 3/8] qemu: Simplify argument list of qemuDomainBlockPullCommon

2019-09-26 Thread Peter Krempa
Drop the 'driver' argument since it can be extracted from private data to shorten the argument list. Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index

[libvirt] [PATCH 5/8] qemu: caps: Add capability for incremental backup support

2019-09-26 Thread Peter Krempa
Add a new all-covering capability which will be used to interlock incremental backup support until all bits are ready. --- src/qemu/qemu_capabilities.c | 3 +++ src/qemu/qemu_capabilities.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/qemu/qemu_capabilities.c

Re: [libvirt] [PATCH] conf: utility function to update entry in def->nets array

2019-09-26 Thread Laine Stump
On 9/26/19 3:28 AM, Michal Privoznik wrote: On 9/25/19 6:57 PM, Laine Stump wrote: diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0753904472..5f63c4f51e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -8786,8 +8786,10 @@

[libvirt] [PATCH v2 06/39] qemu_cgroup: Teardown Cgroup for more host device types

2019-09-26 Thread Michal Privoznik
Since its introduction in v1.0.5-rc1-19-g6e13860cb4 the qemuTeardownHostdevCgroup() does nothing unless the passed hostdev is a PCI device with VFIO backend. This seems unnecessary. Signed-off-by: Michal Privoznik --- src/qemu/qemu_cgroup.c | 8 +--- 1 file changed, 1 insertion(+), 7

[libvirt] [PATCH v2 10/39] qemuDomainGetHostdevPath: Use more VIR_AUTOFREE/VIR_AUTOPTR

2019-09-26 Thread Michal Privoznik
There are several variables which could be automatically freed upon return from the function. I'm not changing @tmpPaths (which is a string list) because it is going to be removed in next commit. Signed-off-by: Michal Privoznik --- src/qemu/qemu_domain.c | 18 ++ 1 file changed,

[libvirt] [PATCH v2 32/39] virSecuritySELinuxRestoreImageLabelInt: Don't skip non-local storage

2019-09-26 Thread Michal Privoznik
This function is currently not called for any type of storage source that is not considered 'local' (as defined by virStorageSourceIsLocalStorage()). Well, NVMe disks are not 'local' from that point of view and therefore we will need to call this function more frequently. Signed-off-by: Michal

[libvirt] [PATCH v2 30/39] qemu: Allow NVMe disk in CGroups

2019-09-26 Thread Michal Privoznik
If a domain has an NVMe disk configured, then we need to allow it on devices CGroup so that qemu can access it. There is one caveat though - if an NVMe disk is read only we need CGroup to allow write too. This is because when opening the device, qemu does couple of ioctl()-s which are considered

[libvirt] [PATCH v2 33/39] qemu_capabilities: Introduce QEMU_CAPS_DRIVE_NVME

2019-09-26 Thread Michal Privoznik
This capability tracks if qemu is capable of: -drive file.driver=nvme The feature was added in QEMU's commit of v2.12.0-rc0~104^2~2. Signed-off-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 4 src/qemu/qemu_capabilities.h | 3 +++

[libvirt] [PATCH v2 31/39] security_selinux: Simplify virSecuritySELinuxSetImageLabelInternal

2019-09-26 Thread Michal Privoznik
This function calls virSecuritySELinuxSetFilecon() or virSecuritySELinuxSetFileconOptional() from a lot of places. It works, because in all places we're passing src->path which is what we wanted. But not anymore. We will want to be able to pass a different path and thus the function must be

[libvirt] [PATCH v2 38/39] qemu_hotplug: Prepare NVMe disks on hotplug

2019-09-26 Thread Michal Privoznik
Signed-off-by: Michal Privoznik --- src/qemu/qemu_domain.c | 58 + src/qemu/qemu_hostdev.c | 22 src/qemu/qemu_hostdev.h | 6 + 3 files changed, 86 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index

[libvirt] [PATCH v2 35/39] qemu_monitor_text: Catch IOMMU/VFIO related errors in qemuMonitorTextAddDrive

2019-09-26 Thread Michal Privoznik
Because this is a HMP we're dealing with, there is nothing like class of reply message, so we have to do some string comparison to guess if the command fails. Well, with NVMe disks whole new class of errors comes to play because qemu needs to initialize IOMMU and VFIO for them. You can see all the

  1   2   >