diff options
| author | Ben Pfaff <blp@nicira.com> | 2011-08-23 09:26:29 -0700 |
|---|---|---|
| committer | Ben Pfaff <blp@nicira.com> | 2011-08-24 11:57:43 -0700 |
| commit | 7d48f8f8bd90922bebbbd46106d8343b2eb1571e (patch) | |
| tree | 52badf33c37f9cfa3063653bac367f2768c526bf /python | |
| parent | 4c0f62718ff9f83613c7f87805ee40495f642583 (diff) | |
| download | openvswitch-7d48f8f8bd90922bebbbd46106d8343b2eb1571e.tar.gz | |
ovs.db.idl: Actually use Idl.__modify_row()'s return value.
Idl.__parse_row_update() assumed that every change that the database server
sent down actually modified the database. This is generally true, but
since Idl.__modify_row() already returns whether there was a change, we
might as well use it.
Reported-by: Reid Price <reid@nicira.com>
Diffstat (limited to 'python')
| -rw-r--r-- | python/ovs/db/idl.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py index 2a04a98f4..abb7a444a 100644 --- a/python/ovs/db/idl.py +++ b/python/ovs/db/idl.py @@ -222,32 +222,37 @@ class Idl: def __parse_row_update(self, table, uuid, old, new): """Returns True if a column changed, False otherwise.""" row = self.data[table.name].get(uuid) + changed = False if not new: # Delete row. if row: del self.data[table.name][uuid] + changed = True else: # XXX rate-limit logging.warning("cannot delete missing row %s from table %s" % (uuid, table.name)) - return False elif not old: # Insert row. if not row: row = self.__create_row(table, uuid) + changed = True else: # XXX rate-limit logging.warning("cannot add existing row %s to table %s" % (uuid, table.name)) - self.__modify_row(table, row, new) + if self.__modify_row(table, row, new): + changed = True else: if not row: row = self.__create_row(table, uuid) + changed = True # XXX rate-limit logging.warning("cannot modify missing row %s in table %s" % (uuid, table_name)) - self.__modify_row(table, row, new) - return True + if self.__modify_row(table, row, new): + changed = True + return changed def __modify_row(self, table, row, row_json): changed = False |
