[libvirt] [libvirt RFC PATCH 04/10] util: storage: Add support for URI based backing volumes in qemu's JSON pseudo-protocol

Eric Blake eblake at redhat.com
Thu Jul 28 03:04:08 UTC 2016


On 07/15/2016 07:46 AM, Peter Krempa wrote:
> http(s), ftp(s) and tftp use URIs for volume definitions in the JSON
> pseudo protocol so it's pretty straightforward to add support for them.
> ---
>  src/util/virstoragefile.c | 34 ++++++++++++++++++++++++++++++++++
>  tests/virstoragetest.c    |  8 ++++++++
>  2 files changed, 42 insertions(+)

Still might be nice to include an example in the commit message, not
just the testsuite addition.

I know that qemu is hoping to move away from URI towards more structured
layouts as part of adding blockdev-add support for these drivers (back
to your observation that once qemu supports two ways, it will have to
continue to support both types of users).  That means we may need more
code to parse non-URI (but better-structured) uses, but we'd still need
this uri parsing.


> +++ b/tests/virstoragetest.c
> @@ -1367,6 +1367,14 @@ mymain(void)
>      TEST_BACKING_PARSE(12, "json:{\"file.driver\":\"host_cdrom\", "
>                                   "\"file.filename\":\"/path/to/cdrom\"}",
>                         "<source dev='/path/to/cdrom'/>\n");
> +    TEST_BACKING_PARSE(13, "json:{\"file.driver\":\"http\", "
> +                                 "\"file.uri\":\"http://example.com/file\"}",
> +                       "<source protocol='http' name='file'>\n"
> +                       "  <host name='example.com'/>\n"
> +                       "</source>\n");
> +    TEST_BACKING_PARSE(14, "json:{\"file.driver\":\"ftp\", "
> +                                 "\"file.uri\":\"http://example.com/file\"}",
> +                       NULL);
> 

On the bright side, this patch made it look fairly simple, which means
we have good reuse of code.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160727/8d2bc62f/attachment-0001.sig>


More information about the libvir-list mailing list