mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-08 16:54:49 +00:00
Conditionally wait for kvm_assigned_device cleanup
Only wait for kvm device cleanup if the driver is pci-stub
This commit is contained in:
parent
4e46107e43
commit
82e8dd4cf8
@ -1256,8 +1256,6 @@ qemuPrepareHostDevices(virQEMUDriverPtr driver,
|
|||||||
static void
|
static void
|
||||||
qemuReattachPciDevice(virPCIDevicePtr dev, virHostdevManagerPtr mgr)
|
qemuReattachPciDevice(virPCIDevicePtr dev, virHostdevManagerPtr mgr)
|
||||||
{
|
{
|
||||||
int retries = 100;
|
|
||||||
|
|
||||||
/* If the device is not managed and was attached to guest
|
/* If the device is not managed and was attached to guest
|
||||||
* successfully, it must have been inactive.
|
* successfully, it must have been inactive.
|
||||||
*/
|
*/
|
||||||
@ -1267,11 +1265,15 @@ qemuReattachPciDevice(virPCIDevicePtr dev, virHostdevManagerPtr mgr)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Wait for device cleanup if it is qemu/kvm */
|
||||||
|
if (STREQ(virPCIDeviceGetStubDriver(dev), "pci-stub")) {
|
||||||
|
int retries = 100;
|
||||||
while (virPCIDeviceWaitForCleanup(dev, "kvm_assigned_device")
|
while (virPCIDeviceWaitForCleanup(dev, "kvm_assigned_device")
|
||||||
&& retries) {
|
&& retries) {
|
||||||
usleep(100*1000);
|
usleep(100*1000);
|
||||||
retries--;
|
retries--;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (virPCIDeviceReattach(dev, mgr->activePciHostdevs,
|
if (virPCIDeviceReattach(dev, mgr->activePciHostdevs,
|
||||||
mgr->inactivePciHostdevs) < 0) {
|
mgr->inactivePciHostdevs) < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user