Assume that you have installed and run the VM1 VM.
Create an XML file vmdesksnapshot.xml with the following content:
<domainsnapshot> <name>vm1_snapshot</name> <description>Ubuntu 12.10 AMD64 server</description></domainsnapshot>
Run the following command to create the snapshot of VM1:
virsh snapshot-create vm1 ./vm1_snapshot.xmlDomain snapshot vm1_snapshot created from './vm1_snapshot.xml'
Check the snapshot of VM1.
virsh snapshot-list vm1 Name Creation Time State------------------------------------------------------------ vm1_snapshot 2012-11-14 14:46:44 +0800 running
Now, log on to the running VM1 and add a file under/root /.
Touch XY
Well, use vm1_snapshot to replace the current VM1 (or restore VM1 to the State saved by vm1_snapshot)
virsh snapshot-revert vm1 vm1_snapshot
Log on to VM1 again, and the XY file does not exist under/root. Restored successfully.
If you do not need this vm1_snapshot, you can use the following command to delete it:
virsh snapshot-delete vm1 vm1_snapshotDomain snapshot vm1_snapshot deletedroot@host2:~/kvm# virsh snapshot-list vm1 Name Creation Time State------------------------------------------------------------