Set up Qemu&Spice&Libvirt 0.9.6 USB Redirection on Ubuntu 11.10

***********************************************************************************************
UPDATE on 11/12/2011. Experimental build libvirt 0.9.7 via git://anonscm.debian.org/pkg-libvirt/libvirt.git
tip commit e49612bea22c681aff95c974d36d009a5ae08a21 for Oneiric, seems to fix bug with VirtManager disconnection at domain shuts down (on Oneiric with kernel 3.1.0-030100-generic) View PPA: https://launchpad.net/~bderzhavets/+archive/xen-next6
***************************************************************************************************
UPDATE on 10/30/2011. View Qemu-kvm 0.15.1 & Spice USB Redirection support for Ubuntu Oneiric
Patches set for debian build may be generated as follows :

$ git clone git://people.freedesktop.org/~jwrdegoede/qemu
$ cd qemu
$ git checkout -B qemu-kvm-0.15.0-usbredir origin/qemu-kvm-0.15.0-usbredir
$ mkdir -p /tmp/patches
$ git format-patch -M -C --output-directory \
/tmp/patches ea2798c1ebe0c12d5feb7d7471a999ea0671ef2f

Kernel installed is 3.1.0-030100-generic
Consider option downgrade seabios 1.6.3 => 0.6.2-qxl if some things go wrong for you. It won’t affect USB Redirection support
***************************************************************************************************
UPDATE on 10/26/2011. After publishing I renamed this PPA as “Libvirt 0.9.6 for Oneiric”. View also :-
“Show PPAs matching Libvirt”
“Show PPAs matching Qemu-kvm”
“Libvirt” 0.9.6-1ubuntu3 was published in precise https://launchpad.net/ubuntu/+source/libvirt/0.9.6-1ubuntu3 on 10/24/2011. View for back ported version of libvirt in PPA :
Qemu&Spice USB Redirection with back ported Libvirt 0.9.6 (as of 10/24/11), new seabios 1.6.3 for Ubuntu Oneiric
***************************************************************************************************
I’ve built locally and uploaded to Launchpad Libvirt 0.9.6 via Debian Unstable, applying standard set of Ubuntu’s patches updated for 0.9.6.

Link to page at Launchpad



Build log for amd64 is attached

Build log for i386 is attached

To start default network :-

$ sudo virsh net-start default
$ sudo virsh net-autostart default

Looks like :-

boris@boris-P5Q-E:~$ sudo virsh net-start default
Network default started
boris@boris-P5Q-E:~$ sudo virsh net-autostart default
Network default marked as autostarted
boris@boris-P5Q-E:~$ brctl show
bridge name bridge id STP enabled interfaces
virbr0 8000.000000000000 yes

Following bellow is attempt to reproduce Hans de Goede blog entry at http://planet.spice-space.org/ on Ubuntu 11.10 with intent to build Qemu-kvm 0.15.0 with usb redirection network support per http://planet.spice-space.org/ via git repository git://people.freedesktop.org/~jwrdegoede/qemu :-

$ git clone git://people.freedesktop.org/~jwrdegoede/qemu
$ cd qemu
$ git checkout -B qemu-kvm-0.15.0-usbredir origin/qemu-kvm-0.15.0-usbredir
$ git log|more

Spice-Gtk-0.7.6X has been built up on current snapshot of git://anongit.freedesktop.org/spice/spice-gtk to obtain Spice-Gtk with usb redirection support working stable with Spice 0.9.1. Build done on Ubuntu Oneiric.Packaged version version of Spice-Gtk-0.7.6X is built up on mentioned git repository. Running autogen.sh with exported environment variable NOCONFIGURE allows to perform it in one build per Debian’s Spice-Gtk-0.7-3 building schema, however requiring several updates to debian/control and debian/rules due to snapshots have to be done from current git tree.

Upgrade version of Libvirt up to 0.9.6 allows to avoid using “qemu” command line (libvirt 0.9.2) and follow http://planet.spice-space.org/ update VM’s XML profile under /etc/libvirt/qemu/ as suggested in second blog entry of Hans de Goede :-

Change the first line from: <domain type=’kvm’> to:

<domain type=’kvm’ xmlns:qemu=’http://libvirt.org/schemas/domain/qemu/1.0′&gt;

And add the following lines at the end, above the “</domain>” line: <qemu:commandline>

<qemu:arg value=’-readconfig’/>
<qemu:arg value=’/etc/qemu/ich9-ehci-uhci.cfg’/>
<qemu:arg value=’-chardev’/>
<qemu:arg value=’spicevmc,name=usbredir,id=usbredirchardev1’/>
<qemu:arg value=’-device’/>
<qemu:arg value=’usb-redir,chardev=usbredirchardev1,id=usbredirdev1,bus=ehci.0,debug=3’/>
<qemu:arg value=’-chardev’/>
<qemu:arg value=’spicevmc,name=usbredir,id=usbredirchardev2’/>
<qemu:arg value=’-device’/>
<qemu:arg value=’usb-redir,chardev=usbredirchardev2,id=usbredirdev2,bus=ehci.0,debug=3’/>
<qemu:arg value=’-chardev’/>
<qemu:arg value=’spicevmc,name=usbredir,id=usbredirchardev3’/>
<qemu:arg value=’-device’/>
<qemu:arg value=’usb-redir,chardev=usbredirchardev3,id=usbredirdev3,bus=ehci.0,debug=3’/>
</qemu:commandline>

Then run :-

# /etc/init.d/libvirt-bin restart

Manage VMs via virsh or Virt Manager having USB redirection support active in Spicy’s sessions.
VirtManager :-





Virsh :-





USB redirection on F16 (TC)



*************************************************************************************************************
UPDATE on 11/14/2011 Issue fixed via upgrade Libvirt up to 0.9.7-2. That’s a link to PPA.
*************************************************************************************************************
VirtManager seems not to be ready for this kind of operations now. Spicy session with KVM started
via VirtManager runs fine working with USB pen. But on domain shutdown following error shows up :-

Error polling connection ‘qemu:///system': Unable to read from monitor: Connection reset by peer

Traceback (most recent call last):
File “/usr/share/virt-manager/virtManager/engine.py”, line 440, in _tick
conn.tick()
File “/usr/share/virt-manager/virtManager/connection.py”, line 1507, in tick
vm.tick(now)
File “/usr/share/virt-manager/virtManager/domain.py”, line 1541, in tick
pcentHostCpu, pcentGuestCpu) = self._sample_cpu_stats(info, now)
File “/usr/share/virt-manager/virtManager/domain.py”, line 1158, in _sample_cpu_stats
guestcpus = self.vcpu_count()
File “/usr/share/virt-manager/virtManager/domain.py”, line 831, in vcpu_count
return int(self._get_guest().vcpus)
File “/usr/share/virt-manager/virtManager/domain.py”, line 339, in _get_guest
xml = self._get_domain_xml(inactive, refresh_if_necc)
File “/usr/share/virt-manager/virtManager/domain.py”, line 331, in _get_domain_xml
refresh_if_necc=refresh_if_necc)
File “/usr/share/virt-manager/virtManager/libvirtobject.py”, line 95, in get_xml
self.refresh_xml()
File “/usr/share/virt-manager/virtManager/libvirtobject.py”, line 105, in refresh_xml
self._xml = self._XMLDesc(self._active_xml_flags)
File “/usr/share/virt-manager/virtManager/domain.py”, line 764, in _XMLDesc
return self._backend.XMLDesc(flags)
File “/usr/lib/python2.7/dist-packages/libvirt.py”, line 381, in XMLDesc
if ret is None: raise libvirtError (‘virDomainGetXMLDesc() failed’, dom=self)
libvirtError: Unable to read from monitor: Connection reset by peer

Final draft and instructions to install are in PPA Qemu&Spice USB Redirection and Libvirt 0.9.6 on Ubuntu 11.10 (Oneiric)
When working with the most recent PPA Qemu-kvm 0.15.1 & Spice USB Redirection support for Ubuntu Oneiric with virt-manager,
patched by RH against previous issue. Another error shows up on VM shutdown :-

Error polling connection ‘qemu:///system': Unable to read from monitor: Connection reset by peer
Traceback (most recent call last):
File “/usr/share/virt-manager/virtManager/engine.py”, line 440, in _tick
conn.tick()
File “/usr/share/virt-manager/virtManager/connection.py”, line 1507, in tick
vm.tick(now)
File “/usr/share/virt-manager/virtManager/domain.py”, line 1531, in tick
info = self._backend.info()
File “/usr/lib/python2.7/dist-packages/libvirt.py”, line 1411, in info
if ret is None: raise libvirtError (‘virDomainGetInfo() failed’, dom=self)
libvirtError: Unable to read from monitor: Connection reset by peer

Consider option downgrade seabios 1.6.3 => 0.6.2-qxl to get more or less stable F15 KVM guest behavior.
It doesn’t help F16 RC1 KVM guest.

About these ads

2 Responses to Set up Qemu&Spice&Libvirt 0.9.6 USB Redirection on Ubuntu 11.10

  1. My Homepage says:

    I genuinely treasure your work , Great post. 402500

  2. f1 forum says:

    f1 forum…

    [...]Set up Qemu&Spice&Libvirt 0.9.6 USB Redirection on Ubuntu 11.10 « Xen Virtualization on Linux and Solaris[...]…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: