Re: [libvirt] [PATCH v3 10/10] qemu: rename migration APIs to include Src or Dst in their name

2018-02-16 Thread John Ferlan
On 02/16/2018 06:22 AM, Daniel P. Berrangé wrote: > It is very difficult while reading the migration code trying to > understand whether a particular function is being called on the src side > or the dst side, or either. Putting "Src" or "Dst" in the method names will > make this much more obviou

Re: [libvirt] [PATCH v3 09/10] qemu: don't export migration job APIs

2018-02-16 Thread John Ferlan
On 02/16/2018 06:22 AM, Daniel P. Berrangé wrote: > These APIs are not required anywhere outside the migration code so need > not be exported to the rest of the QEMU driver. > > Signed-off-by: Daniel P. Berrangé > --- > src/qemu/qemu_migration.c | 43 +--

Re: [libvirt] [PATCH v3 08/10] qemu: remove virConnectPtr in some migration methods

2018-02-16 Thread John Ferlan
On 02/16/2018 06:22 AM, Daniel P. Berrangé wrote: > The qemuMigrationPrecreateStorage method needs a connection > to access the storage driver. Instead of passing it around, > open it at time of use. > > Signed-off-by: Daniel P. Berrangé > --- > src/qemu/qemu_driver.c| 16 +++ >

[libvirt] [PATCH] conf: move 'generated' member from virMacAddr to virDomainNetDef

2018-02-16 Thread Laine Stump
Commit 7e62c4cd26d (first appearing in libvirt-3.9.0 as a resolution to rhbz #1343919) added a "generated" attribute to virMacAddr that was set whenever a mac address was auto-generated by libvirt. This knowledge was used in a single place - when trying to match a NetDef from the domain to delete w

[libvirt] [PATCH v2 11/15] qemu: Validate PCI controllers (pcihole64)

2018-02-16 Thread Andrea Bolognani
Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 37 + 1 file changed, 37 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 52c76b515..b4dd7a7e8 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -445

[libvirt] [PATCH v2 08/15] qemu: Validate PCI controllers (index)

2018-02-16 Thread Andrea Bolognani
Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 56 -- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 9dc3d5597..e4e67c585 100644 --- a/src/qemu/qemu_domain.c +++ b/s

[libvirt] [PATCH v2 10/15] qemu: Validate PCI controllers (targetIndex)

2018-02-16 Thread Andrea Bolognani
Some test cases that were specifically set up to exploit the lack of checks on PCI controller options start failing with these changes, so they are marked as such. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 43 .../i440fx-controllers-pci

[libvirt] [PATCH v2 13/15] qemu: Validate PCI controllers (numaNode)

2018-02-16 Thread Andrea Bolognani
This change catches an invalid use of the option in our test suite. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 39 ++ tests/qemuxml2argvdata/pcie-expander-bus.xml | 3 -- tests/qemuxml2xmloutdata/pcie-expander-bus.xml | 4 +--

[libvirt] [PATCH v2 12/15] qemu: Validate PCI controllers (busNr)

2018-02-16 Thread Andrea Bolognani
This change catches an invalid use of the option in our test suite. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 31 ++ tests/qemuxml2argvdata/pcie-expander-bus.xml | 2 +- tests/qemuxml2xmloutdata/pcie-expander-bus.xml | 2 +-

[libvirt] [PATCH v2 14/15] qemu: Validate PCI controllers (chassisNr)

2018-02-16 Thread Andrea Bolognani
Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 31 +++ 1 file changed, 31 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 965a8384c..99573dee9 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4558,6 +4

[libvirt] [PATCH v2 05/15] qemu: Simplify modelName stringification

2018-02-16 Thread Andrea Bolognani
There's no need to perform checks before conversion, we can just go try and check the results later on. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_command.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command

[libvirt] [PATCH v2 04/15] qemu: Restrict scope in qemuBuildControllerDevStr()

2018-02-16 Thread Andrea Bolognani
Some variables are only used for PCI controllers, and we're going to add more soon. We can declare them in the 'case' scope rather than in the function scope to make it a bit nicer. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_command.c | 8 +--- 1 file changed, 5 insertions(+), 3 delet

[libvirt] [PATCH v2 00/15] qemu: Validate PCI controller options

2018-02-16 Thread Andrea Bolognani
Changes from [v1]: * error out instead of silently accept invalid options; * shave quite a lot of yaks. [v1] https://www.redhat.com/archives/libvir-list/2018-February/msg00244.html Andrea Bolognani (15): tests: Add some tests for PCI controller options qemu: Move 'done' label in qemuBui

[libvirt] [PATCH v2 02/15] qemu: Move 'done' label in qemuBuildControllerDevStr()

2018-02-16 Thread Andrea Bolognani
Even when we skip part of the processing, we still want error checking on the buffer. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 55e573b61..1ab5b0818 10064

[libvirt] [PATCH v2 15/15] qemu: Validate PCI controllers (chassis and port)

2018-02-16 Thread Andrea Bolognani
Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 43 +++ 1 file changed, 43 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 99573dee9..df725ed74 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @

[libvirt] [PATCH v2 09/15] qemu: Validate PCI controllers (modelName)

2018-02-16 Thread Andrea Bolognani
Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 110 + 1 file changed, 110 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e4e67c585..2f76464df 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_do

[libvirt] [PATCH v2 07/15] qemu: Clear out qemuDomainDeviceDefValidateControllerPCI()

2018-02-16 Thread Andrea Bolognani
We will rewrite pretty much every single line of this function over the course of the next several commits, and starting from a clean slate rather than replacing it bit by bit makes the resulting diffs unmeasurably easier to read and understand, and you need fewer of them to boot. Trust me, I tried

[libvirt] [PATCH v2 01/15] tests: Add some tests for PCI controller options

2018-02-16 Thread Andrea Bolognani
The input configurations set all existing options for all PCI controllers, to see what ends up showing up in the output. Signed-off-by: Andrea Bolognani --- .../i440fx-controllers-pciopts.args| 24 +++ .../i440fx-controllers-pciopts.xml | 36 ++ .../ps

[libvirt] [PATCH v2 06/15] qemu: Defer capability check to command line generation time

2018-02-16 Thread Andrea Bolognani
Validate time is a bit too early to check whether the required capabilities are available, since the QEMU binary might have been updated or replaced by the time we are asked to run the guest. Move capability checks (back) to qemuBuildControllerDevStr() and get rid of a lot of redundancy in the pro

[libvirt] [PATCH v2 03/15] qemu: Move skip for implicit PHB of pSeries guests

2018-02-16 Thread Andrea Bolognani
Performing the skip earlier will help us making the function nicer later on. We also make the condition for the skip a bit more precise, though that'a more for self-documenting purposes and doesn't change anything in practice. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_command.c | 12

Re: [libvirt] [PATCH v2 04/10] conf: stop passing virConnectPtr into virDomainDiskTranslateSourcePool

2018-02-16 Thread Jiri Denemark
On Fri, Feb 16, 2018 at 09:39:17 -0500, John Ferlan wrote: ... > Here's the command it uses: > > /usr/bin/virt-install --hvm --accelerate --name 'avocado-vt-vm1' \ >--memory=1024 --vcpu=2 --import --vnc --os-variant fedora25 \ >--serial pty --memballoon model=virtio --disk \ > path=/var/li

Re: [libvirt] [PATCH v2 04/10] conf: stop passing virConnectPtr into virDomainDiskTranslateSourcePool

2018-02-16 Thread John Ferlan
On 02/16/2018 08:48 AM, Jiri Denemark wrote: > On Thu, Feb 15, 2018 at 21:59:45 -0500, John Ferlan wrote: >> >> >> On 02/15/2018 11:50 AM, Daniel P. Berrangé wrote: >>> Rather than expecting callers to pass a virConnectPtr into the >>> virDomainDiskTranslateSourcePool() method, just acquire a con

Re: [libvirt] [PATCH v2 15/42] m4: disable gcc8 -Wcast-function-type warnings from -Wextra

2018-02-16 Thread Daniel P . Berrangé
On Thu, Feb 15, 2018 at 04:43:20PM +, Daniel P. Berrangé wrote: > The -Wextra flag bundle gained a new warning -Wcast-function-type. > This complains if you cast between two function prototypes where > the number of parameters or their data types are not compatible. > Unfortunately we need such

Re: [libvirt] [jenkins-ci PATCH] projects: Don't run virt-manager's test suite on FreeBSD

2018-02-16 Thread Pavel Hrdina
On Fri, Feb 16, 2018 at 03:06:45PM +0100, Andrea Bolognani wrote: > The libxml2 bindings are broken under Python 3.6, so we have > to disable this for the time being. > > Signed-off-by: Andrea Bolognani > --- > projects/virt-manager.yaml | 8 > 1 file changed, 8 insertions(+) Reviewed-

[libvirt] [jenkins-ci PATCH] projects: Don't run virt-manager's test suite on FreeBSD

2018-02-16 Thread Andrea Bolognani
The libxml2 bindings are broken under Python 3.6, so we have to disable this for the time being. Signed-off-by: Andrea Bolognani --- projects/virt-manager.yaml | 8 1 file changed, 8 insertions(+) diff --git a/projects/virt-manager.yaml b/projects/virt-manager.yaml index 8f3112e..e626c

Re: [libvirt] [PATCH v2 04/10] conf: stop passing virConnectPtr into virDomainDiskTranslateSourcePool

2018-02-16 Thread Jiri Denemark
On Thu, Feb 15, 2018 at 21:59:45 -0500, John Ferlan wrote: > > > On 02/15/2018 11:50 AM, Daniel P. Berrangé wrote: > > Rather than expecting callers to pass a virConnectPtr into the > > virDomainDiskTranslateSourcePool() method, just acquire a connection > > to the storage driver when needed. > >

Re: [libvirt] [PATCH 2/6] virObject: Introduce virObjectRecursiveLockableNew

2018-02-16 Thread John Ferlan
On 02/16/2018 04:47 AM, Michal Privoznik wrote: > On 02/16/2018 10:08 AM, Peter Krempa wrote: >> On Fri, Feb 16, 2018 at 09:52:53 +0100, Michal Privoznik wrote: >>> On 02/16/2018 09:34 AM, Pavel Hrdina wrote: On Mon, Feb 12, 2018 at 01:16:28PM +0100, Michal Privoznik wrote: > On 02/12/20

Re: [libvirt] [PATCH v2 02/10] conf: reimplement virDomainNetResolveActualType in terms of public API

2018-02-16 Thread Marc Hartmayer
On Thu, Feb 15, 2018 at 05:50 PM +0100, "Daniel P. Berrangé" wrote: > Now that we have the ability to easily open connections to secondary > drivers, eg network:///system, it is possible to reimplement the > virDomainNetResolveActualType method in terms of the public API. This > avoids the need

[libvirt] [PATCH v3 08/10] qemu: remove virConnectPtr in some migration methods

2018-02-16 Thread Daniel P . Berrangé
The qemuMigrationPrecreateStorage method needs a connection to access the storage driver. Instead of passing it around, open it at time of use. Signed-off-by: Daniel P. Berrangé --- src/qemu/qemu_driver.c| 16 +++ src/qemu/qemu_migration.c | 51 ++-

[libvirt] [PATCH v3 06/10] qemu: stop passing in virConnectPtr for looking up networks

2018-02-16 Thread Daniel P . Berrangé
When setting up graphics, we sometimes need to resolve networks, requiring the caller to pass in a virConnectPtr, except sometimes they pass in NULL. Use virGetConnectNetwork() to acquire the connection to the network driver when it is needed. Reviewed-by: John Ferlan Signed-off-by: Daniel P. Ber

[libvirt] [PATCH v3 02/10] conf: reimplement virDomainNetResolveActualType in terms of public API

2018-02-16 Thread Daniel P . Berrangé
Now that we have the ability to easily open connections to secondary drivers, eg network:///system, it is possible to reimplement the virDomainNetResolveActualType method in terms of the public API. This avoids the need to have the network driver provide a callback for it. Reviewed-by: John Ferla

[libvirt] [PATCH v3 03/10] qemu: stop passing virConnectPtr into qemuMonitorStartCPUs

2018-02-16 Thread Daniel P . Berrangé
There is a long standing hack to pass a virConnectPtr into the qemuMonitorStartCPUs method, so that when the text monitor prompts for a disk password, we can lookup virSecretPtr objects. This causes us to have to pass a virConnectPtr around through countless methods up the call chainexcept some

[libvirt] [PATCH v3 05/10] qemu: don't pass virConnectPtr around for secrets

2018-02-16 Thread Daniel P . Berrangé
During domain startup there are many places where we need to acquire secrets. Currently code passes around a virConnectPtr, except in the places where we pass in NULL. So there are a few codepaths where ability to start guests using secrets will fail. Change to acquire a handle to the secret driver

[libvirt] [PATCH v3 07/10] qemu: remove virConnectPtr from some more startup code paths

2018-02-16 Thread Daniel P . Berrangé
There's a few places in startup code paths which pass around a virConnectPtr which is no longer required. Specifically, the qemuProcessStart() method now only requires a non-NULL connection if autodestroy is requested. Reviewed-by: John Ferlan Signed-off-by: Daniel P. Berrangé --- src/qemu/qemu

[libvirt] [PATCH v3 09/10] qemu: don't export migration job APIs

2018-02-16 Thread Daniel P . Berrangé
These APIs are not required anywhere outside the migration code so need not be exported to the rest of the QEMU driver. Signed-off-by: Daniel P. Berrangé --- src/qemu/qemu_migration.c | 43 +-- src/qemu/qemu_migration.h | 32 ---

[libvirt] [PATCH v3 01/10] driver: allow override of connection for secondary drivers

2018-02-16 Thread Daniel P . Berrangé
When the test suite is running, we don't want to be triggering the startup of daemons for the secondary drivers. Thus we must provide a way to set a custom connection for the secondary drivers, to override the default logic which opens a new connection. This will also be useful for code where we h

[libvirt] [PATCH v3 04/10] conf: stop passing virConnectPtr into virDomainDiskTranslateSourcePool

2018-02-16 Thread Daniel P . Berrangé
Rather than expecting callers to pass a virConnectPtr into the virDomainDiskTranslateSourcePool() method, just acquire a connection to the storage driver when needed. Reviewed-by: John Ferlan Signed-off-by: Daniel P. Berrangé --- src/conf/domain_conf.c | 10 +++--- src/conf/domain_conf.h

[libvirt] [PATCH v3 00/10] Cleanups in QEMU driver wrt virConnectPtr

2018-02-16 Thread Daniel P . Berrangé
There are many places we can stop passing around virConnectPtr now and directly open secondary drivers where required instead. v3: - More migration function renames - Style fixes v2: - Now with working tests ! Daniel P. Berrangé (10): driver: allow override of connection for secondary

Re: [libvirt] [PATCH v2 04/10] conf: stop passing virConnectPtr into virDomainDiskTranslateSourcePool

2018-02-16 Thread Daniel P . Berrangé
On Thu, Feb 15, 2018 at 09:59:45PM -0500, John Ferlan wrote: > > > On 02/15/2018 11:50 AM, Daniel P. Berrangé wrote: > > Rather than expecting callers to pass a virConnectPtr into the > > virDomainDiskTranslateSourcePool() method, just acquire a connection > > to the storage driver when needed. >

Re: [libvirt] [PATCH 2/6] virObject: Introduce virObjectRecursiveLockableNew

2018-02-16 Thread Michal Privoznik
On 02/16/2018 10:08 AM, Peter Krempa wrote: > On Fri, Feb 16, 2018 at 09:52:53 +0100, Michal Privoznik wrote: >> On 02/16/2018 09:34 AM, Pavel Hrdina wrote: >>> On Mon, Feb 12, 2018 at 01:16:28PM +0100, Michal Privoznik wrote: On 02/12/2018 01:10 PM, Peter Krempa wrote: > On Mon, Feb 12, 2

Re: [libvirt] [PATCH 2/6] virObject: Introduce virObjectRecursiveLockableNew

2018-02-16 Thread Peter Krempa
On Fri, Feb 16, 2018 at 09:52:53 +0100, Michal Privoznik wrote: > On 02/16/2018 09:34 AM, Pavel Hrdina wrote: > > On Mon, Feb 12, 2018 at 01:16:28PM +0100, Michal Privoznik wrote: > >> On 02/12/2018 01:10 PM, Peter Krempa wrote: > >>> On Mon, Feb 12, 2018 at 11:52:49 +0100, Michal Privoznik wrote:

Re: [libvirt] [PATCH 2/6] virObject: Introduce virObjectRecursiveLockableNew

2018-02-16 Thread Michal Privoznik
On 02/16/2018 09:34 AM, Pavel Hrdina wrote: > On Mon, Feb 12, 2018 at 01:16:28PM +0100, Michal Privoznik wrote: >> On 02/12/2018 01:10 PM, Peter Krempa wrote: >>> On Mon, Feb 12, 2018 at 11:52:49 +0100, Michal Privoznik wrote: Sometimes we need the lock in virObjectLockable to be recursive. >>

Re: [libvirt] [PATCH 2/6] virObject: Introduce virObjectRecursiveLockableNew

2018-02-16 Thread Pavel Hrdina
On Mon, Feb 12, 2018 at 01:16:28PM +0100, Michal Privoznik wrote: > On 02/12/2018 01:10 PM, Peter Krempa wrote: > > On Mon, Feb 12, 2018 at 11:52:49 +0100, Michal Privoznik wrote: > >> Sometimes we need the lock in virObjectLockable to be recursive. > >> Because of the nature of pthreads we don't n