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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 06, 2015 at 04:32:25PM +0100, Peter Krempa wrote:
> From: Luyao Huang <lhuang@xxxxxxxxxx>
> 
> Export the required helpers and add backend code to hotplug RNG devices.
> 
> Signed-off-by: Luyao Huang <lhuang@xxxxxxxxxx>
> Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
> ---
>  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

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]