Re: [libvirt] [PATCHv2 3/8] conf: Add support for RNG device configuration in XML

2013-02-25 Thread Peter Krempa

On 02/23/13 00:33, Eric Blake wrote:

On 02/21/2013 07:47 AM, Peter Krempa wrote:

This patch adds basic configuration support for the RNG device suporting


s/suporting/supporting/


the virtio model with the random and egd backend types as described
in the schema in the previous patch.
---

Notes:
 Version 2:
 - fix a ton of memory leaks (I assumed that virXMLGetProp returns static 
strings)
 - Add new device type to even more places
 - Fix error message cp error
 - Fix memleak in RNGDef free func



...

@@ -10601,6 +10734,22 @@ virDomainDefParseXML(virCapsPtr caps,
  }
  }

+/* Parse the RNG device */
+if ((n = virXPathNodeSet(./devices/rng, ctxt, nodes))  0)
+goto error;
+
+if (n  1) {
+virReportError(VIR_ERR_XML_ERROR, %s,
+   _(only a single RNG device is supported));


Is this an inherent limit of qemu?  For that matter, is it an inherent
limit, and no hypervisor can ever support more than one?  In the bare
metal case, can't you plug in multiple rng hardware dongles?


AFAIK qemu is able to support multiple RNG devices but I didn't find 
that particularly useful. I will follow up with a patch that will add 
support for more than one RNG device, although I don't think it will be 
used much.


Peter

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


Re: [libvirt] [PATCHv2 3/8] conf: Add support for RNG device configuration in XML

2013-02-25 Thread Peter Krempa

On 02/25/13 10:42, Peter Krempa wrote:

On 02/23/13 00:33, Eric Blake wrote:

On 02/21/2013 07:47 AM, Peter Krempa wrote:

This patch adds basic configuration support for the RNG device suporting


s/suporting/supporting/


the virtio model with the random and egd backend types as described
in the schema in the previous patch.
---

Notes:
 Version 2:
 - fix a ton of memory leaks (I assumed that virXMLGetProp
returns static strings)
 - Add new device type to even more places
 - Fix error message cp error
 - Fix memleak in RNGDef free func



...

@@ -10601,6 +10734,22 @@ virDomainDefParseXML(virCapsPtr caps,
  }
  }

+/* Parse the RNG device */
+if ((n = virXPathNodeSet(./devices/rng, ctxt, nodes))  0)
+goto error;
+
+if (n  1) {
+virReportError(VIR_ERR_XML_ERROR, %s,
+   _(only a single RNG device is supported));


Is this an inherent limit of qemu?  For that matter, is it an inherent
limit, and no hypervisor can ever support more than one?  In the bare
metal case, can't you plug in multiple rng hardware dongles?


AFAIK qemu is able to support multiple RNG devices but I didn't find
that particularly useful. I will follow up with a patch that will add
support for more than one RNG device, although I don't think it will be
used much.


I hacked up the patch to add support for multiple RNG's. qemu appears to 
support the device just fine.


As of guest support it seems that it triggers a 100% reproducible kernel 
panic on linux guest when attempting to read from a machine with two 
virtio-rng devices. I filed a bug to track this issue:


https://bugzilla.redhat.com/show_bug.cgi?id=915335

Peter


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


Re: [libvirt] [PATCHv2 3/8] conf: Add support for RNG device configuration in XML

2013-02-22 Thread Eric Blake
On 02/21/2013 07:47 AM, Peter Krempa wrote:
 This patch adds basic configuration support for the RNG device suporting

s/suporting/supporting/

 the virtio model with the random and egd backend types as described
 in the schema in the previous patch.
 ---
 
 Notes:
 Version 2:
 - fix a ton of memory leaks (I assumed that virXMLGetProp returns static 
 strings)
 - Add new device type to even more places
 - Fix error message cp error
 - Fix memleak in RNGDef free func

 +case VIR_DOMAIN_RNG_BACKEND_EGD:
 +{
 +char *type = virXMLPropString(backends[0], type);
 +if (!type) {
 +virReportError(VIR_ERR_XML_ERROR, %s,
 +   _(missing EGD backend type));
 +goto error;
 +}
 +
 +
 +if (VIR_ALLOC(def-source.chardev)  0) {
 +virReportOOMError();
 +goto error;
 +}

Memleak on 'type'.

 @@ -10601,6 +10734,22 @@ virDomainDefParseXML(virCapsPtr caps,
  }
  }
 
 +/* Parse the RNG device */
 +if ((n = virXPathNodeSet(./devices/rng, ctxt, nodes))  0)
 +goto error;
 +
 +if (n  1) {
 +virReportError(VIR_ERR_XML_ERROR, %s,
 +   _(only a single RNG device is supported));

Is this an inherent limit of qemu?  For that matter, is it an inherent
limit, and no hypervisor can ever support more than one?  In the bare
metal case, can't you plug in multiple rng hardware dongles?


 +static int
 +virDomainRNGDefFormat(virBufferPtr buf,
 +  virDomainRNGDefPtr def,
 +  unsigned int flags)
 +{
 +const char *model = virDomainRNGModelTypeToString(def-model);
 +const char *backend = virDomainRNGBackendTypeToString(def-backend);
 +
 +virBufferAsprintf(buf, rng model='%s'\n, model);
 +virBufferAsprintf(buf,   backend model='%s', backend);
 +
 +switch ((enum virDomainRNGBackend) def-backend) {
 +case VIR_DOMAIN_RNG_BACKEND_RANDOM:
 +if (def-source.file)
 +virBufferAsprintf(buf, %s/backend\n, def-source.file);

Must use virBufferEscape(), as a random file name could contain
characters that are special to XML.

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



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list