mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: Do not wait if the PCI device is not managed when reattaching
Waiting for qemu-kvm cleaning up the PCI bar(s) mapping with long time while the device is not managed is just waste of time.
This commit is contained in:
parent
c1bc3d892c
commit
7fb50e300c
@ -322,13 +322,15 @@ void qemuReattachPciDevice(pciDevice *dev, struct qemud_driver *driver)
|
|||||||
{
|
{
|
||||||
int retries = 100;
|
int retries = 100;
|
||||||
|
|
||||||
|
if (!pciDeviceGetManaged(dev))
|
||||||
|
return;
|
||||||
|
|
||||||
while (pciWaitForDeviceCleanup(dev, "kvm_assigned_device")
|
while (pciWaitForDeviceCleanup(dev, "kvm_assigned_device")
|
||||||
&& retries) {
|
&& retries) {
|
||||||
usleep(100*1000);
|
usleep(100*1000);
|
||||||
retries--;
|
retries--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pciDeviceGetManaged(dev)) {
|
|
||||||
if (pciReAttachDevice(dev, driver->activePciHostdevs) < 0) {
|
if (pciReAttachDevice(dev, driver->activePciHostdevs) < 0) {
|
||||||
virErrorPtr err = virGetLastError();
|
virErrorPtr err = virGetLastError();
|
||||||
VIR_ERROR(_("Failed to re-attach PCI device: %s"),
|
VIR_ERROR(_("Failed to re-attach PCI device: %s"),
|
||||||
@ -336,7 +338,6 @@ void qemuReattachPciDevice(pciDevice *dev, struct qemud_driver *driver)
|
|||||||
virResetError(err);
|
virResetError(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void qemuDomainReAttachHostdevDevices(struct qemud_driver *driver,
|
void qemuDomainReAttachHostdevDevices(struct qemud_driver *driver,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user