Debian 10 Buster
Sponsored Link

KVM : Storage Migration2019/07/23

 
This is the example to use Storage Migration function for virtual machines.
The different point of Storage Migration from Live Migration is that Storage Migration does not need a Storage server which has virtual machine images, when executing Storage Migration, virtual machine image on a KVM host is migrated on another KVM host.
                          Storage Migration
                        <------------------->
                        
+----------------------+                     +----------------------+
|  [   KVM Host #1  ]  |10.0.0.51   10.0.0.52|  [  KVM Host #2   ]  |
|                      +---------------------+                      |
|   kvm01.srv.world    |                     |    kvm02.srv.world   |
+----------------------+                     +----------------------+

[1]
Configure 2 KVM Host Servers and Create a Virtual Machine on a KVM Host.
2 KVM Host Servers need to be resolv hostname or IP address each other via DNS or local hosts file.
[2] Show the file size of a Virtual Machine image on a KVM host, and move to another KVM Host, then create a empty disk image that is the same size of Virtual Machine.
# show the size of Virtual machine

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

total 7237660
-rw------- 1 root root 21478375424 Jul 22 22:16 debian.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/debian.img 21478375424

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

total 196
-rw-r--r-- 1 root root 196936 Jul 23 19:18 debian.img
[3] That's OK, execute Storage Migration like follows.
root@kvm01:~#
virsh list

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

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

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

root@kvm02:~#
virsh list

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

# back to another host, run Live migration with unsafe option

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

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

Matched Content