This calls the PCI-, USB- and SCSI-specific functions just like
qemuPrepareHostDevices() and qemuDomainReAttachHostDevices()
already do.
Update qemuProcessReconnect() to use the new function.
---
src/qemu/qemu_hostdev.c | 18 ++++++++++++++++++
src/qemu/qemu_hostdev.h | 2 ++
src/qemu/qemu_process.c | 8 +-------
3 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index d395271..fad5975 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -83,6 +83,24 @@ qemuUpdateActiveHostSCSIDevices(virQEMUDriverPtr driver,
QEMU_DRIVER_NAME, def->name);
}
+int
+qemuUpdateActiveHostDevices(virQEMUDriverPtr driver,
+ virDomainDefPtr def)
+{
+ if (!def->nhostdevs)
+ return 0;
+
+ if (qemuUpdateActiveHostPCIDevices(driver, def) < 0)
+ return -1;
+
+ if (qemuUpdateActiveHostUSBDevices(driver, def) < 0)
+ return -1;
+
+ if (qemuUpdateActiveHostSCSIDevices(driver, def) < 0)
+ return -1;
+
+ return 0;
+}
bool
qemuHostdevHostSupportsPassthroughVFIO(void)
diff --git a/src/qemu/qemu_hostdev.h b/src/qemu/qemu_hostdev.h
index 3565a44..e6a19ff 100644
--- a/src/qemu/qemu_hostdev.h
+++ b/src/qemu/qemu_hostdev.h
@@ -33,6 +33,8 @@ int qemuUpdateActiveHostUSBDevices(virQEMUDriverPtr driver,
virDomainDefPtr def);
int qemuUpdateActiveHostSCSIDevices(virQEMUDriverPtr driver,
virDomainDefPtr def);
+int qemuUpdateActiveHostDevices(virQEMUDriverPtr driver,
+ virDomainDefPtr def);
bool qemuHostdevHostSupportsPassthroughLegacy(void);
bool qemuHostdevHostSupportsPassthroughVFIO(void);
int qemuPrepareHostPCIDevices(virQEMUDriverPtr driver,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 899f634..1eb1362 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3769,13 +3769,7 @@ qemuProcessReconnect(void *opaque)
priv->agentError = true;
}
- if (qemuUpdateActiveHostPCIDevices(driver, obj->def) < 0)
- goto error;
-
- if (qemuUpdateActiveHostUSBDevices(driver, obj->def) < 0)
- goto error;
-
- if (qemuUpdateActiveHostSCSIDevices(driver, obj->def) < 0)
+ if (qemuUpdateActiveHostDevices(driver, obj->def) < 0)
goto error;
if (qemuConnectCgroup(driver, obj) < 0)
--
2.4.3