2013-09-18 21:29:28 +08:00
|
|
|
#
|
2013-10-28 04:59:47 +08:00
|
|
|
# Copyright 2013 Red Hat, Inc.
|
2013-09-18 21:29:28 +08:00
|
|
|
#
|
2018-04-04 21:35:41 +08:00
|
|
|
# This work is licensed under the GNU GPLv2 or later.
|
2018-03-21 03:00:02 +08:00
|
|
|
# See the COPYING file in the top-level directory.
|
2013-09-18 21:29:28 +08:00
|
|
|
|
2018-03-21 00:18:35 +08:00
|
|
|
from .device import Device
|
2019-05-14 02:42:50 +08:00
|
|
|
from .char import CharSource
|
|
|
|
from ..xmlbuilder import XMLChildProperty, XMLProperty
|
2013-09-18 21:29:28 +08:00
|
|
|
|
|
|
|
|
2018-03-21 00:18:35 +08:00
|
|
|
class DeviceRng(Device):
|
2018-03-21 22:53:34 +08:00
|
|
|
XML_NAME = "rng"
|
2013-09-18 21:29:28 +08:00
|
|
|
|
|
|
|
TYPE_RANDOM = "random"
|
|
|
|
TYPE_EGD = "egd"
|
2020-04-19 21:39:02 +08:00
|
|
|
TYPE_BUILTIN = "builtin"
|
2013-09-18 21:29:28 +08:00
|
|
|
|
2018-09-02 07:58:24 +08:00
|
|
|
model = XMLProperty("./@model")
|
2013-09-18 21:29:28 +08:00
|
|
|
|
2019-05-14 02:42:50 +08:00
|
|
|
backend_model = XMLProperty("./backend/@model")
|
2015-09-06 05:20:43 +08:00
|
|
|
backend_type = XMLProperty("./backend/@type")
|
2013-10-25 23:13:26 +08:00
|
|
|
|
2019-05-14 02:42:50 +08:00
|
|
|
source = XMLChildProperty(CharSource, is_single=True,
|
|
|
|
relative_xpath="./backend")
|
2013-09-18 21:29:28 +08:00
|
|
|
|
2015-09-06 05:20:43 +08:00
|
|
|
rate_bytes = XMLProperty("./rate/@bytes")
|
|
|
|
rate_period = XMLProperty("./rate/@period")
|
2013-09-18 21:29:28 +08:00
|
|
|
|
2017-03-09 06:48:26 +08:00
|
|
|
device = XMLProperty("./backend[@model='random']")
|
2018-09-02 07:58:24 +08:00
|
|
|
|
|
|
|
|
|
|
|
##################
|
|
|
|
# Default config #
|
|
|
|
##################
|
|
|
|
|
|
|
|
def set_defaults(self, guest):
|
|
|
|
if not self.model:
|
|
|
|
self.model = "virtio"
|