[libvirt] [PATCH v2 02/12] domain_conf: parse listen attribute while parsing listen elements

Pavel Hrdina phrdina at redhat.com
Thu May 12 05:25:10 UTC 2016


On Wed, May 11, 2016 at 08:12:59PM +0200, Marc-André Lureau wrote:
> Hi
> 
> On Wed, May 11, 2016 at 5:08 PM, Pavel Hrdina <phrdina at redhat.com> wrote:
> > Move the compatibility code out of virDomainGraphicsListensParseXML()
> > into virDomainGraphicsListenDefParseXML().  This also fixes a small
> > inconsistency between the code and error message itself.
> >
> > Before this patch we would search first listen element that is
> > type='address' to validate listen and address attributes. After this
> > patch we always take the first listen element regardless of the type.
> >
> > This shouldn't break anything since all drivers supports only one
> > listen.
> >
> > Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> > ---
> >  src/conf/domain_conf.c | 85 ++++++++++++++++++++++++++++++--------------------
> >  1 file changed, 51 insertions(+), 34 deletions(-)
> >
> > diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> > index df2258a..45d2789 100644
> > --- a/src/conf/domain_conf.c
> > +++ b/src/conf/domain_conf.c
> > @@ -10640,18 +10640,36 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
> >      return 0;
> >  }
> >
> > +
> > +/**
> > + * virDomainGraphicsListenDefParseXML:
> > + * @def: listen def pointer to be filled
> > + * @node: xml node of <listen/> element
> > + * @parent: xml node of <graphics/> element
> > + * @flags: bit-wise or of VIR_DOMAIN_DEF_PARSE_*
> > + *
> > + * Parses current <listen/> element from @node to @def.  For backward
> > + * compatibility the @parent element should contain node of <graphics/> element
> > + * for the first <listen/> element in order to validate attributes from both
> > + * elements.
> > + */
> >  static int
> >  virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
> >                                     xmlNodePtr node,
> > +                                   xmlNodePtr parent,
> >                                     unsigned int flags)
> >  {
> >      int ret = -1;
> > -    char *type     = virXMLPropString(node, "type");
> > -    char *address  = virXMLPropString(node, "address");
> > -    char *network  = virXMLPropString(node, "network");
> > +    char *type = virXMLPropString(node, "type");
> > +    char *address = virXMLPropString(node, "address");
> > +    char *network = virXMLPropString(node, "network");
> 
> code-style change only

Yes, I took the opportunity to change the code-style together with this patch :)

Pavel




More information about the libvir-list mailing list