Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_driver.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 60dea9c..0a8744f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1746,6 +1746,7 @@ qemuGetPciHostDeviceList(virConnectPtr conn,
}
pciDeviceSetManaged(dev, hostdev->managed);
+ pciDeviceSetPermissive(dev, hostdev->permissive);
}
return list;
@@ -1810,6 +1811,9 @@ qemuPrepareHostDevices(virConnectPtr conn,
for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
pciDevice *dev = pciDeviceListGet(pcidevs, i);
+ if (!pciDeviceIsAssignable(conn, dev))
+ goto cleanup;
+
if (pciDeviceGetManaged(dev) &&
pciDettachDevice(conn, dev) < 0)
goto cleanup;
@@ -5293,7 +5297,10 @@ static int qemudDomainAttachHostPciDevice(virConnectPtr conn,
if (!pci)
return -1;
- if ((hostdev->managed && pciDettachDevice(conn, pci) < 0) ||
+ pciDeviceSetPermissive(pci, hostdev->permissive);
+
+ if (!pciDeviceIsAssignable(conn, pci) ||
+ (hostdev->managed && pciDettachDevice(conn, pci) < 0) ||
pciResetDevice(conn, pci, driver->activePciHostdevs) < 0) {
pciFreeDevice(conn, pci);
return -1;
--
1.6.6.rc4