On Fri, Feb 06, 2015 at 04:32:25PM +0100, Peter Krempa wrote: > From: Luyao Huang <[email protected]> > > Export the required helpers and add backend code to hotplug RNG devices. > > Signed-off-by: Luyao Huang <[email protected]> > Signed-off-by: Peter Krempa <[email protected]> > --- > src/qemu/qemu_command.c | 2 +- > src/qemu/qemu_command.h | 4 ++ > src/qemu/qemu_driver.c | 8 +++- > src/qemu/qemu_hotplug.c | 99 > +++++++++++++++++++++++++++++++++++++++++++++++++ > src/qemu/qemu_hotplug.h | 3 ++ > 5 files changed, 114 insertions(+), 2 deletions(-) >
-- 8< 8< 8< --
> +
> + /* attach the device - up to a 3 stage process */
> + qemuDomainObjEnterMonitor(driver, vm);
> +
> + if (rng->backend == VIR_DOMAIN_RNG_BACKEND_EGD &&
> + qemuMonitorAttachCharDev(priv->mon, charAlias,
> + rng->source.chardev) < 0)
> + goto failchardev;
> +
> + if (qemuMonitorAddObject(priv->mon, type, objAlias, props) < 0)
> + goto failbackend;
> +
> + if (qemuMonitorAddDevice(priv->mon, devstr) < 0)
> + goto failfrontend;
> +
> + if (qemuDomainObjExitMonitor(driver, vm) < 0) {
> + vm = NULL;
> + goto cleanup;
> + }
I know an OOM error at this exact location is not that likely, but
it would be nicer to prealloc the space in vm->def before entering
the monitor so that the operation below cannot fail, like we do
when hotplugging other devices.
Jan
signature.asc
Description: Digital signature
-- libvir-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/libvir-list
