[PATCH virt-manager] rng: add builtin rng backend model

Han Han hhan at redhat.com
Sun Apr 19 13:39:02 UTC 2020


The builtin rng backend uses getrandom syscall to generate random, no
external rng source needed, introduced from libvirt v6.1.0.

Signed-off-by: Han Han <hhan at redhat.com>
---
 man/virt-install.pod       | 8 +++++++-
 virtManager/addhardware.py | 2 ++
 virtinst/devices/rng.py    | 1 +
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/man/virt-install.pod b/man/virt-install.pod
index 12840253..69b49c4b 100644
--- a/man/virt-install.pod
+++ b/man/virt-install.pod
@@ -1722,7 +1722,7 @@ Use --tpm=? to see a list of all available sub options. Complete details at L<ht
 
 Configure a virtual RNG device.
 
-Type can be B<random> or B<egd>.
+Type can be B<random>, B<egd> or B<builtin>.
 
 If the specified type is B<random> then these values must
 be specified:
@@ -1768,6 +1768,8 @@ B<udp> and backend_mode is B<bind>.
 
 =back
 
+If the specified type is B<builtin>, B<backend> is not required.
+
 An example invocation:
 
 =over 4
@@ -1781,6 +1783,10 @@ Connect to localhost to the TCP port 8000 to get entropy data.
 Use the /dev/random device to get entropy data, this form implicitly uses the
 "random" model.
 
+=item B<--rng builtin>
+
+Use the builtin rng device to get entropy data.
+
 Use --rng=? to see a list of all available sub options. Complete details at L<https://libvirt.org/formatdomain.html#elementsRng>
 
 =back
diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
index 25eedb02..492402cc 100644
--- a/virtManager/addhardware.py
+++ b/virtManager/addhardware.py
@@ -573,6 +573,8 @@ class vmmAddHardware(vmmGObjectUI):
             return _("Random")
         if rng_type == DeviceRng.TYPE_EGD:
             return _("Entropy Gathering Daemon")
+        if rng_type == DeviceRng.TYPE_BUILTIN:
+            return _("Builtin RNG")
         return rng_type
 
     @staticmethod
diff --git a/virtinst/devices/rng.py b/virtinst/devices/rng.py
index 82e31ba3..777c3dd6 100644
--- a/virtinst/devices/rng.py
+++ b/virtinst/devices/rng.py
@@ -14,6 +14,7 @@ class DeviceRng(Device):
 
     TYPE_RANDOM = "random"
     TYPE_EGD = "egd"
+    TYPE_BUILTIN = "builtin"
 
     model = XMLProperty("./@model")
 
-- 
2.25.0




More information about the virt-tools-list mailing list