Re: [libvirt] [PATCH v2 00/11] hostdev: handle usb detach/attach on node

2019-09-12 Thread Daniel Henrique Barboza
Hi, While reviewing these I got one question that I think it's better asked here since it's not related to a single patch. I understand the use case for udev machinery to handle the device removal event - in fact, I wonder if this should be done to all hostdevs, not just USB - but I'm not sure

Re: [libvirt] [PATCH v2 11/11] conf: parse hostdev missing flag

2019-09-12 Thread Daniel Henrique Barboza
On 9/9/19 8:33 AM, Nikolay Shirokovskiy wrote: We want to keep this flag across libvirtd restarts. Signed-off-by: Nikolay Shirokovskiy --- Reviewed-by: Daniel Henrique Barboza src/conf/domain_conf.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/conf/domain_conf.c

Re: [libvirt] [PATCH v2 08/11] qemu: handle host usb device plug/unplug when libvirtd is down

2019-09-12 Thread Daniel Henrique Barboza
On 9/9/19 8:33 AM, Nikolay Shirokovskiy wrote: Somebody can easily unplug usb device from host while libvirtd is being stopped. Also usb device can be plugged or unplugged/plugged back and so forth. Let's handle such cases. Signed-off-by: Nikolay Shirokovskiy --- Reviewed-by: Daniel

Re: [libvirt] [PATCH v2 09/11] qemu: don't mess with non mandatory hostdevs on reattaching

2019-09-12 Thread Daniel Henrique Barboza
On 9/9/19 8:33 AM, Nikolay Shirokovskiy wrote: First I don't want to add code to handle dummy device that is used when host usb device is not present at the moment of starting/migrating etc. Second supporting non mandatory policies would require to handle races when host usb device is plugged

Re: [libvirt] [PATCH v2 06/11] qemu: handle race on device deletion and usb host device plugging

2019-09-12 Thread Daniel Henrique Barboza
On 9/9/19 8:33 AM, Nikolay Shirokovskiy wrote: Imagine host usb device is unplugged from host and as a result we send command to qemu to delete appropriate device. Then before qemu device is deleted host usb device is plugged back. Currenly code supposes there is s/Currenly/Currently no

Re: [libvirt] [PATCH v2 05/11] qemu: handle libvirtd restart after host usb device unplug

2019-09-12 Thread Daniel Henrique Barboza
On 9/9/19 8:33 AM, Nikolay Shirokovskiy wrote: It is possible for libvirtd to go down before DEVICE_DELETED event is delivered upon usb hostdev unplug and to receive the event after the libvirtd is up. In order to handle this case we need to save usb hostdev deleteAction is status file.

Re: [libvirt] [PATCH v2 04/11] qemu: handle host usb device add/del udev events

2019-09-12 Thread Daniel Henrique Barboza
On 9/9/19 8:33 AM, Nikolay Shirokovskiy wrote: Now when code handling attaching/detaching usb hostdev is appropriately changed use it to handle host usb device udev add/del events. Assuming we're ok with adding an extra dependency (libudev), LGTM. Reviewed-by: Daniel Henrique Barboza

Re: [libvirt] [PATCH v2 03/11] qemu: support usb hostdev plugging back

2019-09-12 Thread Daniel Henrique Barboza
On 9/9/19 8:33 AM, Nikolay Shirokovskiy wrote: We are going to use qemuDomainAttachHostUSBDevice when host usb device is plugged back to node. Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_hotplug.c | 29 - 1 file changed, 24 insertions(+), 5

Re: [libvirt] [PATCH v2 02/11] qemu: support host usb device unplug

2019-09-12 Thread Daniel Henrique Barboza
On 9/9/19 8:33 AM, Nikolay Shirokovskiy wrote: Handle host usb device unplug in DEVICE_DELETED handle execution path. Signed-off-by: Nikolay Shirokovskiy --- Reviewed-by: Daniel Henrique Barboza src/qemu/qemu_hotplug.c | 38 +++--- 1 file changed, 31

[libvirt] [PATCH] maint: Use flake8 to check python code

2019-09-12 Thread Shi Lei
Replace 'sc_prohibit_semicolon_at_eol_in_python' with generic 'sc_flake8' rule to check python code style. Now 'sc_flake8' just check the error E703: 'statement ends with a semicolon'. In future, we could use '--select' to introduce more rules. Signed-off-by: Shi Lei --- cfg.mk | 8

Re: [libvirt] [PATCH] maint: Use pep8 to implement sc_prohibit_semicolon_at_eol_in_python

2019-09-12 Thread shi_...@massclouds.com
>On Thu, Sep 12, 2019 at 10:05:34AM -0400, Cole Robinson wrote: >> On 9/12/19 9:18 AM, Andrea Bolognani wrote: >> > On Thu, 2019-09-12 at 12:00 +0100, Daniel P. Berrangé wrote: >> >> On Thu, Sep 12, 2019 at 12:56:04PM +0200, Andrea Bolognani wrote: >> >>> FWIW, libvirt-dbus is using flake8 to

Re: [libvirt] [PATCH] maint: Use pep8 to implement sc_prohibit_semicolon_at_eol_in_python

2019-09-12 Thread Daniel P . Berrangé
On Thu, Sep 12, 2019 at 10:05:34AM -0400, Cole Robinson wrote: > On 9/12/19 9:18 AM, Andrea Bolognani wrote: > > On Thu, 2019-09-12 at 12:00 +0100, Daniel P. Berrangé wrote: > >> On Thu, Sep 12, 2019 at 12:56:04PM +0200, Andrea Bolognani wrote: > >>> FWIW, libvirt-dbus is using flake8 to achieve

Re: [libvirt] [PATCH] conf: correctly convert 'managed' attribute from network port

2019-09-12 Thread Michal Privoznik
On 9/12/19 5:05 PM, Daniel P. Berrangé wrote: The virNetworkPortDef config stores the 'managed' attribute as the virTristate type. The virDomainDef config stores the 'managed' attribute as the bool type. Signed-off-by: Daniel P. Berrangé --- src/conf/domain_conf.c | 15 +-- 1

[libvirt] [PATCH python] sanitytest: whitelist 'network' method as having no C impl

2019-09-12 Thread Daniel P . Berrangé
Signed-off-by: Daniel P. Berrangé --- Pushed as a CI build fix for the previous patch. sanitytest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sanitytest.py b/sanitytest.py index e87b57d..0b415fd 100644 --- a/sanitytest.py +++ b/sanitytest.py @@ -357,7 +357,7 @@ for

[libvirt] [PATCH] conf: correctly convert 'managed' attribute from network port

2019-09-12 Thread Daniel P . Berrangé
The virNetworkPortDef config stores the 'managed' attribute as the virTristate type. The virDomainDef config stores the 'managed' attribute as the bool type. Signed-off-by: Daniel P. Berrangé --- src/conf/domain_conf.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-)

Re: [libvirt] [PATCH v2 1/4] util: purge all code for testing OOM handling

2019-09-12 Thread Michal Privoznik
On 9/12/19 1:31 PM, Daniel P. Berrangé wrote: The OOM handling requires special build time options which we never enable in our CI. Even once enabled the tests are incredibly slow and typically require manual inspection of the results to weed out false positives. Since there was previous

Re: [libvirt] [PATCH v2 2/4] util: make allocation functions abort on OOM

2019-09-12 Thread Michal Privoznik
On 9/12/19 1:31 PM, Daniel P. Berrangé wrote: The functions are left returning an "int" to avoid an immediate big-bang cleanup. They'll simply never return anything other than 0, except for virInsertN which can still return an error if the requested insertion index is out of range. Interestingly

Re: [libvirt] [PATCH v2 3/4] util: remove several unused _QUIET allocation macro variants

2019-09-12 Thread Michal Privoznik
On 9/12/19 1:31 PM, Daniel P. Berrangé wrote: Only a few of the _QUIET allocation macros are used. Since we're no longer reporting OOM as errors, we want to eliminate all the _QUIET variants. This starts with the easy, unused, cases. Reviewed-by: Ján Tomko Signed-off-by: Daniel P. Berrangé

Re: [libvirt] [PATCH v2 4/4] util: make string functions abort on OOM

2019-09-12 Thread Michal Privoznik
On 9/12/19 1:31 PM, Daniel P. Berrangé wrote: The functions are left returning an "int" to avoid an immediate big-bang cleanup. They'll simply never return anything other than 0. Reviewed-by: Ján Tomko Signed-off-by: Daniel P. Berrangé --- src/util/virstring.c | 93

Re: [libvirt] [PATCH] fix memleak in virNodeDeviceGetPCISRIOVCaps

2019-09-12 Thread Michal Privoznik
On 9/12/19 10:05 AM, Yi Wang wrote: From: Jiang Kun it always alloc new memory when get dumpxml of pf device,but never free it. Now free the old first,then alloc new memory. Signed-off-by: Jiang kun --- src/conf/node_device_conf.c | 1 + 1 file changed, 1 insertion(+) Reviewed-by:

Re: [libvirt] [PATCH] maint: Use pep8 to implement sc_prohibit_semicolon_at_eol_in_python

2019-09-12 Thread Cole Robinson
On 9/12/19 9:18 AM, Andrea Bolognani wrote: > On Thu, 2019-09-12 at 12:00 +0100, Daniel P. Berrangé wrote: >> On Thu, Sep 12, 2019 at 12:56:04PM +0200, Andrea Bolognani wrote: >>> FWIW, libvirt-dbus is using flake8 to achieve what I believe is >>> basically the same result, whereas virt-manager I

Re: [libvirt] [python PATCH] generator: fix constructor for virNetworkPort

2019-09-12 Thread Michal Privoznik
On 9/12/19 2:53 PM, Daniel P. Berrangé wrote: The virNetworkPort class is passed both the virNetwork parent python class and the virNetworkPort C object. This needs special handling in the generator, similar to how virDomainSnapshots are dealt with. Signed-off-by: Daniel P. Berrangé ---

Re: [libvirt] [PATCH] tools: fix XML validator detection of network port XML schema

2019-09-12 Thread Michal Privoznik
On 9/12/19 3:12 PM, Daniel P. Berrangé wrote: Signed-off-by: Daniel P. Berrangé --- tools/virt-xml-validate.in | 3 +++ 1 file changed, 3 insertions(+) Reviewed-by: Michal Privoznik Michal -- libvir-list mailing list libvir-list@redhat.com

Re: [libvirt] [PATCH] tools: add virsh docs for network port commands

2019-09-12 Thread Michal Privoznik
On 9/12/19 3:07 PM, Daniel P. Berrangé wrote: Signed-off-by: Daniel P. Berrangé --- tools/virsh.pod | 36 1 file changed, 36 insertions(+) Reviewed-by: Michal Privoznik Michal -- libvir-list mailing list libvir-list@redhat.com

Re: [libvirt] [PATCH] conf: avoid looking up network port that doesn't exist

2019-09-12 Thread Michal Privoznik
On 9/12/19 3:24 PM, Daniel P. Berrangé wrote: If the hypervisor driver has not yet created the network port, the portid field will be "----". If a failure occurs during early VM startup, the hypervisor driver may none the less try to release the network port,

[libvirt] [PATCH] qemu_capabilities: Put only unique FW images into domcaps

2019-09-12 Thread Michal Privoznik
In the domain capabilities XML there are FW image paths printed. There are two sources for the image paths (in order of preference): 1) firmware descriptor files - as returned by qemuFirmwareGetSupported() 2) a compile time list of FW:NRAM pairs which can be overridden in qemu.conf If

[libvirt] [PATCH] conf: avoid looking up network port that doesn't exist

2019-09-12 Thread Daniel P . Berrangé
If the hypervisor driver has not yet created the network port, the portid field will be "----". If a failure occurs during early VM startup, the hypervisor driver may none the less try to release the network port, resulting in an undesirable warning: 2019-09-12

Re: [libvirt] [PATCH] maint: Use pep8 to implement sc_prohibit_semicolon_at_eol_in_python

2019-09-12 Thread Andrea Bolognani
On Thu, 2019-09-12 at 12:00 +0100, Daniel P. Berrangé wrote: > On Thu, Sep 12, 2019 at 12:56:04PM +0200, Andrea Bolognani wrote: > > FWIW, libvirt-dbus is using flake8 to achieve what I believe is > > basically the same result, whereas virt-manager I think uses pylint > > and pycodestlye. > > > >

[libvirt] [PATCH] tools: fix XML validator detection of network port XML schema

2019-09-12 Thread Daniel P . Berrangé
Signed-off-by: Daniel P. Berrangé --- tools/virt-xml-validate.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/virt-xml-validate.in b/tools/virt-xml-validate.in index 5cb7dcd276..249bcf7eef 100644 --- a/tools/virt-xml-validate.in +++ b/tools/virt-xml-validate.in @@ -80,6 +80,9 @@

[libvirt] [PATCH] tools: add virsh docs for network port commands

2019-09-12 Thread Daniel P . Berrangé
Signed-off-by: Daniel P. Berrangé --- tools/virsh.pod | 36 1 file changed, 36 insertions(+) diff --git a/tools/virsh.pod b/tools/virsh.pod index 59fb4bfc2e..cf2798e71a 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -3780,6 +3780,42 @@ specified.

[libvirt] [python PATCH] generator: fix constructor for virNetworkPort

2019-09-12 Thread Daniel P . Berrangé
The virNetworkPort class is passed both the virNetwork parent python class and the virNetworkPort C object. This needs special handling in the generator, similar to how virDomainSnapshots are dealt with. Signed-off-by: Daniel P. Berrangé --- generator.py | 13 + 1 file changed, 13

Re: [libvirt] [PATCH v2 01/11] qemu: track hostdev delete intention

2019-09-12 Thread Daniel Henrique Barboza
I had to amend the patch to apply it to the current master (commit e9d51a221c). git am was putting the 'if (!unplug)' block in the wrong function and the code didn't compile. Here's what I did: --- $ git diff diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index

[libvirt] [PATCH v2 1/4] util: purge all code for testing OOM handling

2019-09-12 Thread Daniel P . Berrangé
The OOM handling requires special build time options which we never enable in our CI. Even once enabled the tests are incredibly slow and typically require manual inspection of the results to weed out false positives. Since there was previous agreement to switch to abort on OOM in libvirt code,

[libvirt] [PATCH v2 3/4] util: remove several unused _QUIET allocation macro variants

2019-09-12 Thread Daniel P . Berrangé
Only a few of the _QUIET allocation macros are used. Since we're no longer reporting OOM as errors, we want to eliminate all the _QUIET variants. This starts with the easy, unused, cases. Reviewed-by: Ján Tomko Signed-off-by: Daniel P. Berrangé --- src/util/viralloc.h | 74

[libvirt] [PATCH v2 2/4] util: make allocation functions abort on OOM

2019-09-12 Thread Daniel P . Berrangé
The functions are left returning an "int" to avoid an immediate big-bang cleanup. They'll simply never return anything other than 0, except for virInsertN which can still return an error if the requested insertion index is out of range. Interestingly in that case, the _QUIET function would none

[libvirt] [PATCH v2 4/4] util: make string functions abort on OOM

2019-09-12 Thread Daniel P . Berrangé
The functions are left returning an "int" to avoid an immediate big-bang cleanup. They'll simply never return anything other than 0. Reviewed-by: Ján Tomko Signed-off-by: Daniel P. Berrangé --- src/util/virstring.c | 93 +++- src/util/virstring.h | 73

[libvirt] [PATCH v2 0/4] util: abort when out of memory

2019-09-12 Thread Daniel P . Berrangé
This is the first part of a previously posted series: https://www.redhat.com/archives/libvir-list/2019-August/msg01374.html I've temporarily split the addition of glib into a separate branch until we get clarity on guarantees around g_malloc() and mallc() using the same allocator. I published

Re: [libvirt] [PATCH 4/4] virt-result.m4: Colourize summary printings

2019-09-12 Thread Daniel P . Berrangé
On Mon, Sep 09, 2019 at 09:49:42AM +0200, Michal Privoznik wrote: > The LIBVIRT_RESULT function takes two or three arguments. The > first one is the name of the result (aka CHECK_NAME). It is > printed before the colon character. The rest of the arguments is > printed after the character. To

Re: [libvirt] [PATCH 3/4] configure: Colorize output

2019-09-12 Thread Daniel P . Berrangé
On Mon, Sep 09, 2019 at 09:49:41AM +0200, Michal Privoznik wrote: > If we're running from a TTY we can put some colors around 'yes', > 'no' and other messages. > > Shamelessly copied from Ruby source code and modified a bit to > comply with syntax-check. > >

Re: [libvirt] [PATCH 2/4] virt-result.m4: Align string more generously

2019-09-12 Thread Daniel P . Berrangé
On Thu, Sep 12, 2019 at 12:18:10PM +0200, Michal Privoznik wrote: > On 9/12/19 12:30 AM, Cole Robinson wrote: > > On 9/9/19 3:49 AM, Michal Privoznik wrote: > > > The times, when we had small CRTs are long gone. Now, in the era > > > of wide screens we can be more generous when it comes to

Re: [libvirt] [PATCH 2/4] virt-result.m4: Align string more generously

2019-09-12 Thread Daniel P . Berrangé
On Mon, Sep 09, 2019 at 09:49:40AM +0200, Michal Privoznik wrote: > The times, when we had small CRTs are long gone. Now, in the era > of wide screens we can be more generous when it comes to aligning > the output of configure. The longest string before the colon is > 'wireshark_dissector' which

Re: [libvirt] [PATCH 1/4] configure: Prefer LIBVIRT_RESULT over AC_MSG_NOTICE

2019-09-12 Thread Daniel P . Berrangé
On Mon, Sep 09, 2019 at 09:49:39AM +0200, Michal Privoznik wrote: > One of the advantages is that LIBVIRT_RESULT aligns the resulting > message for us. The other is that in near future we will colour > some parts of the message and thus it helps if we get arguments > split in two. > >

Re: [libvirt] [PATCH 2/4] virt-result.m4: Align string more generously

2019-09-12 Thread Michal Privoznik
On 9/12/19 12:33 PM, Daniel P. Berrangé wrote: On Thu, Sep 12, 2019 at 12:18:10PM +0200, Michal Privoznik wrote: On 9/12/19 12:30 AM, Cole Robinson wrote: On 9/9/19 3:49 AM, Michal Privoznik wrote: The times, when we had small CRTs are long gone. Now, in the era of wide screens we can be more

Re: [libvirt] [PATCH] maint: Use pep8 to implement sc_prohibit_semicolon_at_eol_in_python

2019-09-12 Thread Daniel P . Berrangé
On Thu, Sep 12, 2019 at 12:56:04PM +0200, Andrea Bolognani wrote: > On Thu, 2019-09-12 at 11:13 +0100, Daniel P. Berrangé wrote: > > On Thu, Sep 12, 2019 at 05:55:38PM +0800, Shi Lei wrote: > > > +AC_PATH_PROG([PEP8], [pep8]) > > > +if test -z "$PEP8"; then > > > +AC_MSG_ERROR(['pep8' binary

Re: [libvirt] [PATCH] maint: Use pep8 to implement sc_prohibit_semicolon_at_eol_in_python

2019-09-12 Thread Andrea Bolognani
On Thu, 2019-09-12 at 11:13 +0100, Daniel P. Berrangé wrote: > On Thu, Sep 12, 2019 at 05:55:38PM +0800, Shi Lei wrote: > > +AC_PATH_PROG([PEP8], [pep8]) > > +if test -z "$PEP8"; then > > +AC_MSG_ERROR(['pep8' binary is required to check python code style]) > > +fi > > Using pep8 is an

Re: [libvirt] [PATCH 2/7] util: make allocation functions abort on OOM

2019-09-12 Thread Daniel P . Berrangé
On Thu, Sep 05, 2019 at 06:03:57PM -0400, John Ferlan wrote: > > > On 8/29/19 2:02 PM, Daniel P. Berrangé wrote: > > The functions are left returning an "int" to avoid an immediate > > big-bang cleanup. They'll simply never return anything other > > than 0, except for virInsertN which can still

Re: [libvirt] [PATCH 2/4] virt-result.m4: Align string more generously

2019-09-12 Thread Daniel P . Berrangé
On Thu, Sep 12, 2019 at 12:18:10PM +0200, Michal Privoznik wrote: > On 9/12/19 12:30 AM, Cole Robinson wrote: > > On 9/9/19 3:49 AM, Michal Privoznik wrote: > > > The times, when we had small CRTs are long gone. Now, in the era > > > of wide screens we can be more generous when it comes to

Re: [libvirt] [PATCH 2/4] virt-result.m4: Align string more generously

2019-09-12 Thread Michal Privoznik
On 9/12/19 12:30 AM, Cole Robinson wrote: On 9/9/19 3:49 AM, Michal Privoznik wrote: The times, when we had small CRTs are long gone. Now, in the era of wide screens we can be more generous when it comes to aligning the output of configure. The longest string before the colon is

Re: [libvirt] [PATCH] maint: Use pep8 to implement sc_prohibit_semicolon_at_eol_in_python

2019-09-12 Thread Daniel P . Berrangé
On Thu, Sep 12, 2019 at 05:55:38PM +0800, Shi Lei wrote: > Now sc_prohibit_semicolon_at_eol_in_python can't handle semicolon > within multiline strings(comments) properly. > > I suggest that we could use pep8 to check python code style error, such > as 'statement ends with a semicolon'. In

Re: [libvirt] [dockerfiles PATCH] Add 'trigger' and 'monitor' scripts

2019-09-12 Thread Andrea Bolognani
On Wed, 2019-09-11 at 18:38 +0200, Fabiano Fidêncio wrote: > On Wed, Sep 11, 2019 at 3:12 PM Andrea Bolognani wrote: > > These are extremely crude scripts that are nonetheless useful when > > it's time to rebuild all images. Usage is along these lines: > > > > $ ls libvirt-debian-10* >in > >

[libvirt] [PATCH] maint: Use pep8 to implement sc_prohibit_semicolon_at_eol_in_python

2019-09-12 Thread Shi Lei
Now sc_prohibit_semicolon_at_eol_in_python can't handle semicolon within multiline strings(comments) properly. I suggest that we could use pep8 to check python code style error, such as 'statement ends with a semicolon'. In future, we could use '--select' to introduce other rules. Signed-off-by:

Re: [libvirt] [PATCH v2 03/24] build: force a UTF-8 locale for python

2019-09-12 Thread Daniel P . Berrangé
On Wed, Sep 11, 2019 at 12:27:45PM -0500, Eric Blake wrote: > On 9/11/19 11:23 AM, Daniel P. Berrangé wrote: > > Python3 versions less than 3.7 have very unhelpful handling > > of the C locale where they assume data is 7-bit only. This > > violates POSIX which requires the C locale to be 8-bit

Re: [libvirt] [PATCH v1] docs: Expand the "BIOS bootloader" documentation for domainCaps

2019-09-12 Thread Kashyap Chamarthy
On Wed, Sep 11, 2019 at 05:40:02PM +0200, Michal Privoznik wrote: > On 9/11/19 4:34 PM, Kashyap Chamarthy wrote: [...] > > diff --git a/docs/formatdomaincaps.html.in b/docs/formatdomaincaps.html.in > > index > > bc99d378567a553afe682bc522e7a753b2d805fc..a8d970934df2c0ce8c41eb4958c94fbdf96ef8e0

[libvirt] [PATCH] fix memleak in virNodeDeviceGetPCISRIOVCaps

2019-09-12 Thread Yi Wang
From: Jiang Kun it always alloc new memory when get dumpxml of pf device,but never free it. Now free the old first,then alloc new memory. Signed-off-by: Jiang kun --- src/conf/node_device_conf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/conf/node_device_conf.c