# remove the snapshot file:
rm /var/virtualization/vm-templates/5b77d2f6-061f-410c-8ee7-9e61da6f1927/bbf7796f-90bf-45ab-8645-2894f5dae727.snap01.qcow2
</source>
== Command overview ==
<source lang='bash'>
# create a snapshot for all disks
virsh snapshot-create 8196bb77-7478-4bfb-a6ea-52b3a2c65eba kvm-0022-snapshot-01.xml --disk-only --atomic --quiesce
# TODO: copy images away at this point
# initiate the block commit for the first disk
# TODO: do this for all disks
virsh qemu-monitor-command 8196bb77-7478-4bfb-a6ea-52b3a2c65eba --pretty '{"execute":"block-commit", "arguments": { "device":"drive-virtio-disk0", "base": "gluster://10.122.0.11/virtualization/vm-persistent/0f83f084-8080-413e-b558-b678e504836e/711b08f2-7c26-4ac3-bb46-66176523d752.qcow2", "top": "gluster://10.122.0.11/virtualization/vm-persistent/0f83f084-8080-413e-b558-b678e504836e/711b08f2-7c26-4ac3-bb46-66176523d752.snapshot-01.qcow2" } }'
# monitor the progress
virsh blockjob 8196bb77-7478-4bfb-a6ea-52b3a2c65eba vda
virsh qemu-monitor-command 8196bb77-7478-4bfb-a6ea-52b3a2c65eba --pretty '{"execute": "query-block-jobs"}'
# when finished, have Qemu finish it (TODO: check whether we would have to install a dirty block tracer at some point):
virsh qemu-monitor-command 8196bb77-7478-4bfb-a6ea-52b3a2c65eba --pretty '{"execute": "block-job-complete", "arguments": { "device": "drive-virtio-disk0"} }'
# remove the snapshot information in libvirt. As an alternative, one could tell libvirt when creating the snapshot to not record any information about it (--no-metadata)
virsh snapshot-delete 8196bb77-7478-4bfb-a6ea-52b3a2c65eba --current --metadata
# remove the snapshot
rm /var/virtualization/vm-persistent/0f83f084-8080-413e-b558-b678e504836e/711b08f2-7c26-4ac3-bb46-66176523d752.snapshot-01.qcow2
# have libvirt forget about it as well
virsh edit 8196bb77-7478-4bfb-a6ea-52b3a2c65eba
</source>
[[Category:Snippets]]