From: Stephen McCamant <smcc@CS.Berkeley.EDU>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Combining "loadvm" and "-snapshot"
Date: Wed, 21 Jan 2009 13:09:11 -0800 [thread overview]
Message-ID: <18807.36599.764676.138289@amuro.CS.Berkeley.EDU> (raw)
In-Reply-To: <4976E704.7020607@suse.de>
>>>>> "KW" == Kevin Wolf <kwolf@suse.de> writes:
KW> Stephen McCamant schrieb:
SMcC> I've tried implementing an alternate approach that makes
SMcC> "loadvm" work under "-snapshot" by finding and loading the VM
SMcC> state from the backing image, if a snapshot with that name isn't
SMcC> found in the scratch image. In some preliminary testing, this
SMcC> seems to do what I want; you can also make new snapshots with
SMcC> savevm that live only in the scratch image (and so go away at
SMcC> the end of the session).
KW> I think, this is the point where your approach will break. A
KW> snapshot in the scratch image is still based on a snapshot in the
KW> backing image. So on loading the scratch snapshot you would also
KW> need to load the snapshot for the backing file. However, you don't
KW> know which one because qcow2 can't save a snapshot name for the
KW> backing file.
Ah yes, I think I understand the problem you're referring to. For
instance, if you have two states snap1 and snap2 in the backing image,
and then you save a snapshot "snap1a" in the scratch image based on
snap1, then load snap2, then try to load snap1a, the disk will have an
inconsistent state that's a mixture of snap2 and the differences
between snap1 and snap1a. By playing around with file and directory
contents in snapshots (and unmounting and remounting to bypass the
buffer cache), I can make this show up as corrupted file contents.
I think you could work around this problem by loading the appropriate
backing disk snapshot first, but the need for that isn't intuitive, so
I can see it easily tripping users up. (I presume you can get into
similar trouble if you modify a backing image that a persistent
scratch image is pointing to, though in that case it's clearer what
you're doing wrong.)
As you suggest, the right fix would seem to be to have the scratch
disk snapshots remember what backing disk state they're based on,
though there's no field for that in the current QCOW2 format. It looks
like there is some space left for expansion at the end of the snapshot
structure, though that would be a bigger change. Or if you limit
yourself to the "-snapshot" case, and not persistent backed disk
images, it would be enough to keep the information in memory.
More generally, what I'd like to figure out would be some subset of
this functionality that can have a simple implementation and that's
relatively fool-proof for users, without foreclosing the possibility
of enabling more combinations in the future. Though it was nice to see
that savevm/loadvm in the scratch image mainly worked without
additional effort, I don't really have a need for it. In fact, I would
be satisfied even if the only allowed combination was a "-loadvm"
command-line option used at the same time as "-snapshot", and the
monitor commands were just as limited as they are now.
-- Stephen
next prev parent reply other threads:[~2009-01-21 21:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-20 23:58 [Qemu-devel] Combining "loadvm" and "-snapshot" Stephen McCamant
2009-01-21 9:12 ` Kevin Wolf
2009-01-21 21:09 ` Stephen McCamant [this message]
2009-01-22 10:01 ` Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=18807.36599.764676.138289@amuro.CS.Berkeley.EDU \
--to=smcc@cs.berkeley.edu \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).