mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
conf: virDomainGraphicsDefValidate: validate attribute 'network' for listen type 'network'
Related: https://gitlab.com/libvirt/libvirt/-/issues/93 Signed-off-by: Amneesh Singh <natto@weirdnatto.in> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
d9f175379c
commit
871a071abb
@ -2381,10 +2381,35 @@ virDomainAudioDefValidate(const virDomainDef *def,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
virDomainGraphicsDefListensValidate(const virDomainGraphicsDef *def)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < def->nListens; i++) {
|
||||
if (def->listens[i].type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK &&
|
||||
!def->listens[i].network) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("'network' attribute is required for "
|
||||
"listen type 'network'"));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
virDomainGraphicsDefValidate(const virDomainDef *def,
|
||||
const virDomainGraphicsDef *graphics)
|
||||
{
|
||||
if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC ||
|
||||
graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE ||
|
||||
graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_RDP) {
|
||||
if (virDomainGraphicsDefListensValidate(graphics) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC)
|
||||
return virDomainEnsureAudioID(def, graphics->data.vnc.audioId);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user