Initilize three state value of device driver to 1. This is just for a new call to
qemudNodeDeviceReAttach()
---
src/libvirt_private.syms | 1 +
src/qemu/qemu_driver.c | 2 ++
src/util/pci.c | 8 ++++++++
src/util/pci.h | 1 +
4 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 626ac6c..062dcff 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -807,6 +807,7 @@ pciGetDevice;
pciReAttachDevice;
pciResetDevice;
pciWaitForDeviceCleanup;
+pciDeviceReAttachInit;
# processinfo.h
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 363a361..56ccf44 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7193,6 +7193,8 @@ qemudNodeDeviceReAttach (virNodeDevicePtr dev)
if (!pci)
return -1;
+ pciDeviceReAttachInit(pci);
+
qemuDriverLock(driver);
if (pciReAttachDevice(pci, driver->activePciHostdevs) < 0)
goto out;
diff --git a/src/util/pci.c b/src/util/pci.c
index 21c12b9..e3f978c 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -1382,6 +1382,14 @@ unsigned pciDeviceGetManaged(pciDevice *dev)
return dev->managed;
}
+void pciDeviceReAttachInit(pciDevice *pci)
+{
+ pci->unbind_from_stub = 1;
+ pci->remove_slot = 1;
+ pci->reprobe = 1;
+}
+
+
pciDeviceList *
pciDeviceListNew(void)
{
diff --git a/src/util/pci.h b/src/util/pci.h
index b767930..a351baf 100644
--- a/src/util/pci.h
+++ b/src/util/pci.h
@@ -40,6 +40,7 @@ int pciResetDevice (pciDevice *dev,
void pciDeviceSetManaged(pciDevice *dev,
unsigned managed);
unsigned pciDeviceGetManaged(pciDevice *dev);
+void pciDeviceReAttachInit(pciDevice *dev);
pciDeviceList *pciDeviceListNew (void);
void pciDeviceListFree (pciDeviceList *list);
--
1.7.1