QEMU configuration
==================

Using of the spice protocol requires lots of virtual devices created in the QEMU.


Base configuration
------------------
These options are required to support spice protocol. Without spice-vdagent (see below) mouse cursor would be locked inside client window and you'll have to press some key combination to release it.

    -vga qxl

Enable QXL VGA adapter (which works best with spice). It is supported out of the box with relatively recent and there is windows display driver which can be downloaded from [Spice

    -spice

This enables spice protocol listener itself. Unfortunately spice doesn't support unix-domain sockets as VNC does. This line represents workstation-like setup where connections allowed only from localhost, but no password required

For remote-accessable VMs use something like

    -spice port=5900,password=top-secret

Spice vdagent
-------------

Spice agent is the guest OS tool, which supports seamless mouse movement between VM console window and rest of desktop, clipboard sharing etc.

You need following options in the QEMU command line to let vdagent communicate with client.


    -device virtio-serial -chardev spicevmc,id=vdagent,name=vdagent \
    -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \

Also you'll need agent itself. See for windows spice-guest-tools.

For linux it is probalbly included into your distribution, at least Debian has since wheezy,

Audio support
-------------

Set environment variable QEMU_AUDIO_DRV=spice
before starting QEMU

USB redirection
---------------

We need to add EHCI/UHCI controllers to QEMU command line, and we also need to add one Spice redirection channel per device we want to redirect simultaneously.

Following code fragemnt creates three USB devices on one controller. So, you can
redirect up to three host devices.

    -device ich9-usb-ehci1,id=usb \
    -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,multifunction=on \
    -device ich9-usb-uhci2,masterbus=usb.0,firstport=2 \
    -device ich9-usb-uhci3,masterbus=usb.0,firstport=4 \
    -chardev spicevmc,name=usbredir,id=usbredirchardev1 \
    -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1 \
    -chardev spicevmc,name=usbredir,id=usbredirchardev2 \
    -device usb-redir,chardev=usbredirchardev2,id=usbredirdev2 \
    -chardev spicevmc,name=usbredir,id=usbredirchardev3 \
    -device usb-redir,chardev=usbredirchardev3,id=usbredirdev3


Clients
=======

There is remote-viewer application in the virt-viewer package. There is also spicy in the spice-client-gtk package. Spice authors recommend virt-viewer. Probably they are right.

spicy expects user input from stdin, and if it finds it, it pushes it directly into spice socket. So, if you start spicy from the shell as background job, it would stop on SIGTTIN immedietely. Redirect stdin from to make it runnable in the background.