mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
libxl: add validation if sound device is supported
Xen supports only subset of libvirt's sound devices, and starting with Xen 4.17 it is enforced by libxl. Verify it early. Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
4102acc608
commit
f2fe8a3504
@ -312,6 +312,28 @@ libxlDomainDefValidate(const virDomainDef *def,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (def->nsounds > 0) {
|
||||
virDomainSoundDef *snd = def->sounds[0];
|
||||
|
||||
switch (snd->model) {
|
||||
case VIR_DOMAIN_SOUND_MODEL_ICH6:
|
||||
case VIR_DOMAIN_SOUND_MODEL_ES1370:
|
||||
case VIR_DOMAIN_SOUND_MODEL_AC97:
|
||||
case VIR_DOMAIN_SOUND_MODEL_SB16:
|
||||
break;
|
||||
default:
|
||||
case VIR_DOMAIN_SOUND_MODEL_PCSPK:
|
||||
case VIR_DOMAIN_SOUND_MODEL_ICH7:
|
||||
case VIR_DOMAIN_SOUND_MODEL_USB:
|
||||
case VIR_DOMAIN_SOUND_MODEL_ICH9:
|
||||
case VIR_DOMAIN_SOUND_MODEL_LAST:
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("unsupported audio model %s"),
|
||||
virDomainSoundModelTypeToString(snd->model));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user