CentOS 8
Sponsored Link

KVM : Storage Migration
2019/10/08
 
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] On KVM Hosts, if Firewalld is running, allow ports.
[root ~]#
firewall-cmd --add-service={libvirt,libvirt-tls} --permanent

[root ~]#
firewall-cmd --add-port=49152-49215/tcp --permanent

[root ~]#
firewall-cmd --reload

[3] 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 7950652
-rw-------. 1 root root 32217432064 Oct  7 20:54 centos8.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/centos8.img 32217432064

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

total 196
-rw-r--r--. 1 root root 197096 Oct  8 19:33 centos8.img
[4] That's OK, Run Storage Migration like follows.
root@kvm01:~#
virsh list

 Id    Name                           State
----------------------------------------------------
 1     centos8                        running

root@kvm01:~#
virsh migrate --live --copy-storage-all centos8 qemu+ssh://kvm02.srv.world/system

root@kvm02.srv.world's password:
root@kvm01:~#
virsh list

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

root@kvm02:~#
virsh list

 Id    Name                           State
----------------------------------------------------
 1     centos8                        running
Matched Content