Ubuntu 20.04
Sponsored Link

KVM : Storage Migration2020/08/05

 
This is the example to use Storage Migration feature for Virtual Machines.
The different point of Storage Migration from Common Live Migration is that Storage Migration does not need a Storage server that has Virtual Machine images, when executing Storage Migration, Virtual Machine image on a KVM host is migrated on another KVM host like follows.
                          Storage Migration
                        <------------------->
                        
+----------------------+                     +----------------------+
|  [   KVM Host #1  ]  |10.0.0.21   10.0.0.22|  [  KVM Host #2   ]  |
|                      +---------------------+                      |
|   kvm01.srv.world    |                     |    kvm02.srv.world   |
+----------------------+                     +----------------------+

[1]
Configure 2 KVM Host Server and Create a Virtual Machine on a KVM Host.
Configure DNS or hosts to resolve names or IP addresses normally, first.
[2] Show the file size of a Virtual Machine image like follows on a KVM host and next, move to another KVM host to create an empty disk like follows.
# show the size of Virtual machine

root@kvm01:~#
ll /var/kvm/images

total 5201608
drwxr-xr-x 2 root root        4096 May 16 20:48 ./
drwxr-xr-x 3 root root        4096 May 16 20:21 ../
-rw------- 1 root root 32217432064 May 17 20:12 ubuntu2004.img

### on another KVM host ###

# create a disk which is the same size of a Virtual Machine

root@kvm02:~#
qemu-img create -f qcow2 /var/kvm/images/ubuntu2004.img 32217432064

root@kvm02:~#
ll /var/kvm/images

total 204
drwxr-xr-x 2 root root   4096 May 19 20:43 ./
drwxr-xr-x 3 root root   4096 May 19 19:18 ../
-rw-r--r-- 1 root root 197096 May 19 20:43 ubuntu2004.img
[3] That's OK, Run Storage Migration like follows.
root@kvm01:~#
virsh list

 Id    Name                           State
----------------------------------------------------
 1     ubuntu2004                     running

root@kvm01:~#
virsh migrate --live --copy-storage-all ubuntu2004 qemu+ssh://10.0.0.22/system

root@kvm01:~#
virsh list

 Id    Name             State
--------------------------------------
# just migrated
### on another KVM host ###

root@kvm02:~#
virsh list

 Id    Name                           State
----------------------------------------------------
 2     ubuntu2004                     running
Matched Content