[libvirt] [PATCH 20/34] conf: Introduce modular parser for virStorageSource

Ján Tomko jtomko at redhat.com
Tue Mar 19 12:07:59 UTC 2019


On Mon, Mar 18, 2019 at 04:55:09PM +0100, Peter Krempa wrote:
>Introduce a helper which parses XML into virStorageSource according to
>XPath queries passed in for the various bits. The new parser will allow
>to unify the parsing of the various XML formats we use in different
>parts without the need to do custom parsers.
>
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>---
> src/conf/domain_conf.c   | 94 ++++++++++++++++++++++++++++++++++++++++
> src/conf/domain_conf.h   | 12 +++++
> src/libvirt_private.syms |  1 +
> 3 files changed, 107 insertions(+)
>
>diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>index bf3ad45397..d2cc199ed5 100644
>--- a/src/conf/domain_conf.c
>+++ b/src/conf/domain_conf.c
>@@ -9111,6 +9111,100 @@ virDomainStorageSourceParse(xmlNodePtr node,
> }
>
>
>+/**
>+ * virDomainStorageSourceParseFull
>+ * @typeXPath: XPath query string for the 'type' of virStorageSource

Does this need to be an XPath query as opposed to a simple attribute
queried by virXMLPropString?
All the callers pass either "string(@type)" "or string(./@type)"

>+ * @formatXPath: XPath query for the image format (may be NULL if caller wishes to parse it)
>+ * @sourceXPath: XPath query for the <source> subelement
>+ * @indexXPath: XPath query for 'id' in virStorageSource (may be NULL if skipped)
>+ * @allowMissing: if true no errors are reported if the above fields are missing
>+ * @ctxt: XPath context
>+ * @flags: XML parser flags
>+ * @xmlopt: XML parser callbacks
>+ *

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190319/2905ae1b/attachment-0001.sig>


More information about the libvir-list mailing list