Home page icon

April 05, 2012

Lubos Kocman

OpenHouse 2012 spice



Hi guys

here's my short presentation about SPICE from OpenHouse 2012.

Dowload presentation on following link spice-lkocman.pdf or by clicking on the presentation image.



Thanks everybody for the attendance!

by lkocman (noreply@blogger.com) at April 05, 2012 11:22 AM

March 21, 2012

Lubos Kocman

extended spice support in kvm autotest

Just succeeded to get this patch into autotest:

https://github.com/autotest/autotest/commit/8688e97430a595a90c1c2f7340d42dbd2c1b98c1

What's inside?

The past SPICE support was covering only old qemu-kvm and it's not
working any more with recent qemu

Added SPICE features (configurable qemu-kvm options):
* QXL: configurable memory for qxl
* SSL :x509-dir, x509-key-file, x509-cacert-file, x509-cert-file,
* x509-key-password, tls-port, tls-ciphers, secure-channels
* SSL: added virt_utils.create_x509_dir() which creates required
* certificates for x509 options
* Compression: image-compression, jpeg-wan-compression,
* zlib-glz-wan-compression, playback-compression
* Networking: ipv4, ipv6, addr
* Other: agent-mouse

Modified:
* QXL: replaced old way of defining number of qxl devices qxl=n ->
* -device qxl
* QXL is now being trough in kvm_vm.add_vga()
* VGA: vga = std is now defined in base.cfg.sample (removed from
* -nodefaults in kvm_vm.py)
* drop add_qxl_vga() into favor of add_vga() (+ add_qxl() in case that
* user defined qxl memory or extra qxl devices)

by lkocman (noreply@blogger.com) at March 21, 2012 11:32 AM

February 27, 2012

Alon Levy

Xspice talk given at FOSDEM 2012

I gave a talk about the hack that is Xspice during the last awesome-if-you-aren’t-distracted-by-a-pending-talk-or-second-guessing-a-given-talk FOSDEM.

Slides, are in multitalk, also in html. Patches for multitalk used.

Things learned:

  • homework should include debunking assumption that the W thing is probably just a fad that is going away.
  • practicing to not talk fast doesn’t always work.
  • spice is not the greatest thing since sliced bread.

More positive lessons learned:

  • Wspice would be more interesting to the X-turning-W crowd, and in general for the future.
  • Perhaps rendering at the server and that’s it for 3D is a good idea.

by admin at February 27, 2012 10:39 PM

February 01, 2012

Hans de Goede

New USB redirection features, USB redirection talk @FOSDEM

usbredir-0.3.3, spice-0.10.1, spice-gtk-0.9 have been recently released upstream and are available in Fedora-16 updates[-testing] and are chock-full of new USB redirection features & fixes:
  • Improved compatibility various usb mass storages devices which would not work before are working now
  • You no longer need to run spicy as root to use USB redirection, when running as a normal user you will now get a PolicyKit dialog asking you for the root password. You can change this by editing: /usr/share/polkit-1/actions/org.spice-space.lowlevelusbaccess.policy and setting <allow_active> to "yes". Note that this will give any local users of your machine FULL access to any USB devices plugged in!
  • You can now redirect already plugged in devices / un-redirect devices without unplugging them, go to the
    Input menu and click "Select USB Devices for redirection".
  • Filtering for auto-redirection, you can now specify a filter for auto redirection using --spice-usbredir-filter=<filter-string>. Standard a filter is in place to avoid redirection of HID devices, so that if you've a glitch on your USB bus, or plug a mouse into a laptop it no longer gets swallowed by the vm making it unavailable to the client.
I'll be at FOSDEM this weekend, and I'll give a talk about Spice, sheets here. As well as a talk about USB redirection, sheets here. Besides me there will be 4 other people from the Spice team there, be sure to also watch their talks about XSpice and Boxes. If you have any question about Spice, or just want talk to us, FOSDEM is an excellent opportunity to do so!

While I'm plugging talks @FOSDEM, there will also be lots of other talks from Red Hat speakers.

Enjoy, and be sure to send any feedback you may have my way!

February 01, 2012 10:34 AM

January 31, 2012

Christophe Fergeau

Going to FOSDEM!

This is this time of the year again, FOSDEM will take place in Brussels next week-end. This is one of my favourite free software event, lots of interesting talks, lots of interesting people, and lots of energy everywhere. This year, it looks like it will be the best FOSDEM ever! More devrooms, more than 400 talks, more everything!

I've helped again organizing the crossdesktop devroom. Among these talks, I can only recommend the gnome-boxes presentation that Marc-André and Zeeshan will be giving :) While I'm at it, here are a few more shameless plugs: Hans de Goede will be giving 2 SPICE talks in the Virtualization devroom, one general presentation of SPICE, and one where he will describe the USB redirection support in SPICE. And Alon Levy will present his work to interact with an X server through SPICE without using a virtual machine.

Last but not least, there will also be a GNOME booth with some goodies...

See you all there in a few days!

by Christophe (noreply@blogger.com) at January 31, 2012 10:24 AM

January 23, 2012

Christophe Fergeau

Unpacking Boxes...

For the impatient people running Fedora 16 but who still want to get an aperçu of Boxes, today's your lucky day! I set up a preview repository with all the needed package to install Boxes on Fedora 16.
If you want to try it, download this file to /etc/yum.repos.d and then run  
yum install gnome-boxes && yum update



To go back to your previous setup, you can either use the convenient yum history, or remove /etc/yum.repos.d/gnome-boxes-preview.repo and use
yum remove libvirt-glib && yum distro-sync

Keep in mind that this is a new application still in heavy development, so you're likely to find bugs and missing features. But I'm sure you will enjoy it nonetheless :)

Feel free to join us in #boxes on irc.gnome.org if you have any issues, or if you just want to chat with us.


by Christophe (noreply@blogger.com) at January 23, 2012 12:54 PM

December 22, 2011

Zeeshan Ali

Help needed for Debian and Ubuntu

If you read any of my previous blog entries, you must be now familiar with this 'express installation' concept we have in Boxes. Its pretty neat actually, you just set a few options at the beginning and then you can leave Boxes (or your machine) and when you are back, everything is setup for you automatically in a new box.

I have invested a lot of time/efforts on this already and will be spending a lot more time in future as well but I am just one man so can not possibly cover all operating systems out there. That is why I am asking for help from anyone who will be interested in adding express installation support for Ubuntu and Debian while I focus on Fedora and Windows variants. Oh and if you are interested in adding support for some other distribution/OS, that contribution will also be more than welcomed.

In any case, happy hacking!

by zeenix (noreply@blogger.com) at December 22, 2011 11:47 AM

December 21, 2011

Zeeshan Ali

Another awesome release of Boxes

Yesterday we rolled out the second release of Boxes for upcoming GNOME 3.3.3. There are many fixes/improvements in this release to list them all here but the most significant ones in my opinion are:

  • A nicer UI for deletion of Boxes designed for protecting the user from accidental deletion of boxes. Here is a video demo of it in action.
  • Special handling of 'live' and unknown media: Quick launch of a temporary box for it, which is made permanent automatically (only) if anything is installed on the box by the media. Here is a video demo of this behaviour in action.
  • Express installation for Windows XP now works, thanks to important clues provided by Lucas Meneghel Rodrigues. Don't believe me? I have video footage that proves it.
  • UI for setting user and administrator password and in case of older Windows, ability to set product key as part preparation for express installation. Please check out the videos above for demo of this feature in action.
Apart from changes in Boxes itself, there were some note-worthy changes in our dependencies that helps us directly.
  • Christophe Fergeau added a big bunch of new APIs to libvirt-glib (libvirt-gconfig to be precise) for dealing with libvirt's configuration XML. Now Boxes uses that instead of manually writing/editing XML strings.
  • A Google Code-In participant, Mateusz Kaplon added a lot of data about various different operating systems to libosinfo. For Boxes that means more complete and reliable detection and default resource allocation for various operating systems.

For a detailed list of changes in Boxes 3.3.3, please refer to the release notes.

by zeenix (noreply@blogger.com) at December 21, 2011 06:48 AM

November 30, 2011

Alon Levy

DRM progress 1

Hi,

I’m planning on this being the first of many updates on my ongoing work on adding 3D support to Spice. Right now I have a three stage plan and stage one is adding a DRM driver for linux. Our current linux driver is an X one, adding a DRM driver will allow us to use KMS and have an interrupt handler, and later provide direct rendering of course.

I’ve setup a working environment for developing the DRM driver to it’s current state. I hope that when I look back at this post I’ll notice all the things I missed, but in order to do that I need to write them in the first place:

  1. fedora host, with kernel checkout to /home/alon/src/linux
  2. fedora vm, with 9pfs mount pointing to /home/alon/src, with ttyS0 console (should be hvc0 but this failed for some reason). vm setup with password less login (should be autologin, but still multiuser init level since ssh is helpful). vm boot time is also too long – 10 seconds (was 40-50 before I noticed I was using ide instead of virtio, thanks to writing this blog post), turned off one thing I can’t remember, but a lot more to tweak there.
  3. make install once in vm, get /boot/grub2/grub.cfg to boot the new kernel by default, no quiet, and tty=ttyS0 (again – should be hvc0, not sure why it doesn’t work).

Development iteration:

    1. change code, build driver (make drivers/gpu/drm/qxl/qxl.ko)
    2. reboot vm (can be in parallel to 1)
    3. login and modprobe the new modules. actual keyboard: root<enter> . qxl<enter>.
      qxl is a script that does:
      ifup eth0 # didn’t figure out how to set this up – too used to /etc/network/interfaces. RHCE next week :) This starts sshd
      nc 192.168.122.1 5678 # knock on host side script that does ssh here
      insmod {ttm.ko,qxl.ko}
      on the host I have complementary script.

Most work so far was in figuring out TTM memory management enough to get memory allocated on the PCI BAR 0 for the commands. Initially I also had to figure out kernel debugging and building – building an individual module is much faster then building the whole kernel, and after trying to debug via qemu’s gdbserver (couldn’t find some symbols) gave up for now and am using printk / DRM_INFO’s, and making sure any module I touch (so far just ttm.ko and qxl.ko) is insmod’ed instead of modprobe’d to be sure I get the fresh one (already got bitten by this a few times – this time by just forgetting to build the specific module. inotify eclipse like instant build?). Reread the coding style, last time I read it was for fun, now I actually need to use it.

qxl:

#!/bin/bash
ifup eth0
iptables -F
echo go | nc 192.168.122.1 3456
nc -l 3456
# insmod everything to remove the "make modules_install" slow stage
ROOT=/mnt/src/linux/drivers/gpu/drm
# defaults to 10, doubled for soft lockup thresh, 22 seconds in reality,
# too long
#echo 1 &gt; /proc/sys/kernel/watchdog_thresh
cd $ROOT
insmod drm_kms_helper.ko
insmod ttm/ttm.ko
insmod qxl/qxl.ko

do-ssh:

#!/bin/bash</code>

while [ 1 == 1 ]; do
nc -l 3456
#gnome-terminal -e "ssh root@192.168.122.89"
#screen ssh root@192.168.122.89
xterm -e "ssh root@192.168.122.89" &amp;
sleep 1
echo go | nc 192.168.122.89 3456
done

nc-6666:

#!/bin/bash
i=0
while [ 1 == 1 ]; do
filename=/tmp/nc6666.$i.txt
i=$((i+1))
echo ====================== $filename ======================
(nc -l 6666 | tee $filename)
done

Started the practice of having a ~/tmp-bin with snippets that do not deserve to be in ~/bin but are currently useful. do-ssh, nc-6666 and f16-qxl-drm-6666 are there:

vm command line (need to switch to libvirt, this is done by spice-launcher):

x86_64 garlic:linux alon (qxl)$ cat ~/tmp-bin/f16-qxl-drm-6666
f16-qxl-drm --serial socket,host=127.0.0.1,port=6666 --qxldebug 1 --guestdebug 1 $*
x86_64 garlic:linux alon (qxl)$ ls -l ~/bin/f16-qxl-drm
lrwxrwxrwx. 1 alon alon 6 Nov 11 16:49 /home/alon/bin/f16-qxl-drm -&gt; spice2</code>

f16-qxl-drm --serial socket,host=127.0.0.1,port=6666 --qxldebug 1 --guestdebug 1

x86_64 garlic:linux alon (qxl)$ . ~/tmp-bin/f16-qxl-drm-6666 --print-commandline-only

/home/alon/spice/upstream/bin/qemu-system-x86_64 -chardev stdio,id=muxstdio,mux=on -mon chardev=muxstdio,mode=readline -vga qxl -drive file=/var/lib/libvirt/images/F16-qxl-drm.img,cache=unsafe,if=virtio,readonly=off -enable-kvm -L /home/alon/spice/upstream/share/qemu -m 1024 -cpu host -spice disable-ticketing,port=10006 -chardev socket,id=qmpmon,host=127.0.0.1,port=20006,server,nowait,ipv4 -mon chardev=qmpmon,mode=control -snapshot -no-shutdown -global qxl-vga.guestdebug=1 -global qxl-vga.debug=1 -usb -device virtio-serial,multifunction=on -chardev spicevmc,name=vdagent,id=vdagent -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 -chardev socket,server,path=/tmp/tmpCYCBQ1/virtconsole,nowait,id=virtconsole -device virtconsole,chardev=virtconsole,name=org.alon.console -netdev tap,id=hostnet0,ifname=tap0,script=no,downscript=no -device virtio-net-pci,netdev=hostnet0,id=net0 -chardev socket,host=127.0.0.1,port=6666,id=serial -serial chardev:serial -virtfs local,path=/home/alon/src/,mount_tag=src,security_model=mapped,writeout=immediate

qxl DRM driver after insmod and ls

by admin at November 30, 2011 12:56 AM

November 23, 2011

Zeeshan Ali

Behold the Boxes!


Dear readers! If you recall, in a blog post not so long ago I introduced you to the wonderful virtual world I now live in.  Now around the same time I wrote that post, some of the GNOME designers and developers (myself included) felt the need for having a UI as an integral part of GNOME that lets users easily manage (create and destroy) virtual machines and at the same time lets them connect to remote machines.

Two of our awesome designers, Jon McCann and Jakub Steiner) started creating design for this UI. We (as in Jon McCann) named it 'Boxes' as its something that deals with..hm.. boxes. At the same time, we (me, Marc-Andre and Christophe) kept working on the foundations for Boxes, mainly in the form of lots of improvements to libvirt, libvirt-glib, libosinfo and spice-gtk.

About less than a month ago we started implementing the design when the design stabilized a bit. The implementation actually started as a "proof of concept" from Marc-Andre over a weekend. The result was already so good that we decided to move it to git.gnome as the bases for Boxes' implementation. While most of the credit for the UI goes to Marc-Andre, I think he will agree that it wouldn't have been so easy to get this started so quickly if we hadn't chosen to write this in Vala.

Since by now you have read a lot of blah blah already, I'll stop boring you more and show you some screenshots of what we have already:








And if that gets you excited, you'd want to see this screencast where I show Boxes in action.

After a few days of tiring work on fixing critical issues in Boxes and its dependencies we finally managed to roll-out our first release. You are more than welcome to try it out already and report any issues you find but please keep in mind that at the moment we require the latest (unstable in many cases) releases of our dependencies to be able to make use of their latest features. If you happen to be a jhbuild user, you are in luck as building boxes is as easy as typing `jhbuild build gnome-boxes`.

Why not virt-manager?

 

virt-manager is an awesome tool and I myself use it everyday. I am sure other Boxes hackers are using it on daily bases as well. However we must keep in mind that the UI we were looking for in GNOME is not meant for enterprise-level system-administrators who have hundreds of mission-critical virtual-machines on an array of super computers but rather a typical end-user who just wants to connect from his laptop to his work machine(s) and/or try different operating systems. While virt-manager is undoubtedly the best choice for the former, its not at all tailored for the latter.

It should be noted that while we decided not to use virt-manager for the UI, we still are trying our best to share as much code base/efforts with virt-manager as possible in terms of infrastructure, mainly in the form of libvirt, libosinfo, qemu and spice-gtk.

Known issues


Boxes is still in its infancy so you might find a lot of issues in Boxes and its dependencies but one issue that is a big show-stopper at the moment is the breakage of floppy support in recent Qemu. Boxes depends on floppy-support for making automated/express install possible for both Linux and Windows. Fortunately the issue is already fixed in git master of Qemu and its just a matter of releasing and packaging by distributions.

How to help?


Seems many people are already very excited about this little project of ours and I'm hoping this blog entry will attract more contributors so I wanted to point out some things we need help with. If you are interested in UI work, Marc-Andre has written down a TODO for Boxes that you can pick some tasks from. Other than that, we still need a lot of help with two of our main dependencies:

  • libosinfo: This library is our store for information on operating systems and means to detect operating systems from installation media.
  • libvirt-glib: libvirt-glib wraps libvirt to provide a high-level object-oriented API better suited for glib-based applications.
While Boxes is written in Vala, these libraries are completely written in C so if you are a C hacker and want to contribute, these would be good places to start with. While most of the work needed on libosinfo is that of populating its database with information on all kinds of operating systems out there, libvirt-glib still lacks a lot of needed API. One particular part of libvirt-glib that needs the most work and is of highest priority to us is its API to deal with libvirt's configuration XML.

We all love boxes, don't we?

by zeenix (noreply@blogger.com) at November 23, 2011 06:29 AM

September 13, 2011

Hans de Goede

Using spice from the qemu cmdline

Various people have been asking how to run qemu with spice when launching qemu directly, rather then through libvirt + virt-manager. So here is a quick howto.

*** The basics *** 

Besides adding the usual qemu cmdline options to make it find the harddisk to boot from, have a NIC, soundcard, etc. in order to add spice add the following to the cmdline:
-vga qxl -spice port=5932,disable-ticketing

After launching qemu with this, you can connect to it with spicy (new gtk based client) or spicec (old libX11 client), like this
(their cmdline syntax is compatible):
spicy -h localhost -p 5932

*** Enabling the agent channel ***

To really enjoy spice, with all its features like copy paste between client and guest, and client mouse mode (mouse cursor drawn by client, so 0 mouse lag), you need to install the qxl graphics driver and spice-agent in the guest, *and* enable the agent channel between the guest and the client, to do this add the following options to the qemu cmdline:
-device virtio-serial \
-chardev spicevmc,id=vdagent,name=vdagent \
-device virtserialport,chardev=vdagent,name=com.redhat.spice.0

*** Enabling support for usb redirection ***

If you're running qemu under Fedora-16 (or newer), or have build it from source with usbredirection support as explained in my previous blog post, then you can also let spice redirect usb devices from your client to the vm, to enable this you will first need to enable usb2 emulation in qemu, download this file, and drop it in /etc/qemu. And at the following to the qemu cmdline:
-readconfig /etc/qemu/ich9-ehci-uhci.cfg

Then to create 3 usbredir ports into which the client can then "plug" redirected devices add the following:
-chardev spicevmc,name=usbredir,id=usbredirchardev1 \
-device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,debug=3 \
-chardev spicevmc,name=usbredir,id=usbredirchardev2 \
-device usb-redir,chardev=usbredirchardev2,id=usbredirdev2,debug=3 \
-chardev spicevmc,name=usbredir,id=usbredirchardev3 \
-device usb-redir,chardev=usbredirchardev3,id=usbredirdev3,debug=3 \

The debug=3 is not strictly necessary, but it gives some useful messages without flooding the qemu console with messages. Note that you can also create more / less then 3 usbredirection usb "ports", how to do this is left as an
excercise to the reader :)

To use the usb redirection  connect to the vm with spicy running as root, so that it can access the device nodes under /dev/bus/usb.

Select the options menu entry and make sure that the "auto redirect newly plugged in USB devices" option is checked. After this make sure the vm has keyboard focus (so close the options menu), plug in a new USB device and watch it show up in your vm :) Feel free to yank it out again at any time :)

If you plug in a device while the vm does not have keyboard focus, it will not get redirected, so you can use usb devices
normally as long as you don't have the vm focussed when you plug them in.

Enjoy, and be sure to send any feedback you may have my way!

September 13, 2011 01:52 PM

Howto build qemu + spice with usbredirection from source

Hi,

Here is a little howto for building qemu + spice with usbredirection from source, for those of you who are not running Fedora 16.

The below instructions assume:
  1. That you are familiar with building things from source
  2. That you are running the 64 bit version a fairly recent Linux distribution
  3. That you want to override you distro installed version of various bits with the bits build from source, this is necessary to ensure that everything builds and runs linked against the correct version of various libs.
  4. That using a distribution with a multilib setup where 64 bit libraries go into /usr/lib64. If you are using a distro which puts 64 bits libraries under /usr/lib rather then /usr/lib64 (for example Debian or ubuntu), you need to replace /usr/lib64 with /usr/lib in all commands below
*** Step 1 Building libusb ***

First of all you will need libusb from git for now, hopefully there will soon be an offfical 1.0.9 release you can use instead. To build libusb from git do:

git clone git://libusbx.git.sourceforge.net/gitroot/libusbx/libusbx
cd libusbx
./autogen.sh --prefix=/usr --libdir=/lib64
make
sudo make install

*** Step 2 building usbredir ***

Next you will need to build usbredir itself for the usbredirparser and usbredirhost libraries, download it here, then do:

tar xvfj usbredir-0.4.3.tar.bz2
cd usbredir-0.4.3
make -j2 PREFIX=/usr LIBDIR=/usr/lib64
sudo make PREFIX=/usr LIBDIR=/usr/lib64 install

*** step 3 building spice-protocol ***

For usbredir support we need version >= 0.10 of spice-protocol, download it here, then do:

tar xvfj spice-protocol-0.10.1.tar.bz2
cd spice-protocol-0.10.1
./configure.sh --prefix=/usr --libdir=/usr/lib64
make -j2
sudo make install

*** step 4 building spice[-server] ***

For usbredir support we need version >= 0.10 of spice, download it here, then do:

tar xvfj spice-0.10.1.tar.bz2
cd spice-0.10.1
./configure --prefix=/usr --libdir=/usr/lib64 --enable-smartcard
make -j2
sudo make install

*** Step 5 building qemu ***

The core usbredir code is already in the qemu-0.15.0 upstream release, but some bits needed for integrating it
with spice are missing. Besided that it is also good to get a version with some recent spice fixes included, so
we will again use a git tree for this:

git clone git://people.freedesktop.org/~jwrdegoede/qemu
cd qemu
git checkout -B qemu-kvm-1.0-usbredir qemu-kvm-1.0-usbredir
./configure --prefix=/usr --enable-smartcard-nss --enable-smartcard --enable-spice --target-list=x86_64-softmmu
make -j2
# do not do make install, this will replace the versions of seabios & friends installed by your distro with (quite old non
# working) versions of seabios which are still part of the qemu git tree (someone ought to fix this one of these days)
sudo install -m0755 -p x86_64-softmmu/qemu-system-x86_64 /usr/bin

*** Step 6 building spice-gtk with usbredir support ***

Get spice-gtk version 0.11 or newer here.

tar xvfj spice-gtk-0.11.tar.bz2
cd spice-gtk-0.11
./configure --prefix=/usr --libdir=/usr/lib64
make -j2
sudo make install

*** All done ***

All done, to enjoy the usbredir support you need to pass some extra qemu options on the qemu cmdline, see my next blogpost for details.

September 13, 2011 01:37 PM

September 09, 2011

Hans de Goede

USB redirection integrated into SPICE now available in Fedora-16

I'm happy to announce the availability of USB redirection support in SPICE in Fedora 16. Unfortunately the virtmanager bits are not there yet. So if you want to try this you need to configure it manually. This howto assumes
a fully up2date F-16 with spice-gtk from updates-testing installed.

First create a virtual machine as usual, using virt-manager, select spice as display type and qxl as video card model,
when asked if you want to enable the agent channel, say yes.

When done, close virt-manager and edit the relevant /etc/libvirt/qemu/foo.xml file and add the following lines at the end, above the "</devices>" line:

    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x2'/>
    </controller>
    <redirdev bus='usb' type='spicevmc'>  
      <address type='usb' bus='0' port='3'/>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
      <address type='usb' bus='0' port='4'/>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
      <address type='usb' bus='0' port='5'/>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
      <address type='usb' bus='0' port='6'/>
    </redirdev>

Note that the slot='0x08' needs to be one higher then the higest pci slot already in use, so if you've more
pci devices in your config then me you may need to make this higher.

Then close down any virtual machines you may have open, and restart libvirt:
service libvirtd restart

Now start the vm with virt-manager, open it, select the details view, click on Display Spice and lookup and remember the port mentioned there (this will be 5900 if it is the only running vm).

Close virt-manager, and connect to the vm with spicy, like this:
spicy -h localhost -p 5900

Where 5900 should be replaced by the port the vm is actually running on.

Select the options menu entry and make sure that the "auto redirect newly plugged in USB devices" option is checked. After this make sure the vm has keyboard focus (so close the options menu), and plug in a new USB device. You will now
get a PolicyKit dialog asking you for your root password, this is needed since redirecting USB devices requires access the device nodes under /dev/bus/usb. Once you've (correctly) typed your root password,  watch the USB device show up in your vm :) Feel free to yank it out again at any time :)

If you plug in a device while the vm does not have keyboard focus, it will not get redirected, so you can use usb devices
normally as long as you don't have the vm focussed when you plug them in.

If you want to redirect already plugged in devices, or un-redirect redirected devices without unplugging them go to the
Input menu and click "Select USB Devices for redirection".

Enjoy, and be sure to send any feedback you may have my way!


Note (Feb 1 2012): this blog post has been updated to:
  • Use the new usbredir support in libvirt, rather then to directly inject qemu cmdline from the libvirt xml file using the qemu:commandline syntax.
  • Reflect the use of PolicyKit rather then needing to run the client as root
  • The new USB device selection widget

September 09, 2011 11:39 AM

July 23, 2011

Alon Levy

Announcing Xspice

An X server and a Spice server. Yes, the idea that X is not a good enough networking protocol for WAN has been investigated already many times. Why yet another one? In the end because it seemed like a cool thing to do. And it’s easier to test the qxl driver without the guest/host split.

What I think would be really useful is to be able to use it side by side with an existing X server, i.e. having two drivers both receiving all X operations (vnc doesn’t have this problem because it isn’t implemented as a driver). Sadly this is not yet doable. But happily it is being worked on, mainly due to the relatively-new dual GPU laptops (I don’t know the ETA. I think it’s called sharding, or at least is related to that).

So right now, if you are tired of Xvnc, or Xrdp, or NX, or just want to compare and tell us again that we need to improve SPICE (*) (**)

The source release is one and the same as the xorg qxl driver: xspice source aka xf86-video-qxl-0.0.16.tar.bz2 (see spice-space for the latest)

Building requires the same dependencies as any X video driver, plus spice-server. See README.xspice for details.

XSpice installation as a normal user is a bit of a hassle, since it requires one to build their own X server. If you want to do it, see README.xspice for details. On the other hand, installing as root requires just three things:
* spiceqxl_drv.so -> with all other xorg video drivers.
* xspice -> /usr/bin
* spiceqxl.xorg.conf.example -> /etc/X11/spiceqxl.xorg.conf (this is the default config file xspice looks for, you can change that with –config)

sudo make install will do the first two for you (assuming you did ./configure –prefix=/usr). The third you’ll have to do by hand.

To summarize, this should get you going:

./configure --prefix=/usr
make
sudo make install
sudo cp examples/spiceqxl.xorg.conf.example /etc/X11/spiceqxl.xorg.conf

Alternatively, somewhere in the near future I hope this will be enough

yum install xspice

Running is easier:

xspice --disable-ticketing --port 5900 --tls-port 0 :1.0 2>&1 > /dev/null &
spicy -h localhost -p 5900
DISPLAY=:1.0 favorite-window-manager-that-doesnt-need-dbus # i.e. icewm

Note: you don’t have to redirect, there is just a lot of spew, so you might want to run spicec/spicy in another terminal.

Note 2: that –tls-port 0 is weird, right? bug. But I already used one paper bag (0.0.15 never saw daylight), so I’ll just leave this for the next release.

Most of the options familiar from qemu’s -spice option are there, with some exceptions: no sound yet (do a pulseaudio proxy? not sure), no agent implementation (probably a good idea to reuse spice-vdagent for this), and no per channel secure/unsecure port selection (just laziness). The internal mechanism for passing those options is a bit of a hack – XSPICE_* environment variables are set by xspice and read by spiceqxl_drv.so.

I hope someone finds this useful, if you do, do let me know!

*) we know! but thanks for telling us! no, really! :)
**) Compared to VNC I don’t think there is a question that Spice is a better (***) protocol. Compared to the rest, it has it’s shortcomings. But it will be ;)
***) ok, I can’t write “better” without saying that it is a function of the optimization criteria. But you know what I mean.

p.s. also, we already had spice-x, so xspice was inevitable. Next, ispice!

by admin at July 23, 2011 05:23 PM

July 22, 2011

Alon Levy

tracking release fixed bugs (or, which BZ are missing from spice 0.8.2 NEWS file)

Our NEWS file looks like:

spice new-version
* bla
* fixed 666666, 777777

spice old version
*…

To gurantee all the bz’s are in there the next time we need to track which bz’s were fixed in some git branch between the last and new release. Assuming they are tagged, and commits include the bz in the message (the last is hard to verify – could go look at bugzilla for real), this becomes:


git log 0.8.1..0.8.2 | grep -o -E "#[0-9]{6}\>" | tr -d "#"

If you happened to already have done a release, and you want to see how screwed up the NEWS file is, this works:


((git log 0.8.1..0.8.2 | grep -o -E "#[0-9]{6}\>" | tr -d "#" | sort -u); (git show 0.8:NEWS | gawk '/0.8.2/ { a=1; } /0.8.1/ { a=0; } { if (a) print; }' | grep -o -E "[0-9]{6}" | sort -u);) | sort | uniq -u

And if you also want to paste that into a blog post in html, do:


_last_command_output_ | sort | uniq -u | sed -e 's|\(.*\)|<a href="http://bugzilla.redhat.com/show_bug.cgi?id=\1" title="\1">\1</a>|'

So let posterity know that the following BZs are also fixed in spice 0.8.2:

692976
701111
712941

by admin at July 22, 2011 08:23 PM

July 18, 2011

Hans de Goede

First official release of usbredir code

I'm very happy to announce the first official release of the usbredir code: usbredir-0.3.tar.bz2.

usbredir is a protocol for redirection USB traffic from a single USB device,
to a different (virtual) machine then the one to which the USB device is  
attached. See usb-redirection-protocol.txt for the description / definition
of this protocol.

With the official 0.3 release the protocol is now frozen (only extensions
advertised through capabilities can be added from now on).

This package contains a number of libraries to help implementing support
for usbredir and a few simple usbredir applications:

usbredirparser:
A library containing the parser for the usbredir protocol

usbredirhost:
A library implementing the usb-host (*) side of a usbredir connection. 
All that an application wishing to implement an usb-host needs to do is:
* Provide a libusb device handle for the device
* Provide write and read callbacks for the actual transport of usbredir data
* Monitor for usbredir and libusb read/write events and call their handlers

*) The side to which the actual USB device is attached, also see the
definitions section in usb-redirection-protocol.txt

usbredirserver:
A simple tcp server usb-host, using usbredirhost

usbredirtestclient:
A small testclient for the usbredir protocol over tcp, using usbredirparser

Note that the usb-guest side is missing from this, this will be part of qemu. I've all my qemu usb changes except for the actual usbredir usbdevice itself queued up for merging upstream. You can find a version of qemu with usbredir support in my git repo here. See previous posts for compilation and usage instructions

July 18, 2011 06:54 AM

June 30, 2011

Hans de Goede

USB redirection update

I've pushed an updated version of my usb-redirection code to my git repo. The biggest change is that the usbredir device now is a chardev frontend. Which means that the way to use it has changed. Also there now is proper emulation of companion controllers for the ehci code. Here is an example cmdline for using both:

-device usb-ehci,addr=0b.2,multifunction=on,id=ehci0 -device piix3-usb-uhci,addr=0b.0,multifunction=on,masterbus=ehci0.0,firstport=0
-device piix3-usb-uhci,addr=0b.1,multifunction=on,masterbus=ehci0.0,firstport=2
-chardev socket,id=usbredirchardev,host=localhost,port=4000
-device usb-redir,chardev=usbredirchardev,id=usbredirdev

There have also been some usbredir protocol changes, so you need to update and rebuild your usbredir clone too. I hope to release a usbredir-0.1.0 with a frozen protocol soon.

June 30, 2011 12:14 PM

June 23, 2011

Hans de Goede

USB protocol reverse engineering workship The Hague, Friday July 22 19:30

Friday July 22 we're organizing a workshop on reverse engineering
USB protocols of devices with proprietary protocols.

Reverse engineering protocols is fun! It's like a puzzle, and if there's
software out there that can solve the puzzle, your brain can do it too.

We'll be taking a look at reverse engineering the protocols on USB-connected
devices. Too many of these devices still come with windows drivers only, and
use an undocumented protocol. Figuring out those protocols is often a lot
easier than you might think, and so is writing a simple driver.

If you want to participate in this workshop, bring a Linux laptop,
preferably with a virtual machine with a Windows guest OS. If you have an
exotic USB device that only has a Windows driver, please bring that too.

This workshop will be given by Bert Vermeulen and Hans de Goede. Bert has
reverse engineered and written drivers for various USB logic analyzers for
sigrok: http://sigrok.org . Hans has reverse engineered and written drivers
for various USB webcams for the Linux kernel and for digital photoframes
for libgphoto2.

Program:
19:00 Welcome, drinks
19:30 Start of the workshop Bert & Hans give a short intro on USB protocol
      principles and a short demo of sniffing and interpreting usb traffic
20:15 Time to get your hands dirty, start reverse engineering your own USB
      device, or one of the devices provided. Your hosts will be walking
      around to answer questions and help you pass any speedbumps you
      encounter.
late: Time to go home?
really late: Chances are your hosts will want to go home at this time, hint
             hint.

Location:

This workshop will be held in the hackerspace Revelation Space in The Hague:
http://revspace.nl/

Registration:

Registration is not mandatory, but in order to have an idea of how many
people will be coming we kindly request you to send an email to
hdegoede@redhat.com if you're going to attend.

June 23, 2011 06:02 PM

June 22, 2011

Zeeshan Ali

Slightly more on virtual world..

Forgot to mention in my last blog post that SPICE is not just more efficient at network bandwidth utilization but is also much more faster/responsive. Also, Jon Nordby pointed out that the screenshots of virt-manager I copied from virt-manager website are several years outdated. Here is how the main UI looks like now a days.

P.S. I was going to inline this screenshot but blogger.com is not letting me do that. :(

by zeenix (noreply@blogger.com) at June 22, 2011 07:40 AM

June 21, 2011

Zeeshan Ali

Welcome to the virtual world!

ol{margin:0;padding:0}p{margin:0}.c9{color:#000099;font-size:12pt;text-decoration:underline;font-weight:bold}.c1{color:#ff0000;font-family:Courier New;font-weight:bold}.c7{width:468.0pt;background-color:#ffffff;padding:72.0pt 72.0pt 72.0pt 72.0pt}.c23{list-style-type:disc;margin:0;padding:0}.c4{direction:ltr;margin:0;padding:0}.c15{list-style-type:decimal;margin:0;padding:0}.c0{height:11pt;direction:ltr}.c8{padding-left:0pt;margin-left:36.0pt}.c21{margin:5px;border:1px solid black}.c17{height:1px;width:33%}.c12{font-size:14pt;font-weight:bold}.c10{color:#000099;text-decoration:underline}.c2{color:inherit;text-decoration:inherit}.c14{font-weight:bold}.c19{color:#ff0000}.c18{font-size:12pt}.c16{font-size:24pt}.c6{height:18pt}.c11{font-style:italic}.c5{direction:ltr}.c20{font-size:18pt}.c22{height:14pt}.c13{line-height:1.15}.c3{font-family:Courier New}body{color:#000000;font-size:11pt;font-family:Courier New}h1{padding-top:24.0pt;color:#000000;font-size:24pt;font-family:Courier New;font-weight:bold;padding-bottom:6.0pt}h2{padding-top:18.0pt;color:#000000;font-size:18pt;font-family:Courier New;font-weight:bold;padding-bottom:4.0pt}h3{padding-top:14.0pt;color:#000000;font-size:14pt;font-family:Courier New;font-weight:bold;padding-bottom:4.0pt}h4{padding-top:12.0pt;color:#000000;font-size:12pt;font-family:Courier New;font-weight:bold;padding-bottom:2.0pt}h5{padding-top:11.0pt;color:#000000;font-size:11pt;font-family:Courier New;font-weight:bold;padding-bottom:2.0pt}h6{padding-top:10.0pt;color:#000000;font-size:10pt;font-family:Courier New;font-weight:bold;padding-bottom:2.0pt}

About two months ago I informed the followers of this blog that I will now be working on SPICE project for Red Hat. Judging from the questions I was asked after that, I realized that not many people know about SPICE so I thought I write at least one blog entry dedicated to explaining what SPICE is all about. Before I get to SPICE itself, let me first introduce you to the world SPICE lives in.

Virtualization and Virtual Machines (VMs)


For some reason, I feel that I should leave the definitions to wikipedia and only quote it so that is what I am going to do:
"Virtualization, in computing, is the creation of a virtual (rather than actual) version of something, such as a hardware platform, operating system, a storage device or network resources."
"A virtual machine (VM) is a "completely isolated operating system installation within your normal operating system".Today, this is implemented by either software emulation or hardware virtualization".

Virtualization (of software and hardware platforms) is really nothing new and has been around since..well the the real thing itself: computers. There has been several implementations of different kind ever since and I are two main reason they exist and grow:
  1. Developing/testing software for hardware that you do not have. This makes virtualization softwares were attractive for consumer product manufacturers to be able to start the development of software soon after the plans for a particular product are finalized since it takes some time before they can manufacture enough prototypes for every developer and tester involved.
  2. Portability: In a typically VM setup, installation is done on drive images (files) rather than actual drives/partitions, which means you can carry or send your (virtual) machine anywhere you like.
  3. Ability to use multiple operating systems at the same time: Many Linux and Mac OS X users often need to run applications that are only available for windows and vice versa. Dual-boot is one solution to this issue but that implies you will only be able to use one OS at a time.
  4. Partitioning of a single host to multiple servers: Consolidation of many servers to a single host is a popular use case these days, done internally in many companies and also by hosting services. aka “The Cloud”.
Despite its big drawback, traditionally dual-boot has remained to be the preferred solution for many for a long time. The reason for that has mainly been the limitations of virtualization solutions, especially in terms of performance. However due to significant improvements in both hardware (built-in virtualization support and multi-core) and software, virtualization solutions have been gaining a lot of popularity lately.

Tools

Qemu + KVM


There are many such solutions out there, both Free and non-Free out there but the solution of our choice is Qemu. This awesome virtual-machine manager (a.k.a hypervisor) combined with Kernel-based Virtual Machine (KVM) and built-in virtualization extensions in modern CPUs is capable of providing such a virtual environment that puts the real thing to shame.

Qemu+kvm might be a very powerful tool, its still very much a power-user tool. For example you have to use long commandlines with different switches to use Qemu effectively. Worry not! There is another set of tools to help there:

libvirt


While Qemu+KVM might be an awesome solution, its still one of the many hypervisors out there and with some many people pouring into the virtualization industry, you can be assured that there will be a better alternative available sooner or later. libvirt not only abstracts you from hypervisors but also adds some really nice features on top of that:
  1. Manipulation (creation, deletion and modification etc) and monitoring etc of virtual machines on remote hosts, securely.
  2. Live migration of virtual machine(s) from one host to another.
Apart from the libvirt library itself, the libvirt package also comes with a very nice commandline tool called virsh that exposes libvirt API as convenient arguments. As you can probably guess from its name, virsh is a shell so if you can launch it without (command) arguments it will launch an interactive shell, awaiting your commands.

virt-manager


Neither libvirt, not virsh are tools that an end-user could be expected to use. Thats where virt-manager comes into picture. It basically provides the same functionality as virsh but unlike virsh, its designed for end-users and hence has a very user-friendly graphical user-interface. Here is some screenshots that should give you a good idea:



While virt-manager has nice UIs for everything related to VM management, it still leaves the remote access of virtualized (guest) OS/desktop to tools that are tailored for that, such as VNC and SPICE.

SPICE


SPICE in simple words can be described as very smart remote-access enabler for virtual machines. Oh wait, I was supposed to leave definitions to wikipedia:
"In computing, SPICE (the Simple Protocol for Independent Computing Environments) is a remote-display system built for virtual environments which allows users to view a computing "desktop" environment - not only on its compute-server machine, but also from anywhere on the Internet and using a wide variety of machine architectures."

SPICE was originally developed by Qumranet as a proprietary solution. Red Hat acquired Qumranet in 2008 and in December 2009 Red Hat open-sourced the protocol.

Now with definition and history lesson taken care of, lets talk about the real thing: tools. SPICE, the implementation is divided into 3 main parts:

Server

 

The SPICE server that runs inside the Qemu binary as a library. Its mainly responsible for authentication of client connections, relaying of graphics output of guest OS to the client using a Qemu feature called QXL and relaying of user input (mouse and keyboard) from client to the guest.

 

Client(s)


This is the tool that end-user should be concerned with. It provides a view into the guest OS (very much like the popular VNC).In the past there was only one SPICE client called, spicec. Due to various reasons (not embeddable, too low-level etc), it was deemed necessary to create a better client-tool. So for the past some months, our team has been working on a SPICE client Gtk+ widget called (surprise suprice) spice-gtk and helped in integration of it in vinagre (the GNOME remote-desktop client). I still haven’t used (or even built) spicec but from what I’ve been told, vinagre+spice-gtk are already much better than spicec in functionality so I guess I haven’t missed anything. Wait! Why am I telling you all this when I can just show you?

Just to be very clear here, spice-gtk is nothing specific to vinagre so if you want to have SPICE integration in your UI(s), you can do it very easily using spice-gtk. Apart from the C API, it also provides gobject-introspection and Vala bindings.

 

vdagent:


There are certain important tasks that spice-server needs to perform that it can not do so itself as it runs on the host rather than guest. A good example is copy/cut and paste between client’s host and guest desktop. For this reason, vdagent exists. Its a helper that runs inside the guest (and as such is installed from the guest). So making the copy&paste possible, it proxies the appropriate events to/from the SPICE client from/to guest windowing system through spice-server.

 

Whats wrong with VNC?


VNC has been around for a while now and in modern unix world, its considered as the remote desktop solution so its natural for people to ask: why create yet another solution for the same problem? The reason is that SPICE protocol has been designed to be very efficient on bandwidth usage and to satisfy the needs of a virtualized environment [1]. Recall QXL I mentioned above? QXL is handled/implemented as something called paravirtual devices in SPICE. Its probably appropriate to quote the related wikipedia definition here first:
In computing, paravirtualization is a virtualization technique that presents a software interface to virtual machines that is similar but not identical to that of the underlying hardware. 
So while a VNC server reads frames from video memory and sends (compressed though) the updated areas (if any) to the client, spice-server on the other hand presents the guest windowing system with an X driver that captures X protocol operations directly. That is what makes SPICE a lot more efficient at network usage compared to RFB protocol that VNC uses.

The end


I am really not good at explaining things so I’m sure I must have left-out some necessary details but worry not! We have a team of awesome hackers who can always help you with any issues related to SPICE. You can reach us either through our IRC channel or mailing-list. If you are attending the Desktop Summit 2011 in Berlin, you are in luck cause not only there is a talk about ‘Integrating virtualization into the desktop’ but also some of us will be attending the full duration of the conference so you can come and discuss with us in person.
If you are interested in readily available products based on these awesome virtualization tools, I suggest you have a look here.

[1] Actually, currently SPICE can only be used to access virtualized desktops, though one of our team members is actively working to make it possible to connect to normal/real desktops.

by zeenix (noreply@blogger.com) at June 21, 2011 07:27 PM

June 17, 2011

Christophe Fergeau

Spicy apples

It has been a few months since I've  been hired by Red Hat to hack on Spice, and I realized I haven't blogged as much as I should have :)

Introduction

First, let me introduce Spice quickly. Spice is a protocol which then gets implemented in clients such as Vinagre (using the spice-gtk widget) and in servers (QEMU or the experimental X11 driver). Using this protocol, the video, sound, keyboard, mouse inputs and ouputs can be abstracted away from a virtual machine. This means you can run a Spice client application on one box to get the display of a QEMU virtual machine running on another box. Or you can have a big server running dozens of virtual machines, and connect to the VM you're interested in from your laptop. Or you use it in a VDI setup where you'll have N different PCs connecting to a single server running N virtual machines.

One of the thing I've done during these few months at Red Hat is to look into building a Mac client for Spice. Indeed, so far we have a linux client (as well as a GTK widget if you want to embed Spice in your applications, a Windows client, but nothing on Mac OS X. Since I was the only one in the team with a functional OS X install, I was volunteered to look into this port ;)

The long way toward Vinagre on OS X

I started by building the gtk+ OS X port. Using these build instructions, it was quite straightforward even though it took some time since there were a few bugs to fix here and there in the stack. Then I realized I needed gtk3 and that I had only built gtk2, so I started again, and fixed some more bugs (the glib maintainers really didn't want me to succeed :-) )

Once I had gtk-demo running, it was time to start thinking about my real goal, getting spice-gtk and vinagre to compile. Luckily, I had made a jhbuild moduleset for these, which I could reuse (after adapting it) for the OS X build since gtk-osx is using jhbuild too. This way, I could focus on the real porting work. The easy bits were tweaking spice-gtk build options to use gstreamer instead of pulse-audio, gthreads instead of coroutines, ... And then I finally had to do some actual porting work ;) This ranged from small fixes due to OS X BSD roots, or to older libraries on OS X, to new code to write because there was some linux/Windows specific code to handle screen detection/resolution changes. And after that, lo and behold, I could connect to my remote VM from my Mac!

Then, with the help of Marc-André, I could tackle Vinagre. This mainly meant making some Vinagre dependencies optional (namely gtk-vnc, gnome-keyring and GtkApplication) because I didn't want to compile/use dbus. After some confusion because of a regression in glib causing Vinagre to crash on startup, I was really thrilled to connect to finally connect to a virtual machine running on my work laptop from my Mac OS X laptop!

While this was great, things were far from being over :) In order for this work to be usable by other people, I had to build an application bundle, this basically means making Vinagre relocatable at runtime. Thanksfully, the work from the people porting gtk+ to OS X came to the rescue once again! They provide an ige-mac-bundler to help generate application bundles for gtk+ applications. I had to tweak it since it's not fully ready for gtk3 yet, and to figure out how to get it to change the location of libpeas plugins, typelibs, pango modules, gdk-pixbuf modules at runtime. The good new is that all these modules provide handy environment variables which help with that (PEAS_PLUGIN_LOADERS_DIR, GI_TYPELIB_PATH, PANGO_SYSCONFDIR and GDK_PIXBUF_MODULE_FILE), but it took quite a bit of trial and error to figure out all of these :) Last but not least, I wrote a few patches for Vinagre to add similar environment variables to locate its data files.

The reward

And here is the final result (disclaimer: it's still a work in progress) :





As you can see in the video above (bigger ogg version here), it's already working pretty well, you can connect to a VM, go fullscreen, sound is working, ... But as always, there are still some improvements to be done...
The most important one is to upstream the various changes I had to make in Vinagre, spice-gtk and ige-mac-bundler. For spice-gtk, this is mostly done, for Vinagre and ige-mac-bundler, I have to clean up the changes first. I also have to make building Vinagre on OS X much easier  And then, there is more work to do to polish the OS X integration, like looking at GtkOSXApplication to get the usual OS X top menu bar, finding a better looking theme, having a native GtkApplication backend, and developing native OS X code for things like monitor detection/resolution changes/... (which is currently not implemented/not working). And obviously, it also needs lots of testing :)

All in all, I'm pleased with the result so far, it's a really good basis for a rocking Spice OS X client! Any takers for working on an iOS Spice client next ?

by Christophe (noreply@blogger.com) at June 17, 2011 06:42 PM

June 08, 2011

Lubos Kocman

SPICE at Fedora 15 release party

Hello there is Fedora 15 release party in our Brno office. The whole event starts at 6pm.


I'll present SPICE basics + virt-manager plugin. Google docs link for presentation.

Everybody is welcome.

by lkocman (noreply@blogger.com) at June 08, 2011 10:47 AM

May 31, 2011

Hans de Goede

USB2 support and USB redirection over the network with qemu

Hi All,

I've been working on USB redirection over the network for qemu / spice for a while now. And I'm happy to report I've something which is good enough to invite others to test it. In the mean time Gert Hoffmann (kraxel) has been working on cleaning up the EHCI support which was submitted to the qemu-devel list about a year ago, making it suitable to get merged. My qemu git tree is based on Gert's tree, so it has prelimary USB2 support too. Note that the USB2 support works best when used together with the network redirection code over localhost, that seems to be more reliable at the moment then using qemu's direct usb host redirection code.

So if you want to play around with this here are some installation instructions. These instructions assume a 64 bit Red Hat or Fedora installation, with libusb-1.0.so.0 in /lib64. If you've a 32 bit installation or are using a distribution which does not use /[usr/]lib64 for 64 bit installations (such as Debian and Ubuntu) replace /lib64 with /lib in the below instructions.

First of all you will need my version of libusb, which is has a new libusb_get_device_speed function, this is intended
to go upstream sometime soon. But first upstream needs to get to long awaited 1.0.9 out the door. To install my (fully compatible) libusb version do:
git clone git://anongit.freedesktop.org/~jwrdegoede/libusb
cd libusb
git checkout usbredir
./autogen.sh
./configure --prefix=/usr --libdir=/lib64
make
sudo make install

With the new libusb in place, it is time to build the non qemu parts of the usbredir code
(a standalone server, as well as the usbredir protocol parser and host libraries):
git clone git://anongit.freedesktop.org/~jwrdegoede/usbredir
cd usbredir
make PREFIX=/usr LIBDIR=/usr/lib64
sudo make PREFIX=/usr LIBDIR=/usr/lib64 install

And now lets build qemu with usbredir support (note I enable spice + spices smartcard support here, since that is
what I use in my day to day testing, this is not strictly needed).
git clone git://anongit.freedesktop.org/~jwrdegoede/qemu
cd qemu
git checkout usbredir
./configure --prefix=/usr --enable-smartcard-nss --enable-smartcard --enable-spice --target-list=x86_64-softmmu
make
sudo install -m0755 -p x86_64-softmmu/qemu-system-x86_64 "/usr/bin"

Note do not use make install, this will also install the BIOS roms from qemu git which are outdated, this assumes that you already have a recent qemu installed and will be using the BIOS roms from that version.

Now start qemu with all the options you use normally and "-usb" or "-usb -device usb-ehci" for USB2 support. To test the network redirection, start the usbredirserver in another terminal, lets say you want to redirect a usb device with vid:pid
045e:0772, then start usbredirserver like this:
usbredirserver 045e:0772

And then in the qemu monitor cmdline type:
usb_add tcp-redir:localhost:4000

Notes:
1) replace localhost with the ip or hostname of the other machine if you're actually testing this over  the network
2) you can start multiple servers to redirect multiple devices on the same machine, add " -p 4001" to start a second
    server on port 4001, and make the 4000 4001 in the usb_add command
3) To unplug a device do a usb_del with the exact same arguments as you passed to the usb_add command

If you're interested in the network protocol used for the usb redirection, see:
http://cgit.freedesktop.org/~jwrdegoede/usbredir/tree/usb-redirection-protocol.txt

Regards,

Hans

May 31, 2011 01:44 PM

April 07, 2011

Alon Levy

There are at least two ways to render a cursor (or ie9 rendering bug)

This post, and anything else tagged spice, is about the spice project development that I’m a part of, ever since starting to work for Red Hat last year.

So the first post will be just about a recent fix to a rendering problem (tl;dr version): ie9 (Internet Explorer 9) rendering. A glaring bug was discovered recently – we didn’t render ie9 pages correctly. After a lot of investigation this turned out to be a caching issue – we were using the same key to cache two different bitmap copy operations (this is the driver cache, unrelated to the server/client cache). The DrvCopyBits operation has two parameters, a SURFOBJ containing the bitmap, and a XLATEOBJ containing a color translation object. We ignored the later in some cases. Basically rendering of a blinking cursor (and any text) is done differently in ie9 as compared to a login blinking cursor:

ie9 renders a blinking cursor by sending the same SURFOBJ (iUniq is constant) with two alternating pallettes.

login (and ff4) draw a blinkinging cursor by using DrvBitBlt with a fill operation with mask 0xff (I assume xor, although this didn’t break so I didn’t take a too close look).

To be more precise this is the view from the device driver that is not implementing any DirectDraw, just GDI. So this could be actually an implementation detail of some dll being used by either of those browsers.

These are the logs for the events:

ie9, uses DrvCopyBits with the same SURFOBJ and alternating XLATEOBJ’s:

125684577551 qxldd: DrvCopyBits [0,296191,(15,16,130,146),3,0,(15,16,130,146)]
125684662828 qxldd: _BitBlt
125684693209 qxldd: __DrvBitBlt
125684725824 qxldd: DoCopy
125684760256 qxldd: GetDrawable 0x91f44d70
125684785190 qxldd: SetClip
125684808936 qxldd: SetClip: QXL_CLIP_TYPE_NONE
125684833241 qxldd: GetBitmap
125684856218 qxldd: QXLGetBitmap
125684885552 qxldd: QXLGetBitmap: iUniq=123d DONTCACHE=0 w=1 h=16 cx=1024 cy=674 hsurf=330507e4 ctiUniq=2263 XO_TABLE=0 format=6
125686471440 qxldd: GetCacheImage: ImageKeyPut 231944847
125686542120 qxldd: GetCacheImage: ImageCacheGetByKey 231944847 hits 8
125686567542 qxldd: QXLGetBitmap: cached image found 231944847
125686589891 qxldd: AddRes
125686610494 qxldd: AddRes: done
125686634939 qxldd: WaitForCmdRing: 0xffb83018
125686657847 qxldd: DoCopy: done
126216044861 qxldd: DrvCopyBits [0,296191,(15,16,130,146),3,0,(15,16,130,146)]
126216155001 qxldd: _BitBlt
126216198721 qxldd: __DrvBitBlt
126216264443 qxldd: DoCopy
126216321015 qxldd: GetDrawable 0×92086190
126216365434 qxldd: SetClip
126216406919 qxldd: SetClip: QXL_CLIP_TYPE_NONE
126216456437 qxldd: GetBitmap
126216499180 qxldd: QXLGetBitmap
126216553237 qxldd: QXLGetBitmap: iUniq=123d DONTCACHE=0 w=1 h=16 cx=1024 cy=674 hsurf=330507e4 ctiUniq=2264 XO_TABLE=0 format=6
126219653568 qxldd: GetCacheImage: ImageKeyPut 707842221
126219750019 qxldd: GetCacheImage: ImageCacheGetByKey 707842221 hits 8
126219808546 qxldd: QXLGetBitmap: cached image found 707842221
126220005499 qxldd: AddRes
126220069404 qxldd: AddRes: done
126220184642 qxldd: WaitForCmdRing: 0xffb83018

login cursor – using a fill DrvBitBlt (xor probably – the turn on and turn off operations are identical):

59327727656 qxldd: DrvBitBlt [-1,4294967295,(406,407,499,514),3,0,(406,407,499,514)]
59327845688 qxldd: _BitBlt
59327969167 qxldd: __DrvBitBlt
59328036913 qxldd: DoFill
59328186375 qxldd: GetDrawable 0×91235030
59328263480 qxldd: SetClip
59328360489 qxldd: SetClip: QXL_CLIP_TYPE_NONE
59328455334 qxldd: QXLGetBrush
59328550877 qxldd: QXLGetBrush: color 0xffffff
59328644953 qxldd: QXLGetBrush: done
59328741544 qxldd: WaitForCmdRing: 0xffb83018
59328837925 qxldd: DrvBitBlt: done
59827733713 qxldd: DrvBitBlt [-1,4294967295,(406,407,499,514),3,0,(406,407,499,514)]
59827853002 qxldd: _BitBlt
59827921377 qxldd: __DrvBitBlt
59827982837 qxldd: DoFill
59828117910 qxldd: GetDrawable 0x91233f90
59828291676 qxldd: SetClip
59828366476 qxldd: SetClip: QXL_CLIP_TYPE_NONE
59828461111 qxldd: QXLGetBrush
59828564826 qxldd: QXLGetBrush: color 0xffffff
59828664000 qxldd: QXLGetBrush: done
59828736566 qxldd: WaitForCmdRing: 0xffb83018
59828818839 qxldd: DrvBitBlt: done

by admin at April 07, 2011 02:16 PM

April 05, 2011

Zeeshan Ali

Future Perfect

Ever since I blogged about me looking for opportunities outside Nokia, I was contacted by quite some companies. Some of them ended-up giving me nice offers but in the end the offer that stood out amongst all was from Red Hat. So last evening, I accepted their offer to join the awesome Spice team.

The reasons I chose Red Hat over others were:
  1. Red Hat being undoubtedly the leader in Open Source technologies for more than a decade has always been on my 'awesome places to work at some day' list.
  2. The Spice project that I'm being hired to work on is simply awesome.
  3. They offer good working conditions.
I'll be staying in Finland and most likely working from home (unless I'm asked to work at the Espoo office). I will be officially joining Red Hat on May 2 and my last day at Nokia will be on April 21.

Before you ask, nothing disastrous is going to happen to GUPnP and Rygel. Of course I won't be spending as many hours on these projects as now but keeping in mind that my first 2 years of work on both these projects was purely in my spare time, I think I'll still be able to keep these projects running. Perhaps now I'll be able to better focus on upstream needs rather than that of my employers (more like working around DLNA conformance test tool issues).

by zeenix (noreply@blogger.com) at April 05, 2011 01:08 PM

March 11, 2011

Lubos Kocman

Wicked fast searching within spice code


I just launched experimental instance of opengrok with indexed git repositories from http://cgit.freedesktop.org/spice.

Pulling && re-indexing is being done on hourly basis.

See http://taris.luboskocman.com:8080/source/ for wicked fast searching.

by lkocman (noreply@blogger.com) at March 11, 2011 12:28 AM

March 08, 2011

Lubos Kocman

How to run spice-vdagent in Linux guest?

Hello if you're already using spice with your Windows/Linux guest and you're still not using guest agent, then this could be nice motivator for you.

What doest spice-vdagent offers you?




  • Copy & Paste between guest and client
  • Automatic guest resolution adjustment while entering fullscreen mode
  • Guest side mouse which allows you to move mouse continuously within guest and client without pressing Sihft + F12


Passing required qemu-kvm arguments




qemu-kvm -device virtio-serial -chardev spicevmc,id=vdagent,debug=0,name=vdagent -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 -spice port=3001,disable-ticketing -vga qxl -soundhw ac97 /path/to/your/guest.img

If you're facing -chardev issue (Then you're probably using older qemu-kvm from RHEL6) then use following arguments instead.

qemu-kvm -device virtio-serial -device spicevmc -device virtserialport -spice port=3001,disable-ticketing -vga qxl -soundhw ac97 /path/to/your/guest.img

Guest requirements


Just do this if you're using RHEL 6/6.1 or Fedora


$ sudo yum -y install spice-vdagent

$ sudo chkconfig spice-vdagentd on
$ sudo reboot


If you don't have spice-vdagent in your repository just download it from following link and build it on your own.


http://spice-space.org/download.html

by lkocman (noreply@blogger.com) at March 08, 2011 08:34 AM

Getting started with SPICE

I got several questions in last few weeks about how to get started with SPICE, so here is my global feedback.

I suppose that you already know what SPICE if not then visit http://spice-space.org  for more information about this awesome protocol.

First thing that you should know is that we (Red Hat and Upstream) currently don't have a qemu-less implementation. So from my previous sentence is obvious that there is currently only qemu implementation. When speaking about qemu I mean both qemu and qemu-kvm hypervisors.

Patched qemu with support for SPICE should be a part of each modern distribution which is taking SPICE protocol seriously. Fedora 14 and RHEL{5,6} already have it.

So let's describe some basic terminology here

  • Hypervisor - a Linux host running instance of qemu
  • Client a machine either Windows or Linux running spice-client application (spicy or spicec) (Both client names are pronounced the same way ;-))
  • Guest - qemu based virtual machine


I'm always trying to use raw volume as a storage for the guest as I believe that it will provide me the best I/O performance. I recommend you to use qemu-img for image creation In case that you're not using any LVM based storage and you also don't have any LUNs exported over iSCSI.

qemu-img create -f qcow2 $guest_img_name 10G # For file based image
lvcreate -n $lv_name -L 10G $vg_name # For lv based guest

In order to use benefits of SPICE you really need a QXL video driver for you'r guest (available for Windows and Linux).

You can actually use spice-tools for conncetion to the guest also without QXL video driver but the performance won't be better than standard VNC.

You're probably asking why would somebody do that .and the answer is that you may want to use spice-client also during installation of guest which does not include QXL video driver by default (e.g. Windows).

I'm supposing that you're using either Red Hat Enterprise 6 or Fedora 14 as a guest and hypervisor for simplifying the whole process.  And that the hypervisor and client are the same machine.

So we should now populate image that you  have already created in previous step.


# yum -y install qemu-kvm spice-server spice-client

# export PATH="$PATH:/usr/libexec" # RHEL 6 does have our goods there

Note: -usbdevice tablet is deprecated but it allows you to move mouse between guest and client without having any guest tools (vdagent) installed. However it does not deal well with multiple guest displays.


# qemu-kvm -m 1024 -cdrom /home/lkocman/fedora14.iso -boot dc -soundhw ac97 -vga qxl -usbdevice tablet -spice port=3001,disable-ticketing /path/to/your/image

# spicec -h localhost -p 3001


Use Shift+F12 to release cursor from spicec and Shift+F11 for switch on/off fullscreen mode. If you need to send a key combo which is normally processed by client (like ctr+alt+del or ctr+alt+fn) then hold ALT key and wait for a small watermark to appear then release alt and hit rest of your combo. Watermark should appear in 2-3 seconds.

Ensure yourself that guest uses xorg-x11-drv-qxl (xorg.conf -> qxl) as a default Xorg driver. If your're using windows as your guest then just download binary driver from http://spice-space.org/download.html.

You should know that spice is able to handle only one connection to a guest at time. So if somebody will connect trough spicec to the same host it will drop your session. So you may want to use password  (a ticket in spice terminology) or a certificate/ssl to secure your connection.

The simplest way is to set a ticket by modifying -spice options in qemu command


qemu-kvm ... -spice port=3001,disable-ticketing ...
qemu-kvm ... -spice port=3001,password=redhat ...

spicec -h localhost -p 3001 -w redhat


You can either set it trough qemu-console or vdsClient in order to not interrupt running qemu instance.

The command for qemu-console is "spice.set_ticket <password>"

As the only access to qemu-console in RHEL6 is restricted to libvirt and vdsClient (and libvirt has currently pretty poor  support for spice) you might be fine with setting ticket at qemu startup.

If you'd like to setup secured connection just follow this nice howto http://spice-space.org/page/SSLConnection.


by lkocman (noreply@blogger.com) at March 08, 2011 08:17 AM

March 07, 2011

March 04, 2011

Lubos Kocman

How to connect multiple displays to a spice guest

I was browsing some outdated documentation to spice, and I found something like -qxl n_displays. Which is not suitable for current releases.

I've found following result based on some internal irc discussions .


The option that does the trick is -device qxl each usage of it will increase number of displays by one.

So -device qxl -device qxl should start up guest with 3 displays (as far as I know n_displays > 2 is currently not working very well).


Prior releases need to define -qxl n_displays parameter except of -device qxl. I’m not aware about situation in other distributions so I’ll use RHEL versioning.


RHEL 5


/usr/libexec/qemu-kvm -vga qxl -qxl 2 -m 1024 -spice port=3001,disable-ticketing  -soundhw ac97 -boot order=dc <guest_img>


RHEL 6 and newer 


QEMU_AUDIO="spice" /usr/libexec/qemu-kvm -vga qxl -device qxl -m 1024 -spice port=3001,disable-ticketing -soundhw ac97 -boot order=dc <guest_img>



There is currently no support for multiple qxl devices on Linux guests so it does currently work only with Windows.

by lkocman (noreply@blogger.com) at March 04, 2011 11:42 AM

March 02, 2011

Lubos Kocman

releasing hourly builds of spice user guide draft

Hourly builds of Spice User guide are currently available at http://taris.luboskocman.com/spice. Link is published in Updates section at http://spice-space.org/documentation.html

Documentaton is being written in docbook. The plan is to update pieces in old User Guide, remove some obsolete parts. Docbook will make it as portable as possible it is.

See git repo at https://github.com/lkocman/SPICE-Documentation

by lkocman (noreply@blogger.com) at March 02, 2011 02:08 PM

get_spice

Subscriptions

Last updated:
May 17, 2012 09:11 AM
All times are UTC.

Powered by:
Planet

Planetarium: