This calls the PCI-, USB- and SCSI-specific functions just like qemuHostdev{Prepare,ReAttach}DomainDevices() already do, and was the missing piece for the qemuHostdev API to nicely mirror the virHostdev API. 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 7c920c9..ca38a06 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -83,6 +83,24 @@ qemuHostdevUpdateActiveSCSIDevices(virQEMUDriverPtr driver, QEMU_DRIVER_NAME, def->name); } +int +qemuHostdevUpdateActiveDomainDevices(virQEMUDriverPtr driver, + virDomainDefPtr def) +{ + if (!def->nhostdevs) + return 0; + + if (qemuHostdevUpdateActivePCIDevices(driver, def) < 0) + return -1; + + if (qemuHostdevUpdateActiveUSBDevices(driver, def) < 0) + return -1; + + if (qemuHostdevUpdateActiveSCSIDevices(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 c1a0a57..0a3c715 100644 --- a/src/qemu/qemu_hostdev.h +++ b/src/qemu/qemu_hostdev.h @@ -36,6 +36,8 @@ int qemuHostdevUpdateActiveUSBDevices(virQEMUDriverPtr driver, virDomainDefPtr def); int qemuHostdevUpdateActiveSCSIDevices(virQEMUDriverPtr driver, virDomainDefPtr def); +int qemuHostdevUpdateActiveDomainDevices(virQEMUDriverPtr driver, + virDomainDefPtr def); int qemuHostdevPreparePCIDevices(virQEMUDriverPtr driver, const char *name, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 6f3214e..f744419 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3769,13 +3769,7 @@ qemuProcessReconnect(void *opaque) priv->agentError = true; } - if (qemuHostdevUpdateActivePCIDevices(driver, obj->def) < 0) - goto error; - - if (qemuHostdevUpdateActiveUSBDevices(driver, obj->def) < 0) - goto error; - - if (qemuHostdevUpdateActiveSCSIDevices(driver, obj->def) < 0) + if (qemuHostdevUpdateActiveDomainDevices(driver, obj->def) < 0) goto error; if (qemuConnectCgroup(driver, obj) < 0) -- 2.4.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list