Virsh (Libvirt 0.7.2) & managing DomUs on openSUSE 11.2

January 7, 2010

Recent “zypper update” on November’s openSUSE 11.2 release brought system to the most recent status. Current kernel works fine . Seems like a next generation of xenified aka Suse kernels is on the go right now. However, i believe,that vm-install on recently updated 11.2 works same way as before maintenance update.
So, in meantime vm-install doesn’t understand either HTTP or CDROM sources attempting to create PV Guest and virsh scripting appears to be the only one option to create Xen PV Guests manageable via virt-manager. Notice, that F12 PV Guest install doesn’t require HTTP or NFS share , pygrub performs install just via F12 ISO image , like OpenSolaris PV Guests get installed as usual.

Installation profile f12-install.xml :-

<domain type='xen'>
<bootloader_args>--kernel=/images/pxeboot/vmlinuz --ramdisk=/images/pxeboot/initrd.img</bootloader_args>
<disk type='file' device='cdrom'>
<driver name='file'/>
<source file='/root/vmf/f12.iso'/>
<target dev='xvdc' bus='xen'/>
<disk type='block' device='disk'>
<driver name='phy'/>
<source dev='/dev/sdb9'/>
<target dev='xvda' bus='xen'/>
<interface type='bridge'>
<source bridge='br0'/>
<mac address='00:16:36:43:2a:72'/>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='-1' keymap='en-us'/>

Start F12 DomU install
# virsh create f12-install.xml
# vncviewer localhost:0

Runtime profile f12-run.xml :-

<domain type='xen' id='3'>
<clock offset='utc'/>
<disk type='block' device='disk'>
<driver name='phy'/>
<source dev='/dev/sdb9'/>
<target dev='xvda' bus='xen'/>
<interface type='bridge'>
<mac address='00:16:3e:12:bf:6b'/>
<source bridge='br0'/>
<script path='/etc/xen/scripts/vif-bridge'/>
<target dev='vif3.0'/>
<console type='pty' tty='/dev/pts/1'>
<source path='/dev/pts/1'/>
<target port='0'/>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='5900' autoport='yes'/>

# virsh define f12-run.xml
# virsh start VF12G
# vncviewer localhost:0

Managing created domain via virt-manager:-

Set up Xen 3.4.3-rc2 & Libvirt 0.7.0 Dom0 (with xenified aka Suse kernel) on top of Ubuntu 9.10 Server

January 4, 2010

Install Libvirt 0.7.0 along with KVM creates environment with default Hypervisor QEMU . Two steps in procedure bellow make Xen default Hypervisor on Ubuntu 9.10 . First is commenting out (xend-unix-server yes) in /etc/xen/xend-config.sxp , second export variable


in root’s .bashrc.
1.Installed KVM with no intend to work with it
# apt-get install ubuntu-virt-server ubuntu-virt-mgmt
# adduser $USER kvm
and configured bridge . This step is not required by Xen. It just allows to switch between Xen and QEMU :-

root@ServerKoala:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp

# Bridge definied
auto br0
iface br0 inet static
bridge_ports eth0
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off

Restart /etc/init.d/networking

2. Build Xen 3.4.3-rc1-pre.
First – install on Uubuntu 9.10 Server all packages required for Xen build:-

apt-get install libcurl4-openssl-dev \
xserver-xorg-dev \
python2.6-dev \
mercurial gitk \
build-essential \
libncurses5-dev \
uuid-dev gawk \
gettext texinfo bcc

Second step :-

# cd /usr/src
# hg clone
# cd xen-3.4-testing.hg
Set in
PYTHON = python

Tuning results Xen packages to be placed into /usr/local/lib/python2.6/dist-packages due to Changeset 19594 in xen-3.4-testing.hg. Otherwise, Xen packages would go to /usr/lib/python2.6/site-packages, which is not default location for python 2.6 on Ubuntu 9.10.

# make xen
# make tools
# make install-xen
# make install-tools

3. Edited xend-config.sxp set (xend-http-server yes) and commented all bridge declarations
4. Patched kernel via
Untar linux- and apply patches.

# cd /usr/src/build/
# bzcat linux- | tar xf -
# mkdir -p xen-patches-2.6.31-9
# cd xen-patches-2.6.31-9
# bzcat ../xen-patches-2.6.31-9.tar.bz2 | tar xf -
# cd ../linux-

Run script

for P in `ls ../xen-patches-2.6.31-9/6*.patch1 | sort `
patch -p1 -s -i $P
if [ $? = 0 ]; then
echo $P applied
echo "Error processing "$P
exit 1

5. Built kernel , previously tuned to support Xen at Dom0 , with built-in static command line (root=/dev/sdb11 ro console=tty0) and installed.
Created /boot/grub/grub.cfg entry:-

menuentry "Xen 3.4 / Ubuntu 9.10 kernel xenified" {
insmod ext2
set root=(hd1,10)
multiboot (hd1,10)/xen-3.4.gz
module (hd1,10)/vmlinuz-
module (hd1,10)/initrd-

Rebooted the system

# ln -s /usr/local/bin/pygrub /usr/lib/xen-default/bin/pygrub

root@ServerKoala:~# export VIRSH_DEFAULT_CONNECT_URI="xen:///"
root@ServerKoala:~# virsh version
Connecting to uri: xen:///
Compiled against library: libvir 0.7.0
Using library: libvir 0.7.0
Using API: Xen 3.0.1
Running hypervisor: Xen 3.4.0

Virt-manager install F12 PV DomU via local Apache Mirror

Virt-install CentOS 5.4 PV DomU

virt-install -n VM54R -r 1024 -p --vnc \
--os-type=linux --os-variant=rhel5 --bridge=virbr0 \
-f /dev/sdb7 -l --debug