On 3/10/20 4:47 AM, Kashyap Chamarthy wrote:
To provoke the warning during convert, you'll
have to also pass -B (or -o backing_file), without -o backing_fmt (since
convert lacks the -F shorthand).
Hmm, I tried the following way, but it doesn't provoke the warning:
$> ~/build/qemu/qemu-img convert -B ./base.raw -O qcow2 overlay1.qcow2 flattened.qcow2
$> ~/build/qemu/qemu-img info flattened.qcow2
image: flattened.qcow2
file format: qcow2
virtual size: 4 GiB (4294967296 bytes)
disk size: 196 KiB
cluster_size: 65536
backing file: ./base.raw
Format specific information:
compat: 1.1
lazy refcounts: false
refcount bits: 16
corrupt: false
What am I missing?
Rather, it looks like my patch is missing a warning on that path. I'll
have to investigate, for v4.
- - -
<digression>
Ah, didn't realize the inconsistency of 'convert' lacking the '-F'
shorthand ... which reminds me, there are at least _three_ ways that I
know of, to specify backing file format with 'create':
$ qemu-img create -f qcow2 -o 'backing_file=./base.raw,backing_fmt=raw' ./overlay1.qcow2
$ qemu-img create -f qcow2 -b ./base.raw -o backing_fmt=raw overlay1.qcow2
$ qemu-img create -f qcow2 -b ./base.raw -F raw ./overlay1.qcow2
I'm wondering about the consistency of having all the above three
supported for other operations too. Now I at least know 'convert' lacks
the "-F".
The -o forms (backing_file= and backing_fmt=) always work. Various
commands then have additional shorthand: -b/-F for create, -B for
convert. You're right that we aren't very consistent, but I'm reluctant
to change the inconsistencies in this patch (at one point in the past,
we tried to get rid of the shorthand and force all users to go through
-o, but that broke too many clients that were depending on the
undocumented shorthand, so we documented the existing shorthand instead).
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org