Difference between revisions of "Xen"

From Tardis
Jump to: navigation, search
m (How to Add New Instances)
Line 80: Line 80:
 
</pre>
 
</pre>
  
to get the instance up and running. You should be able to log in.
+
to get the instance up and running. You should be able to log in.  Use ctrl+] to get back to vislor's console.
 +
 
 +
== Booting and Shutting Down ==
 +
 
 +
Xen's init scripts are set up to perform an `xm save` (copy the RAM to disk) for each domU that's running when vislor and/or adric are shut down and to restore saved domUs on boot.  This should take care of the cases where tardis is shut down intentionally, but a bit more work will have to be done following an unexpected power loss.  (When do they happen anyway? ;-)
 +
 
 +
To start all domUs on vislor do:
 +
for foo in /etc/xen/mrtest.conf; do xm create -c $foo; done
 +
<WAIT FOR A LOGIN PROMPT>
 +
ctrl+]
 +
<WAIT FOR A LOGIN PROMPT>
 +
....
  
 
[[category:Services]]
 
[[category:Services]]
 
[[category:Infrastructure]]
 
[[category:Infrastructure]]

Revision as of 23:14, 14 March 2007

Overview

  • We have two P4 PCs, vislor and adric, running Xen 3.0.1.
  • They run Fedora core 5 dom0s with Fedora's Xen-patched kernels (version 2.6.15).
  • As neither machine has space for more than one hard disk, the systems use DRBD to provide data redundancy.
  • vislor (P4 1.7GHz/768MB/40GB) is intended to run domUs for production services as it is the most powerful of the two.
  • adric (P4 1.6GHz/512MB/60GB) runs testing or sandbox domUs, may be used to test new versions of Xen, and provides a mirror of the production domUs' root filesystems.

OS Setup

The unpopular decision to run Fedora core on vislor and adric was made based on its excellent Xen packaging and the poor state of the Debian Xen-patched kernels. --Pert 12:40, 20 October 2006 (BST)

In order to document the installation and to provide an easy way for the boxes to be re-installed by others I used kickstart scripts; available here (only accessable from tardis):

Disk Setup

Vislor:

  • hda1: 4GB ext3 /
  • hda2: 30GB DRBD-PV (drbd0)
  • hda3: ~3GB LVM-PV (swaps VG)
  • hda4: 512MB swap
  • drbd0: 30GB LVM-PV (prod-roots VG)

Adric:

  • hda1: 4GB ext3 /
  • hda2: 30GB DRBD-PV (drbd0)
  • hda3: 512MB swap
  • hda5: 20GB LVM-PV (test-roots VG)
  • hda6: ~3GB LVM-PV (swaps VG)

How to build DRBD for Fedora

yum install make gcc flex bison rpm-build kernel-xen0-devel
wget http://oss.linbit.com/drbd/0.7/drbd-0.7.21.tar.gz
tar -xzvf drbd-0.7.21.tar.gz
cd drbd-0.7.21/
patch <<'END'
--- drbd.spec.in.orig   2006-10-19 11:05:09.000000000 +0100
+++ drbd.spec.in        2006-10-19 11:05:45.000000000 +0100
@@ -64,9 +64,9 @@
 %prep
 %setup
 test -d %{kdir}/.
-test $(echo -e "#include <linux/version.h>\ndrbd_kernel_release UTS_RELEASE" |
-       gcc -nostdinc -E -P -I%{kdir}/include - |
-       sed -ne 's/^drbd_kernel_release "\(.*\)".*/\1/p') = %{kernelversion}
+#test $(echo -e "#include <linux/version.h>\ndrbd_kernel_release UTS_RELEASE" |
+#       gcc -nostdinc -E -P -I%{kdir}/include - |
+#       sed -ne 's/^drbd_kernel_release "\(.*\)".*/\1/p') = %{kernelversion}

 %build
 echo kernelversion=%{kernelversion}
END
make rpm

How to Add New Instances

Login to leela, and add the new box to /etc/bind/db.tardis and /etc/bind/db.193.62.81. Use co -l to check out the files and ci -u -wusername to log it back in. Remember to update the serial number. See the DNS_Service page.

Login to vislor, which is the main xen machine. Use the mkdomU.bash script to create the new instance like so:

mkdomU.bash -vh[newmachinename]

Say yes to shadow passwords, type in root password (twice), say no to creating a user account.

If you want to do something complicated, have a look at /etc/mkdomU.conf, or at the script at /usr/local/bin/mkdomU.bash .

Unmount /mnt/mkdomU once it's done.

Run

xm create -c [newmachinename] 

to get the instance up and running. You should be able to log in. Use ctrl+] to get back to vislor's console.

Booting and Shutting Down

Xen's init scripts are set up to perform an `xm save` (copy the RAM to disk) for each domU that's running when vislor and/or adric are shut down and to restore saved domUs on boot. This should take care of the cases where tardis is shut down intentionally, but a bit more work will have to be done following an unexpected power loss. (When do they happen anyway? ;-)

To start all domUs on vislor do:

for foo in /etc/xen/mrtest.conf; do xm create -c $foo; done
<WAIT FOR A LOGIN PROMPT>
ctrl+]
<WAIT FOR A LOGIN PROMPT>
....