[libvirt] [PATCH 2/2] util: storage: add JSON backing volume parser 'raw' block driver

Peter Krempa pkrempa at redhat.com
Wed Feb 22 09:34:12 UTC 2017


On Mon, Feb 13, 2017 at 23:53:43 +0100, Tomáš Golembiovský wrote:
> The 'raw' block driver in Qemu is not directly interesting from
> libvirt's perspective, but it can be layered above some other block
> drivers and this may be interesting for the user.
> 
> The patch adds support for the 'raw' block driver. The driver is treated
> simply as a pass-through and child driver in JSON is queried to get the
> necessary information.
> 
> Signed-off-by: Tomáš Golembiovský <tgolembi at redhat.com>
> ---
>  src/util/virstoragefile.c | 16 ++++++++++++++++
>  tests/virstoragetest.c    |  6 ++++++
>  2 files changed, 22 insertions(+)
> 
> diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
> index 3698eeeda..0447016bf 100644
> --- a/src/util/virstoragefile.c
> +++ b/src/util/virstoragefile.c
> @@ -2648,6 +2648,11 @@ virStorageSourceParseBackingColon(virStorageSourcePtr src,
>  
>  
>  static int
> +virStorageSourceParseBackingJSONInternal(virStorageSourcePtr src,
> +                                         virJSONValuePtr json);

We try to avoid forward declaration as much as possible. It's better to
move the code.

> +
> +
> +static int
>  virStorageSourceParseBackingJSONPath(virStorageSourcePtr src,
>                                       virJSONValuePtr json,
>                                       int type)
> @@ -2963,6 +2968,16 @@ virStorageSourceParseBackingJSONRBD(virStorageSourcePtr src,
>      return -1;
>  }
>  
> +static int
> +virStorageSourceParseBackingJSONRaw(virStorageSourcePtr src,
> +                                    virJSONValuePtr json,
> +                                    int opaque ATTRIBUTE_UNUSED)
> +{
> +    /* There are no interesting attributes in raw driver.
> +     * Treat it as pass-through.
> +     */

In fact, we may need to start supporting other format drivers explicitly
as well in the future. It may be necessary to add format validation and
other stuff, but this should be okay for now.

ACK, but I'll tweak the coding style a bit prior to pushing.

Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170222/e4104dee/attachment-0001.sig>


More information about the libvir-list mailing list