4

I have created an external snapshot with KVM using

virsh snapshot-create-as domain --name snap1 --disk-only

Then, I started the domain with β€œvirsh start domain”. I know that reverting to external snapshots is not yet implemented (at least not in RHEL7) and there is the possibility to do it manually by editing XML and using qemu-ing. But all HOWTOS that I've found are vague or doubtful or both.

So, how to you throw away the current overlay and return to the latest snapshot, starting a fresh overlay on top of it?

What I've found so far:

  • quasi-official workaround: This is linked to by RedHat's documentation. I find this very complicated and without concrete instructions.
  • answer on Stackexchange: This is vague. What should I change in the XML file? How do I cleanly remove the overlay?
  • Linux Mint Forums post: This is at least slightly helpful for me. But why should I change the file type to β€œraw”? Besides, this doesn't seem to start a fresh overlay on top of the latest snapshot but instead append changes to the overlay before the current one, doesn't it?
Daniel B
  • 60,360
  • 9
  • 122
  • 163
Torsten Bronger
  • 452
  • 5
  • 19

1 Answers1

1

After taking a live external snapshot with --atomic the libvirt xml will be something like:

<disk type='file' device='disk'>
  <driver name='qemu' type='qcow2'/>
  <source file='/srv/qemu/images/proxmox4-node2.pre_upgrade'/>
  <backingStore type='file'>
    <format type='qcow2'/>
    <source file='/srv/qemu/images/proxmox4-node2.qcow2'/>
  </backingStore>
  <target dev='vda' bus='virtio'/>
  <boot order='1'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</disk>

To revert the vm back simply virsh edit my_domain to:

<disk type='file' device='disk'>
  <driver name='qemu' type='qcow2'/>
  <source file='/srv/qemu/images/proxmox4-node2.qcow2'/>
  <target dev='vda' bus='virtio'/>
  <boot order='1'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</disk>
Stuart Cardall
  • 316
  • 2
  • 7