On 7/5/19 10:28 AM, Eric Blake wrote: > Commit b76b4f60 allowed '-o compat=v3' as an alias for the > less-appealing '-o compat=1.1' for 'qemu-img create' since we want to > use the QMP form as much as possible, but forgot to do likewise for > qemu-img amend. Also, it doesn't help that '-o help' doesn't list our > new preferred spellings. > > Signed-off-by: Eric Blake <ebl...@redhat.com> > --- > > I'm arguing that the lack of consistency is a bug, even though the bug > has been present since 2.12.
I found this bug while chasing down another one: trying to see if we can now lift our restriction against 'qemu-img resize' on an image with internal snapshots. For v3 images, the limitation is artificial (the spec says every snapshot is required to have an associated size, so you know what size to change back to when reverting to that snapshot); but for v2 the limitation is real (the spec did not require tracking image size, and therefore changing the size meant that you might not be able to safely revert). Except that we ALSO have a bug in qemu-img amend: 1. Create a v2 file with internal snapshot. On CentOS 6: $ qemu-img create -f qcow2 file 1m $ qemu-img snapshot -c s1 file 2. Check that the internal snapshot header uses the smaller size: $ od -Ax -j64 -N8 -tx1 file # Learn the offset for the next command $ offset=$((0x50000+36)) $ od -Ax -j$offset -N 4 -tx1 file => extra field is 0 3. Upgrade it to v3. Using qemu.git master: $ qemu-img amend -o compat=1.1 file 4. Check the internal snapshot header size: $ od -Ax -j64 -N8 -tx1 file # Learn the offset for the next command $ offset=$((0x50000+36)) $ od -Ax -j$offset -N 4 -tx1 file => oops - extra field is still 0, but should now be at least 16. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature