Sorry for the delayed response. Yes your fix is correct and I tested that in my experiment.
On Sat, Mar 30, 2013 at 1:15 AM, Ben Pfaff <b...@nicira.com> wrote: > On Fri, Mar 29, 2013 at 12:08:32PM +0800, Yeming Zhao wrote: > > I spent last couple days writing a tool interacting with OVSDB, using the > > ovs python package in OVS distribution. It generally works. > > The Python bindings are generally not as mature as the C bindings. > They have some rough edges. > > > But the Row.delete() doesn't work as expected. After looking at how > > Transaction.commit() works, I think Row.delete() should add the following > > line to the end: > > > > self._idl.txn._txn_rows[self.uuid] = self > > I see what you mean. > > I think that this is the correct fix, but I have not tested it. Do > you want to try it? > > @@ -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] > > > It appears the change works, but I'm not sure if it has unexpected > effects. > > I'm using 1.9 branch, but I looked around and found the code is the same > > since 1.3. > > I think that your fix, of just adding that line at the end, will not > do the right thing for deleting a row that was newly added within the > current transaction (hence the "if self._data is None" case). > > > And a general question, is the ovs python package meant to be used by an > > app developer or more a development/test tool? > > It's meant to be general purpose. We use it in various small > applications (some are included with OVS), but if it has bugs like > this then it's pretty obvious that it's not being extensively used. >
_______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev