Copie de VM à chaud, notamment pour les sauvegardes

root@super-auforg2:/var/lib/libvirt/images# virsh stop sogo-test-saml
root@super-auforg2:/var/lib/libvirt/images# virsh edit sogo-test-saml 
Domain sogo-test-saml XML configuration edited.

***********
ajouter : 
<channel type="unix">
  <source mode="bind"/>
  <target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
***********
root@super-auforg2:/var/lib/libvirt/images# virsh start sogo-test-saml

root@super-auforg2:/var/lib/libvirt/images# md5sum sogo-test.img
0da14248266a3c49de7995c68d7dbad8  sogo-test.img
root@super-auforg2:/var/lib/libvirt/images#

mnombre@u-nm:~$ scp fichier.test sogo-test-saml:
fichier.test                                 100%  322MB  29.2MB/s   00:11    
mnombre@u-nm:~$

root@sogo-test-saml:~# stress --cpu 3 --io 1 --vm 1 --hdd 1 --hdd-bytes 1024K
stress: info: [4152] dispatching hogs: 3 cpu, 1 io, 1 vm, 1 hdd

root@super-auforg2:/var/lib/libvirt/images# md5sum sogo-test.img
0da14248266a3c49de7995c68d7dbad8  sogo-test.img

root@super-auforg2:/var/lib/libvirt/images# du -sh sogo-test.sogo-test-saml-snap 
404M    sogo-test.sogo-test-saml-snap

root@super-auforg2:/var/lib/libvirt/images# rsync -avh --progress /var/lib/libvirt/images/sogo-test.img ../images2/test-snapshot.img 
sending incremental file list
sogo-test.img
          4.88G 100%  207.59MB/s    0:00:22 (xfr#1, to-chk=0/1)

sent 4.88G bytes  received 35 bytes  216.90M bytes/sec
total size is 4.88G  speedup is 1.00

root@super-auforg2:/var/lib/libvirt/images# md5sum ../images2/test-snapshot.img
0da14248266a3c49de7995c68d7dbad8  ../images2/test-snapshot.img

root@super-auforg2:/var/lib/libvirt/images# virsh blockcommit sogo-test-saml vda --active --verbose --pivot
Block Commit: [100 %]
Successfully pivoted
root@super-auforg2:/var/lib/libvirt/images#

root@super-auforg2:/var/lib/libvirt/images# md5sum sogo-test.img
84630b7d3e6ddfa78591b36457894f20  sogo-test.img
root@super-auforg2:/var/lib/libvirt/images#

root@super-auforg2:/var/lib/libvirt/images# virsh snapshot-list sogo-test-saml
 Name                 Creation Time             State
------------------------------------------------------------
 sogo-test-saml-snap  2015-09-14 16:07:36 -0400 disk-snapshot

root@super-auforg2:/var/lib/libvirt/images# virsh snapshot-delete sogo-test-saml sogo-test-saml-snap  --metadata
Domain snapshot sogo-test-saml-snap deleted

root@super-auforg2:/var/lib/libvirt/images# virsh snapshot-list sogo-test-saml
 Name                 Creation Time             State
------------------------------------------------------------

root@super-auforg2:/var/lib/libvirt/images# 

KVMLibvirt/CopieVMàChaud (dernière édition le 2015-09-14 21:09:38 par MoussaNombre)