Re: [PATCH 4/4] qemu: Implement support for the RNG device and the random backend

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

 



On 01/11/2013 10:00 AM, Peter Krempa wrote:
> This patch implements support for the virtio-rng-pci device and the
> rng-random backend in qemu.
> 
> Two capabilities bits are added to track support for those:
> 
> QEMU_CAPS_DEVICE_VIRTIO_RNG - for the device support and
> QEMU_CAPS_OBJECT_RNG_RANDOM - for the backend support.

Is there any version of qemu where one but not the other feature is
available?  Or are we always guaranteed that if one is present, the
other is as well, in which case we really only need one bit,
QEMU_CAPS_VIRTIO_RNG?

> ---
>  src/qemu/qemu_capabilities.c |   5 +-
>  src/qemu/qemu_capabilities.h |   3 ++
>  src/qemu/qemu_command.c      | 108 +++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 115 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index b166dd6..4947a3a 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -203,7 +203,8 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST,
> 
>                "usb-serial", /* 125 */
>                "usb-net",
> -
> +              "virtio-rng",
> +              "rng-random",

There may be trivial merge conflicts to resolve, but not a big deal.

> +    case VIR_DOMAIN_RNG_SOURCE_RANDOM:
> +        if (qemuCapsGet(caps, QEMU_CAPS_OBJECT_RNG_RANDOM)) {
> +            virBufferAsprintf(&buf, "rng-random,id=%s", dev->info.alias);
> +            if (dev->address)
> +                virBufferAsprintf(&buf, ",filename=%s", dev->address);
> +        } else {
> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                           _("this qemu doesn't support the rng-random "
> +                             " backend"));

Two spaces in the error message line wrap; should only be one.

> +char *
> +qemuBuildRNGDevStr(virDomainRNGDefPtr dev,
> +                   qemuCapsPtr caps)
> +{
> +    virBuffer buf = VIR_BUFFER_INITIALIZER;
> +
> +    if (dev->model != VIR_DOMAIN_RNG_MODEL_VIRTIO ||
> +        !qemuCapsGet(caps, QEMU_CAPS_DEVICE_VIRTIO_RNG)) {
> +        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +                       _("RNG device type '%s' is not supported "
> +                         "by this of qemu"),

Missing the word 'version'.

> @@ -6978,6 +7064,28 @@ qemuBuildCommandLine(virConnectPtr conn,
>          }
>      }
> 
> +    if (def->rng &&
> +        def->rng->model != VIR_DOMAIN_RNG_MODEL_NONE) {
> +        char *optstr;

I'm still not convinced we need def->rng->model of NONE; if def->rng
exists, it should point to a valid model.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP 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]