aboutsummaryrefslogtreecommitdiff
path: root/lib/ovsdb-idl.h
AgeCommit message (Collapse)Author
2011-10-31ovsdb-idl: Prevent occasional hang when multiple database clients race.Ben Pfaff
When a client of the IDL tries to commit a read-modify-write transaction but the database has changed in the meantime, the IDL tells its client to wait for the IDL to change and then try the transaction again by returning TXN_TRY_AGAIN. The "wait for the IDL to change" part is important because there's no point in retrying the transaction before the IDL has received the database updates (the transaction would fail in the same way all over again). However, the logic was incomplete: the database update can be received *before* the reply to the transaction RPC (I think that in the current ovsdb-server implementation this will always happen, in fact). When this happens, the right thing to do is to retry the transaction immediately; if we wait, then we're waiting for an additional change to the database that may never come, causing an indefinite hang. This commit therefore breaks the "try again" IDL commit status code into two, one that means "try again immediately" and another that means "wait for a change then try again". When an update is processed after a transaction is committed but before the reply is received, the "try again now" tells the IDL client not to wait for another database change before retrying its transaction. Bug #5980. Reported-by: Ram Jothikumar <rjothikumar@nicira.com> Reproduced-by: Alex Yip <alex@nicira.com>
2011-07-26vswitchd: Prevent multiple ovs-vswitchd processes from acting together.Ben Pfaff
Once in a while someone reports a problem caused by running multiple ovs-vswitchd processes at the same time. This fixes the problem by requiring ovs-vswitchd to obtain a database lock before taking any actions.
2011-06-21ovsdb-idl: Plug hole in state machine.Ben Pfaff
The state machine didn't have a proper state for "not yet committed or aborted", which meant that destroying an ovsdb_idl_txn without committing or aborting it caused a segfault. This fixes the problem by adding a new state TXN_UNCOMMITTED to the state machine. This is related to commit 79554078d "ovsdb-idl: Fix bad logic in ovsdb_idl_txn_commit() state transitions", which fixed a related bug. Bug #2438.
2011-04-21bridge: Tolerate missing Port and Interface records for local port.Ben Pfaff
Until now, ovs-vswitchd has been unable to configure IP addresses and routes for bridges whose Bridge records lack a Port and an Interface record for the bridge's local port (e.g. OFPP_LOCAL, the port with the same name as the bridge itself). When such a bridge was reconfigured, ovs-vswitchd would output a log message that worried people. This commit fixes the internal limitation that led to the message being printed. Bug #5385.
2010-11-16ovsdb-idl: Make selecting tables and columns to replicate more flexible.Ben Pfaff
Until now, by default the IDL replicated all tables and all columns in the database, and a few functions made it possible to avoid replicating selected columns. This commit adds a mode in which nothing is replicated by default and the client code is responsible for specifying each column and table that it is interested in. The following commit adds a user for this mode.
2010-08-11ovsdb-idl: Make it possible to omit or pay less attention to columns.Ben Pfaff
ovs-vswitchd has no need to replicate some parts of the database. In particular, it doesn't need to replicate the bits that it never reads, such as the external_ids column in the Open_vSwitch table. This saves some memory, CPU time, and bandwidth to the database. Another type of column that benefits from special treatment is "write-only columns", that is, those that ovs-vswitchd writes and keeps up-to-date but never expects another client to write, such as the cur_cfg column in the Open_vSwitch table. If the IDL reports that the database has changed when ovs-vswitchd updates such a column, then ovs-vswitchd reconfigures itself for no reason, wasting CPU time. This commit also adds support for such columns.
2010-07-12ovsdb-idl: Transition to better interfaces for reading table columns.Ben Pfaff
The existing ovsdb_idl_txn_read() was somewhat difficult and expensive to use, because it always made a copy of the data in the column. This was necessary at the time it was introduced, because there was no way for it to return a "default" value for columns that had not yet been populated without allocating data and hence requiring the caller to free it. Now that ovsdb_datum_default() exists, this is no longer required. This commit introduces a pair of new functions, ovsdb_idl_read() and ovsdb_idl_get(), that return a pointer to existing data and do not do any copying. It also transitions all of ovsdb_idl_txn_read()'s callers to the new interfaces.
2010-06-23ovsdb-idl: Start documenting the public interface.Ben Pfaff
Long overdue.
2010-06-23ovsdb-idl: Simplify usage of ovsdb_idl_run().Ben Pfaff
It makes client code simpler if ovsdb_idl_run() simply lets the caller know whether anything changed.
2010-06-17ovs-vsctl: Support references among records at creation time.Ben Pfaff
This makes it easy to create a bunch of records that are all related to each other in a single ovs-vsctl invocation. It adds an example to the ovs-vsctl manpage.
2010-03-08ovsdb-idl: Make ovsdb_idl_txn_add_comment() take a printf() format string.Ben Pfaff
All of the callers were calling xasprintf() and then passing the result to ovsdb_idl_txn_add_comment(), so this slightly simplifies the callers.
2010-03-03brcompatd: Make bridge ioctls synchronous again.Ben Pfaff
Before OVSDB was adopted in the vswitch, bridge ioctls were synchronous. That is, an operation that, say, creates a new bridge was guaranteed to have completed before brcompatd returned a success result to the kernel. When OVSDB was adopted, however, we failed to maintain this property. Instead, bridge creation (etc.) only happened some time after the return value was passed back to the kernel. This causes a race condition against software that creates or deletes bridges or ports and expects that the operation is completed synchronously. This commit restores the synchronous behavior. Bug #2443.
2010-03-03ovsdb-idl: New function ovsdb_idl_txn_commit_block().Ben Pfaff
This commit factors out common code from multiple callers of ovsdb_idl_txn_commit() into a new function ovsdb_idl_txn_commit_block().
2010-02-08ovsdb-idl: On transaction hard failure make a reason available to client.Ben Pfaff
This make ovs-vsctl able to report problems that occur in better detail.
2010-01-28ovsdb-idl: Add interface to find out the permanent IDL of an inserted row.Ben Pfaff
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-27ovsdb-idl: Export ovsdb_idl_txn_delete() and ovsdb_idl_txn_insert().Ben Pfaff
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-26ovsdb-idl: Allow clients to modify records without using structs.Ben Pfaff
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-14ovsdb: Provide helper function to determine if IDL has ever connectedJustin Pettit
2009-12-16Make ovs-vswitchd report when it is done configuring; make ovs-vsctl wait.Ben Pfaff
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-16ovsdb: Add "comment" feature to transactions and make ovs-vsctl use them.Ben Pfaff
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-11ovs-vsctl: Add --dry-run option.Ben Pfaff
2009-12-09ovs-vsctl: Fix performance problem.Ben Pfaff
2009-12-07ovsdb-idl: Make it possible to write data through the IDL.Ben Pfaff
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-02ovsdb: Implement C bindings for IDL.Ben Pfaff