From: Sumit Garg <su...@extremenetworks.com>

1. A bool (has_lock) was being accessed as a function call
   leading to a runtime exception.

2. When 'alert' was turned off on a column, the code was
   erroring out when value for that column was being set
   in a newly inserted row. This is because the row._data
   was None at this time.

A question related to change #2 - should a newly inserted
row get automatically intialized to default values? If so,
I'm not sure the initialization to defaults is happening
and maybe that's why I'm seeing the NULL error. Either way,
I don't see an issue with adding the additional check.
---
 python/ovs/db/idl.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py
index 45a5a23..f074dbf 100644
--- a/python/ovs/db/idl.py
+++ b/python/ovs/db/idl.py
@@ -875,7 +875,7 @@ class Transaction(object):
             return self._status
 
         # If we need a lock but don't have it, give up quickly.
-        if self.idl.lock_name and not self.idl.has_lock():
+        if self.idl.lock_name and not self.idl.has_lock:
             self._status = Transaction.NOT_LOCKED
             self.__disassemble()
             return self._status
@@ -1074,7 +1074,7 @@ class Transaction(object):
         # transaction only does writes of existing values, without making any
         # real changes, we will drop the whole transaction later in
         # ovsdb_idl_txn_commit().)
-        if not column.alert and row._data.get(column.name) == datum:
+        if not column.alert and row._data and row._data.get(column.name) == 
datum:
             new_value = row._changes.get(column.name)
             if new_value is None or new_value == datum:
                 return
-- 
2.1.3

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to