Configure LXD
# old server (lxd-old.example.com, 10.0.0.11) lxc config set core.https_address 10.0.0.11:8443 lxc config set core.trust_password ${MY_PASS} # new server (lxd-new.example.com, 10.0.0.22) lxc remote add lxd-old.example.com 10.0.0.11:8443 #lxc config set core.https_address 10.0.0.22:8443 #lxc config set core.trust_password pass1234
Migrate profile
PROFILE=nic-dev-mgmt lxc profile copy ${REMODE_LXD_NODE}:${PROFILE} ${PROFILE}
Migrate container
# @ new LXD node REMODE_LXD_NODE=lxd-old.example.com CONTAINER=container1 # list container on remote host lxc ls ${REMODE_LXD_NODE}: lxc stop ${REMODE_LXD_NODE}:${CONTAINER} lxc copy ${REMODE_LXD_NODE}:${CONTAINER} #lxc start ${REMODE_LXD_NODE}:${CONTAINER} lxc start ${CONTAINER} # start new container lxc start ${CONTAINER} lxc shell ${CONTAINER} # OPTIONAL: disable autostart on old container lxc config set ${OLD_LXD_NODE}:${CONTAINER} boot.autostart false # @ old LXD node CONTAINER=www #lxc config show ${CONTAINER} lxc config set ${CONTAINER} boot.autostart false lxc stop ${CONTAINER} # copy whole container lxc copy lxd-old.example.com:${CONTAINER} ${CONTAINER} --verbose # move only snapshot (copy container) # lxc snapshot ${CONTAINER} # lxc move ${CONTAINER}/snap0 lxd2.example.com:${CONTAINER} --verbose # @ new server CONTAINER=www #lxc config set ${CONTAINER} volatile.eth0.hwaddr 00:11:22:33:44:70 lxc start ${CONTAINER}
Debug
tail -f /var/log/lxd/lxd.log
Live migrate (test)
https://packages.ubuntu.com/impish/criu
wget http://mirrors.kernel.org/ubuntu/pool/universe/c/criu/criu_3.14-1_amd64.deb dpkg -i criu_3.14-1_amd64.deb apt install -f dpkg -i criu_3.14-1_amd64.deb