[libvirt] [PATCH 11/12] qemu: Implement random number generator hotplug

Ján Tomko jtomko at redhat.com
Mon Feb 9 15:57:17 UTC 2015


On Fri, Feb 06, 2015 at 04:32:25PM +0100, Peter Krempa wrote:
> From: Luyao Huang <lhuang at redhat.com>
> 
> Export the required helpers and add backend code to hotplug RNG devices.
> 
> Signed-off-by: Luyao Huang <lhuang at redhat.com>
> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> ---
>  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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150209/8a3e3bee/attachment-0001.sig>


More information about the libvir-list mailing list