2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-28 21:07:47 +00:00

131 Commits

Author SHA1 Message Date
Ben Pfaff
79554078d0 ovsdb-idl: Fix bad logic in ovsdb_idl_txn_commit() state transitions.
If sending the transaction fails (jsonrpc_session_send() returns 0),
then we need to transition to TXN_TRY_AGAIN.  (Transitioning to
TXN_INCOMPLETE is actually a no-op, because at this point in the code
we are guaranteed to be in that state already.)

Leaving the transaction in TXN_INCOMPLETE causes a segfault later in
ovsdb_idl_txn_destroy() when it calls hmap_remove() on the transaction's
txn_node.

This bug reveals a hole in the ovsdb_idl_txn state machine: destroying
a transaction without committing it or aborting it will cause the same
problem.  This problem is *not* fixed by this patch: it really should be
handled by adding a new state TXN_UNCOMMITTED that indicates that the
transaction is not yet committed or aborted.  That's too much for this
patch, and doesn't really matter for OVS at the moment since none of its
code paths destroy a transaction without committing or aborting it.

Bug #2435.
2010-02-27 08:52:48 -08:00
Ben Pfaff
9cb53f2613 ovsdb: Add support for multiple databases to the protocol.
This also adds protocol compatibility to the database itself and to
ovsdb-client.  It doesn't actually add multiple database support to
ovsdb-server, since we don't really need that yet.
2010-02-09 14:25:32 -08:00
Ben Pfaff
fbf925e45d ovsdb: Get rid of "declare" operation.
It's more elegant, and just as easy to implement, if we allow a
"named-uuid" to be a forward reference to a "uuid-name" in a later
"insert" operation.
2010-02-08 16:03:21 -08:00
Ben Pfaff
bd76d25d8b ovsdb: Add simple constraints. 2010-02-08 14:16:19 -08:00
Ben Pfaff
91e310a5c2 ovsdb-idl: On transaction hard failure make a reason available to client.
This make ovs-vsctl able to report problems that occur in better detail.
2010-02-08 14:16:18 -08:00
Ben Pfaff
0196cc159f ovsdb-idl: Fix memory leaks and bad memory references.
Found with valgrind.
2010-02-02 15:21:09 -08:00
Ben Pfaff
69490970b3 ovsdb-idl: Add interface to find out the permanent IDL of an inserted row.
The ovs-vsctl "create" command, and perhaps other commands, should print
the UUID of the newly created database row, but until now the IDL has not
provided a way to find that out.  This commit adds the ability.
2010-01-28 16:06:31 -08:00
Ben Pfaff
987ae96159 ovsdb-idl: Make rows inserted by transaction appear during table iteration. 2010-01-27 14:12:35 -08:00
Ben Pfaff
9e336f4910 ovsdb-idl: Export ovsdb_idl_txn_delete() and ovsdb_idl_txn_insert().
ovs-vsctl wants to use these functions directly, so make them available
through the ovsdb-idl public header instead of only through the private
one.

Also, change the prototypes to make them usable without casts.
2010-01-27 13:51:52 -08:00
Ben Pfaff
979821c0a6 ovsdb-idl: Allow clients to modify records without using structs.
The IDL is intended to allow clients easier access to data in the database
by providing an extra layer of abstraction.  However, ovs-vsctl needs to
also provide generic access to database tables, rows, and columns, and
until now the IDL has not allowed this.  In particular, there was no way
to modify the value of a database column by providing a "struct
ovsdb_datum" with the new value and then have that reflected in the IDL
structs, although the other direction was possible.

This commit fixes that problem, which requires a bit of refactoring of the
IDL layer.  It also exposes the interface for iterating through table
records to clients directly, by moving it from the "private" IDL header to
the public one.
2010-01-26 09:49:30 -08:00
Ben Pfaff
181aba2eb0 ovsdb-idl: Avoid redundant memset. 2010-01-26 09:46:43 -08:00
Ben Pfaff
c7f7adb70c ovsdb-idl: Fix use-after-free error in ovsdb_idl_txn_delete(). 2010-01-26 09:46:43 -08:00
Ben Pfaff
c5a80c70c1 idl: Gracefully handle destroying a transaction before receiving its reply.
If ovsdb_idl_txn_destroy() is called to destroy a transaction before its
reply has been received from the database server, then until now we would
drop the connection to the database when the reply actually arrived,
because we would have no record of that transaction ID any longer.

Notably, ovs-vswitchd does this: it "fires and forgets" database
transactions.  (Really, it should not do that, but that's a bigger commit.)

This commit fixes the problem by not dropping the database connection in
such a case.

This fixes an observed problem such that sometimes ovs-vsctl took a long
time to complete, which was because ovs-vswitchd was dropping its
connection to the database and backing off.
2010-01-15 15:35:38 -08:00
Justin Pettit
f3d645212a ovsdb: Provide helper function to determine if IDL has ever connected 2010-01-14 13:10:35 -08:00
Ben Pfaff
2f3ca7ea71 ovsdb-idl: Fix memory leak committing a no-op transaction.
Partial fix for bug #2373.
2010-01-12 14:28:01 -08:00
Ben Pfaff
4931f33ad9 ovsdb-server: Factor out complication by using jsonrpc_session. 2010-01-04 09:47:01 -08:00
Ben Pfaff
b54e22e91e Make ovs-vswitchd report when it is done configuring; make ovs-vsctl wait.
Until now the ovsdb-based vswitch has provided no way to know when it has
finished applying the configuration from the database.  This commit
introduces a way:

  * The client who wants to wait increments the "next_cfg" column of the
    Open_vSwitch record.

  * When ovs-vswitchd finishes reconfiguring, it sets the value of the
    "cur_cfg" column to that of the "next_cfg" column.

  * The client waits until the "cur_cfg" column is at least as great as
    the value it set into "next_cfg".

This allows us to drop the 5-second sleep in interface-reconfigure.
2009-12-16 16:26:17 -08:00
Ben Pfaff
d171b5846f ovsdb: Add "comment" feature to transactions and make ovs-vsctl use them.
The idea here is that transaction comments get copied to the ovsdb-server's
transaction log, which can then make it clear later why a particular change
was made to the database, to ease debugging.
2009-12-16 13:30:53 -08:00
Ben Pfaff
fbd8fd40a3 ovsdb-idl: Prevent segfault destroying an incomplete transaction. 2009-12-11 16:58:16 -08:00
Ben Pfaff
1ebeed630c ovsdb-idl: Fix deletion of modified row.
If the transaction modified a row and then deleted it, the IDL would
instead mistakenly leave the row entirely untouched.

This commit fixes this bug.  It needs a regression test, but this commit
does not add one.
2009-12-11 13:26:08 -08:00
Ben Pfaff
577aebdfec ovs-vsctl: Add --dry-run option. 2009-12-11 13:26:08 -08:00
Ben Pfaff
f0f54cb4dd ovsdb-idl: Fix row insertion and deletion behavior.
When the IDL was used to insert a row, but all of the new row's columns
were left at the default values, then the IDL would not insert the row at
all.

When the IDL was used to delete one or more rows, and the transaction did
not include any update or insertion operations, the transaction was dropped
entirely.

This commit fixes these two bugs.  It needs a regression test, but this
commit does not add one.
2009-12-11 13:26:08 -08:00
Ben Pfaff
586bb84a49 ovs-vsctl: Fix performance problem. 2009-12-09 13:29:02 -08:00
Ben Pfaff
76c91af91e ovsdb-idl: New function to obtain the current transaction from any row. 2009-12-08 17:14:56 -08:00
Ben Pfaff
72c6edc5d5 ovsdb-idl: Bug fixes. 2009-12-08 17:14:36 -08:00
Ben Pfaff
8bc915de7a ovsdb-idl: Update IDL data when "set" functions are called.
Until now, the "set" functions generated by the IDL updated the data in the
database (during commit) but not the data exposed by the IDL in its data
structures.  This was just an oversight, so this commit causes the data
exposed by IDL to be updated also.
2009-12-08 10:59:46 -08:00
Ben Pfaff
475281c01b ovsdb-idl: Make it possible to write data through the IDL.
Until now the IDL has been exclusively a read-only interface.  This commit
introduces a general-purpose interface for writing to ovsdb via the IDL.
2009-12-07 17:10:28 -08:00
Ben Pfaff
7ecd4b03dd ovsdb-idl: Fix memory leak. 2009-12-04 15:08:07 -08:00
Ben Pfaff
115f1e4dc5 ovsdb-idl: Optimize lookup of struct idl_table from struct idl_table_class.
Before, the idl_table could only be obtained through a hash lookup of a
string.  This way is faster and more straightforward.
2009-12-04 15:08:07 -08:00
Ben Pfaff
e9011ac832 ovsdb-idl: Fix resolution of references from one table to another.
Our tests only checked references from a table to itself, so of course
there were bugs in references from one table to another.  This fixes the
obvious one and adds a test.
2009-12-03 10:55:00 -08:00
Ben Pfaff
c3bb4bd7f1 ovsdb: Implement C bindings for IDL. 2009-12-02 11:26:15 -08:00