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

Re: [libvirt] [PATCH V3 3/4] Extend NWFilter parameter parser to cope with lists of values



2011/10/24 Stefan Berger <stefanb linux vnet ibm com>:
> This patch modifies the NWFilter parameter parser to support multiple
> elements with the same name and to internally build a list of items.
> An example of the XML looks like this:
>
>        <parameter name='TEST' value='10.1.2.3'/>
>        <parameter name='TEST' value='10.2.3.4'/>
>        <parameter name='TEST' value='10.1.1.1'/>
>
> The list of values is then stored in the newly introduced data type
> virNWFilterVarValue.
>
> The XML formatter is also adapted to print out all items in alphabetical
> order sorted by 'name'.
>
> This patch als fixes a bug in the XML schema on the way.
>
> v3:
>  - Follow Daniel Berrange's suggestion of parsing a list as shown above
>  - Rewrote XML formatter to print out parameters in alphabetical order

The parameters are stored in a hash and their name is used as key.
This means that the parameters aren't guaranteed to be printed to XML
again in the same order as they where parsed from XML, doesn't it?

This might be no problem when all parameters have a unique name. But
now with multiple parameters having the same name this might be an
issue, assuming that a given element order has a meaning attached to
it. If

       <parameter name='TEST' value='10.1.2.3'/>
       <parameter name='TEST' value='10.2.3.4'/>
       <parameter name='TEST' value='10.1.1.1'/>

and

       <parameter name='TEST' value='10.1.1.1'/>
       <parameter name='TEST' value='10.1.2.3'/>
       <parameter name='TEST' value='10.2.3.4'/>

aren't the same from the NWFilter's point-of-view then this needs to
be fixed to have NWFilter preserve the exact order of elements.

If it's the same then there's no problem here.

-- 
Matthias Bolte
http://photron.blogspot.com


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