SPICE support in Xen
SPICE is a protocol for virtual desktops which allows a much richer connection than display-only protocols like VNC.
Xen 4.4
Xen Project 4.4 adds support for additional SPICE functionality, including vdagent, clipboard sharing, and USB redirection.
The following notes were added to the wiki on request of Fabio Fantoni, who added SPICE support to Xen
Restrictions
The SPICE protocol is currently only supported on HVM guests.
QEMU Upstream
To use SPICE you will need an upstream version of qemu built with SPICE support enabled.
The upstream qemu packages may already be in your Linux distribution. Recent Debian, Ubuntu, etc. will work: these have SPICE support already built-in. In addition to the xl configuration changes below, you only need to install spice-vdagent in the domU to fully enable SPICE.
Alternatively, you can compile upstream qemu from the xen source tree. However, you will need to apply a small patch to enable SPICE and USB Redirection to the build parameters. See:
tools/Makefile @@ -201,6 +201,8 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find --datadir=$(SHAREDIR)/qemu-xen \ --localstatedir=/var \ --disable-kvm \ + --enable-spice \ + --enable-usb-redir \ --disable-docs \ --disable-guest-agent \ --python=$(PYTHON) \
With xen 4.5 can be added with configure:
./configure --with-extra-qemuu-configure-args="--enable-spice --enable-usb-redir"
XL Configuration
You can use XL configuration parameters to enable SPICE support and control its advanced functions. Please check man xl.cfg or check out xl.cfg(5).
The following example is for a domU xl cfg for xen 4.4 with spice full features (except qxl):
name='W7' builder="hvm" memory=2048 vcpus=2 # The fixed mac address is a workaround for know xl problem (network not working after restore) vif=['bridge=xenbr0,mac=00:16:3e:41:ae:8f'] # empty cdrom is for use cdrom hotswap from xl # raw disk with qdisk as backend produces better performance than blktap2 disk=['/mnt/vm/disks/W7.disk1.xm,raw,hda,rw',',raw,hdb,ro,cdrom'] boot='dc' device_model_version="qemu-xen" viridian=1 vnc=0 keymap="it" on_crash="destroy" vga="stdvga" spice=1 spicehost='0.0.0.0' spiceport=6000 # spicedisable_ticketing enabled is for no spice password, instead use spicepasswd spicedisable_ticketing=1 #spicepasswd="test" spicevdagent=1 spice_clipboard_sharing=1 # this will automatically redirect up to 4 usb devices from spice client to domUs spiceusbredirection=4 # This adds intel hd audio emulated card used for spice audio soundhw="hda" localtime=1
Known Problems
- Linux domUs with recent kernel need pci=nomsi set for kernel boot parameters to ensure that vdagent is working. This is a know problem with virtio devices on Xen which has not yet been solved. All other cases and things works out of box based on my tests. We are not entirely sure which kernel versions are affected, except that kernel >= 3.2 exhibits the problem, while kernel <= 2.6.32 does not. Feel free to update this section if you have more accurate information.
Ongoing work
Work on the following patches to improve SPICE support and integration in Xen is ongoing:
- qxl vga support (libxl patch complete and seems good. qxl is working on windows domUs but is not working on linux domUs because other changes are needed on xen, xorg/qxl driver and/or qemu) patch v16
- Basic SPICE support on PV guests (patch is working but needs serious improvements)
- Add SPICE parameters to xenstore and handle those acquired with qmp (only the qmp part is currently working)
- Automatic SPICE port selection similar to the support available in VNC (blocked, awaiting reply from qemu community)
The latest work in progress and discussions can be found on xen-devel and any patches (including partial and drafts) can be found on Fabio Fantoni's github repository.