Xen on Fedora 13: Difference between revisions

From Alteeve Wiki
Jump to navigation Jump to search
(Created page with '{{howto_header}} '''Warning''': This is currently a dumping ground for notes. '''''DO NOT FOLLOW THIS DOCUMENT'S INSTRUCTIONS'''''. Seriously, it could blow up your computer or …')
 
No edit summary
 
(30 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{howto_header}}
{{howto_header}}


'''Warning''': This is currently a dumping ground for notes. '''''DO NOT FOLLOW THIS DOCUMENT'S INSTRUCTIONS'''''. Seriously, it could blow up your computer or cause winter to come early.
'''''NOTICE''''': This section has been moved to [[Two_Node_Fedora_13_Cluster_-_Xen-Based_Virtual_Machine_Host_on_DRBD%2BCLVM#Setting_up_Xen.27s_dom0|Two Node Fedora 13 Cluster - Xen-Based Virtual Machine Host on DRBD+CLVM]]. This will be removed shortly.


----
----


= Installing from RPM =


= Building from Source =
'''Note''': This method uses the older Xen 3.4.x tools and myoung's [[dom0]], which does '''not''' support [[DRBD]].


All of this is from [http://wiki.xensource.com/xenwiki/Xen4.0 here].
== Xen Hypervisor ==
 
Installing Xen (minus [[dom0]]) is trivial:
 
<source lang="bash">
yum install xen
</source>
 
== dom0 ==
 
This uses a kernel built for Fedora 12, but it works on Fedora 13.
 
Add the repo:
 
<source lang="bash">
cd /etc/yum.repos.d/
wget -c http://myoung.fedorapeople.org/dom0/myoung.dom0.repo
</source>
 
Edit the repo file and change the two <span class="code">enabled=0</span> entries to <span class="code">enabled=1</span>.
 
<source lang="bash">
vim /etc/yum.repos.d/myoung.dom0.repo
</source>
<source lang="text">
[myoung-dom0]
name=myoung's repository of Fedora based dom0 kernels - $basearch
baseurl=http://fedorapeople.org/~myoung/dom0/$basearch/
enabled=1
gpgcheck=0
 
[myoung-dom0-source]
name=myoung's repository of Fedora based dom0 kernels - Source
baseurl=http://fedorapeople.org/~myoung/dom0/src/
enabled=1
gpgcheck=0
</source>
 
Install the [[Xen]] [[dom0]] kernel (edit the version number if needed).
 
<source lang="bash">
yum install kernel-2.6.32.21-167.xendom0.fc12.x86_64
</source>
 
The entry in grub's <span class="code">/boot/grub/menu.lst</span> won't work. You will need to edit it to look like this:
 
'''Note''': Copy and modify the entry created by the RPM. Simply copying this entry will almost certainly not work! Your <span class="code">root=</span> is likely different and your <span class="code">rd_MD_UUID=</span> will definitely be different, even on the same machine across installs. Generally speaking, what follows the <span class="code">kernel /vmlinuz-2.6.32.21-167.xendom0.fc12.x86_64 ...</span> entry made by the dom0 kernel can be copied after the <span class="code">module /vmlinuz-2.6.32.21-167.xendom0.fc12.x86_64 ...</span> entry in the example below.
 
<source lang="bash">
vim /boot/grub/menu.lst
</source>
<source lang="bash">
title Xen 3.4.x, Linux kernel 2.6.32.21-167.xendom0.fc12.x86_64
root  (hd0,2)
kernel /xen.gz dom0_mem=1024M
module /vmlinuz-2.6.32.21-167.xendom0.fc12.x86_64 ...
module /initramfs-2.6.32.21-167.xendom0.fc12.x86_64.img
</source>
 
Add this to <span class="code">/etc/fstab</span>
 
<source lang="bash">
echo "xenfs                  /proc/xen              xenfs  defaults        0 0" >> /etc/fstab
</source>
 
= Build from source =
 
This is required if you want a more up to date [[dom0]].


== Install Requirements ==
== Install Requirements ==


Install:
For the hypervisor:


<source lang="bash">
<source lang="bash">
yum groupinstall "Development Libraries"
yum -y groupinstall "Development Libraries"
yum groupinstall "Development Tools"
yum -y groupinstall "Development Tools"
yum install transfig wget texi2html libaio-devel dev86 glibc-devel e2fsprogs-devel gitk mkinitrd iasl xz-devel bzip2-devel pciutils-libs pciutils-devel SDL-devel libX11-devel gtk2-devel bridge-utils PyXML qemu-common qemu-img mercurial
yum -y install transfig wget texi2html libaio-devel dev86 glibc-devel e2fsprogs-devel gitk mkinitrd iasl xz-devel bzip2-devel pciutils-libs pciutils-devel SDL-devel libX11-devel gtk2-devel bridge-utils PyXML qemu-common qemu-img mercurial
yum -y install glibc-devel.i686
</source>
 
For [[dom0]]:


yum install glibc-devel.i686
Notes taken from [http://fedoraproject.org/wiki/Docs/CustomKernel here].
 
<source lang="bash">
yum -y install rpmdevtools yum-utils
</source>
</source>


== Build from source ==
== Xen Hypervisor ==


'''Note''': These are the tools, not [[dom0]].
'''Note''': These are the tools, not [[dom0]].
All of this is from [http://wiki.xensource.com/xenwiki/Xen4.0 here].


From mercurial, stable tag.
From mercurial, stable tag.


Get version 4.0.0 (or newer, depending on what the latest stable is):
Get version 4.0.1 (or newer, depending on what the latest stable is):
<source lang="bash">
<source lang="bash">
hg clone -r RELEASE-4.0.0 http://xenbits.xen.org/xen-4.0-testing.hg
hg clone -r RELEASE-4.0.1 http://xenbits.xen.org/xen-4.0-testing.hg
</source>
</source>


Line 50: Line 127:
</source>
</source>


Done.
== dom0 ==
 
= dom0 =
 
== From RPM ==
 
This uses a kernel built for Fedora 12, but it works on Fedora 13.
 
Add the repo:
 
<source lang="bash">
cd /etc/yum.repos.d/
wget -c http://myoung.fedorapeople.org/dom0/myoung.dom0.repo
</source>
 
Edit the repo file and change the two <span class="code">enabled=0</span> entries to <span class="code">enabled=1</span>.


Install the [[Xen]] [[dom0]] kernel (edit the version number if needed).
'''Note''': Until otherwise noted, you do not need to run these steps as <span class="code">root</span>.


<source lang="bash">
<source lang="bash">
yum install kernel-2.6.32.17-157.xendom0.fc12.x86_64
cd ~
rpmdev-setuptree
</source>
</source>


The entry in grub's <span class="code">/boot/grub/menu.lst</span> won't work. You will need to edit it to look like this:
'''Note''': Copy and modify the entry created by the RPM. Simply copying this entry will almost certainly not work! Your <span class="code">root=</span> is likely different and your <span class="code">rd_MD_UUID=</span> will definitely be different, even on the same machine across installs. Generally speaking, what follows the <span class="code">kernel /vmlinuz-2.6.32.17-157.xendom0.fc12.x86_64 ...</span> entry made by the dom0 kernel can be copied after the <span class="code">module /vmlinuz-2.6.32.17-157.xendom0.fc12.x86_64 ...</span> entry in the example below.


'''Note''': Copy and modify the entry created by the RPM. Simply copying this entry will almost certainly not work!
'''Xen 4.0.1''':


<source lang="bash">
<source lang="bash">
title Xen 4.0, Linux kernel 2.6.32.17-157.xendom0.fc12.x86_64
title Xen 4.0.1, Linux kernel 2.6.32.17-157.xendom0.fc12.x86_64
root  (hd0,0)
root  (hd0,0)
kernel /xen-4.0.0.gz dom0_mem=1024M loglvl=all guest_loglvl=all
kernel /xen-4.0.1.gz dom0_mem=1024M
module /vmlinuz-2.6.32.17-157.xendom0.fc12.x86_64 ro root=/dev/mapper/vg01-lv_root rd_LVM_LV=vg01/lv_root rd_LVM_LV=vg01/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us rhgb quiet
module /vmlinuz-2.6.32.17-157.xendom0.fc12.x86_64 ro root=/dev/mapper/vg_01-lv_root rd_MD_UUID=<your UUID> rd_LVM_LV=vg_01/lv_root rd_LVM_LV=vg_01/lv_swap rd_NO_LUKS rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us rhgb quiet
module /initramfs-2.6.32.17-157.xendom0.fc12.x86_64.img
module /initramfs-2.6.32.17-157.xendom0.fc12.x86_64.img
</span>
</source>


Add this to <span class="code">/etc/fstab</span>
Add this to <span class="code">/etc/fstab</span>


<source lang="bash">
vim /etc/fstab
</source>
<source lang="text">
<source lang="text">
xenfs                  /proc/xen              xenfs  defaults        0 0
xenfs                  /proc/xen              xenfs  defaults        0 0
</source>
</source>


== Make cman and xend play nice ==
= Make xend play nice with clustering =


By default under Fedora 13, <span class="code">cman</span> will start before <span class="code">xend</span>. This is a problem because <span class="code">xend</span> takes the network down as part of it's setup. This causes [[totem]] communication to fail which leads to fencing.
By default under Fedora 13, <span class="code">cman</span> will start before <span class="code">xend</span>. This is a problem because <span class="code">xend</span> takes the network down as part of it's setup. This causes [[totem]] communication to fail which leads to fencing.


To avoid this, edit <span class="code">/etc/init.d/cman</span> and tell it to start after <span class="code">xend</span> by adding "<span class="code">xend</span>" to <span class="code">Required-Start</span> and <span class="code">Required-Stop</span> boot facility lists.
To avoid this, edit <span class="code">/etc/init.d/xend</span> and tell it to start earlier than position <span class="code">98</span>. This is done by changing the line <span class="code">chkconfig: 2345 98 01</span> to <span class="code">chkconfig: 2345 11 98</span>. We also don't want it to stop until <span class="code">cman</span> has stopped. We accomplish this by adding <span class="code">cman</span> to the <span class="code">Required-Stop</span> line.


When done, the <span class="code">cman</span> LSB header should look like this:
<source lang="bash">
vim /etc/init.d/xend
</source>
<source lang="bash">
#!/bin/bash
#
# xend          Script to start and stop the Xen control daemon.
#
# Author:      Keir Fraser <keir.fraser@cl.cam.ac.uk>
#
# chkconfig: 2345 11 98
# description: Starts and stops the Xen control daemon.
### BEGIN INIT INFO
# Provides:          xend
# Required-Start:    $syslog $remote_fs
# Should-Start:
# Required-Stop:    $syslog $remote_fs cman
# Should-Stop:
# Default-Start:    3 4 5
# Default-Stop:      0 1 2 6
# Default-Enabled:  yes
# Short-Description: Start/stop xend
# Description:      Starts and stops the Xen control daemon.
### END INIT INFO
</source>
 
With <span class="code">xend</span> set to start at a position lower than <span class="code">98</span>, we now have room for <span class="code">chkconfig</span> to put other daemons after it in the start order. First and foremost, we now need to tell <span class="code">cman</span> to not start until after <span class="code">xend</span> is up.
 
As above, we will now edit <span class="code">cman</span>'s <span class="code">/etc/init.d/cman</span> script. This time though, we will not edit it's <span class="code">chkconfig</span> line. Instead, we will add <span class="code">xend</span> to the <span class="code">Required-Start</span> entry.


<source lang="bash">
<source lang="bash">
Line 103: Line 197:
</source>
</source>
<source lang="bash">
<source lang="bash">
#!/bin/bash
#
# cman - Cluster Manager init script
#
# chkconfig: - 21 79
# description: Starts and stops cman
#
#
### BEGIN INIT INFO
### BEGIN INIT INFO
# Provides:            cman
# Provides:            cman
# Required-Start:      $network $time xend
# Required-Start:      $network $time xend
# Required-Stop:        $network $time xend
# Required-Stop:        $network $time
# Default-Start:
# Default-Start:
# Default-Stop:
# Default-Stop:
Line 114: Line 216:
</source>
</source>


Lastly, remove and re-add the <span class="code">cman</span> daemon and add the <span class="code">xend</span> daemon to the start list:
Lastly, remove and re-add the <span class="code">xend</span> and <span class="code">cman</span> daemons to re-order them in the start list:
 
<source lang="bash">
chkconfig xend off; chkconfig cman off; chkconfig xend on; chkconfig cman on
</source>
 
Confirm that the order has changed so that <span class="code">xend</span> is earlier in the boot sequence than <span class="code">cman</span>. Assuming you've switched to run-level 3, run:


<source lang="bash">
<source lang="bash">
chkconfig cman off
ls -lah /etc/rc3.d/
chkconfig cman on
</source>
chkconfig xend on
 
Your start sequence should now look like:
 
<source lang="text">
lrwxrwxrwx.  1 root root  14 Sep  1 19:26 S26xend -> ../init.d/xend
lrwxrwxrwx.  1 root root  14 Sep  1 19:26 S27cman -> ../init.d/cman
</source>
</source>


Done. You should be able to reboot into the [[dom0]] kernel now.
Done. You should be able to reboot into the [[dom0]] kernel now.
= Misc =
Source RPM: [http://pasik.reaktio.net/fedora/xen-4.0.1-0.2.fc13.src.rpm xen-4.0.1-0.2.fc13.src.rpm], [http://pasik.reaktio.net/fedora/xen-modules.patch xen-modules.patch]
= Creating domU VMs =
If you are running on top of DRBD in a cluster, please see "[[DRBD on Fedora 13]]" before proceeding.
'''ToDo'''


{{footer}}
{{footer}}

Latest revision as of 00:17, 9 September 2010

 AN!Wiki :: How To :: Xen on Fedora 13

NOTICE: This section has been moved to Two Node Fedora 13 Cluster - Xen-Based Virtual Machine Host on DRBD+CLVM. This will be removed shortly.


Installing from RPM

Note: This method uses the older Xen 3.4.x tools and myoung's dom0, which does not support DRBD.

Xen Hypervisor

Installing Xen (minus dom0) is trivial:

yum install xen

dom0

This uses a kernel built for Fedora 12, but it works on Fedora 13.

Add the repo:

cd /etc/yum.repos.d/
wget -c http://myoung.fedorapeople.org/dom0/myoung.dom0.repo

Edit the repo file and change the two enabled=0 entries to enabled=1.

vim /etc/yum.repos.d/myoung.dom0.repo
[myoung-dom0]
name=myoung's repository of Fedora based dom0 kernels - $basearch
baseurl=http://fedorapeople.org/~myoung/dom0/$basearch/
enabled=1
gpgcheck=0

[myoung-dom0-source]
name=myoung's repository of Fedora based dom0 kernels - Source
baseurl=http://fedorapeople.org/~myoung/dom0/src/
enabled=1
gpgcheck=0

Install the Xen dom0 kernel (edit the version number if needed).

yum install kernel-2.6.32.21-167.xendom0.fc12.x86_64

The entry in grub's /boot/grub/menu.lst won't work. You will need to edit it to look like this:

Note: Copy and modify the entry created by the RPM. Simply copying this entry will almost certainly not work! Your root= is likely different and your rd_MD_UUID= will definitely be different, even on the same machine across installs. Generally speaking, what follows the kernel /vmlinuz-2.6.32.21-167.xendom0.fc12.x86_64 ... entry made by the dom0 kernel can be copied after the module /vmlinuz-2.6.32.21-167.xendom0.fc12.x86_64 ... entry in the example below.

vim /boot/grub/menu.lst
title Xen 3.4.x, Linux kernel 2.6.32.21-167.xendom0.fc12.x86_64
	root   (hd0,2)
	kernel /xen.gz dom0_mem=1024M
	module /vmlinuz-2.6.32.21-167.xendom0.fc12.x86_64 ...
	module /initramfs-2.6.32.21-167.xendom0.fc12.x86_64.img

Add this to /etc/fstab

echo "xenfs                   /proc/xen               xenfs   defaults        0 0" >> /etc/fstab

Build from source

This is required if you want a more up to date dom0.

Install Requirements

For the hypervisor:

yum -y groupinstall "Development Libraries"
yum -y groupinstall "Development Tools"
yum -y install transfig wget texi2html libaio-devel dev86 glibc-devel e2fsprogs-devel gitk mkinitrd iasl xz-devel bzip2-devel pciutils-libs pciutils-devel SDL-devel libX11-devel gtk2-devel bridge-utils PyXML qemu-common qemu-img mercurial
yum -y install glibc-devel.i686

For dom0:

Notes taken from here.

yum -y install rpmdevtools yum-utils

Xen Hypervisor

Note: These are the tools, not dom0.

All of this is from here.

From mercurial, stable tag.

Get version 4.0.1 (or newer, depending on what the latest stable is):

hg clone -r RELEASE-4.0.1 http://xenbits.xen.org/xen-4.0-testing.hg

Go into the directory and compile the tools:

cd xen-4.0-testing.hg
make xen
make tools
make stubdom

Install the tools (assuming compile worked):

make install-xen
make install-tools
make install-stubdom

dom0

Note: Until otherwise noted, you do not need to run these steps as root.

cd ~
rpmdev-setuptree

Note: Copy and modify the entry created by the RPM. Simply copying this entry will almost certainly not work! Your root= is likely different and your rd_MD_UUID= will definitely be different, even on the same machine across installs. Generally speaking, what follows the kernel /vmlinuz-2.6.32.17-157.xendom0.fc12.x86_64 ... entry made by the dom0 kernel can be copied after the module /vmlinuz-2.6.32.17-157.xendom0.fc12.x86_64 ... entry in the example below.

Xen 4.0.1:

title Xen 4.0.1, Linux kernel 2.6.32.17-157.xendom0.fc12.x86_64
	root   (hd0,0)
	kernel /xen-4.0.1.gz dom0_mem=1024M
	module /vmlinuz-2.6.32.17-157.xendom0.fc12.x86_64 ro root=/dev/mapper/vg_01-lv_root rd_MD_UUID=<your UUID> rd_LVM_LV=vg_01/lv_root rd_LVM_LV=vg_01/lv_swap rd_NO_LUKS rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us rhgb quiet
	module /initramfs-2.6.32.17-157.xendom0.fc12.x86_64.img

Add this to /etc/fstab

vim /etc/fstab
xenfs                   /proc/xen               xenfs   defaults        0 0

Make xend play nice with clustering

By default under Fedora 13, cman will start before xend. This is a problem because xend takes the network down as part of it's setup. This causes totem communication to fail which leads to fencing.

To avoid this, edit /etc/init.d/xend and tell it to start earlier than position 98. This is done by changing the line chkconfig: 2345 98 01 to chkconfig: 2345 11 98. We also don't want it to stop until cman has stopped. We accomplish this by adding cman to the Required-Stop line.

vim /etc/init.d/xend
#!/bin/bash
#
# xend          Script to start and stop the Xen control daemon.
#
# Author:       Keir Fraser <keir.fraser@cl.cam.ac.uk>
#
# chkconfig: 2345 11 98
# description: Starts and stops the Xen control daemon.
### BEGIN INIT INFO
# Provides:          xend
# Required-Start:    $syslog $remote_fs
# Should-Start:
# Required-Stop:     $syslog $remote_fs cman
# Should-Stop:
# Default-Start:     3 4 5
# Default-Stop:      0 1 2 6
# Default-Enabled:   yes
# Short-Description: Start/stop xend
# Description:       Starts and stops the Xen control daemon.
### END INIT INFO

With xend set to start at a position lower than 98, we now have room for chkconfig to put other daemons after it in the start order. First and foremost, we now need to tell cman to not start until after xend is up.

As above, we will now edit cman's /etc/init.d/cman script. This time though, we will not edit it's chkconfig line. Instead, we will add xend to the Required-Start entry.

vim /etc/init.d/cman
#!/bin/bash
#
# cman - Cluster Manager init script
#
# chkconfig: - 21 79
# description: Starts and stops cman
#
#
### BEGIN INIT INFO
# Provides:             cman
# Required-Start:       $network $time xend
# Required-Stop:        $network $time
# Default-Start:
# Default-Stop:
# Short-Description:    Starts and stops cman
# Description:          Starts and stops the Cluster Manager set of daemons
### END INIT INFO

Lastly, remove and re-add the xend and cman daemons to re-order them in the start list:

chkconfig xend off; chkconfig cman off; chkconfig xend on; chkconfig cman on

Confirm that the order has changed so that xend is earlier in the boot sequence than cman. Assuming you've switched to run-level 3, run:

ls -lah /etc/rc3.d/

Your start sequence should now look like:

lrwxrwxrwx.  1 root root   14 Sep  1 19:26 S26xend -> ../init.d/xend
lrwxrwxrwx.  1 root root   14 Sep  1 19:26 S27cman -> ../init.d/cman

Done. You should be able to reboot into the dom0 kernel now.

Misc

Source RPM: xen-4.0.1-0.2.fc13.src.rpm, xen-modules.patch

Creating domU VMs

If you are running on top of DRBD in a cluster, please see "DRBD on Fedora 13" before proceeding.

ToDo

 

Any questions, feedback, advice, complaints or meanderings are welcome.
Alteeve's Niche! Enterprise Support:
Alteeve Support
Community Support
© Alteeve's Niche! Inc. 1997-2024   Anvil! "Intelligent Availability®" Platform
legal stuff: All info is provided "As-Is". Do not use anything here unless you are willing and able to take responsibility for your own actions.