wiki:UpgradeOpenvzNotes

Version 5 (modified by Ted Faber, 12 years ago) (diff)

--

Upgrade Notes for OpenVZ

Upgrading Templates

Start an experiment with the templates to update in it. For example:

source tb_compat.tcl
set ns [new Simulator]

set u1004x86 [$ns node]
tb-add-node-attribute $u1004x86 containers:openvz_template ubuntu-10.04-x86
set u1004x8664 [$ns node]
tb-add-node-attribute $u1004x8664 containers:openvz_template ubuntu-10.04-x86_64
set u1204x86 [$ns node]
tb-add-node-attribute $u1204x86 containers:openvz_template ubuntu-12.04-x86
set u1204x8664 [$ns node]
tb-add-node-attribute $u1204x8664 containers:openvz_template ubuntu-12.04-x86_64

# Creation boilerplate
$ns rtptoto Static
$ns run

Stop one of the VMs:

$ sudo vzlist -n
$ sudo vzlist -n
      CTID      NPROC STATUS    IP_ADDR         NAME
       102         21 running   -               u1004x86
       103         26 running   -               u1204x86
       104         19 running   -               u1004x8664
$ sudo vzctl stop 102

Pull the creation commands for that VM out of /var/containers/config/openvz_create_commands.yaml. You only need the creation and network setup commands, but it won't hurt to run them all.

vzctl create 101 --ostemplate ubuntu-12.04-x86_64
/usr/sbin/vzctl set 101 --netif_add eth0,00:66:00:00:1c:2e,veth101.0,00:67:00:00:1c:2e --save

You'll also need the IP address of that node. You can note it before or pull it from the extra_nodes table in the database.

Start the VM and configure its networking

$ sudo vzctl 555 startA

At this point the virtual interface from the ---netif_add will reappear. Add it back into the control bridge:

$ sudo brctl addif control0 veth101.0
~$ brctl show
bridge name	bridge id		STP enabled	interfaces
control0		8000.0025906ad176	no		eth0
							veth101.0
							veth102.0
							veth103.0
							veth104.0

Enter the VM and start its networking

$ sudo vzctl 555 enter
root@pnode-0000:/# ifconfig eth0 172.16.28.46 netmask 255.240.0.0 up
root@pnode-0000:/# ip route add 192.168.0.0/22 dev eth0  scope link 
root@pnode-0000:/# ip route add default via 192.168.1.254 dev eth0
root@pnode-0000:/# ping users
PING users.isi.deterlab.net (192.168.253.1) 56(84) bytes of data.
64 bytes from users.isi.deterlab.net (192.168.253.1): icmp_req=1 ttl=63 time=2.02 ms
64 bytes from users.isi.deterlab.net (192.168.253.1): icmp_req=2 ttl=63 time=1.39 ms

The ping will fail if /etc/resolv.conf doesn't exist or is wrong. A right one is:

search isi.deterlab.net
nameserver 192.168.252.1

Now you have a functional, if minimal VM, and you can update the template in place. E.g:

root@pnode-0000:/# apt-get update

The Openvz notes on upgrading Debian are a template for the rest of this.

The short form is:

root@pnode-0000:/# exit
logout
exited from CT 555
pnode-0000:~$ sudo vzctl stop 555
$ sudo mv /vz/template/cache/ubuntu-12.04-x86_64.tar.gz /vz/template/cache/ubuntu-12.04-x86_64.tar.gz.old
$ sudo tar -C /vz/private/555/ --numeric-owner -czf /vz/template/cache/ubuntu-12.04-x86_64.tar.gz .

Test it by recreating the temporary VM and starting it.

$ sudo vzctl destroy 555
# goto 1