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

Eric Blake eblake at redhat.com
Fri Nov 12 17:21:16 UTC 2010


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.

>  src/conf/storage_conf.c      |   21 +++++++++++++++++++--
>  src/conf/storage_conf.h      |    1 -
>  3 files changed, 24 insertions(+), 3 deletions(-)
> 
> 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...

> @@ -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?

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

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


More information about the libvir-list mailing list