KVM : Live Migration2024/05/10 |
This is the example to use Live Migration feature for Virtual Machines.
It requires 2 KVM host server and also a storage server like follows. +----------------------+ | [ NFS Servver ] | | nfs.srv.world | | | +-----------+----------+ |10.0.0.35 | +----------------------+ | +----------------------+ | [ KVM Host #1 ] |10.0.0.30 | 10.0.0.51| [ 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. For connection between KVM Hosts, they connects to others with SSH, so it had better to set SSH key-pair with root account before running live migration. |
# edit the setting of a VM you'd like to run live migration root@kvm01:~# virsh edit ubuntu2404 <disk type='file' device='disk'> # add : change cache mode to [none] <driver name='qemu' type='qcow2' discard='unmap' cache='none'/> <source file='/var/kvm/images/ubuntu2404.img'/>root@kvm01:~# virsh start ubuntu2404 root@kvm01:~# virsh list Id Name State ---------------------------- 1 ubuntu2404 running
root@kvm01:~#
root@kvm01:~# virsh migrate --live ubuntu2404 qemu+ssh://10.0.0.51/system virsh list Id Name State -------------------------- # VM migrated
### on another KVM Host ### root@kvm02:~# virsh list Id Name State ---------------------------- 1 ubuntu2404 running # back to the KVM Host again like follows root@kvm02:~# virsh migrate --live ubuntu2404 qemu+ssh://10.0.0.30/system virsh list Id Name State -------------------------- |
Sponsored Link |