Openvz_Kernel
This page mainly introduces how to create an OpenVZ image based on Fedore8-64 image and a way to add nfs support during migration.
1. Create an experiment, using a pc3000 and use FEDORA8-64-OVZ-STD as the base image.
2. The default disk is not large enough to support Linux compilation, so you need to run /usr/testbed/bin/mkextrafs to get more disk space.
sudo /usr/testbed/bin/mkextrafs /usr/src/redhat
3. Install the OpenVZ source RPM(You can find this at /proj/checkpoint/openvz/SRPMS. Or you can simply install the RPM at /proj/checkpoint/openvz/RPMS directly).
sudo rpm -ihv kernel-2.6.18-128.2.1.el5.028stab064.7.emulab.1.src.rpm
Or you can install this new SRPM with the following nfs change and release already made in the patch.
sudo rpm -ihv kernel-2.6.18-128.2.1.el5.028stab064.7.emulab.openvz.migration.src.rpm
4. Create BUILD and RPMS directories at /usr/src/redhat/.
5. Change the specification file as you want. For example, I change the buildid to be
%define elabrelease .emulab.migration
6. Change OpenVZ patch to support nfs during migration. The patch named patch-028stab064-core in SOURCE directory is the core patch for OpenVZ. Add one line in check_one_vfsmount()
strcmp(mnt->mnt_sb->s_type->name, "sysfs") != 0 && \ + strcmp(mnt->mnt_sb->s_type->name, "nfs") != 0 && \ strcmp(mnt->mnt_sb->s_type->name, "binfmt_misc") != 0)
7. Change the default value of strict in find-debuginfo.sh from true to false at /usr/lib/rpm/.
strict=false
8. Build kernel binary RPM
sudo rpmbuild -bb --with emulab --with baseonly --without debuginfo --target=x86_64 SPECS/kernel-ovz.spec
You will be able to find RPM at /usr/src/redhat/RPMS/.
9. Install the new kernel
sudo rpm -i --oldpackage kernel-2.6.18-128.2.1.el5.028stab064.7.emulab.migration.x86_64.rpm
10. additional update in database in boss. (Contact testbed-ops@flux.utah.edu if you do not have access to boss.)
- Add your image as a parent OS for other OSs in the table os_submap.
mysql> select osname from os_info where osid=10002; +-------------------+ | osname | +-------------------+ | OVZ-F8-Migration2 | +-------------------+ mysql> select * from os_submap where parent_osid = 10002; +------+-------------+ | osid | parent_osid | +------+-------------+ | 1995 | 10002 | | 1996 | 10002 | | 1997 | 10002 | | 1998 | 10002 | | 2016 | 10002 | | 2017 | 10002 | +------+-------------+ mysql> select osname from os_info where osid in (1995,1996,1997,1998); +----------------------+ | osname | +----------------------+ | OVZ-GUEST-F10-64-STD | | OVZ-GUEST-F10-STD | | OVZ-GUEST-F8-64-STD | | OVZ-GUEST-F8-STD | +----------------------+
- Add additional OS features for your OS if you want it in the table os_info. Use OVZ-F8-Migration2 as an example.
mysql> update os_info set osfeatures='ping,ssh,ipod,isup,veths,veth-ne,mlinks,linktest,linkdelays,vlans,suboses' where osname='OVZ-F8-Migration2'; Query OK, 1 row affected (0.02 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select osname,osfeatures from os_info where pid='checkpoint'; +-------------------+---------------------------------------------------------------------------+ | osname | osfeatures | +-------------------+---------------------------------------------------------------------------+ | OVZ-F8-Migration | ping,ssh,ipod,isup,veths,veth-ne,mlinks,linktest,linkdelays,vlans,suboses | | OVZ-F8-Migration2 | ping,ssh,ipod,isup,veths,veth-ne,mlinks,linktest,linkdelays,vlans,suboses | +-------------------+---------------------------------------------------------------------------+
tips:
1. .config for the current running system is at /proc/config.gz. When compiling Linux kernel, make menuconfig and load that config file.[in Ubuntu10.10 with kernel 3.6.35-22, it is at /boot/config-*]
2. release is stored at /include/config/kernel.release
3. Never put your new guest image at /proj/utahstud/images. It is mounted by nfs which will cause stat() to be failed. Put your new guest image at /usr/testbed/images/.
4. Set the partition to be 1 for the guest image(not 2 even if the host is Linux) and select whole disk.
5. You also need to set the def_parentosid in os_info. Otherwise, the child image created by you will not be found in the children image list for the host image.
The complete property for a guest image is as following.
mysql> select * from images where imageid =10000; +-------------------+---------+---------+------------+------------+---------+--------------------------------------+-------------+---------+-------------+---------------------+--------------------------------------------+----------+------------+------------+------------+------------+------------+--------------+-------------------------------------------+-------+------+--------+--------+-------------+---------+------------+-----------+----------+----------------+ | imagename | pid_idx | gid_idx | pid | gid | imageid | uuid | old_imageid | creator | creator_idx | created | description | loadpart | loadlength | part1_osid | part2_osid | part3_osid | part4_osid | default_osid | path | magic | ezid | shared | global | mbr_version | updated | access_key | auth_uuid | auth_key | decryption_key | +-------------------+---------+---------+------------+------------+---------+--------------------------------------+-------------+---------+-------------+---------------------+--------------------------------------------+----------+------------+------------+------------+------------+------------+--------------+-------------------------------------------+-------+------+--------+--------+-------------+---------+------------+-----------+----------+----------------+ | OVZ-GUEST-F8-STD2 | 10926 | 10926 | checkpoint | checkpoint | 10000 | 08e695fb-08a7-11e0-b8cd-0024e87919e0 | | utos | 32874 | 2010-12-15 16:57:12 | Gold image for OpenVZ guest in block level | 0 | 4 | 10000 | NULL | NULL | NULL | 10000 | /usr/testbed/images/OVZ-GUEST-F8-STD2.ndz | NULL | 1 | 0 | 1 | 1 | NULL | NULL | NULL | NULL | NULL | +-------------------+---------+---------+------------+------------+---------+--------------------------------------+-------------+---------+-------------+---------------------+--------------------------------------------+----------+------------+------------+------------+------------+------------+--------------+-------------------------------------------+-------+------+--------+--------+-------------+---------+------------+-----------+----------+----------------+ 1 row in set (0.00 sec) mysql> select * from os_info where osid =10000; +-------------------+------------+---------+-------+--------------------------------------+----------+---------+-------------+---------------------+-----------------------------+--------+---------+------+-------+-------------+----------------------------------------+------+--------+-----------+---------+----------+----------------+--------------+----------------+-----+-----------------+------------------+ | osname | pid | pid_idx | osid | uuid | old_osid | creator | creator_idx | created | description | OS | version | path | magic | machinetype | osfeatures | ezid | shared | mustclean | op_mode | nextosid | def_parentosid | old_nextosid | max_concurrent | mfs | reboot_waittime | protogeni_export | +-------------------+------------+---------+-------+--------------------------------------+----------+---------+-------------+---------------------+-----------------------------+--------+---------+------+-------+-------------+----------------------------------------+------+--------+-----------+---------+----------+----------------+--------------+----------------+-----+-----------------+------------------+ | OVZ-GUEST-F8-STD2 | checkpoint | 10926 | 10000 | 08e6218e-08a7-11e0-b8cd-0024e87919e0 | | utos | 32874 | 2010-12-15 16:57:12 | Gold image for OpenVZ guest | Fedora | 8 | NULL | | | ping,ssh,ipod,isup,linktest,linkdelays | 1 | 1 | 0 | PCVM | NULL | 1761 | | NULL | 0 | 120 | 0 | +-------------------+------------+---------+-------+--------------------------------------+----------+---------+-------------+---------------------+-----------------------------+--------+---------+------+-------+-------------+----------------------------------------+------+--------+-----------+---------+----------+----------------+--------------+----------------+-----+-----------------+------------------+ 1 row in set (0.00 sec)