KVM : Live Migration2020/08/05 |
This is the example to use Live Migration feature for Virtual Machines.
It requires 2 KVM host server and a storage server like follows.
Configure DNS or hosts to resolve names or IP addresses normally, first. +----------------------+ | [ NFS Servver ] | | nfs.srv.world | | | +-----------+----------+ |10.0.0.35 | +----------------------+ | +----------------------+ | [ KVM Host #1 ] |10.0.0.21 | 10.0.0.22| [ KVM Host #2 ] | | +----------+----------+ | | kvm01.srv.world | | kvm02.srv.world | +----------------------+ +----------------------+ |
[1] | |
[2] |
Configure 2 KVM host server and mount a directory provided from Storage server on the same mount point on both KVM server.
It uses [/var/kvm/images] for mount point on this example.
|
[3] | Create and Start a Virtual Machine on a KVM Host and run Live Migration like follows. Before Migration, it needs to set SSH key-pair or other settings to use SSH connection with root user account. |
# edit setting of a VM root@kvm01:~# virsh edit ubuntu2004 <disk type='file' device='disk'> # add: change cache mode to [none] <driver name='qemu' type='qcow2' cache='none'/> <source file='/var/kvm/images/ubuntu2004.img'/>root@kvm01:~# virsh start ubuntu2004 root@kvm01:~# virsh list Id Name State ---------------------------------------------------- 1 ubuntu2004 running
root@kvm01:~#
root@kvm01:~# virsh migrate --live ubuntu2004 qemu+ssh://10.0.0.22/system virsh list Id Name State -------------------------------------- # just migrated
### on another KVM Host ### root@kvm02:~# virsh list Id Name State ---------------------------------------------------- 1 ubuntu2004 running # back to the KVM Host again like follows root@kvm02:~# virsh migrate --live ubuntu2004 qemu+ssh://10.0.0.21/system virsh list Id Name State -------------------------------------- |
Sponsored Link |