Red Hat Bugzilla – Bug 848927
RFE: support VNC audio
Last modified: 2016-09-20 00:43:33 EDT
Description of problem:
Creating a virtual domain with virsh or virt-manager will bring up a Windows 7 VM with the appropriate sound driver, but it will not play through the host speaker or configured output.
ex: #sudo virsh create /etc/libvirt/qemu/Windows_7.xml
Creating a Windows 7 VM with qemu-kvm as a non-root user allow sound to work. It appears to me there is a permissions issue between qemu user and pulse/alsa.
ex: #/usr/libexec/qemu-kvm /var/lib/libvirt/images/Windows_7.img -device AC97,id=sound0,bus=pci.0,addr=0x4
Version-Release number of selected component (if applicable):
RHEL 6.3 x86_64 and Windows 7 32-bit. Using Intel AC'97 Audio Driver.
#sudo virsh create /etc/libvirt/qemu/Windows_7.xml or virt-manager
Sound never works.
#/usr/libexec/qemu-kvm /var/lib/libvirt/images/Windows_7.img -device AC97,id=sound0,bus=pci.0,addr=0x4
Steps to Reproduce:
1. Create Windows 7 32-bit VM on RHEL 6.3
2. Try creating domain with virsh or virt-manager (sound will not work)
3. Try starting with qemu-kvm as a non-root user and device defined (sound will work)
Driver loads on Windows. Volume can be seen on Windows. Nothing comes through host audio.
Sound will work when domain is created from libvirt.
Could you attach Windows_7.xml file? Sound should just work if the domain is properly configured to use spice (of course, it only works iff spice client is connected to the domain). If it uses VNC, it should also work if the VNC client supports audio over VNC extension. If it doesn't, the only way is to set vnc_allow_host_audio = 1 in /etc/libvirt/qemu.conf. I would recomend using spice.
Requested xml is below. I have verified sound also works in spice. This bug was clearly mistitled by me. It's not that sound doesn't work, it's that sound doesn't work with the default virt-manager vnc (which is also the default viewer).
If that is acceptable behavior, perhaps there should be a UI warning on the audio device when trying to configure without spice channels and with a vnc_allow_host_audio = 0 value. Or perhaps spice should just be the default viewer.
***I should also note, I noticed behavior that is contrary to what is being said about vnc. When I execute the following:
1. I set vnc_allow_host_audio = 1 in /etc/libvirt/qemu.conf
2. Restart libvirtd
3. Start up a Win 7 VM through libvirt with vnc as the viewer
4. Use Tigervnc, which I know to support audio
Audio still does not get passed to host.***
<type arch='x86_64' machine='rhel6.3.0'>hvm</type>
<timer name='rtc' tickpolicy='catchup'/>
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='none'/>
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<target dev='hdc' bus='ide'/>
<address type='drive' controller='0' bus='1' target='0' unit='0'/>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
<controller type='virtio-serial' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
<target type='serial' port='0'/>
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
<model type='vga' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
Enabling vnc_allow_host_audio requires prerequisites on the host to actually work (qemu using the correct group, pulseaudio not running ...) so this approach is not really usable.
I'm moving this bug on virt-manager to see if it's feasible to add a warning about audio not working with the default VNC video console as Joseph suggested. I recommend using spice video, where audio works out-of-the-box.
Actually nowadays gtk-vnc actually supports audio streaming, so changing this to track that as an RFE