On 12/20/22 23:52, Marek Marczykowski-Górecki wrote:
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(a)invisiblethingslab.com>
---
src/libxl/libxl_domain.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 2d53250895..6507e34469 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -312,6 +312,27 @@ libxlDomainDefValidate(const virDomainDef *def,
return -1;
}
+ if (def->nsounds > 0) {
+ virDomainSoundDef *snd = def->sounds[0];
+ switch (snd->model) {
Nit pick, the variable declaration block and code should be separated by
an empty line. It's more readable that way.
+ 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;
}
Reviewed-by: Michal Privoznik <mprivozn(a)redhat.com>
Michal