[ovs-dev] [PATCH 2/2] xenserver: Add type-checking to monitor-external-ids script.
jpettit at nicira.com
Thu Aug 26 10:07:51 PDT 2010
I wasn't able to get the type-checking to work yesterday. I assume that was related to the "__ne__" change? Assuming that's true, the change looks good. I'm a bit worried about raising an exception, since the daemon can theoretically do other useful work. However, this sort of error would likely occur during development testing so maybe it's good to make the problem obvious. As we discussed in-person yesterday, we need a better strategy when it comes to monitoring Python daemons in general.
On Aug 26, 2010, at 9:47 AM, Ben Pfaff wrote:
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> python/ovs/db/types.py | 2 +-
> ..._share_openvswitch_scripts_monitor-external-ids | 6 ++++++
> 2 files changed, 7 insertions(+), 1 deletions(-)
> diff --git a/python/ovs/db/types.py b/python/ovs/db/types.py
> index aa0a8ed..6e7ef11 100644
> --- a/python/ovs/db/types.py
> +++ b/python/ovs/db/types.py
> @@ -386,7 +386,7 @@ class Type(object):
> self.n_min == other.n_min and self.n_max == other.n_max)
> def __ne__(self, other):
> - if not isinstance(other, BaseType):
> + if not isinstance(other, Type):
> return NotImplemented
> return not (self == other)
> diff --git a/xenserver/usr_share_openvswitch_scripts_monitor-external-ids b/xenserver/usr_share_openvswitch_scripts_monitor-external-ids
> index 28aaf78..c87171f 100755
> --- a/xenserver/usr_share_openvswitch_scripts_monitor-external-ids
> +++ b/xenserver/usr_share_openvswitch_scripts_monitor-external-ids
> @@ -131,6 +131,12 @@ def keep_table_columns(schema, table_name, column_types):
> if not column:
> raise error.Error("%s table schema lacks %s column"
> % (table_name, column_name))
> + if column.type != column_type:
> + raise error.Error("%s column in %s table has type \"%s\", "
> + "expected type \"%s\""
> + % (column_name, table_name,
> + column.type.toEnglish(),
> + column_type.toEnglish()))
> new_columns[column_name] = column
> table.columns = new_columns
> return table
> dev mailing list
> dev at openvswitch.org
More information about the dev