mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 04:55:18 +00:00
conf: Introduce virDomainRNGDefPostParse()
Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
fcb30c40e9
commit
49b45a1cf4
@ -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
|
||||
virDomainVsockDefPostParse(virDomainVsockDefPtr vsock)
|
||||
{
|
||||
@ -4866,13 +4880,8 @@ virDomainDeviceDefPostParseCommon(virDomainDeviceDefPtr dev,
|
||||
if (dev->type == VIR_DOMAIN_DEVICE_CHR)
|
||||
return virDomainChrDefPostParse(dev->data.chr, def);
|
||||
|
||||
/* set default path for virtio-rng "random" backend to /dev/random */
|
||||
if (dev->type == VIR_DOMAIN_DEVICE_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;
|
||||
}
|
||||
if (dev->type == VIR_DOMAIN_DEVICE_RNG)
|
||||
return virDomainRNGDefPostParse(dev->data.rng);
|
||||
|
||||
/* verify disk source */
|
||||
if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user