https://bugzilla.novell.com/show_bug.cgi?id=651822
https://bugzilla.novell.com/show_bug.cgi?id=651822#c3
--- Comment #3 from Dongyang Li 2010-11-13 12:53:09 UTC ---
ok, this is embarrassing, I think I've found the reason:
right now when we do the snapshot without -d, we save the vmstat and tell
qemu-dm to create the snapshot inside the qcow2 image, this is all done,
and after taking the snapshot, if any write request come to the image, the
internal L1 and L2 table of qcow2 has changed due to the snapshot ref count.
that's normal by far,
and when we apply the snapshot, we restore the vmstat, but doesn't tell qcow2
to switch to the snapshot just created,
now you may guess what happened next: the vmstat contains the memory of the vm,
thus including the page cache(which might has some dirty data to flush), the
inode cache, the dcache and so on, and if we make a write request, we will use
the newer L1 and L2 table of qcow2,and our memory is expecting the old ones, so
the inconsistent vmstat -- qcow2 image state will result the corruption.
you can make a experiment to reflect this:
make a snapshot with -d option: only same the disk image
after taking the snapshot, make some changes to the disk, and shut the vm down.
apply the snapshot, you'll find the changes made *after* the snapshot appears.
and here is a patch for this: fix the regression - record the snapshot name in
the snapshot control file so qcow2 snapshot will be loaded.
diff --git a/tools/python/xen/xend/XendCheckpoint.py
b/tools/python/xen/xend/XendCheckpoint.py
index 49c2729..bb00ddc 100644
--- a/tools/python/xen/xend/XendCheckpoint.py
+++ b/tools/python/xen/xend/XendCheckpoint.py
@@ -79,6 +79,9 @@ def save(fd, dominfo, network, live, dst, checkpoint=False,
node=-1, name=None,
sxprep = dominfo.sxpr()
+ if name:
+ sxprep.append(['snapshotname', name])
+
if node > -1:
insert_after(sxprep,'vcpus',['node', str(node)])
you'd better restart your xend
and to the snapshot - clone question:
after reading the comments in the qcow2 source, I think the snapshot of qcow2
should be called "clone" as you said the changes will be remained, but
according to the source code of qcow2, everytime you apply a snapshot of qcow2,
the L1 and L2 table will be re-written to the snapshot's so after applying the
snapshot, you'll always using the snapshot, not the original image, it that
what you want?
and correct me if am wrong, thanks.
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.