[ovs-dev] [PATCH 2/3] xenserver: Allow unknown other-config attributes.

Ian Campbell Ian.Campbell at citrix.com
Wed Jan 19 09:50:21 UTC 2011


On Tue, 2011-01-18 at 14:54 -0800, Ethan Jackson wrote:
> When saving the database cache, InterfaceReconfigure can crash if
> unexpected attributes are in an object's other-config column.  This
> commit causes it to skip that attribute and log a warning.
> 
> Signed-off-by: Ethan Jackson <ethan at nicira.com>
> CC: Ian Campbell <Ian.Campbell at citrix.com>
> CC: Dominic Curran <Dominic.Curran at citrix.com>

I think this change is fine and protects against e.g. a typo in an
other-config key name breaking the system.

However if you added support for a new other-config field which you
expect to be picked up when the network is attached on boot then you
likely need to expand the attr list which interface-reconfigure knows
about otherwise it won't cache it and therefore won't recall it for use
at boot.

Even if you don't need the new key on boot it would be worth expanding
that list anyway since it has become somewhat the canonical list of keys
which are understood (incl. explicitly ignored) by the tool.

It would be useful to CC xen-api at lists.xensource.com with any patches to
the interface-reconfigure stuff (or the vif hotplug script for that
matter) since that is where the upstream version is maintained.

Ian.

> ---
>  .../opt_xensource_libexec_InterfaceReconfigure.py  |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/xenserver/opt_xensource_libexec_InterfaceReconfigure.py b/xenserver/opt_xensource_libexec_InterfaceReconfigure.py
> index 48b3938..7204032 100644
> --- a/xenserver/opt_xensource_libexec_InterfaceReconfigure.py
> +++ b/xenserver/opt_xensource_libexec_InterfaceReconfigure.py
> @@ -245,9 +245,10 @@ def _map_to_xml(xml, parent, tag, val, attrs):
>      e = xml.createElement(tag)
>      parent.appendChild(e)
>      for n,v in val.items():
> -        if not n in attrs:
> -            raise Error("Unknown other-config attribute: %s" % n)
> -        _str_to_xml(xml, e, n, v)
> +        if n in attrs:
> +            _str_to_xml(xml, e, n, v)
> +        else:
> +            log("Unknown other-config attribute: %s" % n)
>  
>  def _map_from_xml(n, attrs):
>      ret = {}






More information about the dev mailing list