diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 1835b39911..4cafc92aba 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4310,7 +4310,8 @@ qemu-kvm -net nic,model=? /dev/null model attribute. Supported source models are:

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index e7231cc0bf..4b608855af 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3511,7 +3511,10 @@ random - + + /dev/random + /dev/hwrng + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 995cf0cae3..9c96cf1af0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7423,6 +7423,13 @@ virDomainRNGDefParseXML(const xmlNodePtr node, switch ((enum virDomainRNGBackend) def->backend) { case VIR_DOMAIN_RNG_BACKEND_RANDOM: def->source.file = virXPathString("string(./backend)", ctxt); + if (STRNEQ(def->source.file, "/dev/random") && + STRNEQ(def->source.file, "/dev/hwrng")) { + virReportError(VIR_ERR_XML_ERROR, + _("file '%s' is not a supported random source"), + def->source.file); + goto error; + } break; case VIR_DOMAIN_RNG_BACKEND_EGD: diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.args b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.args index ad271321e7..7ab9dbc0c0 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-random.args @@ -2,5 +2,5 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu \ -S -M pc -m 214 -smp 1 -nographic -nodefaults \ -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ --object 'rng-random,id=rng0,filename=/test/ph - /test/ph<ile + /dev/hwrng