Ubuntu 18.04
Sponsored Link

KVM : Storage Migration2018/05/18

 
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 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.
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 like follows on a KVM host and move to another KVM host, create a 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 ubuntu1804.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/ubuntu1804.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 ubuntu1804.img
[3] It's OK all, execute Storage Migration like follows.
root@kvm01:~#
virsh list

 Id    Name                           State
----------------------------------------------------
 1     ubuntu1804                     running

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

root@10.0.0.22's password:
root@kvm01:~#
virsh list

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

root@kvm02:~#
virsh list

 Id    Name                           State
----------------------------------------------------
 2     ubuntu1804                     running

# back to another host, it's OK to execute normal Live Migration

root@kvm02:~#
virsh migrate --live ubuntu1804 qemu+ssh://10.0.0.21/system

root@10.0.0.21's password:
root@kvm02:~#
virsh list

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

Matched Content