diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index 7c920c9c67..ca38a064a7 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 c1a0a57f95..0a3c715998 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 6f3214e48f..f7444196af 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)