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 2.6.31.8-xen 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.
View https://bugzilla.novell.com/show_bug.cgi?id=555181
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'>
<name>VM12G</name>
<bootloader>/usr/bin/pygrub</bootloader>
<bootloader_args>--kernel=/images/pxeboot/vmlinuz --ramdisk=/images/pxeboot/initrd.img</bootloader_args>
<memory>2097152</memory>
<vcpu>2</vcpu>
<devices>
<disk type='file' device='cdrom'>
<driver name='file'/>
<source file='/root/vmf/f12.iso'/>
<target dev='xvdc' bus='xen'/>
<readonly/>
</disk>
<disk type='block' device='disk'>
<driver name='phy'/>
<source dev='/dev/sdb9'/>
<target dev='xvda' bus='xen'/>
</disk>
<interface type='bridge'>
<source bridge='br0'/>
<mac address='00:16:36:43:2a:72'/>
</interface>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='-1' keymap='en-us'/>
</devices>
</domain>
</code>

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







Runtime profile f12-run.xml :-

<domain type='xen' id='3'>
<name>VF12G</name>
<memory>2097152</memory>
<currentMemory>2097152</currentMemory>
<vcpu>1</vcpu>
<bootloader>/usr/bin/pygrub</bootloader>
<bootloader_args>-q</bootloader_args>
<os>
<type>linux</type>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<disk type='block' device='disk'>
<driver name='phy'/>
<source dev='/dev/sdb9'/>
<target dev='xvda' bus='xen'/>
</disk>
<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'/>
</interface>
<console type='pty' tty='/dev/pts/1'>
<source path='/dev/pts/1'/>
<target port='0'/>
</console>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='5900' autoport='yes'/>
</devices>
</domain>

# 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 2.6.31.8 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

export VIRSH_DEFAULT_CONNECT_URI="xen:///"

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
address 192.168.1.45
network 192.168.0.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
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 http://xenbits.xensource.com/xen-3.4-testing.hg
# cd xen-3.4-testing.hg
Set in Config.mk
PYTHON = python
PYTHON_PREFIX_ARG =

Tuning Config.mk 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 2.6.31.8 kernel via

http://gentoo-xen-kernel.googlecode.com/files/xen-patches-2.6.31-9.tar.bz2

Untar linux-2.6.31.8.tar.bz2 and apply patches.

# cd /usr/src/build/
# bzcat linux-2.6.31.8.tar.bz2 | 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-2.6.31.8

Run script

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

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 2.6.31.8 xenified" {
insmod ext2
set root=(hd1,10)
multiboot (hd1,10)/xen-3.4.gz
module (hd1,10)/vmlinuz-2.6.31.8
module (hd1,10)/initrd-2.6.31.8.img
}

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 http://192.168.1.45/rhel54 --debug





Follow

Get every new post delivered to your Inbox.