]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Allow using regular audio backends with VNC
authorCole Robinson <crobinso@redhat.com>
Wed, 19 May 2010 20:41:01 +0000 (16:41 -0400)
committerCole Robinson <crobinso@redhat.com>
Tue, 25 May 2010 14:49:29 +0000 (10:49 -0400)
Currently all host audio backends are disabled if a VM is using VNC, in
favor of the QEMU VNC audio extension. Unfortunately no released VNC
client supports this extension, so users have no way of getting audio
to work if using VNC.

Add a new config option in qemu.conf which allows changing libvirt's
behavior, but keep the default intact.

v2: Fix doc typos, change name to vnc_allow_host_audio

src/qemu/libvirtd_qemu.aug
src/qemu/qemu.conf
src/qemu/qemu_conf.c
src/qemu/qemu_conf.h
src/qemu/test_libvirtd_qemu.aug

index 5bd60b3629963687b28d97b45e0e08a1ca6a5233..551cc20fd8b027bb2f35f6f300d5142e0fbfedf2 100644 (file)
@@ -38,6 +38,7 @@ module Libvirtd_qemu =
                  | str_entry "save_image_format"
                  | str_entry "hugetlbfs_mount"
                  | bool_entry "relaxed_acs_check"
+                 | bool_entry "vnc_allow_host_audio"
 
    (* Each enty in the config is one of the following three ... *)
    let entry = vnc_entry
index 3da332fc8641dc98ebc1bed807706fef2060b6a8..98a117693f20bf58980b55afb0a842fbdc571ab1 100644 (file)
 # be assigned to guests.
 #
 # relaxed_acs_check = 1
+
+
+# QEMU implements an extension for providing audio over a VNC connection,
+# though if your VNC client does not support it, your only chance for getting
+# sound output is through regular audio backends. By default, libvirt will
+# disable all QEMU sound backends if using VNC, since they can cause
+# permissions issues. Enabling this option will make libvirtd honor the
+# QEMU_AUDIO_DRV environment variable when using VNC.
+#
+# vnc_allow_host_audio = 0
index 2755545e792d589e701919b755be2b3b1ce0e030..b4d8e74cbd877f6741c291ad77163e4a0c56d11e 100644 (file)
@@ -351,6 +351,10 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
     CHECK_TYPE ("relaxed_acs_check", VIR_CONF_LONG);
     if (p) driver->relaxedACS = p->l;
 
+    p = virConfGetValue (conf, "vnc_allow_host_audio");
+    CHECK_TYPE ("vnc_allow_host_audio", VIR_CONF_LONG);
+    if (p) driver->vncAllowHostAudio = p->l;
+
     virConfFree (conf);
     return 0;
 }
@@ -4399,12 +4403,15 @@ int qemudBuildCommandLine(virConnectPtr conn,
             ADD_ARG_LIT(def->graphics[0]->data.vnc.keymap);
         }
 
-        /* QEMU implements a VNC extension for providing audio, so we
-         * set the audio backend to none, to prevent it opening the
-         * host OS audio devices since that causes security issues
-         * and is non-sensical when using VNC.
+        /* Unless user requested it, set the audio backend to none, to
+         * prevent it opening the host OS audio devices, since that causes
+         * security issues and might not work when using VNC.
          */
-        ADD_ENV_LIT("QEMU_AUDIO_DRV=none");
+        if (driver->vncAllowHostAudio) {
+            ADD_ENV_COPY("QEMU_AUDIO_DRV");
+        } else {
+            ADD_ENV_LIT("QEMU_AUDIO_DRV=none");
+        }
     } else if ((def->ngraphics == 1) &&
                def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) {
         char *xauth = NULL;
index 8fd8d798f5706f75bd1b4940115cd98de3f1d0a6..7fb4de57d2eec0c2111f50b6858dc0515457e693 100644 (file)
@@ -138,6 +138,8 @@ struct qemud_driver {
 
     unsigned int relaxedACS : 1;
 
+    unsigned int vncAllowHostAudio : 1;
+
     virCapsPtr caps;
 
     /* An array of callbacks */
index 2feedc05cf48749ac960d24e5b3aa5d609acce2a..a048ae55e6016cf6be911afb08ea53e76ccfd230 100644 (file)
@@ -97,6 +97,8 @@ save_image_format = \"gzip\"
 hugetlbfs_mount = \"/dev/hugepages\"
 
 relaxed_acs_check = 1
+
+vnc_allow_host_audio = 1
 "
 
    test Libvirtd_qemu.lns get conf =
@@ -204,3 +206,5 @@ relaxed_acs_check = 1
 { "hugetlbfs_mount" = "/dev/hugepages" }
 { "#empty" }
 { "relaxed_acs_check" = "1" }
+{ "#empty" }
+{ "vnc_allow_host_audio" = "1" }