[libvirt] [PATCH 01/11] Fix parsing of port attribute in storage XML configuration

Daniel P. Berrange berrange at redhat.com
Fri Nov 12 18:36:23 UTC 2010


On Fri, Nov 12, 2010 at 10:21:16AM -0700, Eric Blake wrote:
> On 11/12/2010 09:22 AM, Daniel P. Berrange wrote:
> > The XML docs describe a 'port' attribute for the
> > storage source <host> element, but the parser never
> > handled it.
> > 
> > * docs/schemas/storagepool.rng: Define port attribute
> > * src/conf/storage_conf.c: Add missing parsing/formatting
> >   of host port number
> > * src/conf/storage_conf.h: Remove bogus/unused 'protocol' field
> > ---
> >  docs/schemas/storagepool.rng |    5 +++++
> 
> Missing corresponding docs/formatstorage.html.in change.

As per the commit message, this is already documented, but not
implemented !

> > diff --git a/docs/schemas/storagepool.rng b/docs/schemas/storagepool.rng
> > index 54eb802..8f067f3 100644
> > --- a/docs/schemas/storagepool.rng
> > +++ b/docs/schemas/storagepool.rng
> > @@ -186,6 +186,11 @@
> >        <attribute name='name'>
> >          <text/>
> >        </attribute>
> > +      <optional>
> > +        <attribute name='port'>
> > +          <text/>
> 
> Is text really appropriate, when...

I guess it should reference a port number

> 
> > @@ -423,6 +424,17 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
> >      }
> >  
> >      source->host.name = virXPathString("string(./host/@name)", ctxt);
> > +    port = virXPathString("string(./host/@port)", ctxt);
> > +    if (port) {
> > +        if (virStrToLong_i(port, NULL, 10, &source->host.port) < 0) {
> 
> it looks like you insist on an integer instead?  For that matter, should
> you do a range check that the port is < 0x10000?

The range check gets done eventually, at least by the kernel, so I'm
not too bothered about that.


Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list