[PATCH] virStorageSourceParseNBDColonString: Rewrite to match what qemu does
Peter Krempa
pkrempa at redhat.com
Fri Apr 24 15:20:53 UTC 2020
On Fri, Apr 24, 2020 at 10:02:49 -0500, Eric Blake wrote:
> On 4/24/20 7:04 AM, Peter Krempa wrote:
> > Our implementation wasn't quite able to parse everything that qemu does.
> > This patch rewrites the parser to a code that semantically resembles the
> > combination of 'nbd_parse_filename' and 'inet_parse' methods in qemu to
> > be able to parse the strings in an equivalent manner.
> >
> > The only thing that libvirt doesn't do is to check the lenghts of
>
> lengths
>
> > various components in the nbd string in places where qemu uses constant
> > size buffers.
> >
> > The test cases validate that some of the corner cases involving colons
> > are parsed properly.
> >
> > https://bugzilla.redhat.com/show_bug.cgi?id=1826652
> >
> > Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> > ---
> > src/util/virstoragefile.c | 90 +++++++++++++++++++++++----------------
> > tests/virstoragetest.c | 16 +++++++
> > 2 files changed, 70 insertions(+), 36 deletions(-)
> >
>
> > + TEST_BACKING_PARSE("nbd:unix:/tmp/sock::exportname=:",
> > + "<source protocol='nbd' name=':'>\n"
> > + " <host transport='unix' socket='/tmp/sock:'/>\n"
> > + "</source>\n");
>
> nbd+unix:///:?socket=/tmp/sock:
>
> Whether you also add the proper URI counterparts to the test is not directly
> relevant to the fix at hand.
I can add them but separately. The URIs are parsed via the libxml URI
module so they are not related in any way to the colon-delimited string
code-wise.
More information about the libvir-list
mailing list