render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
Mark McLoughlin 38cf1b
From 4721ceb9b85daabe53804627473b06ced821c695 Mon Sep 17 00:00:00 2001
Mark McLoughlin 38cf1b
From: Daniel P. Berrange <berrange@redhat.com>
Mark McLoughlin 38cf1b
Date: Mon, 14 Sep 2009 11:23:20 +0100
Mark McLoughlin 38cf1b
Subject: [PATCH] Allow control over QEMU audio backend
Mark McLoughlin 38cf1b
Mark McLoughlin 38cf1b
When using VNC for graphics + keyboard + mouse, we shouldn't
Mark McLoughlin 38cf1b
then use the host OS for audio. Audio should go back over
Mark McLoughlin 38cf1b
VNC.
Mark McLoughlin 38cf1b
Mark McLoughlin 38cf1b
When using SDL for graphics, we should use the host OS for
Mark McLoughlin 38cf1b
audio since that's where the display is. We need to allow
Mark McLoughlin 38cf1b
certain QEMU env variables to be passed through to guest
Mark McLoughlin 38cf1b
too to allow choice of QEMU audio backend.
Mark McLoughlin 38cf1b
Mark McLoughlin 38cf1b
* qemud/libvirtd.sysconf: Mention QEMU/SDL audio env vars
Mark McLoughlin 38cf1b
* src/qemu_conf.c: Passthrough QEMU/SDL audio env for SDL display,
Mark McLoughlin 38cf1b
  disable host audio for VNC display
Mark McLoughlin 38cf1b
Mark McLoughlin 38cf1b
(cherry picked from commit b08e6d38ae7a0ed70300d7d82107f83fddb60f44)
Mark McLoughlin 38cf1b
Mark McLoughlin 38cf1b
Fedora-patch: libvirt-disable-audio-backend.patch
Mark McLoughlin 38cf1b
---
Mark McLoughlin 38cf1b
 qemud/libvirtd.sysconf |    8 ++++++++
Mark McLoughlin 38cf1b
 src/qemu_conf.c        |   14 ++++++++++++++
Mark McLoughlin 38cf1b
 2 files changed, 22 insertions(+), 0 deletions(-)
Mark McLoughlin 38cf1b
Mark McLoughlin 38cf1b
diff --git a/qemud/libvirtd.sysconf b/qemud/libvirtd.sysconf
Mark McLoughlin 38cf1b
index fe4596a..28080a0 100644
Mark McLoughlin 38cf1b
--- a/qemud/libvirtd.sysconf
Mark McLoughlin 38cf1b
+++ b/qemud/libvirtd.sysconf
Mark McLoughlin 38cf1b
@@ -7,3 +7,11 @@
Mark McLoughlin 38cf1b
 
Mark McLoughlin 38cf1b
 # Override Kerberos service keytab for SASL/GSSAPI
Mark McLoughlin 38cf1b
 #KRB5_KTNAME=/etc/libvirt/krb5.tab
Mark McLoughlin 38cf1b
+
Mark McLoughlin 38cf1b
+# Override the QEMU/SDL default audio driver probing when
Mark McLoughlin 38cf1b
+# starting virtual machines using SDL graphics
Mark McLoughlin 38cf1b
+#
Mark McLoughlin 38cf1b
+# NB these have no effect for VMs using VNC
Mark McLoughlin 38cf1b
+#QEMU_AUDIO_DRV=sdl
Mark McLoughlin 38cf1b
+#
Mark McLoughlin 38cf1b
+#SDL_AUDIODRIVER=pulse
Mark McLoughlin 38cf1b
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
Mark McLoughlin 38cf1b
index f92bcef..0dd0624 100644
Mark McLoughlin 38cf1b
--- a/src/qemu_conf.c
Mark McLoughlin 38cf1b
+++ b/src/qemu_conf.c
Mark McLoughlin 38cf1b
@@ -2109,6 +2109,13 @@ int qemudBuildCommandLine(virConnectPtr conn,
Mark McLoughlin 38cf1b
             ADD_ARG_LIT("-k");
Mark McLoughlin 38cf1b
             ADD_ARG_LIT(def->graphics[0]->data.vnc.keymap);
Mark McLoughlin 38cf1b
         }
Mark McLoughlin 38cf1b
+
Mark McLoughlin 38cf1b
+        /* QEMU implements a VNC extension for providing audio, so we
Mark McLoughlin 38cf1b
+         * set the audio backend to none, to prevent it opening the
Mark McLoughlin 38cf1b
+         * host OS audio devices since that causes security issues
Mark McLoughlin 38cf1b
+         * and is non-sensical when using VNC.
Mark McLoughlin 38cf1b
+         */
Mark McLoughlin 38cf1b
+        ADD_ENV_LIT("QEMU_AUDIO_DRV=none");
Mark McLoughlin 38cf1b
     } else if ((def->ngraphics == 1) &&
Mark McLoughlin 38cf1b
                def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) {
Mark McLoughlin 38cf1b
         char *xauth = NULL;
Mark McLoughlin 38cf1b
@@ -2131,6 +2138,13 @@ int qemudBuildCommandLine(virConnectPtr conn,
Mark McLoughlin 38cf1b
             ADD_ENV(display);
Mark McLoughlin 38cf1b
         if (def->graphics[0]->data.sdl.fullscreen)
Mark McLoughlin 38cf1b
             ADD_ARG_LIT("-full-screen");
Mark McLoughlin 38cf1b
+
Mark McLoughlin 38cf1b
+        /* If using SDL for video, then we should just let it
Mark McLoughlin 38cf1b
+         * use QEMU's host audio drivers, possibly SDL too
Mark McLoughlin 38cf1b
+         * User can set these two before starting libvirtd
Mark McLoughlin 38cf1b
+         */
Mark McLoughlin 38cf1b
+        ADD_ENV_COPY("QEMU_AUDIO_DRV");
Mark McLoughlin 38cf1b
+        ADD_ENV_COPY("SDL_AUDIODRIVER");
Mark McLoughlin 38cf1b
     }
Mark McLoughlin 38cf1b
 
Mark McLoughlin 38cf1b
     if (def->nvideos) {
Mark McLoughlin 38cf1b
-- 
Mark McLoughlin 38cf1b
1.6.2.5
Mark McLoughlin 38cf1b