mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
f34f73622d
The builtin rng backend uses getrandom syscall to generate random, no external rng source needed, introduced from libvirt v6.1.0. Reviewed-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Han Han <hhan@redhat.com>
40 lines
936 B
Python
40 lines
936 B
Python
#
|
|
# Copyright 2013 Red Hat, Inc.
|
|
#
|
|
# This work is licensed under the GNU GPLv2 or later.
|
|
# See the COPYING file in the top-level directory.
|
|
|
|
from .device import Device
|
|
from .char import CharSource
|
|
from ..xmlbuilder import XMLChildProperty, XMLProperty
|
|
|
|
|
|
class DeviceRng(Device):
|
|
XML_NAME = "rng"
|
|
|
|
TYPE_RANDOM = "random"
|
|
TYPE_EGD = "egd"
|
|
TYPE_BUILTIN = "builtin"
|
|
|
|
model = XMLProperty("./@model")
|
|
|
|
backend_model = XMLProperty("./backend/@model")
|
|
backend_type = XMLProperty("./backend/@type")
|
|
|
|
source = XMLChildProperty(CharSource, is_single=True,
|
|
relative_xpath="./backend")
|
|
|
|
rate_bytes = XMLProperty("./rate/@bytes")
|
|
rate_period = XMLProperty("./rate/@period")
|
|
|
|
device = XMLProperty("./backend[@model='random']")
|
|
|
|
|
|
##################
|
|
# Default config #
|
|
##################
|
|
|
|
def set_defaults(self, guest):
|
|
if not self.model:
|
|
self.model = "virtio"
|