virt-manager/virtinst-add-default-rng-device.patch
2015-09-10 22:13:47 +00:00

39 lines
1.4 KiB
Diff

References: bnc#885308
Enhancement to add a virtio RNG device to non windows VMs.
Index: virt-manager-1.2.1/virtinst/guest.py
===================================================================
--- virt-manager-1.2.1.orig/virtinst/guest.py
+++ virt-manager-1.2.1/virtinst/guest.py
@@ -54,6 +54,7 @@ from .pm import PM
from .seclabel import Seclabel
from .xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
from .devicedisk import VirtualDisk
+from .devicerng import VirtualRNGDevice
class Guest(XMLBuilder):
@@ -670,6 +671,15 @@ class Guest(XMLBuilder):
return
self.add_device(VirtualGraphics(self.conn))
+ def add_default_rng(self):
+ osvar = self._get_os_variant()
+ if not self.conn.is_qemu() or not osvar or osvar.startswith("win"):
+ return
+ rng_dev = VirtualRNGDevice(True)
+ rng_dev.type = VirtualRNGDevice.TYPE_RANDOM
+ setattr(rng_dev, "device", "/dev/random")
+ self.add_device(rng_dev)
+
def add_default_devices(self):
self.add_default_graphics()
self.add_default_video_device()
@@ -677,6 +687,7 @@ class Guest(XMLBuilder):
self.add_default_console_device()
self.add_default_usb_controller()
self.add_default_channels()
+ self.add_default_rng()
def _add_install_cdrom(self):
if self._install_cdrom_device: