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

Nikolay Shirokovskiy posted 11 patches 4 years, 7 months ago
Test syntax-check passed
Failed in applying to current master (apply log)
There is a newer version of this series
src/conf/domain_conf.c   |  32 +++
src/conf/domain_conf.h   |  15 ++
src/qemu/Makefile.inc.am |   2 +
src/qemu/qemu_conf.h     |   3 +
src/qemu/qemu_domain.c   |   2 +
src/qemu/qemu_domain.h   |   2 +
src/qemu/qemu_driver.c   | 431 ++++++++++++++++++++++++++++++++++++++-
src/qemu/qemu_hotplug.c  | 104 ++++++++--
src/qemu/qemu_hotplug.h  |   3 +-
src/qemu/qemu_process.c  |  59 ++++++
src/util/virhostdev.c    |   2 +
tests/qemuhotplugtest.c  |   2 +-
12 files changed, 637 insertions(+), 20 deletions(-)
[libvirt] [PATCH v2 00/11] hostdev: handle usb detach/attach on node
Posted by Nikolay Shirokovskiy 4 years, 7 months ago
*Notes*

Deleting usb device from qemu is synchronous operation (although it
is not stated in qemu API). I did not used this knowledge in the 
series.

The last patch is remnant of previus version of the series yet it is useful.

Diff to previous[1] version: 
- don't use dummy device while host usb device is unplugged

[1] https://www.redhat.com/archives/libvir-list/2019-August/msg01413.html

Nikolay Shirokovskiy (11):
  qemu: track hostdev delete intention
  qemu: support host usb device unplug
  qemu: support usb hostdev plugging back
  qemu: handle host usb device add/del udev events
  qemu: handle libvirtd restart after host usb device unplug
  qemu: handle race on device deletion and usb host device plugging
  qemu: hotplug: update device list on device deleted event
  qemu: handle host usb device plug/unplug when libvirtd is down
  qemu: don't mess with non mandatory hostdevs on reattaching
  qemu: handle detaching of unplugged hostdev
  conf: parse hostdev missing flag

 src/conf/domain_conf.c   |  32 +++
 src/conf/domain_conf.h   |  15 ++
 src/qemu/Makefile.inc.am |   2 +
 src/qemu/qemu_conf.h     |   3 +
 src/qemu/qemu_domain.c   |   2 +
 src/qemu/qemu_domain.h   |   2 +
 src/qemu/qemu_driver.c   | 431 ++++++++++++++++++++++++++++++++++++++-
 src/qemu/qemu_hotplug.c  | 104 ++++++++--
 src/qemu/qemu_hotplug.h  |   3 +-
 src/qemu/qemu_process.c  |  59 ++++++
 src/util/virhostdev.c    |   2 +
 tests/qemuhotplugtest.c  |   2 +-
 12 files changed, 637 insertions(+), 20 deletions(-)

-- 
2.23.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 00/11] hostdev: handle usb detach/attach on node
Posted by Daniel Henrique Barboza 4 years, 7 months ago
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 about the handling of device add. Let's
say you have a server running lots of guests and an administrator
physically disconnect a USB device that might have been in used
as hostdev by any of them. It makes sense to remove the device
from the domain in this scenario because, well, the device isn't there
anymore.

But when the admin connects the same USB device back, is he/she
really expecting the device to be automatically assigned to the same
guest, without direct action? Isn't there a chance of this admin reconnect
back the USB device to the server for any other use, then see Libvirt
automatically re-assign the device back to the guest that was using it
before, and get not so pleased about it (i.e. furiously opening a new
Libvirt bug)?



Thanks,


DHB




On 9/9/19 8:33 AM, Nikolay Shirokovskiy wrote:
> *Notes*
>
> Deleting usb device from qemu is synchronous operation (although it
> is not stated in qemu API). I did not used this knowledge in the
> series.
>
> The last patch is remnant of previus version of the series yet it is useful.
>
> Diff to previous[1] version:
> - don't use dummy device while host usb device is unplugged
>
> [1] https://www.redhat.com/archives/libvir-list/2019-August/msg01413.html
>
> Nikolay Shirokovskiy (11):
>    qemu: track hostdev delete intention
>    qemu: support host usb device unplug
>    qemu: support usb hostdev plugging back
>    qemu: handle host usb device add/del udev events
>    qemu: handle libvirtd restart after host usb device unplug
>    qemu: handle race on device deletion and usb host device plugging
>    qemu: hotplug: update device list on device deleted event
>    qemu: handle host usb device plug/unplug when libvirtd is down
>    qemu: don't mess with non mandatory hostdevs on reattaching
>    qemu: handle detaching of unplugged hostdev
>    conf: parse hostdev missing flag
>
>   src/conf/domain_conf.c   |  32 +++
>   src/conf/domain_conf.h   |  15 ++
>   src/qemu/Makefile.inc.am |   2 +
>   src/qemu/qemu_conf.h     |   3 +
>   src/qemu/qemu_domain.c   |   2 +
>   src/qemu/qemu_domain.h   |   2 +
>   src/qemu/qemu_driver.c   | 431 ++++++++++++++++++++++++++++++++++++++-
>   src/qemu/qemu_hotplug.c  | 104 ++++++++--
>   src/qemu/qemu_hotplug.h  |   3 +-
>   src/qemu/qemu_process.c  |  59 ++++++
>   src/util/virhostdev.c    |   2 +
>   tests/qemuhotplugtest.c  |   2 +-
>   12 files changed, 637 insertions(+), 20 deletions(-)
>

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 00/11] hostdev: handle usb detach/attach on node
Posted by Nikolay Shirokovskiy 4 years, 7 months ago

On 13.09.2019 00:08, Daniel Henrique Barboza wrote:
> 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 about the handling of device add. Let's
> say you have a server running lots of guests and an administrator
> physically disconnect a USB device that might have been in used
> as hostdev by any of them. It makes sense to remove the device
> from the domain in this scenario because, well, the device isn't there
> anymore.
> 
> But when the admin connects the same USB device back, is he/she
> really expecting the device to be automatically assigned to the same
> guest, without direct action? Isn't there a chance of this admin reconnect
> back the USB device to the server for any other use, then see Libvirt
> automatically re-assign the device back to the guest that was using it
> before, and get not so pleased about it (i.e. furiously opening a new
> Libvirt bug)?

Hi.

At least the admin has an option to detach the device from domain
thru libvirt API then there will be no any connection between 
physical device and domain and the device will not be re-assigned
to the domain.

Nikolay

> 
> 
> 
> Thanks,
> 
> 
> DHB
> 
> 
> 
> 
> On 9/9/19 8:33 AM, Nikolay Shirokovskiy wrote:
>> *Notes*
>>
>> Deleting usb device from qemu is synchronous operation (although it
>> is not stated in qemu API). I did not used this knowledge in the 
>> series.
>>
>> The last patch is remnant of previus version of the series yet it is useful.
>>
>> Diff to previous[1] version: 
>> - don't use dummy device while host usb device is unplugged
>>
>> [1] https://www.redhat.com/archives/libvir-list/2019-August/msg01413.html
>>
>> Nikolay Shirokovskiy (11):
>>   qemu: track hostdev delete intention
>>   qemu: support host usb device unplug
>>   qemu: support usb hostdev plugging back
>>   qemu: handle host usb device add/del udev events
>>   qemu: handle libvirtd restart after host usb device unplug
>>   qemu: handle race on device deletion and usb host device plugging
>>   qemu: hotplug: update device list on device deleted event
>>   qemu: handle host usb device plug/unplug when libvirtd is down
>>   qemu: don't mess with non mandatory hostdevs on reattaching
>>   qemu: handle detaching of unplugged hostdev
>>   conf: parse hostdev missing flag
>>
>>  src/conf/domain_conf.c   |  32 +++
>>  src/conf/domain_conf.h   |  15 ++
>>  src/qemu/Makefile.inc.am |   2 +
>>  src/qemu/qemu_conf.h     |   3 +
>>  src/qemu/qemu_domain.c   |   2 +
>>  src/qemu/qemu_domain.h   |   2 +
>>  src/qemu/qemu_driver.c   | 431 ++++++++++++++++++++++++++++++++++++++-
>>  src/qemu/qemu_hotplug.c  | 104 ++++++++--
>>  src/qemu/qemu_hotplug.h  |   3 +-
>>  src/qemu/qemu_process.c  |  59 ++++++
>>  src/util/virhostdev.c    |   2 +
>>  tests/qemuhotplugtest.c  |   2 +-
>>  12 files changed, 637 insertions(+), 20 deletions(-)
>>
> 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list