summaryrefslogtreecommitdiff
path: root/python/ovs/db
diff options
context:
space:
mode:
authorAmitabha Biswas <azbiswas@gmail.com>2016-08-23 22:12:30 -0700
committerBen Pfaff <blp@ovn.org>2016-08-30 13:25:16 -0700
commitb3220c677a658e3bd17978b6edf6be9b8c4d4926 (patch)
treef2dec9f7f28602dfdbca00cc6d2fb008e7182329 /python/ovs/db
parent58026109d5ad0914d873e57df45c5e9dcc8e68da (diff)
downloadopenvswitch-b3220c677a658e3bd17978b6edf6be9b8c4d4926.tar.gz
ovsdb: Fix mutation of newly inserted rows from Python IDL.
This patch fixes the scenario, where the mutate operation on a row is sent in the same transaction as row insert operation. It was obvserved that this mutate operation was not getting committed to the OVSDB. To get around the above problem the "where" condition in an mutate operation is modified to use the named-uuid to identify a row created in the current transaction. Signed-off-by: Amitabha Biswas <abiswas@us.ibm.com> Suggested-by: Richard Theis <rtheis@us.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'python/ovs/db')
-rw-r--r--python/ovs/db/idl.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py
index 1e5c20f71..187e902c5 100644
--- a/python/ovs/db/idl.py
+++ b/python/ovs/db/idl.py
@@ -1271,7 +1271,13 @@ class Transaction(object):
addop = False
op = {"table": row._table.name}
op["op"] = "mutate"
- op["where"] = _where_uuid_equals(row.uuid)
+ if row._data is None:
+ # New row
+ op["where"] = self._substitute_uuids(
+ _where_uuid_equals(row.uuid))
+ else:
+ # Existing row
+ op["where"] = _where_uuid_equals(row.uuid)
op["mutations"] = []
if '_removes' in row._mutations.keys():
for col, dat in six.iteritems(row._mutations['_removes']):