Virt-install Debian Squeeze PV DomU at Xen 4.1.2 Oneiric Dom0

November 19, 2011

RH’s opensource distros ISO images (Fedora,CentOS) have a nice feature,been loop mounted on apache folder /var/www/domain, they allow to create local mirror to virt-install corresponding paravirtual guest. Not customized Debian ISOs don’t have this feature, however virt-install still works for Debian Squeeze utilizing remote system HTTP source. Virt-install Debian PV DomU is possible via remote official HTTP source.Begin via virt-install command line

root@boris-System-P5Q3:~# virt-install --connect xen:/// --debug -n SQUEEZE --vnc \
> -p -r 2048 --vcpus=2 -f /dev/sdb7 \
> -l http://ftp.at.debian.org/debian/dists/squeeze/main/installer-amd64/
Sat, 19 Nov 2011 19:23:20 DEBUG Launched with command line:
/usr/bin/virt-install --connect xen:/// --debug -n SQUEEZE --vnc -p -r 2048 --vcpus=2 -f /dev/sdb7 -l http://ftp.at.debian.org/debian/dists/squeeze/main/installer-amd64/
Sat, 19 Nov 2011 19:23:20 DEBUG Requesting libvirt URI xen:///
Sat, 19 Nov 2011 19:23:20 DEBUG Received libvirt URI xen:///
Sat, 19 Nov 2011 19:23:20 DEBUG Requesting virt method 'xen', hv type 'default'.
Sat, 19 Nov 2011 19:23:20 DEBUG Received virt method 'xen'
Sat, 19 Nov 2011 19:23:20 DEBUG Hypervisor name is 'xen'
Sat, 19 Nov 2011 19:23:20 DEBUG --graphics compat generated: vnc
Sat, 19 Nov 2011 19:23:20 DEBUG DistroInstaller location is a network source.
Sat, 19 Nov 2011 19:23:20 DEBUG Attempting to detect distro:
Sat, 19 Nov 2011 19:23:22 DEBUG Fetching URI: http://ftp.at.debian.org/debian/dists/squeeze/main/installer-amd64/current/images/MANIFEST
Sat, 19 Nov 2011 19:23:22 DEBUG Saved file to /var/tmp/virtinst-MANIFEST.1GW1wt
Sat, 19 Nov 2011 19:23:22 DEBUG Detected a Debian distro
Sat, 19 Nov 2011 19:23:22 DEBUG Guest.has_install_phase: True
Starting install...
Sat, 19 Nov 2011 19:23:22 DEBUG scratchdir=/var/lib/xen
Sat, 19 Nov 2011 19:23:23 DEBUG Attempting to detect distro:
Sat, 19 Nov 2011 19:23:25 DEBUG Fetching URI: http://ftp.at.debian.org/debian/dists/squeeze/main/installer-amd64/current/images/MANIFEST
Sat, 19 Nov 2011 19:23:25 DEBUG Saved file to /var/lib/xen/virtinst-MANIFEST.rh1eGO
Retrieving file MANIFEST... | 3.3 kB 00:00 ...
Sat, 19 Nov 2011 19:23:25 DEBUG Detected a Debian distro
Sat, 19 Nov 2011 19:23:25 DEBUG Fetching URI: http://ftp.at.debian.org/debian/dists/squeeze/main/installer-amd64/current/images/netboot/xen/vmlinuz
Sat, 19 Nov 2011 19:23:36 DEBUG Saved file to /var/lib/xen/virtinst-vmlinuz.5Or9oh 00:00 ETA
Retrieving file vmlinuz... | 4.6 MB 00:10 ...
Sat, 19 Nov 2011 19:23:36 DEBUG Fetching URI: http://ftp.at.debian.org/debian/dists/squeeze/main/installer-amd64/current/images/netboot/xen/initrd.gz
Sat, 19 Nov 2011 19:24:51 DEBUG Saved file to /var/lib/xen/virtinst-initrd.gz.T9hVje 00:00 ETA
Retrieving file initrd.gz... | 37 MB 01:15 ...
Sat, 19 Nov 2011 19:24:51 DEBUG Auto detected OS type as: linux
Sat, 19 Nov 2011 19:24:51 DEBUG Have access to local system scratchdir so nothing to upload
Sat, 19 Nov 2011 19:24:51 DEBUG Could not open "/etc/sysconfig/keyboard" [Errno 2] No such file or directory: '/etc/sysconfig/keyboard'
Sat, 19 Nov 2011 19:24:51 DEBUG Could not open "/etc/X11/xorg.conf": [Errno 2] No such file or directory: '/etc/X11/xorg.conf'
Sat, 19 Nov 2011 19:24:51 DEBUG Could not open "/etc/sysconfig/keyboard" [Errno 2] No such file or directory: '/etc/sysconfig/keyboard'
Sat, 19 Nov 2011 19:24:51 DEBUG Could not open "/etc/X11/xorg.conf": [Errno 2] No such file or directory: '/etc/X11/xorg.conf'
Sat, 19 Nov 2011 19:24:51 DEBUG Generated install XML:
<domain type='xen'>
<name>SQUEEZE</name>
<uuid>3978d7ce-454b-103e-d9df-a486052bf6ce</uuid>
<memory>2097152</memory>
<currentMemory>2097152</currentMemory>
<vcpu>2</vcpu>
<os>
<type arch='x86_64'>linux</type>
<kernel>/var/lib/xen/virtinst-vmlinuz.5Or9oh</kernel>
<initrd>/var/lib/xen/virtinst-initrd.gz.T9hVje</initrd>
<cmdline>method=http://ftp.at.debian.org/debian/dists/squeeze/main/installer-amd64/</cmdline>
</os>
<features>
<acpi/><apic/>
</features>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<disk type='block' device='disk'>
<source dev='/dev/sdb7'/>
<target dev='xvda' bus='xen'/>
</disk>
<interface type='bridge'>
<source bridge='br0'/>
<mac address='00:16:3e:da:f5:3f'/>
</interface>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='-1' keymap='en-us'/>
<video>
<model type='cirrus'/>
</video>
</devices>
</domain>
Sat, 19 Nov 2011 19:24:51 DEBUG Generated boot XML:
<domain type='xen'>
<name>SQUEEZE</name>
<uuid>3978d7ce-454b-103e-d9df-a486052bf6ce</uuid>
<memory>2097152</memory>
<currentMemory>2097152</currentMemory>
<vcpu>2</vcpu>
<bootloader>/usr/lib/xen-default/bin/pygrub</bootloader>
<features>
<acpi/><apic/>
</features>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<disk type='block' device='disk'>
<source dev='/dev/sdb7'/>
<target dev='xvda' bus='xen'/>
</disk>
<interface type='bridge'>
<source bridge='br0'/>
<mac address='00:16:3e:da:f5:3f'/>
</interface>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='-1' keymap='en-us'/>
<video>
<model type='cirrus'/>
</video>
</devices>
</domain>
Creating domain... | 0 B 00:01
Sat, 19 Nov 2011 19:24:53 DEBUG Started guest, connecting to console if requested
Sat, 19 Nov 2011 19:24:53 DEBUG Launching virt-viewer for graphics type 'vnc'
Sat, 19 Nov 2011 19:24:53 DEBUG Running: /usr/bin/virt-viewer --connect xen:/// --wait 1
(virt-viewer:2892): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",
Sat, 19 Nov 2011 19:24:53 DEBUG XML fetched from libvirt object:
<domain type='xen' id='1'>
<name>SQUEEZE</name>
<uuid>3978d7ce-454b-103e-d9df-a486052bf6ce</uuid>
<description></description>
<memory>2097152</memory>
<currentMemory>2097152</currentMemory>
<vcpu>2</vcpu>
<bootloader></bootloader>
<bootloader_args></bootloader_args>
<os>
<type>linux</type>
<kernel>/var/lib/xen/virtinst-vmlinuz.5Or9oh</kernel>
<initrd>/var/lib/xen/virtinst-initrd.gz.T9hVje</initrd>
<cmdline>method=http://ftp.at.debian.org/debian/dists/squeeze/main/installer-amd64/</cmdline>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/lib/xen-4.1/bin/qemu-dm</emulator>
<disk type='block' device='disk'>
<driver name='phy'/>
<source dev='/dev/sdb7'/>
<target dev='xvda' bus='xen'/>
</disk>
<interface type='bridge'>
<mac address='00:16:3e:da:f5:3f'/>
<source bridge='br0'/>
<script path='/etc/xen/scripts/vif-bridge'/>
<target dev='vif1.0'/>
</interface>
<console type='pty' tty='/dev/pts/2'>
<source path='/dev/pts/2'/>
<target type='xen' port='0'/>
</console>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='5900' autoport='yes' keymap='en-us'/>
</devices>
</domain>







Sat, 19 Nov 2011 20:04:50 DEBUG Removing /var/lib/xen/virtinst-vmlinuz.5Or9oh
Sat, 19 Nov 2011 20:04:50 DEBUG Removing /var/lib/xen/virtinst-initrd.gz.T9hVje
Guest installation complete... restarting guest.
Sat, 19 Nov 2011 20:04:56 DEBUG Launching virt-viewer for graphics type 'vnc'
Sat, 19 Nov 2011 20:04:56 DEBUG Running: /usr/bin/virt-viewer --connect xen:/// --wait 2
(virt-viewer:3705): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",




root@boris-System-P5Q3:~# virsh list –all
Id Name State
———————————-
0 Domain-0 running
– OneiricPV shut off
– SQUEEZE shut off
– VF16PV shut off
– VF16RC5 shut off

root@boris-System-P5Q3:~# virsh start SQUEEZE
Domain SQUEEZE started

root@boris-System-P5Q3:~# vncviewer localhost:0

VNC Viewer Free Edition 4.1.1 for X – built Sep 7 2011 11:16:25
Copyright (C) 2002-2005 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.

Sat Nov 19 20:11:30 2011
CConn: connected to host localhost port 5900
CConnection: Server supports RFB protocol version 3.8
CConnection: Using RFB protocol version 3.8
TXImage: Using default colormap and visual, TrueColor, depth 24.
CConn: Using pixel format depth 6 (8bpp) rgb222
CConn: Using ZRLE encoding
CConn: Throughput 20006 kbit/s – changing to hextile encoding
CConn: Throughput 20006 kbit/s – changing to full colour
CConn: Using pixel format depth 24 (32bpp) little-endian rgb888
CConn: Using hextile encoding

VNC window pops up nicely.

Domain also is manageable via VirtManager :-




Set up Spice-Gtk-0.7 on Ubuntu 11.10

August 7, 2011

All packages required are already in PPA “Spice-Gtk-0.7 on Ubuntu 11.10″. Spice-gtk-0.7 has been done for Oneiric as two builds. First one with python, gobject-introspection enabled and –with-gtk=”2.0″(GTK2). Second one –with-introspection and –with-gtk=”3.0″ (GTK3).This builds actually are the core builds in PPA, which bring RH’s technologies to Ubuntu 11.10. Notice, that option –with-audio=”pulse” is also used by both builds and appears to be working fine.Patched virt-manager and virtinst also support spicevmc channel.
Following bellow is brief description of PPA Spice-Gtk-0.7 on Ubuntu 11.10.
View also PPA Qemu-kvm 0.15.0 and Spice on Ubuntu 11.10

1.The most recent qemu-kvm packages were done via “git clone git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git” are Release 0.15-rc1 as of 07/31/2011.
$ git clone git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git
$ cd qemu-kvm
$ git checkout -b stable-0.15 origin/stable-0.15
$ cd ..
Copy to building directory :
$ cp -R qemu-kvm ../BUILD/qemu-kvm-mmddyy
Stable branch is already patched to fix “QXL” issues and to support spicevmc channel

2. Spice-gtk-0.7 has been done for Oneiric as two builds.

GTK2 build performed with
./configure --prefix=/usr --build=x86_64-linux-gnu \
--mandir=/usr/share/man --infodir=/usr/share/info \
--datadir=/usr/share \
--sysconfdir=/etc --localstatedir=/var \
--libexecdir=/usr/bin \
--with-python --disable-static \
--enable-introspection \
--enable-smartcard=no \
--with-gtk="2.0" --with-audio="pulse"

GTK3 build performed with
./configure --prefix=/usr --build=x86_64-linux-gnu \
--mandir=/usr/share/man --infodir=/usr/share/info \
--datadir=/usr/share \
--sysconfdir=/etc --localstatedir=/var \
--libexecdir=/usr/bin \
--disable-static \
--enable-introspection \
--with-gtk="3.0" --enable-smartcard=no --with-audio="pulse"

libspice-protocol-dev 0.8.1-1 is required by both builds

3.Current version of spice-vdagent for Oneiric as KVM guest installs service and *.desktop (file) automatically and requires guest restart for activation or manual gdm restart and starting service.
4.Packages virt-manager-0.8.7-4ubuntu9 and virtinst-0.500.6-4ubuntu9
support spicevmc channel.
******************************
Install software from PPA :-
******************************
$ sudo apt-add-repository ppa:bderzhavets/spice-7
$ sudo apt-get update
$ sudo apt-get install qemu-kvm qemu qemu-common \
libspice-client libspice-client-dev \
libspicegtk3-client libspicegtk3-client-dev \
spice libspice-protocol-dev spicegtk3-client

$ sudo apt-get install virtinst virt-viewer virt-manager

Disable libvirtd’s apparmor profile :

$ sudo ln -s /etc/apparmor.d/usr.sbin.libvirtd /etc/apparmor.d/disable/
$ sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.libvirtd
$ sudo adduser $USER kvm
$ sudo reboot


Build Spice-Gtk-0.6 (GTK2&GTK3) on Ubuntu 11.10 (Oneiric)

June 28, 2011

Package spice-gtk-0.6 has been rebuilt on Natty to support gobject-introspection.Notice, that it was GTK2 build. Only GTK2 build creates SpiceClientGtk.so,which allows you to open Spice Console via virt-manager. Fedora 16 (rawhide) does two parallel builds GTK2 and GTK3. Analysis of spice-gtk-0.6-1.fc16.src.rpm clearly shows how packages are supposed to be created separating directories with GTK2 and GTK3 shared libraries. Actually, spice-gtk.spec works as a sample to create debian’s package.install files, providing an option reproduce exactly the same file layout on Ubuntu 11.10 as it is on F16 (rawhide) after install package spice-gtk-0.6-1.
Just SpiceClientGtk.so allows to run installs with video mode “vga” and spice sessions in “qxl” video mode with created domains via virt-manager.
View PPA Spice-Gtk-0.6 on Ubuntu 11.04 and Ubuntu 11.10 for details :-
Build with GTK2 : spice-gtk-0.6-9ubuntu15
Built packages
libspice-client Spice GTK+ Library
libspice-client-dev Spice GTK+ Library (development files)
Build with GTK3 : spice-gtk3-0.6-3ubuntu9
Built packages
libspicegtk3-client Spice GTK+ Library
libspicegtk3-client-dev Spice GTK+ Library (development files)
spicegtk3-client Virtual Desktop Interface Client using the Spice Protocol
Build spice-gtk3-0.6-3ubuntu9 depends on libspice-client. Both builds have been done for Oneiric and tested to install (with no conflicts) via Synaptic Manager and to work on daily builds 06/24/11 and 06/29/11 . Qemu-kvm build (spice enabled) was based on git clone git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git as of 06/23/11.


Set up Spicevmc Channel on Ubuntu 11.04 as KVM Server and spice-vdagent on Natty as a KVM guest

June 13, 2011

Procedure following bellow set up spicevmc channel support on KVM Server Ubuntu Natty. It also instructs how to setup spice-vdagent on Natty installed as KVM guest at any KVM Server Ubuntu 11.04 or F15. In other words it contains build debian package spice-vdagent via source for Ubuntu 11.04 ( Natty). To setup spicevmc channel on Natty install qemu-kvm packages from PPA Packages in Spice-Gtk-0.6 on Ubuntu 11.04 and Ubuntu 11.10. Build qemu-kvm-060911-0ubuntu5 from PPA already supports spicevmc channel.It’s original tarball is based on git clone git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git on 06/09/2011.Also upgrade virtinst via same PPA up to 0.500.6 to have virt-install understand option “–channel spicevmc”

Install VF15 KVM guest via :-

virt-install --connect qemu:///system \
--virt-type kvm \
--os-type=linux --os-variant=fedora15 \
--name VM15VMC --ram 2048 --disk path=/dev/sda5 \
--graphics spice --video qxl --channel spicevmc \
--cdrom /usr/tmp/Fedora-15-x86_64-DVD.iso --vcpus 2

Due to absence Virt-Manager’s ability to create channels,
e.g. it’s missing required F15 patches. Then in guest environment :
# sudo yum update
# sudo yum install spice-vdagent.
It provides an option cut text in VM Spice screen and paste in KVM Server Ubuntu 11.04 desktop environment and vice versa ….
Debian qemu-kvm packages providing spicevmc support have been also tested OK on Oneiric ( Libvirt 0.9.1)





Install Natty KVM guest as follows :-


virt-install --connect qemu:///system \
--virt-type kvm \
--os-type=linux --os-variant=ubuntunatty \
--name UbuntuVMC --ram 2048 \
--disk path=/dev/sdb7 \
--graphics spice --video qxl \
--channel spicevmc \
--cdrom /usr/tmp/ubuntuDesk11.04.iso \
--vcpus 2

When done install spice-vdagent for Natty via PPA Spice on Ubuntu 11.04 and 11.10.
*********************************************************************************
Update on 06/17/2011. Current versions of spice-vdagent install service and *.desktop (file) automatically and require guest restart for activation or manual gdm restart and starting service.
*********************************************************************************

Next :-
1. Create file /etc/xdg/autostart/spice-vdagent.desktop

[Desktop Entry]
Name=Spice vdagent
Comment=Agent for Spice guests
Exec=/usr/bin/spice-vdagent
Terminal=false
Type=Application
Categories=
X-GNOME-Autostart-Phase=Initialization
X-GNOME-AutoRestart=true

2. Then create service spice-vdagentd.

Create file /etc/init/spice-vdagentd.conf

# spice-vdagent - spice-vdagent job file
description "spice-vdagentd"
author "Boris Derzhavets <bderzhavets@yahoo.com>"
# Stanzas
#
# Stanzas control when and how a process is started and stopped
# See a list of stanzas here: http://upstart.ubuntu.com/wiki/Stanzas#respawn
# When to start the service
start on runlevel [2345]
# When to stop the service
stop on runlevel [016]
# Automatically restart process if crashed
respawn
# Essentially lets upstart know the process will detach itself to the background
expect fork
# Run before process
pre-start script
[ -d /var/run/spice-vdagentd ] || mkdir -p /var/run/spice-vdagentd
echo "Put bash code here"
end script
# Start the process
exec /usr/sbin/spice-vdagentd

Expected result :-

boris@boris-virtual-machine:~$ ps -ef| grep spice- | grep -v grep
root 739 1 0 09:23 ? 00:00:00 /usr/sbin/spice-vdagentd
gdm 1041 1 0 09:23 ? 00:00:00 /usr/bin/spice-vdagent
boris 1248 1 0 09:23 ? 00:00:00 /usr/bin/spice-vdagent

Current Build is just for testing. All actions above should be incapsulated in debian package.
If feature doesn’t work :-
boris@boris-virtual-machine:~$ ps -ef|grep spice-
root 1044 1 0 18:25 ? 00:00:00 /usr/sbin/spice-vdagentd
boris 1439 1379 0 18:25 pts/0 00:00:00 grep –color=auto spice-
boris@boris-virtual-machine:~$ /usr/bin/spice-vdagent &
[1] 1445



Testing Oneiric Daily Build as KVM guest :-


Spice-Gtk-0.6 on Ubuntu 11.10 (Oneiric) after Libvirt & python-libvirt upgrade up to 0.9.1

June 10, 2011

Packages from PPA Spice-Gtk-0.6 on Ubuntu 11.04 have been rebuilt and installed on Oneiric Alpha 1 + (apt-get update; apt-get upgrade) as of 06/10/2011. Virt-Manager is able to perform guest’s installs with either VNC Server or Spice Server & Video Mode “VGA”. Afterwards guest’s Grapics may be switched to Spice Server and video mode to “QXL” Spice sessions run normal via Virt-Manager and spicec as well. As of now all packages from Spice-Gtk-0.6 on Ubuntu 11.04 and Ubuntu 11.10 are rebuilt for Oneiric and uploaded to the same PPA.








Set up Spice-Gtk-0.6 on Ubuntu 11.04 ( Natty Narwhal )

May 23, 2011

I presume that standard KVM Server has been already setup on Ubuntu 11.04. The intend is to push “spice” as far as possible on the system, including option of running spice session via virt-manager for domains install (video “vmvga”) and runtime (video “qxl” or “vmvga”) as well. Add to system PPA Building qemu-kvm&spice based on current /virt/kvm/qemu-kvm.git for Ubuntu 11.04

# apt-add-repository ppa:bderzhavets/git-spice
# apt-get update

Install all packages from PPA except spice-gtk. It will result install spice enabled qemu binaries into /usr/bin due to
original tar ball was based on git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git as of May 18 2011. Spice server and spice client will be installed also.
*************************************************************************************************************
Update on 05/25/2011. Finally i have rebuilt Spice-gtk package in mentioned PPA to support python and gobject-introspection
*************************************************************************************************************
Then we will build Spice-gtk-0.6 manually to enable gobject-introspection

# apt-get install cdbs debhelper autotools-dev spice-protocol-dev \
libpixman-1-dev pkg-config libssl-dev \
libjpeg62-dev libcelt051-dev libgtk2.0-dev libglib2.0-dev \
libcairo2-dev libpulse-dev libsasl2-dev \
python2.6 libtext-csv-perl python-pyparsing python-gtk2-dev \
gobject-introspection libgirepository1.0-dev

Download spice-gtk-0.6.tar.bz2 to /usr/src/SPICE_GTK_0.6

# cd /usr/src/SPICE_GTK_0.6
# tar -jxvf spice-gtk-0.6.tar.bz2
# cd spice-gtk-0.6
# ./configure –prefix=/usr –build=x86_64-linux-gnu \
–mandir=/usr/share/man –infodir=/usr/share/info –datadir=/usr/share \
–sysconfdir=/etc –localstatedir=/var –libexecdir=/usr/bin \
–with-python –disable-static –enable-introspection

. . . . . . . .

Spice-Gtk 0.6
==============

prefix: /usr
c compiler: gcc -std=gnu99
c++ compiler: g++

Coroutine: ucontext
Audio: pulse
Target:
SASL support: yes
Gtk: 2.0

Now type ‘make’ to build spice-gtk

# make
# checkinstall –install=no
# dpkg -i ./spice-gtk_0.6-1_amd64.deb
(Reading database … 148506 files and directories currently installed.)
Unpacking spice-gtk (from ./spice-gtk_0.6-1_amd64.deb) …
Setting up spice-gtk (0.6-1) …

There is also another option add to system PPA Spice-Gtk-0.6 on Ubuntu 11.04 and install ready package spice-gtk-0.6-1ubuntu8.

Start spice session via virt-manager :-





At this point mouse pointer will be lost after blind click on the bar ” Account Name”. But bar will stay highlighted. Press “Enter”
it will activate password prompt and get mouse pointer back. Otherwise, log into VM and mouse pointer should be alive again.
Procedure has been tested with F14,Natty,W7 virtual machines logging in.




Rebuild KVM/QEMU to support SPICE on Ubuntu 11.04 (Natty Narwhal)

May 9, 2011

Rebuild procedure of regular qemu-kvm package to support spice on Natty Narwhal follows bellow. It depends on all packages from ppa:serge-hallyn/spice2 except qemu-kvm-spice. New packages install spice enabled /usr/bin/qemu* binaries and graphical spice client. I just disabled libvirtd’s AppArmor profile to be able manage domains via virt-manager. Spice install may be performed via virt-install. It would understand options “–graphics spice”, “–video qxl”. All required packages have been uploaded and built in PPA Spice on Ubuntu 11.04. View also
Building qemu-kvm&spice based on current /virt/kvm/qemu-kvm.git for Ubuntu 11.04
Uncompress regular Natty qemu-kvm package :-

qemu-kvm_0.14.0+noroms-0ubuntu4.diff.gz
qemu-kvm_0.14.0+noroms-0ubuntu4.dsc
qemu-kvm_0.14.0+noroms.orig.tar.gz

# dpkg-source -x qemu-kvm_0.14.0+noroms-0ubuntu4.dsc
# cd qemu-kvm_0.14.0+noroms-0ubuntu4

Edit debian/rules and comment line ( per Serge Hallyn)

# $(MAKE) -f debian/rules unpatch

to get patching to work !!

That’s a reason why hack “spice-qxl-locking-fix-for-qemu-kvm.patch” didn’t work originally.

Change ./configure part of debian/rules adding “–enable-spice” :-

config-host.mak: $(QUILT_STAMPFN)
dh_testdir
./configure \
–target-list=”x86_64-softmmu i386-softmmu x86_64-linux-user i386-linux-user” \
–prefix=/usr \
–interp-prefix=/etc/qemu-binfmt/%M \
–disable-blobs \
–disable-strip \
–enable-spice \
$(conf_arch)
Save

Edit debian/patches/series:-

larger_default_ram_size.patch
# Detect-and-use-GCC-atomic-builtins-for-locking.patch
# spice-qxl-locking-fix-for-qemu-kvm.patch
0001-qxl-spice-display-move-pipe-to-ssd.patch
0002-qxl-implement-get_command-in-vga-mode-without-locks.patch
0003-qxl-spice-remove-qemu_mutex_-un-lock_iothread-around.patch
0004-hw-qxl-render-drop-cursor-locks-replace-with-pipe.patch

Save and copy required patches to debian/patches.

Edit debian/control like in SPICE2 PPA:-

Build-Depends: bcc,
bzip2,
debhelper (>= 7),
device-tree-compiler [powerpc],
iasl,
libaio-dev,
libasound2-dev,
libcelt051-dev,
libcurl4-gnutls-dev,
libgnutls-dev,
libncurses5-dev,
libpci-dev,
libpixman-1-dev,
libpulse-dev,
libsasl2-dev,
libsdl1.2-dev (>= 1.2.14),
libssl-dev,
libx11-dev,
nasm,
perl,
pkg-config,
quilt (>= 0.40),
libspice-server-dev,
spice-protocol-dev,
sysv-rc (>= 2.86.ds1-14.1ubuntu2),
texi2html,
texinfo,
uuid-dev,
zlib1g-dev
Save.

Edit debian/chagelog and upgrade version to 5.
# cd ..
# dpkg-buildpackage -rfakeroot -b -us -uc
# cd ..
root@boris-System-P5Q3:~/QEMU14# # dpkg -i ./qemu-kvm_0.14.0+noroms-0ubuntu5_amd64.deb \
qemu_0.14.0+noroms-0ubuntu5_amd64.deb \
qemu-common_0.14.0+noroms-0ubuntu5_all.deb

(Reading database … 141175 files and directories currently installed.)
Preparing to replace qemu-kvm 0.14.0+noroms-0ubuntu4 (using …/qemu-kvm_0.14.0+noroms-0ubuntu5_amd64.deb) …
Unpacking replacement qemu-kvm …
Preparing to replace qemu 0.14.0+noroms-0ubuntu4 (using qemu_0.14.0+noroms-0ubuntu5_amd64.deb) …
Unpacking replacement qemu …
Preparing to replace qemu-common 0.14.0+noroms-0ubuntu4 (using qemu-common_0.14.0+noroms-0ubuntu5_all.deb) …
Unpacking replacement qemu-common …
Setting up qemu-common (0.14.0+noroms-0ubuntu5) …
Setting up qemu-kvm (0.14.0+noroms-0ubuntu5) …
Processing triggers for ureadahead …
ureadahead will be reprofiled on next reboot
Processing triggers for man-db …
Setting up qemu (0.14.0+noroms-0ubuntu5) …

# dpkg -l | grep qemu

ii qemu 0.14.0+noroms-0ubuntu5 dummy transitional package from qemu to qemu-kvm
ii qemu-common 0.14.0+noroms-0ubuntu5 qemu common functionality (bios, documentation, etc)
ii qemu-kvm 0.14.0+noroms-0ubuntu5 Full virtualization on i386 and amd64 hardware

root@boris-System-P5Q3:~/QEMU14# ls -l /usr/bin/kvm*
lrwxrwxrwx 1 root root 18 2011-05-06 15:24 /usr/bin/kvm -> qemu-system-x86_64
lrwxrwxrwx 1 root root 8 2011-05-06 15:24 /usr/bin/kvm-img -> qemu-img
lrwxrwxrwx 1 root root 8 2011-05-06 15:24 /usr/bin/kvm-nbd -> qemu-nbd
-rwxr-xr-x 1 root root 11792 2011-02-22 16:34 /usr/bin/kvm_stat

root@boris-System-P5Q3:~/QEMU14# ls -l /usr/bin/qemu*
-rwxr-xr-x 1 root root 3520568 2011-05-06 15:08 /usr/bin/qemu
-rwxr-xr-x 1 root root 2014976 2011-05-06 15:08 /usr/bin/qemu-i386
-rwxr-xr-x 1 root root 270 2011-05-06 14:04 /usr/bin/qemu-ifdown
-rwxr-xr-x 1 root root 138 2011-02-22 16:34 /usr/bin/qemu-ifup
-rwxr-xr-x 1 root root 350640 2011-05-06 15:08 /usr/bin/qemu-img
-rwxr-xr-x 1 root root 362928 2011-05-06 15:08 /usr/bin/qemu-io
-rwxr-xr-x 1 root root 338384 2011-05-06 15:08 /usr/bin/qemu-nbd
lrwxrwxrwx 1 root root 4 2011-05-06 15:24 /usr/bin/qemu-system-i386 -> qemu
-rwxr-xr-x 1 root root 3590968 2011-05-06 15:08 /usr/bin/qemu-system-x86_64
-rwxr-xr-x 1 root root 2055128 2011-05-06 15:08 /usr/bin/qemu-x86_64

Signed packages uploaded to https://launchpad.net/~bderzhavets/+archive/spice2


Backport Virt-manager 0.8.7-3 (without spice) & python-virtinst-0.500.6-2 to Scientific Linux 6

April 19, 2011

Primary target is to get virt-install supporting options “–graphics spice”,”–video qxl”,”–channel spicevmc”.
Virt-manager-0.8.7-3.fc15.src.rpm has to be installed and it’s spec’s file updated :-

%define with_spice 0

then rebuild and perform virt-manager-0.8.7-3.el6.noarch.rpm install, having python-virtinst-0.500.6-2 already in place :-

yum install virt-manager-0.8.7-3.el6.noarch.rpm

It seems running smoothly with python-virtinst-0.500.6-2 ( rebuilt and reinstalled in the same way). Obviously there is no access to spice console via virt-manager. I also upgraded spice-client up to 0.6.3 , what requires pixman-0.18.4-1.fc14.src.rpm rebuilt on SL 6 and install pixman & pixman-devel. In particular, “Add Hardware” wizard Graphics->Spice Server allows
to avoid manual updating XML VM’s profile as suggested in [1].
Two KVMs have been tested positive :-

virt-install --connect qemu:///system --virt-type kvm \
--os-type=linux --os-variant=virtio26 \
--name NattyB2 --ram 1024 --disk path=/dev/sdb3 \
--graphics spice --video qxl --channel spicevmc \
--cdrom /usr/tmp/ubuntu-11.04-beta2-desktop-amd64.iso --vcpus 2







virt-install --connect qemu:///system --virt-type kvm \
--name W7 --ram 4096 \
--disk path=/dev/sdb11,bus=virtio \
--disk /usr/tmp/virtio-win-1.1.16.vfd,device=floppy \
--os-variant win7 \
--graphics spice --video qxl --channel spicevmc \
--cdrom /usr/tmp/Win7_64.iso --vcpus 2







XML profile after virt-install looks like :-

<domain type='kvm'>
<name>W7</name>
<memory>4194304</memory>
<currentMemory>4194304</currentMemory>
<vcpu>2</vcpu>
<os>
<type arch='x86_64' machine='rhel6.0.0'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='localtime'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='block' device='disk'>
<driver name='qemu' type='raw'/>
<source dev='/dev/sdb11'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
<disk type='file' device='floppy'>
<driver name='qemu' type='raw'/>
<source file='/usr/tmp/virtio-win-1.1.16.vfd'/>
<target dev='fda' bus='fdc'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/usr/tmp/virtio-win-1.1.16.iso'/>
<target dev='hdc' bus='ide'/>
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
<controller type='fdc' index='0'/>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<controller type='virtio-serial' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</controller>
<interface type='bridge'>
<mac address='52:54:00:f1:01:e9'/>
<source bridge='br0'/>
<target dev='vnet0'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target port='0'/>
</console>
<channel type='spicevmc'>
<target type='virtio' name='com.redhat.spice.0'/>
<address type='virtio-serial' controller='0' bus='0' port='0'/>
</channel>
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<graphics type='spice' port='5900' tlsPort='-1' autoport='yes' />
<video>
<model type='qxl' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</memballoon>
</devices>
</domain>

Updated via “virsh edit W7″ :-

<graphics type='spice' port='5900' tlsPort='-1' autoport='yes' listen='0.0.0.0'/>
<video>
<model type='qxl' vram='32768' heads='1'/>
. . . .

Same XML may be automatically generated via Virt-Manager 0.8.7-3 after normal VNC install :-
1. Remove VNC Server
2. “Add hardware”->”Graphics”->”SPICE Server”



Package “spice-gtk” is expected only in RHEL 6.2
References
1. http://www.server-world.info/en/note?os=Scientific_Linux_6&p=kvm&f=6


Attempt to manage Fedora 15 KVM Server via Gnome 3 shell

April 9, 2011

Following bellow is brief exercise managing Gnome 3 Desktop to create Ubuntu Maverick Meerkat KVM and run it in spice session.First of all after “yum update” i verified current “qemu” and “libvirt” status on Fedora 15. Virtualization Group has been selected during initial install.

[root@fedora15 ~]# rpm -qa |grep qemu
qemu-common-0.14.0-7.fc15.x86_64
qemu-kvm-0.14.0-7.fc15.x86_64
qemu-img-0.14.0-7.fc15.x86_64
qemu-system-x86-0.14.0-7.fc15.x86_64
gpxe-roms-qemu-1.0.1-4.fc15.noarch

[root@fedora15 ~]# rpm -qa |grep virt
redland-virtuoso-1.0.12-3.fc15.x86_64
virtuoso-opensource-6.1.2-3.fc15.x86_64
python-virtkey-0.50-9.fc15.x86_64
libvirt-0.8.8-4.fc15.x86_64
virt-manager-0.8.7-2.fc15.noarch
python-virtinst-0.500.6-1.fc15.noarch
virt-viewer-0.3.1-1.fc15.x86_64
libvirt-python-0.8.8-4.fc15.x86_64
libvirt-client-0.8.8-4.fc15.x86_64

Then added Virt-Manager to favourites to avoid several mouse clicks at every start up :-






Start Ubuntu 10.10 KVM install :-





Run “apt-get update; apt-get upgrade” in VNC session :-



Switch to SPICE Server



**********************************************************************************************************************************************
In this case Spice Display Screen will show address 127.0.0.1 and connection to via spicec will be available only locally.
To get spicec working remotely remove Display VNC and “Add hardware” Display Spice. It will show you address 0.0.0.0.
In this case connections via spicec will be available remotely
**********************************************************************************************************************************************
Started Ubuntu 10.10 KVM and activated command window via ALT+F2





Set up Ubuntu 11.04 ,10.10 KVM to run in spice session on Fedora 14 KVM Server ( Libvirt Preview Env)

March 19, 2011

The most recent patches to Fedora’s Qemu 0.14 went into qemu-0.14.0-6.fc14.src.rpm on 03/31/2011. Following bellow is brief description of F14 KVM and Spice Server set up via “Libvirt Preview” ( http://repos.fedorapeople.org/repos/jforbes/virt-preview/fedora-14/SRPMS/). Configured KVM Server allows to create Ubuntu 10.10, 11.04 Desktop KVM beta 1 (64 bit), which may run in spice session. Notice that Virt-Manager 0.8.7-2 does have SPICE support. It allows to switch particular VM from VNC Server to SPICE Server and run spice session via GUI or connect to VM via command line locally or remotely.
**********************************************************************************************************************************************
In this case Spice Display Screen will show address 127.0.0.1 and connections to VM via spicec will be available only locally.
To get spicec working remotely remove Display VNC and “Add hardware” Display Spice. It will show you address 0.0.0.0
In this case connections via spicec will be available remotely
***********************************************************************************************************************************************
Ubuntu 10.10 Desktop,11.04 Desktop KVM beta 1 require “apt-get update,apt-get upgrade” to run stable in SPICE session

Configure fedora-virt-preview.repo :-
[root@fedorakvm yum.repos.d]# cat fedora-virt-preview.repo

# Place this file in your /etc/yum.repos.d/ directory
[fedora-virt-preview]

name=Virtualization Preview Repository for Fedora 14 Users
baseurl=http://repos.fedorapeople.org/repos/jforbes/virt-preview/fedora-$releasever/$basearch/
enabled=1
skip_if_unavailable=1
gpgcheck=0

[fedora-virt-preview-source]
name=Virtualization Preview Repository for Fedora 14 Users – Source
baseurl=http://repos.fedorapeople.org/repos/jforbes/virt-preview/fedora-$releasever/SRPMS
enabled=0
skip_if_unavailable=1
gpgcheck=0

Then run :-
# yum update

Make sure :-

[root@fedorakvm ~]# rpm -qa|grep virt
virt-manager-0.8.7-2.fc14.noarch
python-virtkey-0.50-8.fc14.x86_64
libvirt-client-0.8.8-2.fc14.x86_64
libvirt-0.8.8-2.fc14.x86_64
libvirt-python-0.8.8-2.fc14.x86_64
virt-viewer-0.3.1-1.fc14.x86_64
python-virtinst-0.500.6-1.fc14.noarch

[root@fedorakvm ~]# rpm -qa|grep qemu
qemu-system-x86-0.14.0-6.fc14.x86_64
qemu-kvm-0.14.0-6.fc14.x86_64
qemu-common-0.14.0-6.fc14.x86_64
qemu-img-0.14.0-6.fc14.x86_64
gpxe-roms-qemu-1.0.1-3.fc14.noarch

Install spice :-
# yum install spice-protocol spice-server spice-client

Make sure :-

# rpm -qa |grep spice
spice-server-devel-0.8.0-1.fc14.x86_64
spice-protocol-0.8.0-1.fc14.noarch
spice-gtk-python-0.5-1.fc14.x86_64
spice-client-0.8.0-1.fc14.x86_64
spice-glib-0.5-1.fc14.x86_64
spice-server-0.8.0-1.fc14.x86_64
spice-gtk-0.5-1.fc14.x86_64

Create via virt-manager Ubuntu 11.04 Desktop (betta 1) KVM and run :-

# apt-get update
# apt-get upgrade

Due to presence SPICE support in Virt-Manager 0.7.2 switch to SPICE DISPLAY and start SPICE session via Virt-Manager :-





Connection to VM via command line :-



Automatically generated XML profile :-

[root@fedora14sp ~]# virsh dumpxml Natty
<domain type='kvm' id='7'>
<name>Natty</name>
<uuid>18260de6-7958-046a-7bc6-cd5e6d15bff5</uuid>
<memory>2097152</memory>
<currentMemory>2097152</currentMemory>
<vcpu>2</vcpu>
<os>
<type arch='x86_64' machine='pc-0.14'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type='block' device='disk'>
<driver name='qemu' type='raw'/>
<source dev='/dev/sda9'/>
<target dev='vda' bus='virtio'/>
<alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
<disk type='block' device='cdrom'>
<driver name='qemu' type='raw'/>
<target dev='hdc' bus='ide'/>
<readonly/>
<alias name='ide0-1-0'/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
<controller type='ide' index='0'>
<alias name='ide0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<interface type='bridge'>
<mac address='52:54:00:63:5d:a9'/>
<source bridge='br0'/>
<target dev='vnet0'/>
<model type='virtio'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<source path='/dev/pts/0'/>
<target port='0'/>
<alias name='serial0'/>
</serial>
<console type='pty' tty='/dev/pts/0'>
<source path='/dev/pts/0'/>
<target type='serial' port='0'/>
<alias name='serial0'/>
</console>
<input type='mouse' bus='ps2'/>
<graphics type='spice' port='5900' tlsPort='-1' autoport='yes' listen='0.0.0.0'/>
<sound model='ac97'>
<alias name='sound0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<alias name='video0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<alias name='balloon0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</memballoon>
</devices>
</domain>

Graphics section now looks like :-

<graphics type='spice' port='5900' tlsPort='-1' autoport='yes' listen='0.0.0.0'/>

Old way with modifying XML definition and connecting via command would work as well.
Create script /usr/tmp/qemu-spice :
cat /usr/tmp/qemu-spice
#!/bin/bash

exec /usr/bin/qemu-kvm $* \
-vga qxl \
-spice port=5930,disable-ticketing

# chmod 755 /usr/tmp/qemu-spice

and add to root’s .bashrc
export PATH=/usr/tmp:$PATH

Create via virt-manager Ubuntu 11.04 Desktop (alpha 3) KVM and install QXL driver via Synaptic manager. Say name of VM created is NATTY. Then run :-
# virsh dumpxml NATTY > Natty.xml
Edit XML file as follows

1. Change emulator to /usr/tmp/qemu-spice
2. Remove VIDEO section
3. Remove UUID section
4. Change VM’s name

[root@fedorakvm ~]# cat Natty.xml
<domain type='kvm'>
<name>NATSP</name>
<memory>2097152</memory>
<currentMemory>2097152</currentMemory>
<vcpu>2</vcpu>
<os>
<type arch='x86_64' machine='pc-0.14'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/tmp/qemu-spice</emulator>
<disk type='block' device='disk'>
<driver name='qemu' type='raw'/>
<source dev='/dev/sdb6'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
<disk type='block' device='cdrom'>
<driver name='qemu' type='raw'/>
<target dev='hdc' bus='ide'/>
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<interface type='bridge'>
<mac address='52:54:00:c5:81:45'/>
<source bridge='br0'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'/>
<sound model='ac97'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</memballoon>
</devices>
</domain>

Run :-
# virsh define Natty.xml
and new NATSP entry in Virt-Manager will be created. Start NATSP and connect via
# spicec -h localhost -p 5930
to NATSP







Follow

Get every new post delivered to your Inbox.

Join 25 other followers