Сергей Бронников (estetus) wrote in openvz,
Сергей Бронников
estetus
openvz

OpenVZ upgrade and migration script

Author: Andre Moruga

Every now and then our team is asked question "How do I move a container created on OpenVZ to Virtuozzo"? This is one of the issues which will be finally resolved in version 7 that we are now working on (first technical preview is just out). In this version the compatibility will be on binary and transfer protocol levels. So the regular mechanisms (like container migration) will work out of the box.
In prior version this task, although not technically difficult, is not very straightforward, the data images cannot be simply moved - depending on configuration used in OpenVZ, they may be incompatible.Besides, an OpenVZ based container will have configuration that needs to be updated to fit the new platform.
To facilitate such migrations, we created a script which automates all these operations: data transfer, migrating container configuration, and tuning configuration to ensure container will work on the new platform.
The script is available at https://src.openvz.org/projects/OVZL/repos/ovztransfer/browse/ovztransfer.sh. Its usage is simple: run it in the source (old) node, and specify destination host IP and list of containers to be migrated:

 $ ./ovztransfer.sh TARGET_HOST SOURCE_VEID0:[TARGET_VEID0] ...


For example:

 ./ovztransfer.sh 10.1.1.3 101 102 103


The script has been designed to migrate containers from older OpenVZ versions to v.7; however it should also work migrating data to existing Virtuozzo versions (like 6.0).
There is one restriction: containers based on obsolete templates that do not exist on the destination servers will be transferred as "not template based" - which means tools for template management (like adding an application via vzpkg) won't work for them.
This is a first version of this script; we will have an opportunity to improve it before the final release. That's why your feedback (or even code contributions) is important here.
If you tried it and want to share your thoughts, email to OpenVZ user group at users@openvz.org.
Tags: openvz, upgrade
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 2 comments
I tried it and was able to migrate a CentOS 7 container... but the Fedora 22 one seems to be stuck in the "started" phase. It creates a /vz/private/{ctid} dir on the destination host (with the same ctid from the OpenVZ Legacy host rather than a hash-looking UUID) but nothing seems to get transferred there as a du -sh of the dir shows 4K. It starts up the container on the source system... but since there are 12 processes still running inside of it, I'm guessing it stalled as killing as much as possible... which seems to be a step. Anyway.
Scott, please submit a bug for Fedora 22 template.