提交 49b45a1c 编写于 作者: A Andrea Bolognani

conf: Introduce virDomainRNGDefPostParse()

Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 fcb30c40
...@@ -4842,6 +4842,20 @@ virDomainChrDefPostParse(virDomainChrDefPtr chr, ...@@ -4842,6 +4842,20 @@ virDomainChrDefPostParse(virDomainChrDefPtr chr,
} }
static int
virDomainRNGDefPostParse(virDomainRNGDefPtr rng)
{
/* set default path for virtio-rng "random" backend to /dev/random */
if (rng->backend == VIR_DOMAIN_RNG_BACKEND_RANDOM &&
!rng->source.file) {
if (VIR_STRDUP(rng->source.file, "/dev/random") < 0)
return -1;
}
return 0;
}
static int static int
virDomainVsockDefPostParse(virDomainVsockDefPtr vsock) virDomainVsockDefPostParse(virDomainVsockDefPtr vsock)
{ {
...@@ -4866,13 +4880,8 @@ virDomainDeviceDefPostParseCommon(virDomainDeviceDefPtr dev, ...@@ -4866,13 +4880,8 @@ virDomainDeviceDefPostParseCommon(virDomainDeviceDefPtr dev,
if (dev->type == VIR_DOMAIN_DEVICE_CHR) if (dev->type == VIR_DOMAIN_DEVICE_CHR)
return virDomainChrDefPostParse(dev->data.chr, def); return virDomainChrDefPostParse(dev->data.chr, def);
/* set default path for virtio-rng "random" backend to /dev/random */ if (dev->type == VIR_DOMAIN_DEVICE_RNG)
if (dev->type == VIR_DOMAIN_DEVICE_RNG && return virDomainRNGDefPostParse(dev->data.rng);
dev->data.rng->backend == VIR_DOMAIN_RNG_BACKEND_RANDOM &&
!dev->data.rng->source.file) {
if (VIR_STRDUP(dev->data.rng->source.file, "/dev/random") < 0)
return -1;
}
/* verify disk source */ /* verify disk source */
if (dev->type == VIR_DOMAIN_DEVICE_DISK) { if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册