Citrix Systems switch 4 Manuel D’Utilisation

Page de 272
Importing Amazon Machine Images
123
You need to have a XenServer host with a file-based storage repository (either a local ext3 SR or an
NFS SR) to convert to a VHD once the image file has been customized on the Centos/Fedora host.
Note
When copying and pasting a command, be sure the command has pasted as a single line before
executing. Some document viewers may introduce unwanted line breaks in copied text.
To import an AMI:
1.
Set up loopback on image file:
# mkdir -p /mnt/loop/centos62
# mount -o loop  CentOS_6.2_x64 /mnt/loop/centos54
2.
Install the kernel-xen package into the image. This downloads the PV kernel and ramdisk to the
image.
# yum -c /mnt/loop/centos54/etc/yum.conf --installroot=/mnt/loop/centos62/ -y install
 kernel-xen
3.
Create a grub entry in /boot/grub/grub.conf.
# mkdir -p /mnt/loop/centos62/boot/grub
# touch /mnt/loop/centos62/boot/grub/grub.conf
# echo "" > /mnt/loop/centos62/boot/grub/grub.conf
4.
Determine the name of the PV kernel that has been installed into the image.
# cd /mnt/loop/centos62
# ls lib/modules/
2.6.16.33-xenU  2.6.16-xenU  2.6.18-164.15.1.el5xen  2.6.18-164.6.1.el5.centos.plus 
 2.6.18-xenU-ec2-v1.0  2.6.21.7-2.fc8xen  2.6.31-302-ec2
# ls boot/initrd*
boot/initrd-2.6.18-164.6.1.el5.centos.plus.img boot/initrd-2.6.18-164.15.1.el5xen.img
# ls boot/vmlinuz*
boot/vmlinuz-2.6.18-164.15.1.el5xen  boot/vmlinuz-2.6.18-164.6.1.el5.centos.plus  boot/
vmlinuz-2.6.18-xenU-ec2-v1.0  boot/vmlinuz-2.6.21-2952.fc8xen
Xen kernels/ramdisk always end with "xen". For the kernel version you choose, there has to be
an entry for that version under lib/modules, there has to be an initrd and vmlinuz corresponding to
that. Above, the only kernel that satisfies this condition is 2.6.18-164.15.1.el5xen.
5.
Based on your findings, create an entry in the grub.conf file. Below is an example entry.
default=0
timeout=5
hiddenmenu
title CentOS (2.6.18-164.15.1.el5xen)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.18-164.15.1.el5xen ro root=/dev/xvda 
        initrd /boot/initrd-2.6.18-164.15.1.el5xen.img
6.
Edit etc/fstab, changing “sda1” to “xvda” and changing “sdb” to “xvdb”.