Bug 848927 - RFE: support VNC audio
Summary: RFE: support VNC audio
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Virtualization Tools
Classification: Community
Component: virt-manager
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Cole Robinson
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-08-16 20:33 UTC by Joseph Scalia
Modified: 2018-10-03 23:53 UTC (History)
10 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2018-10-03 23:53:31 UTC
Embargoed:


Attachments (Terms of Use)

Description Joseph Scalia 2012-08-16 20:33:01 UTC
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.

How reproducible:
 #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 
Always works.

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)
  
Actual results:
Driver loads on Windows.  Volume can be seen on Windows.  Nothing comes through host audio.

Expected results:
Sound will work when domain is created from libvirt.

Comment 2 Jiri Denemark 2012-08-17 11:23:04 UTC
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.

Comment 3 Joseph Scalia 2012-08-17 13:38:34 UTC
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.***

<domain type='kvm'>
  <name>Windows_7</name>
  <uuid>ee9de63c-4cb9-f9c6-84fd-3d0db647fab7</uuid>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='x86_64' machine='rhel6.3.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='localtime'>
    <timer name='rtc' tickpolicy='catchup'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/var/lib/libvirt/images/Windows_7.img'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/home/jscalia/Share/ISO/en_windows_7_ultimate_x86_dvd_x15-65921.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:1c:f8:74'/>
      <source network='default'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes'/>
    <sound model='ac97'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='vga' vram='9216' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </memballoon>
  </devices>
</domain>

Comment 4 Peter Krempa 2012-08-27 13:36:15 UTC
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.

Comment 5 Cole Robinson 2013-06-13 01:30:29 UTC
Actually nowadays gtk-vnc actually supports audio streaming, so changing this to track that as an RFE

Comment 6 Cole Robinson 2018-10-03 23:53:31 UTC
While gtk-vnc supports audio streaming, I think in practical application very few people will use it, as this type of desktopy case is what spice is suited for. So closing this as DEFERRED, but if someone shows up with a patch I'll consider it


Note You need to log in before you can comment on or make changes to this bug.