[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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 redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]