All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] block/raw-format: implement .bdrv_get_specific_info handler
@ 2021-07-07  5:35 Or Ozeri
  2021-07-07  7:51 ` Kevin Wolf
       [not found] ` <OFCAC1F821.335F9C72-ON0025870B.00309CB1-0025870B.00309CB5@ibm.com>
  0 siblings, 2 replies; 3+ messages in thread
From: Or Ozeri @ 2021-07-07  5:35 UTC (permalink / raw)
  To: qemu-devel
  Cc: kwolf, berrange, qemu-block, dannyh, oro, idryomov, to.my.trociny

When using the raw format, allow exposing specific info by the underlying storage.
In particular, this will enable RBD images using the raw format to indicate
a LUKS2 encrypted image in the output of qemu-img info.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
---
 block/raw-format.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/block/raw-format.c b/block/raw-format.c
index 7717578ed6..f6e70e2356 100644
--- a/block/raw-format.c
+++ b/block/raw-format.c
@@ -369,6 +369,12 @@ static int raw_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
     return bdrv_get_info(bs->file->bs, bdi);
 }
 
+static ImageInfoSpecific *raw_get_specific_info(BlockDriverState *bs,
+                                                Error **errp)
+{
+    return bdrv_get_specific_info(bs->file->bs, errp);
+}
+
 static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
 {
     if (bs->probed) {
@@ -603,6 +609,7 @@ BlockDriver bdrv_raw = {
     .has_variable_length  = true,
     .bdrv_measure         = &raw_measure,
     .bdrv_get_info        = &raw_get_info,
+    .bdrv_get_specific_info = &raw_get_specific_info,
     .bdrv_refresh_limits  = &raw_refresh_limits,
     .bdrv_probe_blocksizes = &raw_probe_blocksizes,
     .bdrv_probe_geometry  = &raw_probe_geometry,
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] block/raw-format: implement .bdrv_get_specific_info handler
  2021-07-07  5:35 [PATCH v1] block/raw-format: implement .bdrv_get_specific_info handler Or Ozeri
@ 2021-07-07  7:51 ` Kevin Wolf
       [not found] ` <OFCAC1F821.335F9C72-ON0025870B.00309CB1-0025870B.00309CB5@ibm.com>
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2021-07-07  7:51 UTC (permalink / raw)
  To: Or Ozeri
  Cc: berrange, qemu-block, qemu-devel, to.my.trociny, idryomov, dannyh

Am 07.07.2021 um 07:35 hat Or Ozeri geschrieben:
> When using the raw format, allow exposing specific info by the underlying storage.
> In particular, this will enable RBD images using the raw format to indicate
> a LUKS2 encrypted image in the output of qemu-img info.
> 
> Signed-off-by: Or Ozeri <oro@il.ibm.com>

This doesn't feel right because it would introduce an inconsistency
(drivers are supposed to return information about their layer, and all
drivers except raw would still do so) and therefore wouldn't even solve
the full problem: For non-raw images, the information isn't any less
useful, but it still wouldn't be available.

I believe the information is already available in QMP, using
query-named-block-nodes, because then you get a separate BlockDeviceInfo
(which contains ImageInfoSpecific) for each node, including the protocol
node.

So maybe what we need to do is change qemu-img to iterate the node chain
(possibly using bdrv_primary_bs()) and print the ImageInfoSpecific for
each layer if it's present, while indicating which part is for which
layer.

So the output could look like this:

...
Driver specific information (qcow2):
    compat: 0.10
    compression type: zlib
    refcount bits: 16
Driver specific information (rbd):
    encryption format: luks

Kevin



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] block/raw-format: implement .bdrv_get_specific_info handler
       [not found] ` <OFCAC1F821.335F9C72-ON0025870B.00309CB1-0025870B.00309CB5@ibm.com>
@ 2021-07-07 12:31   ` Kevin Wolf
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2021-07-07 12:31 UTC (permalink / raw)
  To: Or Ozeri
  Cc: berrange, qemu-block, qemu-devel, to.my.trociny, idryomov, Danny Harnik

Am 07.07.2021 um 10:50 hat Or Ozeri geschrieben:
> Would you suggest to do this child traversal on bdrv_query_image_info, and have
> it returned as part of the ImageInfo struct?
> In that case, I would add *driver-specific to ImageInfo, in addition to the
> existing *format-specific?

No, extending ImageInfo with a single additonal field wouldn't be
generic either. It's not set in stone that your graph must consist of
exactly two block nodes.

> Or should I just do the traversal in img_info (qemu-img.c), avoiding
> the change to the ImageInfo struct?

Yes, img_info() or bdrv_image_info_dump() doing the traversal through
the chain is what I had in mind. Maybe let img_info() collect everything
and then pass a list of ImageInfos instead of just a single one to
bdrv_image_info_dump().

Kevin

> -----"Kevin Wolf" <[1]kwolf@redhat.com> wrote: -----
> To: "Or Ozeri" <[2]oro@il.ibm.com>
> From: "Kevin Wolf" <[3]kwolf@redhat.com>
> Date: 07/07/2021 10:52AM
> Cc: [4]qemu-devel@nongnu.org, [5]qemu-block@nongnu.org, [6]
> to.my.trociny@gmail.com, [7]dannyh@il.ibm.com, [8]berrange@redhat.com, [9]
> idryomov@gmail.com
> Subject: [EXTERNAL] Re: [PATCH v1] block/raw-format: implement
> .bdrv_get_specific_info handler
> 
> Am 07.07.2021 um 07:35 hat Or Ozeri geschrieben:
> > When using the raw format, allow exposing specific info by the underlying
> storage.
> > In particular, this will enable RBD images using the raw format to indicate
> > a LUKS2 encrypted image in the output of qemu-img info.
> >
> > Signed-off-by: Or Ozeri <[10]oro@il.ibm.com>
> 
> This doesn't feel right because it would introduce an inconsistency
> (drivers are supposed to return information about their layer, and all
> drivers except raw would still do so) and therefore wouldn't even solve
> the full problem: For non-raw images, the information isn't any less
> useful, but it still wouldn't be available.
> 
> I believe the information is already available in QMP, using
> query-named-block-nodes, because then you get a separate BlockDeviceInfo
> (which contains ImageInfoSpecific) for each node, including the protocol
> node.
> 
> So maybe what we need to do is change qemu-img to iterate the node chain
> (possibly using bdrv_primary_bs()) and print the ImageInfoSpecific for
> each layer if it's present, while indicating which part is for which
> layer.
> 
> So the output could look like this:
> 
> ...
> Driver specific information (qcow2):
>     compat: 0.10
>     compression type: zlib
>     refcount bits: 16
> Driver specific information (rbd):
>     encryption format: luks
> 
> Kevin
> 
> 
> 
> 
> References:
> 
> [1] mailto:kwolf@redhat.com
> [2] mailto:oro@il.ibm.com
> [3] mailto:kwolf@redhat.com
> [4] mailto:qemu-devel@nongnu.org
> [5] mailto:qemu-block@nongnu.org
> [6] mailto:to.my.trociny@gmail.com
> [7] mailto:dannyh@il.ibm.com
> [8] mailto:berrange@redhat.com
> [9] mailto:idryomov@gmail.com
> [10] mailto:oro@il.ibm.com



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-07 12:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07  5:35 [PATCH v1] block/raw-format: implement .bdrv_get_specific_info handler Or Ozeri
2021-07-07  7:51 ` Kevin Wolf
     [not found] ` <OFCAC1F821.335F9C72-ON0025870B.00309CB1-0025870B.00309CB5@ibm.com>
2021-07-07 12:31   ` Kevin Wolf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.