Install Xen 3.4 from mercurial repository on Debian.

Install Xen on Debian Unstable/testing.
-------------------------------------------------------

apt-get install iproute bridge-utils python-twisted gcc binutils make zlib1g-dev patch bcc gettext git-arch
apt-get install python-dev transfig bzip2 screen ssh debootstrap libcurl3-dev libncurses5-dev
apt-get install libbeecrypt6 libc6-xen libsqlite3-0 libtext-template-perl reiserfsprogs xfsprogs
apt-get install libc6-xen libsqlite3-0 tightvncserver
apt-get install libsdl1.2-dev libgpmg1-dev gcc gettext gawk libtext-template-perl build-essential

(some of theese packages are not needed for Xen. But I kept them in the howto since I installed more than just Xen :)

Check if you processor supports VMX.
# xm dmesg | grep "VMX Extension is enabled"
(XEN) AMD SVM Extension is enabled for cpu 0.
(XEN) AMD SVM Extension is enabled for cpu 1.

Install Mercurial and Xen.

# apt-get install mercurial
# cd /usr/src/
# hg clone http://xenbits.xensource.com/xen-3.4-testing.hg
# cd xen-3.4-testing.hg
# make world
# make install
# mkinitramfs -o initrd.img-2.6.18.8-xen 2.6.18.8-xen
# ln -sf initrd.img-2.6.18-xen initrd.img-2.6-xen

Write the boot of the Dom0 kernel into /boot/grub/menu.lst

title Xen 3.4 / XenLinux 2.6
root (hd0,0)
kernel /xen-3.4-rc2-pre.gz
module /vmlinuz-2.6.18.8-xen root=/dev/sda3 ro
module /initrd.img-2.6.18.8-xen

The installation of xen is now done, and its time to make some vm's.

Example for config file with Image files.
------------------------------------------

#Now we create a 1 GB image file and a 500 MB swap image. In the end the virtual machines will have 1 GB space and 500 MB swap. These are just example values, in the real world you might want to have more space for your virtual machines (e.g. between 5 and 30 GB), so just increase the value of count to create larger images.

dd if=/dev/zero of=/vserver/images/vm_base.img bs=1024k count=1000
dd if=/dev/zero of=/vserver/images/vm_base-swap.img bs=1024k count=500

#Make a Xen config file for your host.

kernel = "/usr/lib/xen/boot/hvmloader"
builder='hvm'
memory = 512
name = "WinXP"
vcpus=2
pae=0
acpi=1
apic=1
console=0
#cpus = ""
vif = [ 'type=ioemu, bridge=xenbr0' ]
disk    = [ 'phy:/dev/etherd/e1.1,ioemu:hda,w']
#, 'file:/root/2003.iso,hdb:cdrom,r'
on_poweroff = 'destroy'
#on_reboot   = 'destroy'
on_crash    = 'destroy'
device_model = '/usr/lib/xen/bin/qemu-dm'
cdrom='/root/xp.iso'
boot='c'
sdl=0
vnc=1
vncpasswd = 'secretvncpassword'
vncviewer=0
vnclisten='0.0.0.0'
stdvga=0
serial='pty'
ne2000=0
#hanging after mounted root filesystem ... add
#extra='xencons=tty'

###################################################
AOE
###################################################
To build custom modules for your kernel go to your /usr/src/*.hg directory and work from there.
download the aoe package from http://support.coraid.com/support/linux/ , aoetools are included in the source.
do :
#make
#make install
#/usr/sbin/aoe-version

 

 

###################################################
ISCSI
###################################################
Target##
########
For best throughput we share the vm images via ISCSI.

On the Target machine (this is where they are shared from).

apt-get install linux-headers-2.6.16-1-xen-686 openssl libssl-dev
apt-get install

Download ISCSI-Target (iscsi enterprise target) from http://sourceforge.net/project/showfiles.php?group_id=108475&package_id=...
>tar -zxf iscsitarget-0.4.13.tar.gz
>cd iscsitarget-0.4.13
>make
>make install

#/etc/ietd.conf
Copy etc/ietd.conf from the source folder to /etc
Change the target name in /etc/ietd.conf to something like ...

Target iqn.12-11-06.org.erter:storage.webserver-1.sys1.xyz
Lun 0 Path=/dev/group1/webserver,Type=fileio

start iscsi-target
>/etc/init.d/iscsi-target start

Check if it starts with dmesg

How to add a new device to iscsi-target without shuting down the service.
ietadm --op new --tid=7 --params Name=iqn.23-06-07.org.erter:storage.2003.sys1.xyz
ietadm --op new --tid=7 --lun=0 --params Path=/dev/group1/2003

cat /proc/net/iet/volume #to check if it was added ok.

The target will be lost on service reload, or server restart, so you should allso add it to /etc/ietd.conf if you want it permanent.

###########
Initiator##
###########
>apt-get install open-iscsi
Remove the Authentication part in /etc/iscsid.conf for this example.
>/etc/init.d/open-iscsi restart
check with dmesg
>iscsiadm -m discovery -t sendtargets -p target-server-ip:3260
>iscsiadm -m node -r 884a2e -l
('-r xxxxxx' is the record number you get from the discovery command.)

Check with dmesg again, and you will probably now have another device named /dev/sdb etc...........

Or even better, open-iscsi now supports to mount the disk by its iqn.name found under /dev/disk/by-path/ who really makes it alot easyer to keep track of all the partitions, and without udev rules to name them.

#check for iscsi partitions on target host
iscsiadm --mode node --targetname iqn.12-11-06.org.erter:storage.webserver-1.sys1.xyz --portal target-server-ip:3260 --login
iscsiadm --mode discovery --type sendtargets --portal target-server-ip:3260 --login

#connect all the iscsi partitions.
#! /bin/sh
mount -t nfs :/xen/configs /xen/configs/
#mount -t nfs :/home/xen /home/xen
#iscsiadm -m node -r 884a2e -l
#mail server disk /sdb
iscsiadm --mode node --targetname iqn.03-11-06.org.erter:storage.mail-1.sys1.xyz --portal target-server-ip:3260 --login
#maildirs /sdc
iscsiadm --mode node --targetname iqn.12-11-06.org.erter:storage.maildirs-1.sys1.xyz --portal target-server-ip:3260 --login
#webserver /sdd
iscsiadm --mode node --targetname iqn.12-11-06.org.erter:storage.webserver-1.sys1.xyz --portal target-server-ip:3260 --login
#samba filserver /sde
iscsiadm --mode node --targetname iqn.19-11-06.org.erter:storage.samba-1.sys1.xyz --portal target-server-ip:3260 --login
#samba home /sdf
iscsiadm --mode node --targetname iqn.04-11-06.org.erter:storage.home.sys1.xyz --portal target-server-ip:3260 --login

Make a domU KERNEL
-------------------------------
from the /usr/src/.hg folder.

make linux-2.6-xenU-build
make linux-2.6-xenU-install
depmod 2.6.16.13-xenU

Live Migration
---------------------------
in /etc/xen/xend-config.sxp make sure the below 2 lines are commented out
(xend-relocation-port 8002)
(xend-relocation-address '')

To live migrate use..
xm migrate --live webserver

Lvm
--------------------------------------
#prepare the partitions for lvm
# Initialize partition #4 on the third SCSI disk and the entire fifth SCSI disk for later use by LVM:

pvcreate /dev/sdc4 /dev/sde

#make a volume group (lun) with the partitions you need
# To create a volume group named test_vg using physical volumes /dev/hdk1, and /dev/hdl1 with default physical extent size of 4MB:

vgcreate group1 /dev/sdk1 /dev/sdl1

lvcreate -n maildirs --size 10G group1
lvcreate -n webserver --size 5G group1
lvcreate -n samba-1 --size 5G group1
lvdisplay -v

##########################################################
#my lv's
##########################################################
--- Logical volume ---
LV Name /dev/group1/2003
VG Name group1
LV UUID Ujupea-Jao7-d8cg-05zo-UJN5-GsMi-4w2Eyj
LV Write Access read/write
LV Status available
# open 0
LV Size 10.00 GB
Current LE 2560
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 254:0

###########################################
Problems:
Check that the path to qemu-dm are correct, if it is...check qemu-dm (upgrade?)

Links:
http://www.performancemagic.com/iscsi-xen-howto/iSCSI.html#id2471464
http://sourceforge.net/project/showfiles.php?group_id=108475&package_id=...
http://ubuntuforums.org/showthread.php?t=213545
http://docs.solstice.nl/index.php/Infrastructure_virtualisation_with_Xen...

pageTracker._trackPageview();