Archive

Archive for the ‘Virtualization’ Category

May
14

I see sloppy Administrators do this again and again…

They might update the Linux-Xen enabled Kernel on Dom0, but often DomU keeps the same for different reasons.

Running a (para) virtual environment, the freedom of running different Linux distributions, is often a goal. If one keeps a single architect environment stack, like Ubuntu Hardy Dom0 and DomU’s or CentOS 5.x Dom0 and DomU, keeping kernels in DomU up to date is low hassle.

The hassle starts to arise when you deploy mixed environments, like running Ubuntu Hardy as Dom0 and CentOS 5.x as DomU, or vice versa. You could setup CentOS or Ubuntu to use each others Kernel packages, though that seemed a bit overkill for my setup. Having a Debian Etch DomU on a Ubuntu Hardy Dom0 is fixable with pointing Etch to grab the Kernel from Hardy via an apt-repo.

PyGrub solves some hassles, so I recommend reading up on that and verifying that CVE-2007-4993 is not affecting you.

But for the cases where I have a bit hassle, and I dont want to use PyGrub, I wrote a small bash script to update the Linux Kernels.
Get the script here, and update/change/modify or learn from it, before you use it.
It Powers down the DomU if it is booted, and mounts the Logical Volume of the DomU, before it copies the kernel modules to the DomU filesystem. Runs depmod and unmounts the filesystem. Then it gives you the small change you need to update your xen-domU.cfg with (I dont use pygrub).

BTW: This paper has a nice walk through from Xen DomU to Xen Dom0 bypassing SELinux http://invisiblethingslab.com/pub/xenfb-adventures-10.pdf. Recommended read :)

Now go and update some Kernels!

Jul
13

I have been running CentOS 5 with Xen virtualization since around mid April (I started to play with Redhat 5 beta and its Xen in Desember 2006). CentOS 5 ships with Xen-3.0.3 and with RedHat’s virt-manager, which is a very simple but OK tool to manage Xen guests/domUs. The only 1337 about virt-manager at this point, in my opinion, is the vnc integration.

A quick way to get up and running (if you are connected to internet), is to set up dhcpd on Dom0 and export an kickstart.cfg file by httpd etc. That is, if you dont have a dhcp on you network. If you do have a dhcp-server on your network, you should drop the dhcp part.

# yum install dhcp httpd
# cp /root/anaconda-ks.cfg /var/www/html/xen.cfg
# vi /var/www/html/xen.cfg

Change the permision of the file and remove etc. cdrom (install media) and %packages that you dont need. Driveorder should be xvda –driveorder=xvda.
Also add url –url http://your-centos-mirror.something.com/centos/5/os/{ARCH}. http://www.centos.org/modules/tinycontent/index.php?id=13 has a list of mirrors

# vi /etc/dhcpd.conf # setup you own network:

ddns-update-style interim;
ignore client-updates;
subnet 10.10.10.0 netmask 255.255.255.0 {
# — default gateway
option routers 10.10.10.1;
option subnet-mask 255.255.255.0;
option domain-name “v.gamelinux.org”;
option domain-name-servers 10.10.10.2;
# we want control over DomU’s adress
host node1 {
next-server node1.gamelinux.org;
hardware ethernet 00:16:3e:3e:c2:fd,;
fixed-address 10.10.10.101;
}
host node2 {
next-server node2.gamelinux.org;
hardware ethernet 00:16:3e:4a:6f:87;
fixed-address 10.10.10.102;
}
}

# service dhcpd start
# service httpd start

For some reason I like to have my DomU’s on a logical volume. I do not recommend this yet, cuz I lack testing, but here is how I end up doing it:

# lvcreate -L 10G -n LogVolN1 VolGroup00
# lvcreate -L 10G -n LogVolN2 VolGroup00

My setup, needs me to tail /var/log/messages to get the MAC address of the nodes (when you start the node installation), then edit the dhcp.conf and restart dhcpd. You could just setup a dhcp-pool.

Then you just fire up virt-manager, enter system name (node1 etc), choose your flavor of virtualization, and point to a centos mirror (http://mirror.hh.se/centos/5.0/os/i386/ ect.). The kickstart URL, should be the ip/host of you Dom0 (http://dom0.v.gamelinux.org/xen1.cfg etc.). Then choose normal disk partition : and use the lvm we just created (/dev/VolGroup00/LogVolN1). Choose an amount of memory and cpus, and the start the installation.

How much cpu and memory you give your guests are all up to you!

May
08

After setting up Xen 3 on a Dell PowerEdge 1855 with Ubuntu Dapper (LTS) x86_64, I am posting my two cents…

First you need to install Dapper on to your Dell PE 1855, which is no hassle.
Do a minimal install. (I normally don’t use Dom0 for anything else than hosting DomU’s)
Download the latest Xen 3 .tar release for x86_64 architecture and read the readme file :)

Then install the applications needed for Xen. Download the Xen 3.x.x x84_64 tar. Unpack and install. After installing, you need to set up grub and of course you want console redirect ;)

1. Under BIOS:
2. Under “Console Redirection”:

Console Redirection .............. DRAC/MC
Failsafe Baud Rate ............... 57600
Remote Terminal Type ............. VT100/VT220
Redirection After Boot ........... Enabled

In /etc/inittab add:

# Dell 1855 Serial Consol Redirect
T1:2345:respawn:/sbin/getty -L ttyS0 57600 vt100

Make sure you have ttyS0 in /etc/securetty

This is how I set up network and bridging.
In /etc/network/interfaces :

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.10.2
netmask 255.255.255.0
network 192.168.10.0
broadcast 192.168.10.255
gateway 192.168.10.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 192.168.10.1
dns-search virtual.gamelinux.org
# vlan (500)
post-up vconfig add eth0 500
pre-down vconfig rem eth0.500


# Bridge with vlan500
auto xbrv500
iface xbrv500 inet manual
bridge_ports eth0.500
bridge_stp off
bridge_fd 0

I also installed xen-tools: Makes it easy and fast to install DomU’s. Oneliner:
xen-create-image --hostname domu1 --lvm vg --size 10G --swap 2G --dist dapper --ip 10.10.10.10 --netmask 255.255.255.192 --gateway 10.10.10.1 --memory 512Mb --force --debootstrap