Difference between revisions of "Migration from Linux-VServer to OpenVZ"
(organized into sections, some fixes, improvements, cleanups.) |
|||
Line 3: | Line 3: | ||
Current document describes the migration from Linux-VServer based virtualization solution to OpenVZ. | Current document describes the migration from Linux-VServer based virtualization solution to OpenVZ. | ||
− | Description of challenge | + | == Description of challenge == |
The challenge is migration from Linux-Vserver to OpenVZ by booting the OpenVZ kernel and updating the existing configs of | The challenge is migration from Linux-Vserver to OpenVZ by booting the OpenVZ kernel and updating the existing configs of | ||
utility level in purpose to make the existing guest OSes work over OpenVZ kernel. | utility level in purpose to make the existing guest OSes work over OpenVZ kernel. | ||
− | Details of migration process | + | == Details of migration process == |
− | + | === Initial conditions === | |
+ | |||
+ | The following example of Linux-VServer based solution was used for the experiment: | ||
* Kernel linux-2.6.17.13 was patched by the patch-2.6.17.13-vs2.0.2.1.diff and rebuild; | * Kernel linux-2.6.17.13 was patched by the patch-2.6.17.13-vs2.0.2.1.diff and rebuild; | ||
* Util-vserver-0.30.211 tools were used for creating containers; | * Util-vserver-0.30.211 tools were used for creating containers; | ||
− | |||
# vserver-info | # vserver-info | ||
Versions: | Versions: | ||
Line 45: | Line 46: | ||
vserver-Rootdir: /vservers | vserver-Rootdir: /vservers | ||
# | # | ||
− | |||
VServer v345 was built using vserver vX build utility and populated by using the tarballed template of Fedora Core 4. | VServer v345 was built using vserver vX build utility and populated by using the tarballed template of Fedora Core 4. | ||
− | |||
# vserver v345 start | # vserver v345 start | ||
Starting system logger: [ OK ] | Starting system logger: [ OK ] | ||
Line 76: | Line 75: | ||
sh-2.05b# | sh-2.05b# | ||
......... | ......... | ||
− | |||
As a result we obtain running virtual environment v345: | As a result we obtain running virtual environment v345: | ||
− | |||
# vserver-stat | # vserver-stat | ||
Line 88: | Line 85: | ||
# | # | ||
− | |||
− | + | === Starting migration to OpenVZ === | |
+ | |||
+ | Downloading and installing the stable OpenVZ kernel. | ||
− | Install the OpenVZ kernel, as described in [[ | + | Install the OpenVZ kernel, as described in [[Quick installation]]. |
After the kernel is installed, reboot the machine. After rebooting and logging in you will see the following reply on vserver-stat call: | After the kernel is installed, reboot the machine. After rebooting and logging in you will see the following reply on vserver-stat call: | ||
− | |||
# vserver-stat | # vserver-stat | ||
can not change context: migrate kernel feature missing and 'compat' API disabled: Function not implemented | can not change context: migrate kernel feature missing and 'compat' API disabled: Function not implemented | ||
− | |||
− | |||
It is a natural thing that now virtual environment v345 is unavailable. The following steps will be devoted to making it | It is a natural thing that now virtual environment v345 is unavailable. The following steps will be devoted to making it | ||
work over OpenVZ kernel. | work over OpenVZ kernel. | ||
− | + | === Downloading and installing vzctl package === | |
OpenVZ solution requires installing a set of tools: vzctl and vzquota packages. Download and install it, as described in [[quick installation]]. | OpenVZ solution requires installing a set of tools: vzctl and vzquota packages. Download and install it, as described in [[quick installation]]. | ||
Line 112: | Line 107: | ||
Then launch the OpenVZ: | Then launch the OpenVZ: | ||
− | |||
# /sbin/service vz start | # /sbin/service vz start | ||
Starting OpenVZ: [ OK ] | Starting OpenVZ: [ OK ] | ||
Bringing up interface venet0: [ OK ] | Bringing up interface venet0: [ OK ] | ||
Configuring interface venet0: [ OK ] | Configuring interface venet0: [ OK ] | ||
− | |||
− | |||
Currently vzlist utility is unable to find any containers: | Currently vzlist utility is unable to find any containers: | ||
− | |||
− | |||
# vzlist | # vzlist | ||
Containers not found | Containers not found | ||
− | |||
− | |||
− | + | === Updating different configurations === | |
− | Move the existing | + | Move the existing guest OSs to the right place: |
− | |||
# cd /vz | # cd /vz | ||
# mkdir private | # mkdir private | ||
− | # mkdir 345 | + | # mkdir private/345 |
# mv /vservers/v345 /vz/private/345 | # mv /vservers/v345 /vz/private/345 | ||
− | |||
Now it is time for creating configuration files for OpenVZ container. Use the basic sample | Now it is time for creating configuration files for OpenVZ container. Use the basic sample | ||
configuration presented in /etc/sysconfig/vz-scripts/ve-vps.basic.conf-sample file: | configuration presented in /etc/sysconfig/vz-scripts/ve-vps.basic.conf-sample file: | ||
− | |||
# cd /etc/sysconfig/vz-scripts | # cd /etc/sysconfig/vz-scripts | ||
# cp ve-vps.basic.conf-sample 345.conf | # cp ve-vps.basic.conf-sample 345.conf | ||
− | |||
− | + | Now, let's set some parameters for the new container. | |
− | + | First, we need to tell which distro the container is running: | |
− | + | # echo "OSTEMPLATE="fedora-core-4" >> 345.conf | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | Then we set a few more parameters: | |
+ | vzctl set 345 --onboot yes --save # to make it start upon reboot | ||
+ | vzctl set 345 --ipadd 192.168.0.145 --save | ||
+ | vzctl set 345 --hostname test345.my.org --save | ||
− | + | == Testing how the guest OSs successfully work over OpenVZ == | |
− | |||
− | |||
− | + | Now you can start a container: | |
− | + | # vzctl start 345 | |
− | |||
− | + | and see if it's running: | |
# vzlist -a | # vzlist -a | ||
CTID NPROC STATUS IP_ADDR HOSTNAME | CTID NPROC STATUS IP_ADDR HOSTNAME | ||
345 5 running 192.168.0.145 test345.my.org | 345 5 running 192.168.0.145 test345.my.org | ||
− | |||
− | |||
− | + | You can run commands in it: | |
− | |||
# vzctl exec 345 ls -l | # vzctl exec 345 ls -l | ||
total 48 | total 48 | ||
Line 205: | Line 172: | ||
drwxr-xr-x 15 root root 4096 Jul 27 2004 usr | drwxr-xr-x 15 root root 4096 Jul 27 2004 usr | ||
drwxr-xr-x 17 root root 4096 Oct 26 2004 var | drwxr-xr-x 17 root root 4096 Oct 26 2004 var | ||
− | |||
− | |||
− | Issues | + | == Issues == |
1. The vserver-originating containers do not initialize network at all. Thus one needs to use following command to enable networking start (inside of the migrated container): | 1. The vserver-originating containers do not initialize network at all. Thus one needs to use following command to enable networking start (inside of the migrated container): | ||
Line 214: | Line 179: | ||
ln -s ../init.d/networking S40networking | ln -s ../init.d/networking S40networking | ||
− | 2. Disk space information is empty. | + | 2. Disk space information is empty. Do the following to fix: |
− | + | rm /etc/mtab | |
+ | ln -s /proc/mounts /etc/mtab | ||
[[Category:HOWTO]] | [[Category:HOWTO]] |
Revision as of 07:13, 22 August 2008
Current document describes the migration from Linux-VServer based virtualization solution to OpenVZ.
Contents
Description of challenge
The challenge is migration from Linux-Vserver to OpenVZ by booting the OpenVZ kernel and updating the existing configs of utility level in purpose to make the existing guest OSes work over OpenVZ kernel.
Details of migration process
Initial conditions
The following example of Linux-VServer based solution was used for the experiment:
- Kernel linux-2.6.17.13 was patched by the patch-2.6.17.13-vs2.0.2.1.diff and rebuild;
- Util-vserver-0.30.211 tools were used for creating containers;
# vserver-info Versions: Kernel: 2.6.17.13-vs2.0.2.1 VS-API: 0x00020002 util-vserver: 0.30.211; Dec 5 2006, 17:10:21 Features: CC: gcc, gcc (GCC) 3.4.3 20041212 (Red Hat 3.4.3-9.EL4) CXX: g++, g++ (GCC) 3.4.3 20041212 (Red Hat 3.4.3-9.EL4) CPPFLAGS: CFLAGS: '-g -O2 -std=c99 -Wall -pedantic -W -funit-at-a-time' CXXFLAGS: '-g -O2 -ansi -Wall -pedantic -W -fmessage-length=0 -funit-at-a-time' build/host: i686-pc-linux-gnu/i686-pc-linux-gnu Use dietlibc: yes Build C++ programs: yes Build C99 programs: yes Available APIs: v13,net ext2fs Source: kernel syscall(2) invocation: alternative vserver(2) syscall#: 273/glibc Paths: prefix: /usr/local sysconf-Directory: ${prefix}/etc cfg-Directory: ${prefix}/etc/vservers initrd-Directory: $(sysconfdir)/init.d pkgstate-Directory: ${prefix}/var/run/vservers vserver-Rootdir: /vservers #
VServer v345 was built using vserver vX build utility and populated by using the tarballed template of Fedora Core 4.
# vserver v345 start Starting system logger: [ OK ] Initializing random number generator: [ OK ] Starting crond: l: [ OK ] Starting atd: [ OK ] # vserver v345 enter [/]# ls -l total 44 drwxr-xr-x 2 root root 4096 Oct 26 2004 bin drwxr-xr-x 3 root root 4096 Dec 8 17:16 dev drwxr-xr-x 27 root root 4096 Dec 8 15:21 etc -rw-r--r-- 1 root root 0 Dec 8 15:33 halt drwxr-xr-x 2 root root 4096 Jan 24 2003 home drwxr-xr-x 7 root root 4096 Oct 26 2004 lib drwxr-xr-x 2 root root 4096 Jan 24 2003 mnt drwxr-xr-x 3 root root 4096 Oct 26 2004 opt -rw-r--r-- 1 root root 0 Dec 7 20:17 poweroff dr-xr-xr-x 80 root root 0 Dec 8 11:38 proc drwxr-x--- 2 root root 4096 Dec 7 20:17 root drwxr-xr-x 2 root root 4096 Oct 26 2004 sbin drwxrwxrwt 2 root root 40 Dec 8 17:16 tmp drwxr-xr-x 15 root root 4096 Jul 27 2004 usr drwxr-xr-x 17 root root 4096 Oct 26 2004 var [/]# sh sh-2.05b# .........
As a result we obtain running virtual environment v345:
# vserver-stat CTX PROC VSZ RSS userTIME sysTIME UPTIME NAME 0 51 90.9M 26.3M 0m58s75 2m42s57 33m45s93 root server 49153 4 10.2M 2.8M 0m00s00 0m00s11 21m45s42 v345 #
Starting migration to OpenVZ
Downloading and installing the stable OpenVZ kernel.
Install the OpenVZ kernel, as described in Quick installation.
After the kernel is installed, reboot the machine. After rebooting and logging in you will see the following reply on vserver-stat call:
# vserver-stat can not change context: migrate kernel feature missing and 'compat' API disabled: Function not implemented
It is a natural thing that now virtual environment v345 is unavailable. The following steps will be devoted to making it work over OpenVZ kernel.
Downloading and installing vzctl package
OpenVZ solution requires installing a set of tools: vzctl and vzquota packages. Download and install it, as described in quick installation.
If rpm complains about unresolved dependencies, you'll have to satisfy them first, then repeat the installation. Then launch the OpenVZ:
# /sbin/service vz start Starting OpenVZ: [ OK ] Bringing up interface venet0: [ OK ] Configuring interface venet0: [ OK ]
Currently vzlist utility is unable to find any containers:
# vzlist Containers not found
Updating different configurations
Move the existing guest OSs to the right place:
# cd /vz # mkdir private # mkdir private/345 # mv /vservers/v345 /vz/private/345
Now it is time for creating configuration files for OpenVZ container. Use the basic sample configuration presented in /etc/sysconfig/vz-scripts/ve-vps.basic.conf-sample file:
# cd /etc/sysconfig/vz-scripts # cp ve-vps.basic.conf-sample 345.conf
Now, let's set some parameters for the new container.
First, we need to tell which distro the container is running:
# echo "OSTEMPLATE="fedora-core-4" >> 345.conf
Then we set a few more parameters:
vzctl set 345 --onboot yes --save # to make it start upon reboot vzctl set 345 --ipadd 192.168.0.145 --save vzctl set 345 --hostname test345.my.org --save
Testing how the guest OSs successfully work over OpenVZ
Now you can start a container:
# vzctl start 345
and see if it's running:
# vzlist -a CTID NPROC STATUS IP_ADDR HOSTNAME 345 5 running 192.168.0.145 test345.my.org
You can run commands in it:
# vzctl exec 345 ls -l total 48 drwxr-xr-x 2 root root 4096 Oct 26 2004 bin drwxr-xr-x 3 root root 4096 Dec 11 12:42 dev drwxr-xr-x 27 root root 4096 Dec 11 12:44 etc -rw-r--r-- 1 root root 0 Dec 11 12:13 fastboot -rw-r--r-- 1 root root 0 Dec 8 15:33 halt drwxr-xr-x 2 root root 4096 Jan 24 2003 home drwxr-xr-x 7 root root 4096 Oct 26 2004 lib drwxr-xr-x 2 root root 4096 Jan 24 2003 mnt drwxr-xr-x 3 root root 4096 Oct 26 2004 opt -rw-r--r-- 1 root root 0 Dec 7 20:17 poweroff dr-xr-xr-x 70 root root 0 Dec 11 12:42 proc drwxr-x--- 2 root root 4096 Dec 7 20:17 root drwxr-xr-x 2 root root 4096 Dec 11 12:13 sbin drwxrwxrwt 2 root root 4096 Dec 8 12:40 tmp drwxr-xr-x 15 root root 4096 Jul 27 2004 usr drwxr-xr-x 17 root root 4096 Oct 26 2004 var
Issues
1. The vserver-originating containers do not initialize network at all. Thus one needs to use following command to enable networking start (inside of the migrated container): cd /etc/rcS.d ln -s ../init.d/networking S40networking
2. Disk space information is empty. Do the following to fix:
rm /etc/mtab ln -s /proc/mounts /etc/mtab