On Fri, Oct 09, 2020 at 10:10:18AM +0200, Markus Armbruster wrote: > Eric Blake <ebl...@redhat.com> writes: > > > Allow the server to expose an additional metacontext to be requested > > by savvy clients. qemu-nbd adds a new option -A to expose the > > qemu:allocation-depth metacontext through NBD_CMD_BLOCK_STATUS; this > > can also be set via QMP when using block-export-add. > > > > qemu as client can be hacked into viewing this new context by using > > the now-misnamed x-dirty-bitmap option when creating an NBD blockdev > > (even though our x- naming means we could rename it, I did not think > > it worth breaking back-compat of tools that have been using it while > > waiting for a better solution). It is worth noting the decoding of > > how such context information will appear in 'qemu-img map > > --output=json': > > > > NBD_STATE_DEPTH_UNALLOC => "zero":false, "data":true > > NBD_STATE_DEPTH_LOCAL => "zero":false, "data":false > > NBD_STATE_DEPTH_BACKING => "zero":true, "data":true > > > > libnbd as client is probably a nicer way to get at the information > > without having to decipher such hacks in qemu as client. ;) > > > > Signed-off-by: Eric Blake <ebl...@redhat.com> > > Message-Id: <20200930121105.667049-6-ebl...@redhat.com> > > Reviewed-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> > > [eblake: comment tweak suggested by Vladimir] > > Signed-off-by: Eric Blake <ebl...@redhat.com> > > --- > [...] > > diff --git a/qapi/block-core.json b/qapi/block-core.json > > index 3758ea991269..249bd434f4eb 100644 > > --- a/qapi/block-core.json > > +++ b/qapi/block-core.json > > @@ -3882,9 +3882,12 @@ > > # > > # @tls-creds: TLS credentials ID > > # > > -# @x-dirty-bitmap: A "qemu:dirty-bitmap:NAME" string to query in place of > > +# @x-dirty-bitmap: A metacontext name such as "qemu:dirty-bitmap:NAME" or > > What is a "metacontext"? > > Aside: nbd.h spells it "meta context". The two spellings suggest > different meanings to me. Using meta- as a prefix modifies the prefixed > word, as in metadata (data that provides information about other data). > Separated by space, meta becomes a noun. None of its common meanings > seem to apply here. Recommend to pick an appropriate one of > "metacontext", "meta-context", "meta context", and stick to it.
In the NBD protocol it's called a "metadata context". This is abbreviated to "...META_CONTEXT" in the names of constants, eg. NBD_OPT_SET_META_CONTEXT. For the reasons you gave I don't think it's a very good name, but it's what we have. https://github.com/NetworkBlockDevice/nbd/blob/master/doc/proto.md#metadata-querying What it actually is, is a string, like "base:allocation" or "qemu:dirty-bitmap:<NAME>" which selects which metadata you want to query in NBD_CMD_BLOCK_STATUS commands. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/