qemu: hostdev: Introduce qemuHostdevUpdateActiveDomainDevices()

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.
This commit is contained in:
Andrea Bolognani 2015-10-26 12:09:33 +01:00
parent 8da5cbfc78
commit 66f319aec0
3 changed files with 21 additions and 7 deletions

View File

@ -83,6 +83,24 @@ qemuHostdevUpdateActiveSCSIDevices(virQEMUDriverPtr driver,
QEMU_DRIVER_NAME, def->name); 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 bool
qemuHostdevHostSupportsPassthroughVFIO(void) qemuHostdevHostSupportsPassthroughVFIO(void)

View File

@ -36,6 +36,8 @@ int qemuHostdevUpdateActiveUSBDevices(virQEMUDriverPtr driver,
virDomainDefPtr def); virDomainDefPtr def);
int qemuHostdevUpdateActiveSCSIDevices(virQEMUDriverPtr driver, int qemuHostdevUpdateActiveSCSIDevices(virQEMUDriverPtr driver,
virDomainDefPtr def); virDomainDefPtr def);
int qemuHostdevUpdateActiveDomainDevices(virQEMUDriverPtr driver,
virDomainDefPtr def);
int qemuHostdevPreparePCIDevices(virQEMUDriverPtr driver, int qemuHostdevPreparePCIDevices(virQEMUDriverPtr driver,
const char *name, const char *name,

View File

@ -3769,13 +3769,7 @@ qemuProcessReconnect(void *opaque)
priv->agentError = true; priv->agentError = true;
} }
if (qemuHostdevUpdateActivePCIDevices(driver, obj->def) < 0) if (qemuHostdevUpdateActiveDomainDevices(driver, obj->def) < 0)
goto error;
if (qemuHostdevUpdateActiveUSBDevices(driver, obj->def) < 0)
goto error;
if (qemuHostdevUpdateActiveSCSIDevices(driver, obj->def) < 0)
goto error; goto error;
if (qemuConnectCgroup(driver, obj) < 0) if (qemuConnectCgroup(driver, obj) < 0)