[ovs-dev] Row deletion in ovs python package

Ben Pfaff blp at nicira.com
Mon Apr 8 17:45:31 UTC 2013


Thanks.

I applied this to master, as follows:

On Mon, Apr 08, 2013 at 11:07:28AM +0800, Yeming Zhao wrote:
> Sorry for the delayed response.
> 
> Yes your fix is correct and I tested that in my experiment.

--8<--------------------------cut here-------------------------->8--

From: Ben Pfaff <blp at nicira.com>
Date: Mon, 8 Apr 2013 10:44:40 -0700
Subject: [PATCH] python.ovs.db.idl: Fix Row.delete() of a row already committed to the db.

Row.delete() handled the case of deleting a row that was added within the
current transaction, but not yet committed, but it did not correctly handle
the case of deleting a row that belonged to the database before the
transaction started.  This fixes the problem.

Reported-by: Yeming Zhao <zhaoyeming at gmail.com>
Tested-by: Yeming Zhao <zhaoyeming at gmail.com>
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 AUTHORS              |    1 +
 python/ovs/db/idl.py |    4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 2ca0c2b..68bcf01 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -197,6 +197,7 @@ Vishal Swarankar        vishal.swarnkar at gmail.com
 Vjekoslav Brajkovic     balkan at cs.washington.edu
 Voravit T.              voravit at kth.se
 YAMAMOTO Takashi        yamamoto at valinux.co.jp
+Yeming Zhao             zhaoyeming at gmail.com
 Yongqiang Liu           liuyq7809 at gmail.com
 kk yap                  yapkke at stanford.edu
 likunyun                kunyunli at hotmail.com
diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py
index 9e9bf0f..55fbcba 100644
--- a/python/ovs/db/idl.py
+++ b/python/ovs/db/idl.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc.
+# Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -610,6 +610,8 @@ class Row(object):
         assert self._changes is not None
         if self._data is None:
             del self._idl.txn._txn_rows[self.uuid]
+        else:
+            self._idl.txn._txn_rows[self.uuid] = self
         self.__dict__["_changes"] = None
         del self._table.rows[self.uuid]
 
-- 
1.7.2.5




More information about the dev mailing list