[PATCH v2 1/2] libxl: add validation if sound device is supported

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxxxx>
---
 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) {
+            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;
 }
 
-- 
2.37.3




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux