Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Live migration for instances created on ephemeral storage


This procedure must be used only from/to hypervisor using LVM thin

Let's suppose that we want to migrate a VM with id dad2d364-3432-454d-a72d-910067e0187d  from compute-02 to compute-04


First of all on the source hypervisor let's take a LV snapshotTo migrate an instance from a compute node to another one, you can use the "openstack server migrate" command with the '–block-migration' option, after having sourced the admin openrc script. E.g.:


Code Block
languagebash
openstack server migrate[root@compute-02 ~]# lvcreate -s --live cld-np-14.cloud.pd.infn.it --block-migration e1914906-7e33-4d30-88f0-785130fdd85d

This will live migrate the instance with uuid e1914906-7e33-4d30-88f0-785130fdd85d to the compute node cld-np-14.cloud.pd.infn.it.

name lvmnova.dad2d364-3432-454d-a72d-910067e0187d lvmvg/lvmnova
  WARNING: Sum of all thin volume sizes (335.75 GiB) exceeds the size of thin pool lvmvg/pool00 and the size of whole volume group (167.88 GiB).
  WARNING: You have not turned on protection against thin pools running out of space.
  WARNING: Set activation/thin_pool_autoextend_threshold below 100 to trigger automatic extension of thin pools before they get full.
  Logical volume "lvmnova.dad2d364-3432-454d-a72d-910067e0187d" created.
[root@compute-02 ~]# lvs
  LV                                           VG    Attr       LSize    Pool   Origin  Data%  Meta%  Move Log Cpy%Sync Convert
  lvmnova                                      lvmvg Vwi-aotz-- <167.88g pool00         6.11                                   
  lvmnova.dad2d364-3432-454d-a72d-910067e0187d lvmvg Vwi---tz-k <167.88g pool00 lvmnova                                        
  pool00                                       lvmvg twi-aotz-- <167.88g                6.14   11.04                           
[root@compute-02 ~]# 


Let's set the snapshot in read only mode:

Code Block
languagebash
[root@compute-02 ~]# lvchange -p r lvmvg/lvmnova.dad2d364-3432-454d-a72d-910067e0187d
  Logical volume lvmvg/lvmnova.dad2d364-3432-454d-a72d-910067e0187d changed.
[root@compute-02 ~]# 


Let's migrate the instance,using  the "openstack server migrate" command with the '–block-migration' option, after having sourced the admin openrc script, i.e.In train the "–live" option is deprecated. You can use:

Code Block
languagebash
[root@controller-01 ~]# openstack server migrate --os-compute-api-version 2.30 --live-migration --host compute-0304.cloud.pd.infn.it --block-migration dad2d364-3432-os454d-compute-api-version 2.79 92c413cb-d6f2-4103-9042-9e2e85257029a72d-910067e0187d 
[root@controller-01 ~]# 




The command doesn't work if source and target hypervisor aren't compatible. The error would be something like:

...

In this case, please find another compatible hypervisor, or you can use cold migration (i.e. the VM will be powered off during the migration)


If the block live migration for some reason didn't work and you have a "corrupted VM"

[root@controller-01 ~]# nova stop dad2d364-3432-454d-a72d-910067e0187d | grep comp
[root@controller-01 ~]# 



Code Block
[root@compute-02 ~]# mkdir /mnt/snap
[root@compute-02 ~]# mount /dev/lvmvg/lvmnova.dad2d364-3432-454d-a72d-910067e0187d /mnt/snap -o ro,nouuid,norecovery 
   
[root@compute-02 ~]# ll /mnt/snap/dad2d364-3432-454d-a72d-910067e0187d/
console.log  disk         disk.info    


[root@compute-02 ~]# scp /mnt/snap/dad2d364-3432-454d-a72d-910067e0187d/disk compute-04.cloud.pd.infn.it:/var/lib/nova/instances/dad2d364-3432-454d-a72d-910067e0187d
The authenticity of host 'compute-04.cloud.pd.infn.it (192.168.60.89)' can't be established.
ED25519 key fingerprint is SHA256:Fqq7jDeH98KxJ3J9QCFnBaWdiESy7gZ9+toHWU8i1jA.
This host key is known by the following other names/addresses:
    ~/.ssh/known_hosts:1: compute-04
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'compute-04.cloud.pd.infn.it' (ED25519) to the list of known hosts.
root@compute-04.cloud.pd.infn.it's password: 
disk  

[root@compute-02 ~]# umount /mnt/snap
[root@compute-02 ~]#                                                                                                                                                                                    




Code Block
[root@controller-01 ~]# nova start dad2d364-3432-454d-a72d-910067e0187d
Request to start server dad2d364-3432-454d-a72d-910067e0187d has been accepted.
[root@controller-01 ~]# 



Cold migration for instances created on ephemeral storage

...