Skip to content

Live migrating OVZ mainstream container

Pavel Emelyanov edited this page Feb 13, 2014 · 26 revisions

This page describes how to create and live migrate and OVZ container on Fedora 20

Table of Contents

Prepare shared FS on two nodes

P.Haul currently assumes, that container's private are is shared between the nodes you migrate it between. This can be achieved e.g. by mounting the same NFS export on /vz directory on both nodes.

Create container

There are two things to know before creating contianer.

CRIU can dump and restore container based on

  • Centos-6-x86_64
  • Ubuntu-10.04-x86_64
templates and doesn't work with user-namespaces.

That said, create a container with this command

 # vzctl create $id $template --local_uid 0 --local_gid 0

Attach it to the network

The easiest way to do it is via bridging. To do so, you should first have your host's main link attached (eth0/enp0sN) to bridge.

Configuring bridge on host

It's just and example of how to do it on Fedora-20, you can skip this section and do it in your own way.

  • Disable NetworkManager and enable legacy networking
 # chkconfig NetworkManager off
 # chkconfig network on
 # service NetworkManager stop
 # service network start
  • Configure bridge and attach eth0 device to it.
Create config file /etc/sysconfig/network-scripts/ifcfg-br0
 DEVICE=br0
 TYPE=Bridge
 BOOTPROTO=dhcp
 ONBOOT=yes
 DELAY=0

To /etc/sysconfig/network-scripts/ifcfg-$link add line

 BRIDGE=br0

Then do

 # service network restart

After this you should have eth0/enp0sN be in bridge (seen by brctl show br0) and br0 have the ip address (seen by ip a l).

This should be so on both nodes -- source and destination!

Configure CT networking

  • Assign veth to container
 # vzctl set $id --netif_add eth0,$ct_mac,veth$id.0,$host_mac,br0

Plz note, that if $host_mac is arithmetically less that the mac on your main link (eth0/enp0sN) after starting CT you would see some lag in networking due to br0's mac would change.

  • Make sure you have eth0 config file in CT's /etc/sysconfig/network-scripts/ifcfg-eth0.
= Migrate it

Clone this wiki locally