On Wed, Feb 28, 2024 at 7:58 PM Kevin Wolf <kw...@redhat.com> wrote:
> Am 28.02.2024 um 12:30 hat Daniel P. Berrangé geschrieben: > > On Wed, Feb 28, 2024 at 11:17:37AM +0100, Kevin Wolf wrote: > > > Until now, @size has been mandatory for creating images with every > > > driver. Maybe we should even have put it into BlockdevCreateOptions's > > > base, because without a size, you're not really creating an image. > > > > NB, @size isn't mandatory for creating images. It isn't required > > when creating qcow2 files with backing stores, as the size is > > acquired from the backing file instead. > > > > $ qemu-img create demo.raw 1g > > Formatting 'demo.raw', fmt=raw size=1073741824 > > $ qemu-img create -o backing_file=demo.raw -o backing_fmt=raw -f qcow2 > demo.qcow2 > > Formatting 'demo.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off > compression_type=zlib size=1073741824 backing_file=demo.raw backing_fmt=raw > lazy_refcounts=off refcount_bits=16 > > Yes, 'qemu-img create' is different, it adds some convenience magic like > this. But for 'blockdev-create', it's mandatory for every driver. I > double checked the QAPI schema. > > Kevin > > IMHO, LUKS detached header creation is not the case as qcow2 backing store creation in aspect of allowing @size absent, since qemu-img creation process fetch the @size from backing file as Daniel said above actually, while contrastively LUKS detached header creation with no need for @size. Making @size optional feels better for me. Yong -- Best regards