On 09/05/2013 02:13 PM, Plamen Dimitrov wrote:
> Hello virt-test developers,
> 
> I decided to rely on the vm snapshot functionality in order to reuse
> appropriate setup for some of the tests we developed for our product.
> For this purpose I used the /save_to_file()/ or respectively
> /restore_from_file()/ methods of the /qemu_vm.VM /class. My problem is
> however that when the vm state is being restored from a file the
> filesystem is in an unclean state detecting missing inodes and some of
> the programs are crashing. Therefore my main question is are there any
> issues that are known with these functions? I know that a /system_reset/
> command is used during the vm snapshot saving but the problem I talk
> about appear after loading the saved vm snapshot. I am ready to post
> some code if you think this is appropriate and also to mention the
> solutions I have gone through however without any success at the moment.
> 
> Thank you,
> Plamen Dimitrov

I can't speak much for the qemu_vm code at this time since it's been a
really long time since I've looked at it.  I do remember that lmr
reported having some disk corruption problems back when I wrote those
two methods.  However, I think he eventually found the cause and fixed
it, maybe he remembers better.

In general, this mechanism may not be the best for you since there isn't
any way to guarantee storage state is maintained exactly the same as VM
state was at the time of /save_to_file()/.  In other words, if after
saving, the VM's storage is modified in ANY way (even just mounting it
rw somewhere then unmounting) it's very easy to corrupt when the VM resumes.

As you may know/guess, this is because the VM may have both I/O and/or
pagecache operations in-flight when it's paused & saved.  Therefor,
if/when storage changes underneath, it will easily become corrupted when
those operations complete on resume.  There are few (if any) protections
against this happening, short of externally capturing storage hashes
after save, and comparing/verifying them before resume.

That said, one option you may consider is snapshotting the VM's storage
after /save_to_file()/.  Then you may do whatever you like to the
snapshot, as long as it's destroyed prior to /load_from_file()/ (thereby
guaranteeing unchanged storage state WRT VM state).  There are probably
other ways to handle this, but w/o knowing more about your requirements,
I'd only be guessing.

Anyway, I hope this helps.

-- 
Chris Evich, RHCA, RHCE, RHCDS, RHCSS
Quality Assurance Engineer
e-mail: cevich + `@' + redhat.com o: 1-888-RED-HAT1 x44214

_______________________________________________
Virt-test-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-test-devel

Reply via email to