On 10/6/26 17:11, Eric Blake wrote:
> On Sun, Sep 13, 2026 at 09:52:59PM +0200, Denis V. Lunev wrote:
>> From: Denis V. Lunev <[email protected]>
>>
>> Nothing tells which persistent bitmaps an image carries. qemu-img info
>> says nothing about them, and the only other way to see one is to export
>> the image over NBD and ask for a bitmap by name, which needs the name
>> beforehand.
> I would amend that statement, "s/an image/a parallels image/"; because
> existing 'qemu-img info' definitely tells you what bitmaps a qcow2
> image has:
>
> $ qemu-img create -f qcow2 base.qcow2 100M
> Formatting 'base.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off 
> compression_type=zlib size=104857600 lazy_refcounts=off refcount_bits=16
> $ qemu-img bitmap --add -f qcow2 base.qcow2 bm1
> $ qemu-img bitmap --add -f qcow2 base.qcow2 bm2
> $ qemu-img info base.qcow2
> image: base.qcow2
> file format: qcow2
> virtual size: 100 MiB (104857600 bytes)
> disk size: 220 KiB
> cluster_size: 65536
> Format specific information:
>     compat: 1.1
>     compression type: zlib
>     lazy refcounts: false
>     bitmaps:
>         [0]:
>             flags:
>                 [0]: auto
>             name: bm1
>             granularity: 65536
>         [1]:
>             flags:
>                 [0]: auto
>             name: bm2
>             granularity: 65536
>     refcount bits: 16
> ...
>
>
> Also, the NBD protocol indeed allows a client to query what
> metacontexts an image supports, which can be used to expose bitmaps;
> and both 'qemu-nbd -L' and libnbd's 'nbdinfo' are happy to read that
> information.  But, at present, qemu-nbd limits us to exposing that on
> a per-bitmap basis, rather than having an easy way to export all
> bitmaps at once.  For example,
>
> $ qemu-nbd -L
> exports available: 1
>  export: ''
> ...
>   available meta contexts: 4
>    base:allocation
>    qemu:allocation-depth
>    qemu:dirty-bitmap:bm2
>    qemu:dirty-bitmap:bm1
> $ nbdinfo nbd://localhost
> protocol: newstyle-fixed without TLS, using extended packets
> export="":
> ...
>       contexts:
>               base:allocation
>               qemu:allocation-depth
>               qemu:dirty-bitmap:bm2
>               qemu:dirty-bitmap:bm1
> ...
>
> So I will probably submit a patch to add a command-line flag to
> qemu-nbd to expose all known bitmaps without having to do a -B option
> per name, on top of this series.

That is a good point. I have done similar with

commit 7e8cc6c886, "qemu-img: add sub-command --remove-all to 'qemu-img
bitmap'".

Den

Reply via email to