On 09/13/2012 03:41 AM, Guannan Ren wrote:
BZ:https://bugzilla.redhat.com/show_bug.cgi?id=843372
when qemu supports the 'transaction' monitor command,
and libvirt's --reuse-ext flag was not specified, libvirt created
a stub file with zero size in first place. After the failure of
QEMU transaction command performing qcow2 snapshots on more than
one drives, the stub file is left behind with non-empty
by the QEMU transaction command.
In order to unlink the file, the patch removes the file size checking.
I was still hoping you'd list the reproduction steps here in the commit
message, rather than making me chase down a link. Remember, a year down
the road, when reading 'git log', the more self-contained the log is,
the easier it will be to understand WHY the patch is appropriate.
Conditional ACK - no need to post a v3; I'm okay if you push once you
amend the commit message. Keep the mention of the BZ number, but also
add this text (from your previous message).
qemu left non-empty file.
Steps:
1, Create a qemu instance with two drive images of qcow2 type (root
user)
/usr/libexec/qemu-kvm -m 1024 -smp 1 -name "rhel6u1" \
-drive
file=/var/lib/libvirt/images/firstqcow2,if=none,id=drive-virtio-disk0,format=qcow2,cache=none
-device
virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1
\
-drive
file=/var/lib/libvirt/images/secondqcow2,if=none,id=drive-virtio-disk1,format=qcow2,cache=none
\
-device
virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=drive-virtio-disk1,id=virtio-disk1
-qmp stdio
2, Initialize qemu qmp
{"execute":"qmp_capabilities"}
3, Remove the second drive image file
rm -f /var/lib/libvirt/images/secondqcow2
4, Run 'transaction' command with snapshot qemu commands in.
{"execute":"transaction","arguments":
{"actions":
[{"type":"blockdev-snapshot-sync","data":{"device":"drive-virtio-disk0","snapshot-file":"/var/lib/libvirt/images/firstqcow2-snapshot.img","format":"qcow2"}},
{"type":"blockdev-snapshot-sync","data":{"device":"drive-virtio-disk1","snapshot-file":"/var/lib/libvirt/images/secondqcow2-snapshot.img","format":"qcow2"}}]
},
"id":"libvirt-6"}
5, Got the error as follows:
{"id": "libvirt-6", "error": {"class":
"OpenFileFailed",
"desc": "Could not open
'/var/lib/libvirt/images/secondqcow2-snapshot.img'",
"data": {"filename":
"/var/lib/libvirt/images/secondqcow2-snapshot.img"}}}
6, List first newly-created snapshot file:
-rw-r--r--. 1 root root 262144 Sep 13 11:43
firstqcow2-snapshot.img
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org