Debian 10 Buster
Sponsored Link

KVM : Live Migration2019/07/23

 
This is the example to use Live Migration function for Virtual Machines.
This requires 2 KVM host server and a storage server like follows.
Please set 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.51 | 10.0.0.52|  [  KVM Host #2   ]  |
|                      +----------+----------+                      |
|   kvm01.srv.world    |                     |    kvm02.srv.world   |
+----------------------+                     +----------------------+

[1]
Configure Storage server which has virtual machine images.
For Storage server, it's OK to use NFS, iSCSI, GlusterFS and so on.
This example uses NFS Storage server.
[2]
Configure 2 KVM host servers and mount a directory provided from Storage server on the same mount point on both KVM server.
This example mounts on [/var/kvm/images].
And also, 2 servers need to be resolv hostname or IP address each other via DNS or local hosts file.
[3]
Set SSH key-pair for root account because SSH is used between 2 KVM servers.
[4] Create a Virtual Machine on a KVM Host and migrate it to another KVM Host like follows.
# edit settings of VM you'd like to migrate

root@kvm01:~#
virsh edit debian
 <disk type='file' device='disk'>
      # add: sepcify disk cache mode [none]
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/var/kvm/images/debian.img'/>

root@kvm01:~#
virsh start debian

root@kvm01:~#
virsh list

 Id   Name     State
------------------------
 1    debian   running

root@kvm01:~#
virsh migrate --live debian qemu+ssh://10.0.0.52/system
root@kvm01:~#
virsh list

 Id   Name   State
--------------------
# VM is just migrated to another Host
### on another KVM Host ###

root@kvm02:~#
virsh list

 Id   Name     State
------------------------
 1    debian   running

# back to the KVM Host again like follows

root@kvm02:~#
virsh migrate --live debian qemu+ssh://10.0.0.51/system
root@kvm02:~#
virsh list

 Id    Name             State
--------------------------------------

Matched Content