On Wed, Jan 01, 2020 at 13:06:33 +0800, Han Han wrote:
Since v4.2-rc0, QEMU introduced a builtin rng backend that uses
getrandom() syscall to generate random. Add it to libvirt with the
backend model 'builtin'.
https://bugzilla.redhat.com/show_bug.cgi?id=1785091
Signed-off-by: Han Han <hhan(a)redhat.com>
---
src/conf/domain_audit.c | 2 ++
src/conf/domain_conf.c | 9 +++++++++
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 15 +++++++++++++++
src/qemu/qemu_domain.c | 3 +++
5 files changed, 30 insertions(+)
[...]
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index a8137b3a..d372d289 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
[...]
@@ -5640,6 +5641,20 @@ qemuBuildRNGBackendProps(virDomainRNGDefPtr
rng,
break;
+ case VIR_DOMAIN_RNG_BACKEND_BUILTIN:
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_RNG_BUILTIN)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("this qemu doesn't support the rng-builtin "
+ "backend"));
The error message is misaligned, should be on a single line and also
should be in the validation code not in the formatter.
+ return -1;
+ }
+
+ if (qemuMonitorCreateObjectProps(props, "rng-builtin", objAlias,
+ NULL) < 0)
+ return -1;
+
+ break;
+
case VIR_DOMAIN_RNG_BACKEND_LAST:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("unknown rng-random backend"));
This patch fails to pass make check:
$ ./tests/qemucapabilitiestest
TEST: qemucapabilitiestest
............!........................... 40
....!.......!........................... 80
....!... 88 FAIL
45) 4.2.0 (x86_64) ...
In '/home/pipo/libvirt/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml':
Offset 7070
Expect [v]
Actual [flag name='rng-builtin'/>
<v]
... FAILED