# Save the state and stop a running guest, then detach pci devices$ virsh managedsave vm# Create a qemu internal snapshot$ qemu-img snapshot -c snap1 vm_snapshot# Extract the internal snapshot, convert it to qcow2 and export it a file, then upload to glance$ qemu-img convert -f qcow2 vm -O qcow2 vm_snapshot# Start the guest again$ virsh start vm
4. live snapshot 流程
# Abort any failed/finished block operations:
$ virsh blockjob vm vda --abort
# Undefine a running domain. (Note: Undefining a running domain does not _kill_ the domain, it just converts it from persistent to transient.)
$ virsh undefine vm
# create a destination image with the original backing file and matching size of the instance root disk.
$ qemu-img create -f qcow2 vm_copy --backing_file=backing_file --size=root_disk_size
#Invoke ‘virsh blockcopy‘ (This will take time, depending on the size of disk image vm1):
$ virsh blockcopy --domain vm vda vm_copy --wait --verbose
#Abort any failed/finished block operations:
$ virsh blockjob vm vda --abort
#Define the guest again (to make it persistent):
$ virsh define vm
#From the obtained new copy, convert the QCOW2 with a backing file to a qcow2 image with no backing file, then upload to glance:
$ qemu-img convert -f qcow2 -O raw vm_copy vm_convert
5. virsh snapshot-create-as/snapshot-create 快照简析
默认为内置快照,支持快照链,支持快照回滚,支持内存信息。
快照过程中,虚拟机短暂卡顿。
不知 openstack 为什么不通过该方法实现主流快照 ?!
6. conclusion
支持功能
限制与缺点
不支持含元数据导出,不支持含元数据导入
原文地址:http://blog.csdn.net/wsfdl/article/details/38522099