2. cold snapshot and live snapshot cold snapshot: 创建snapshot时,需暂停虚拟机。 live snapshot: 创建snapshot时,无需暂停虚拟机。
3. cold snapshot 流程: # 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