[libvirt] [PATCH v2 2/9] hostdev: Use common reattach code to rollback prepare errors

John Ferlan jferlan at redhat.com
Tue Jan 26 23:55:53 UTC 2016


Need something here...

Perhaps to the effect of instead of inlining most of
virHostdevOnlyReattachPCIDevice, call virHostdevOnlyReattachPCIDevice.

One extra "call" or check being made by doing this is the
virPCIDeviceGetStubDriver check and virPCIDeviceWaitForCleanup. Are
there any "timing" considerations from this path?  Now for every PCI
hostdev found, we'll call *WaitForCleanup. That should perhaps be noted.

This looks reasonable otherwise.

John

On 01/25/2016 11:20 AM, Andrea Bolognani wrote:
> ---
>  src/util/virhostdev.c | 14 +-------------
>  1 file changed, 1 insertion(+), 13 deletions(-)
> 
> diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
> index 66629b4..586937e 100644
> --- a/src/util/virhostdev.c
> +++ b/src/util/virhostdev.c
> @@ -799,19 +799,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
>      for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) {
>          virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i);
>  
> -        if (virPCIDeviceGetManaged(dev)) {
> -            /* NB: This doesn't actually re-bind to original driver, just
> -             * unbinds from the stub driver
> -             */
> -            VIR_DEBUG("Reattaching managed PCI device %s",
> -                      virPCIDeviceGetName(dev));
> -            ignore_value(virPCIDeviceReattach(dev,
> -                                              hostdev_mgr->activePCIHostdevs,
> -                                              hostdev_mgr->inactivePCIHostdevs));
> -        } else {
> -            VIR_DEBUG("Not reattaching unmanaged PCI device %s",
> -                      virPCIDeviceGetName(dev));
> -        }
> +        ignore_value(virHostdevOnlyReattachPCIDevice(hostdev_mgr, dev, true));
>      }
>  
>   cleanup:
> 




More information about the libvir-list mailing list