Difference between revisions of "Xen"

From Tardis
Jump to: navigation, search
m (Booting and Shutting Down)
(Big changes for wotan.)
Line 1: Line 1:
 
== Overview ==
 
== Overview ==
  
* We have two P4 PCs, [[vislor]] and [[adric]], running Xen 3.0.1.
+
* We currently have a single Xen host: [[WOTAN]]. It replaced the previous Xen hosts as it has more of everything (disks, CPUs, RAM, PSUs).
* They run Fedora core 5 dom0s with Fedora's Xen-patched kernels (version 2.6.15).
+
* We run i386 Xen 3.0.3 with PAE (as packaged in Debian etch).
* As neither machine has space for more than one hard disk, the systems use DRBD to provide data redundancy.
+
* We use LVM to create volumes for each domU's root and swap partitions.
* [[vislor]] (P4 1.7GHz/768MB/40GB) is intended to run domUs for production services as it is the most powerful of the two.
+
* We have a homebrew [http://jp-hosting.net/mkdomU.bash.html script] to create the LV and use debootstrap to install the OS.
* [[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. --[[User:Pert|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):
 
 
 
* http://packages.tardis.ed.ac.uk/fedora/ks-vislor.cfg
 
* http://packages.tardis.ed.ac.uk/fedora/ks-adric.cfg
 
 
 
== 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 ==
 
 
 
<pre>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
 
</pre>
 
  
 
== How to Add New Instances ==
 
== 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.
+
The VM creation script gets the new system's IP address from DNS so the first job is to see the [[DNS_Service]] page for details on how to set up a new entry for your system.
  
Login to vislor, which is the main xen machine. Use the mkdomU.bash script to create the new instance like so:
+
Login to wotan, which is the main xen machine. Use the mkdomU.bash script to create the new instance like so:
  
 
<pre>
 
<pre>

Revision as of 14:30, 7 October 2008

Overview

  • We currently have a single Xen host: WOTAN. It replaced the previous Xen hosts as it has more of everything (disks, CPUs, RAM, PSUs).
  • We run i386 Xen 3.0.3 with PAE (as packaged in Debian etch).
  • We use LVM to create volumes for each domU's root and swap partitions.
  • We have a homebrew script to create the LV and use debootstrap to install the OS.

How to Add New Instances

The VM creation script gets the new system's IP address from DNS so the first job is to see the DNS_Service page for details on how to set up a new entry for your system.

Login to wotan, 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 .

Don't forget to unmount the domU filesystem!

umount /mnt/mkdomU

Run

xm create -c <newmachinename>.conf

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/*.conf; do xm create -c $foo; done
<WAIT FOR A LOGIN PROMPT>
ctrl+]
<WAIT FOR A LOGIN PROMPT>
ctrl+]
....