On 03/13/2013 12:55 PM, Evaggelos Balaskas wrote: > Hi there, > i am trying to understand something that bothering me for some time now. > > A running domain has two things that someone needs to take backup. > So there is the disk and the state. > > Using snapshots as checkpoint someone can take the disk snapshot > but i cant understand how to "transfer" the saved state from "backup ed" disk. In other words, you want to revert to a snapshot. For internal snapshots, use 'virsh snapshot-revert $dom $snapname'; easy as can be. But libvirt is not quite there yet for external snapshots. We have ideas on what needs to happen, but there still needs to be some code written to get to that point. So for now, the answer is that you have to do it manually. > > Reading through Kashyap's and Eric's posts (mostly) i can now > understand a lot about > backing up and snapshotting but i cant figure out (perhaps i need to > read more) how to > boot up the snapshot disk with the saved (?) state. I'll start by describing an external snapshot where the memory was saved in /path/to/memstate, and where you have only a single disk image, such that the snapshot command made the disk have the following chain: orig.img <- snap.img Next, you need to decide how much you care about snap.img - do you plan on switching branches back and forth (you need a second qcow wrapper file), or are you discarding the work (you can go directly back to editing orig.img, and throw away snap.img)? If you are branching, then orig.img must remain untouched, so the solution is to hand-create a new qcow2 wrapper: qemu-img create -f qcow2 -o backing_file=/path/to/orig.img,backing_fmt=$fmt /path/to/branch.img with the correct $fmt according to what orig.img is, so that you now have a chain: /- snap.img orig.img < \- branch.img If you have more than one disk, just be sure to do the revert for all of the disks before reloading memory state. Now that you know what image you want to revert back to (branch.img for the branch case, orig.img for the discard case), you need to edit your memory state file to reflect that. Use 'virsh save-image-edit /path/to/memstate' and change the <disk> elements in that screen to point to the correct files. (You may want to copy /path/to/memstate, and only modify your copy, in case you goof). Now, you can revert to the snapshot state with 'virsh restore /path/to/memstate'. By this point in time, your hand-edits to the external snapshot information have probably rendered libvirt's snapshot metadata inaccurate; you may find it useful to 'virsh snapshot-delete --metadata $dom --$snapname' to clean up the mess in libvirt's tracking. Hope that helps, and hope we can find time to get this coded into libvirt itself before too much more time elapses. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ libvirt-users mailing list libvirt-users@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvirt-users