SPICE support in Xen: Difference between revisions

From Xen
Jump to navigationJump to search
Line 32: Line 32:
You can use [[XL]] configuration parameters to enable SPICE support and control its advanced functions. Please check <em>man xl.cfg</em> or check out [http://xenbits.xen.org/docs/4.4-testing/man/xl.cfg.5.html#spice_graphics_support xl.cfg(5)].
You can use [[XL]] configuration parameters to enable SPICE support and control its advanced functions. Please check <em>man xl.cfg</em> or check out [http://xenbits.xen.org/docs/4.4-testing/man/xl.cfg.5.html#spice_graphics_support xl.cfg(5)].


The following example is for a domU xl cfg for xen 4.4 with spice full features (except qxl):
You can also find configuration examples in this [http://lists.xenproject.org/archives/html/xen-users/2013-06/msg00423.html e-mail thread].


<pre>
<pre>
name='W7'
builder = 'hvm'
builder="hvm"
memory = '1024'
memory=2048
device_model_version = 'qemu-xen'
vcpus=2
device_model_override = '/usr/src/qemu-dm/i386-softmmu/qemu-system-i386'
# The fixed mac address is a workaround for know xl problem (network not working after restore)
disk = [ 'tap2:vhd:/srv/win7_noDriver,sda,w']
vif = ['bridge=xenbr0']
vif=['bridge=xenbr0,mac=00:16:3e:41:ae:8f']
# empty cdrom is for use cdrom hotswap from xl
boot='cd'
# raw disk with qdisk as backend produces better performance than blktap2
vcpus=4
disk=['/mnt/vm/disks/W7.disk1.xm,raw,hda,rw',',raw,hdb,ro,cdrom']
name = 'UserVM'
boot='dc'
usbdevice='tablet'
device_model_version="qemu-xen"
vnc=1
viridian=1
vnclisten="0.0.0.0"
vnc=0
vncdisplay=1
keymap="it"
vncunused = 0
on_crash="destroy"
vga="stdvga"
spice=1
spice=1
spicehost='0.0.0.0'
spicehost='0.0.0.0'
spiceport=6000
spiceport=6000
# spicedisable_ticketing enabled is for no spice password, instead use spicepasswd
spicedisable_ticketing=1
spicedisable_ticketing=1
#spicepasswd="test"
device_model_args_hvm = [ '-vga', 'qxl' ]
spicevdagent=1
videoram = 128
spice_clipboard_sharing=1
apic=1
# this will automatically redirect up to 4 usb devices from spice client to domUs
pae=1
spiceusbredirection=4
stdvga=1
# This adds intel hd audio emulated card used for spice audio
vga = "qxl"
soundhw="hda"
videoram=32
localtime=1
</pre>
</pre>

{{InfoLeft|Note that the author has taken this from the e-mail thread and not checked it. If you find an issue, please refer to the thread and fix the example.}}


=== Know Problems ===
=== Know Problems ===

Revision as of 12:27, 10 April 2014

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. In many cases, you may be able to use upstream qemu packages from Linux distributions (recent Debian, Ubuntu, etc. will work) : these have SPICE support already built-in.

Alternatively, 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) \

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

Know 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 (libxl patch complete and seems good but qxl is not working because other changes are needed on xen and/or qemu)
  • 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.