Comment 5 for bug 1025244

Revision history for this message
Todor Andreev (toshko3) wrote :

I did some testing with a WindowsXP guest, that I have and could test on.
It seems that this behavior is not present at the beginning. But at the moment we create a snapshot it is starting to write on top of the current size. So, it is like this:
 1. Image is:

Code:
qemu-img info WindowsXP.img
image: WindowsXP.img
file format: qcow2
virtual size: 15G (15728640000 bytes)
disk size: 13G
cluster_size: 65536

I write some files and it doesn't become more than that.

 2. I delete some files, then write again and it doesn't changes size.
 3. I create a snapshot:

Code:
qemu-img info WindowsXP.img
image: WindowsXP.img
file format: qcow2
virtual size: 15G (15728640000 bytes)
disk size: 13G
cluster_size: 65536
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 test 0 2012-07-17 09:52:25 00:00:00.000

4. I write something with a size of 587MB and it becomes larger (with 587MB)

Code:
du -sm WindowsXP.img
14102 WindowsXP.img

5. I delete it and then write it again. It becomes more larger... (again with another 587MB)

Code:
du -sm WindowsXP.img
14703 WindowsXP.img

6. I delete it and then write it again. It doesn't change this time.

7. I write a copy of it. It becomes larger (with 587MB)

Code:
du -sm WindowsXP.img
15309 WindowsXP.img

8. I delete it and then write it again. It doesn't change this time.

9. I write a copy of it. It becomes larger again (with 587MB)

Code:
du -sm WindowsXP.img
16010 WindowsXP.img

10. I write another copy of it and it stays the same.

Code:
du -sm WindowsXP.img
16010 WindowsXP.img

11. I write another copy of it and becomes larger again.

Code:
du -sm WindowsXP.img
16913 WindowsXP.img

Code:
qemu-img info WindowsXP.img
image: WindowsXP.img
file format: qcow2
virtual size: 15G (15728640000 bytes)
disk size: 17G
cluster_size: 65536
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 test 0 2012-07-17 09:52:25 00:00:00.000

12. Create a snapshot.
13. I write a copy of it. It becomes larger again (with 587MB)

Code:
du -sm WindowsXP.img
17572 WindowsXP.img

14. I delete both of the snapshots.
15. I delete the file (in guest with the size of 587MB) and write it again. No change in size.
16. I delete the file again and write it again. No change in size.
17. Create a snapshot.
18. I delete the file again and write it again. No change in size.
19. Delete the file.
20. Create a snapshot.
21. Write the file again. No change in size.

 Well from all this, I can conclude that most probably:
 1. The problem occurs only when there is an internal snapshot present.
 2. The problem is not "by design" because the behavior is not consistent (for example, 13. and 21. should be with the same result, but they arent't)..

At the end of the day, after these procedures (4 creations of snapshots, 2 deletions and some writing and deleting of internal guest files) the result is this:

Code:
qemu-img info WindowsXP.img
image: WindowsXP.img
file format: qcow2
virtual size: 15G (15728640000 bytes)
disk size: 17G
cluster_size: 65536
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 test2 0 2012-07-17 14:55:17 00:00:00.000
2 test3 0 2012-07-17 15:27:43 00:00:00.000

and

Code:
ls -lsh WindowsXP.img
18G -rw------- 1 libvirt-qemu kvm 18G Jul 17 15:43 WindowsXP.img