mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
virtio-rng: Add rate limiting options for virtio-RNG
Qemu's implementation of virtio RNG supports rate limiting of the
entropy used. This patch exposes the option to tune this functionality.
This patch is based on qemu commit 904d6f588063fb5ad2b61998acdf1e73fb4
The rate limiting is exported in the XML as:
<devices>
...
<rng model='virtio'>
<rate bytes='123' period='1234'/>
<backend model='random'/>
</rng>
...
This commit is contained in:
@@ -4294,6 +4294,7 @@ qemu-kvm -net nic,model=? /dev/null
|
||||
...
|
||||
<devices>
|
||||
<rng model='virtio'>
|
||||
<rate period="2000" bytes="1234"/>
|
||||
<backend model='random'>/dev/random</backend>
|
||||
<!-- OR -->
|
||||
<backend model='egd' type='udp'>
|
||||
@@ -4316,6 +4317,18 @@ qemu-kvm -net nic,model=? /dev/null
|
||||
<li>'virtio' — supported by qemu and virtio-rng kernel module</li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt><code>rate</code></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The optional <code>rate</code> element allows limiting the rate at
|
||||
which entropy can be consumed from the source. The mandatory
|
||||
attribute <code>bytes</code> specifies how many bytes are permitted
|
||||
to be consumed per period. An optional <code>period</code> attribute
|
||||
specifies the duration of a period in milliseconds; if omitted, the
|
||||
period is taken as 1000 milliseconds (1 second).
|
||||
<span class='since'>Since 1.0.4</span>
|
||||
</p>
|
||||
</dd>
|
||||
<dt><code>backend</code></dt>
|
||||
<dd>
|
||||
<p>
|
||||
|
||||
@@ -3522,7 +3522,12 @@
|
||||
<value>virtio</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
<ref name="rng-backend"/>
|
||||
<interleave>
|
||||
<ref name="rng-backend"/>
|
||||
<optional>
|
||||
<ref name="rng-rate"/>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
@@ -3550,6 +3555,20 @@
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name="rng-rate">
|
||||
<element name="rate">
|
||||
<attribute name="bytes">
|
||||
<ref name="positiveInteger"/>
|
||||
</attribute>
|
||||
<optional>
|
||||
<attribute name="period">
|
||||
<ref name="positiveInteger"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<empty/>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name="usbmaster">
|
||||
<element name="master">
|
||||
<attribute name="startport">
|
||||
|
||||
Reference in New Issue
Block a user