Blame SOURCES/0072-launch-libvirt-Add-a-dev-urandom-based-virtio-rng-de.patch

e76f14
From 3281d502733b198697bd076ae71d278c0e8b1912 Mon Sep 17 00:00:00 2001
e76f14
From: "Richard W.M. Jones" <rjones@redhat.com>
e76f14
Date: Thu, 28 Apr 2016 15:58:05 +0100
e76f14
Subject: [PATCH] launch: libvirt: Add a /dev/urandom-based virtio-rng device
e76f14
 to the appliance.
e76f14
e76f14
It is safe to use /dev/urandom to seed the guest.  In libvirt 1.3.4
e76f14
this silly restriction has been lifted.
e76f14
e76f14
This restores commit b2c845333f66d4d3135d3b6a8d4b992d6160bf0a.
e76f14
See also commit 9423c16607259b30985c46d04db9958ec079aa42.
e76f14
e76f14
Thanks: Cole Robinson for doing the libvirt implementation.
e76f14
(cherry picked from commit 2b9f58f87b0dc2553061b4d8b301ff8e08121cb7)
e76f14
---
e76f14
 src/launch-libvirt.c | 29 +++++++++++------------------
e76f14
 1 file changed, 11 insertions(+), 18 deletions(-)
e76f14
e76f14
diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c
e76f14
index 96c5913..4c29409 100644
e76f14
--- a/src/launch-libvirt.c
e76f14
+++ b/src/launch-libvirt.c
e76f14
@@ -1306,26 +1306,19 @@ construct_libvirt_xml_devices (guestfs_h *g,
e76f14
     }
e76f14
 #endif
e76f14
 
e76f14
-#if 0
e76f14
-    /* This is disabled.  Pulling random numbers from /dev/random
e76f14
-     * causes the appliance to pause for long periods.  We should
e76f14
-     * use /dev/urandom, but for bogus reasons libvirt prevents that.
e76f14
-     * https://bugzilla.redhat.com/show_bug.cgi?id=1074464#c7
e76f14
+    /* Add a random number generator (backend for virtio-rng).  This
e76f14
+     * requires Cole Robinson's patch to permit /dev/urandom to be
e76f14
+     * used, which was added in libvirt 1.3.4.
e76f14
      */
e76f14
-    /* Add a random number generator (backend for virtio-rng). */
e76f14
-    start_element ("rng") {
e76f14
-      attribute ("model", "virtio");
e76f14
-      start_element ("backend") {
e76f14
-        attribute ("model", "random");
e76f14
-        /* It'd be nice to do this, but libvirt says:
e76f14
-         *   file '/dev/urandom' is not a supported random source
e76f14
-         * Let libvirt pick /dev/random automatically instead.
e76f14
-         * See also: https://bugzilla.redhat.com/show_bug.cgi?id=1074464
e76f14
-         */
e76f14
-        //string ("/dev/urandom");
e76f14
+    if (params->data->libvirt_version >= 1003004) {
e76f14
+      start_element ("rng") {
e76f14
+        attribute ("model", "virtio");
e76f14
+        start_element ("backend") {
e76f14
+          attribute ("model", "random");
e76f14
+          string ("/dev/urandom");
e76f14
+        } end_element ();
e76f14
       } end_element ();
e76f14
-    } end_element ();
e76f14
-#endif
e76f14
+    }
e76f14
 
e76f14
     /* virtio-scsi controller. */
e76f14
     start_element ("controller") {
e76f14
-- 
7af31e
1.8.3.1
e76f14