[libvirt] [PATCH v14 17/49] rename qemuReAttachPciDevice to virHostdevReAttachPciDevice
Daniel P. Berrange
berrange at redhat.com
Mon Mar 10 17:26:12 UTC 2014
On Fri, Mar 07, 2014 at 06:52:44PM +0800, Chunyan Liu wrote:
> Signed-off-by: Chunyan Liu <cyliu at suse.com>
> ---
> src/qemu/qemu_hostdev.c | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
> index 5fa6eb4..2dfe252 100644
> --- a/src/qemu/qemu_hostdev.c
> +++ b/src/qemu/qemu_hostdev.c
> @@ -1254,10 +1254,8 @@ qemuPrepareHostDevices(virQEMUDriverPtr driver,
> * are locked
> */
> static void
> -qemuReattachPciDevice(virPCIDevicePtr dev, virHostdevManagerPtr mgr)
> +virHostdevReattachPciDevice(virPCIDevicePtr dev, virHostdevManagerPtr mgr)
> {
> - int retries = 100;
> -
> /* If the device is not managed and was attached to guest
> * successfully, it must have been inactive.
> */
> @@ -1267,10 +1265,14 @@ qemuReattachPciDevice(virPCIDevicePtr dev, virHostdevManagerPtr mgr)
> return;
> }
>
> - while (virPCIDeviceWaitForCleanup(dev, "kvm_assigned_device")
> - && retries) {
> - usleep(100*1000);
> - retries--;
> + /* Wait for device cleanup if it is qemu/kvm */
> + if (STREQ(virPCIDeviceGetStubDriver(dev), "pci-stub")) {
> + int retries = 100;
> + while (virPCIDeviceWaitForCleanup(dev, "kvm_assigned_device")
> + && retries) {
> + usleep(100*1000);
> + retries--;
> + }
> }
>
> if (virPCIDeviceReattach(dev, mgr->activePciHostdevs,
Looks like this commit is 2 separate patches merged into one. I can
easily split this in two though.
> @@ -1363,7 +1365,7 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
>
> while (virPCIDeviceListCount(pcidevs) > 0) {
> virPCIDevicePtr dev = virPCIDeviceListStealIndex(pcidevs, 0);
> - qemuReattachPciDevice(dev, hostdev_mgr);
> + virHostdevReattachPciDevice(dev, hostdev_mgr);
> }
>
> virObjectUnref(pcidevs);
ACK when split in two.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list