summaryrefslogtreecommitdiff
path: root/ovsdb
Commit message (Collapse)AuthorAgeFilesLines
* ovsdb-idlc: Remove special case for "sizeof bool".Ben Pfaff2016-10-191-23/+4
| | | | | | | | | | | | The "sparse" checker used to warn about sizeof(bool). These days, it does not warn (without -Wsizeof-bool), so remove this ugly special case. If you have a version of "sparse" that still warns by default, please upgrade to a version that includes commit 2667c2d4ab33 (sparse: Allow override of sizeof(bool) warning). Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* ovsdb-idl: Sort and unique-ify datum in ovsdb_idl_txn_write().Ben Pfaff2016-10-191-2/+0
| | | | | | | | | | | | I noticed that there were lots of calls to ovsdb_datum_sort_unique() from "set" functions in generated IDL code. This moves that call into common code, reducing redundancy. There are more calls to the same function that are a little harder to remove. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* ovsdb-idlc: Eliminate <prefix>_init() function from generated code.Ben Pfaff2016-10-191-57/+30
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* ovsdb-idlc: Consolidate assertions.Ben Pfaff2016-10-191-21/+12
| | | | | | | | There were lots of bits of code emitting "assert(inited);". This combines many of them. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* ovsdb-idlc: Declare loop variables in for statements in generated code.Ben Pfaff2016-10-191-14/+5
| | | | | | | | | | | | This changes several instances of size_t i; for (i = 0; i < ...; i++) into: for (size_t i = 0; i < ...; i++) in generated code, making it slightly more compact and easier to read. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* ovsdb-idlc: Make generated references to columns easier to read.Ben Pfaff2016-10-191-38/+28
| | | | | | | | | This replaces ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_CUR_CFG] by the easier to read and equivalent ovsrec_open_vswitch_col_cur_cfg in generated code. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* ovsdb-idlc: Make generated references to table classes easier to read.Ben Pfaff2016-10-191-28/+29
| | | | | | | | This replaces &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH] by the easier to read and equivalent &ovsrec_table_open_vswitch in generated code. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* ovsdb-idlc: Simplify code generation to parse sets and maps of references.Ben Pfaff2016-10-191-21/+21
| | | | | | | | | | | | | | | | | This switches from code that looks like: if (keyRow) { ... } to: if (!keyRow) { continue; } ... which is a little easier to generate because the indentation of ... is constant. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* ovsdb-idlc: Factor out sorting columns.Ben Pfaff2016-10-191-17/+20
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* ovsdb-idlc: Remove obsolete documentation and usage.Ben Pfaff2016-10-192-6/+0
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* ovsdb-idlc: Use ovsdb_datum_from_smap() instead of open-coding it.Ben Pfaff2016-10-191-42/+3
| | | | | | | | | | | | There's no reason to have three copies of this code for every smap-type column. The code wasn't a perfect match for ovsdb_datum_from_smap(), so this commit also changes ovsdb_datum_from_smap() to better suit it. It only had one caller and the new design is adequate for that caller. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* ovsdb: Reorder elements in ovsdb_table_schema structure.Bhanuprakash Bodireddy2016-10-171-2/+2
| | | | | | | | | | | | | | By reordering the elements in ovsdb_table_schema structure, pad bytes can be reduced and also a cache line is saved. Before: structure size:72, holes:2, sum padbytes:10, cachelines:2 After: structure size:64, holes:1, sum padbytes:2, cachelines:1 Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com> Co-authored-by: Antonio Fischetti <antonio.fischetti@intel.com> Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com> Acked-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
* ovsdb: Fix memory leak when disposing 'replication_dbs'Andy Zhou2016-09-271-7/+14
| | | | | | | | | | | | Found by inspection. The 'replication_dbs' structure was not freed after use. Fix by adding a new function replication_dbs_destroy(). Also remove unnecessary global pointer variables initializer. Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ovsdb: Fix segfalut during replication.Andy Zhou2016-09-271-1/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The newly added replication logic makes it possible for a monitor to receive delete and insertion of the same row back to back, which was not possible before. Add logic (and comment) to handle this case to avoid follow crash reported by Valgrind: #0 0x0000000000453edd in ovsdb_datum_compare_3way (a=0x5efbe60, b=0x0, type=0x5e6a848) at lib/ovsdb-data.c:1626 #1 0x0000000000453ea4 in ovsdb_datum_equals (a=0x5efbe60, b=0x0, type=0x5e6a848) at lib/ovsdb-data.c:1616 #2 0x000000000041b651 in update_monitor_row_data (mt=0x5eda4a0, row=0x5efbe00, data=0x0) at ovsdb/monitor.c:310 #3 0x000000000041ed14 in ovsdb_monitor_changes_update (old=0x0, new=0x5efbe00, mt=0x5eda4a0, changes=0x5ef7180) at ovsdb/monitor.c:1255 #4 0x000000000041f12e in ovsdb_monitor_change_cb (old=0x0, new=0x5efbe00, changed=0x5efc218, aux_=0xffefff040) at ovsdb/monitor.c:1339 #5 0x000000000042ded9 in ovsdb_txn_for_each_change (txn=0x5efbd90, cb=0x41ef50 <ovsdb_monitor_change_cb>, aux=0xffefff040) at ovsdb/transaction.c:906 #6 0x0000000000420155 in ovsdb_monitor_commit (replica=0x5eda2c0, txn=0x5efbd90, durable=false) at ovsdb/monitor.c:1553 #7 0x000000000042dc04 in ovsdb_txn_commit_ (txn=0x5efbd90, durable=false) at ovsdb/transaction.c:868 #8 0x000000000042ddd4 in ovsdb_txn_commit (txn=0x5efbd90, durable=false) at ovsdb/transaction.c:893 #9 0x0000000000422e0c in process_notification (table_updates=0x5efad10, db=0x5e6bd40) at ovsdb/replication.c:575 #10 0x0000000000420ff3 in replication_run () at ovsdb/replication.c:184 #11 0x0000000000405cc8 in main_loop (jsonrpc=0x5e67770, all_dbs=0xffefff3a0, unixctl=0x5ebd980, remotes=0xffefff360, run_process=0x0, exiting=0xffefff3c0, is_backup=0xffefff2de) at ovsdb/ovsdb-server.c:198 #12 0x0000000000406edb in main (argc=1, argv=0xffefff550) at ovsdb/ovsdb-server.c:429 Reported-by: Joe Stringer <joe@ovn.org> Reported-at: http://openvswitch.org/pipermail/dev/2016-September/079315.html Reported-by: Alin Serdean <aserdean@cloudbasesolutions.com> Reported-at: http://openvswitch.org/pipermail/dev/2016-September/079586.html Co-authored-by: Joe Stringer <joe@ovn.org> Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ovsdb-idl: Update comments.Ben Pfaff2016-09-191-3/+1
| | | | | | | | | TXN_AGAIN_WAIT and TXN_AGAIN_NOW were combined into a single return code TXN_TRY_AGAIN a long time ago, but these comment was not updated. Reported-by: Justin Pettit <jpettit@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* ovsdb: monitor - Replace tabs with spacesAlin Serdean2016-09-191-25/+25
| | | | | | | Found by inspection. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Windows: Extend support for binaries which allow detachAlin Serdean2016-09-141-0/+1
| | | | | | | | | | | On Windows we require service_start to be called to parse and setup requirements for '--detach' argument. Affected binaries: ovn-trace, ovsdb-client, ovs-testcontroller. Subsequent patches will be sent to adapt the tests with the new features. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* replication: Be more careful about JSON parsing and simplify code.Ben Pfaff2016-09-121-126/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code here wasn't careful about parsing JSON received from the remote OVSDB server. It assumed, for example, that a row that the remote server implied was new was actually new, without looking to see whether there was already a row with that UUID. This commit improves this validation. It also rewrites code that translated updates locally into calls into the query engine, via JSON, into simple lookups by UUID. For me, this fixes a test failure in test 1866 (ovsdb-server/active-backup-role-switching), which caused the following valgrind report: ==18725== Process terminating with default action of signal 11 (SIGSEGV): dumping core ==18725== Access not within mapped region at address 0x0 ==18725== at 0x43937E: ovsdb_datum_compare_3way (ovsdb-data.c:1626) ==18725== by 0x439344: ovsdb_datum_equals (ovsdb-data.c:1616) ==18725== by 0x4166CC: update_monitor_row_data (monitor.c:310) ==18725== by 0x414A90: ovsdb_monitor_changes_update (monitor.c:1255) ==18725== by 0x417009: ovsdb_monitor_change_cb (monitor.c:1339) ==18725== by 0x41DB52: ovsdb_txn_for_each_change (transaction.c:906) ==18725== by 0x416CC9: ovsdb_monitor_commit (monitor.c:1553) ==18725== by 0x41D993: ovsdb_txn_commit_ (transaction.c:868) ==18725== by 0x41D6F5: ovsdb_txn_commit (transaction.c:893) ==18725== by 0x418185: process_notification (replication.c:576) ==18725== by 0x417705: replication_run (replication.c:185) ==18725== by 0x408240: main_loop (ovsdb-server.c:198) ==18725== by 0x406432: main (ovsdb-server.c:429) I don't know the exact cause of the problem, but this new implementation leaves me more confident due to its simplicity. Reported-by: Joe Stringer <joe@ovn.org> Reported-at: http://openvswitch.org/pipermail/dev/2016-September/079315.html Fixes: 60e0cd041958 ("ovsdb: Replication usability improvements") Signed-off-by: Ben Pfaff <blp@ovn.org> Tested-by: Joe Stringer <joe@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* ovsdb: Fix replication memory leak.Joe Stringer2016-09-121-1/+0
| | | | | | | | | | | | | | | | | | | | | | | Valgrind reports: ==18725== 32 bytes in 1 blocks are definitely lost in loss record 339 of 497 ==18725== at 0x4C29BBE: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==18725== by 0x450F1F: xmalloc (util.c:112) ==18725== by 0x41748E: replication_add_local_db (replication.c:137) ==18725== by 0x40803B: ovsdb_replication_init (ovsdb-server.c:146) ==18725== by 0x407C9E: ovsdb_server_connect_active_ovsdb_server (ovsdb-server.c:1165) ==18725== by 0x450AB3: process_command (unixctl.c:313) ==18725== by 0x4500DC: run_connection (unixctl.c:347) ==18725== by 0x44FFB6: unixctl_server_run (unixctl.c:400) ==18725== by 0x4081AC: main_loop (ovsdb-server.c:182) ==18725== by 0x406432: main (ovsdb-server.c:429) Fixes: 60e0cd041958 ("ovsdb: Replication usability improvements") Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Flavio Fernandes <flavio@flaviof.com> Acked-by: Ben Pfaff <blp@ovn.org>
* ovsdb-monitor: Fix valgrind 'possible loss' warnings.Joe Stringer2016-09-122-4/+4
| | | | | | | | | By placing these nodes at the start of their respective structures, several "possibly lost" warnings from valgrind are silenced. Fixes: 60e0cd041958 ("ovsdb: Replication usability improvements") Signed-off-by: Joe Stringer <joe@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ovsdb-server: Fix memory leak in ovsdb_server_get_sync_exclude_tables().Ben Pfaff2016-09-091-1/+3
| | | | | | Fixes: 3109b4e127fa ("ovsdb: Add blacklist_tables") Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* ovsdb: Replication usability improvementsAndy Zhou2016-09-037-107/+316
| | | | | | | | | | | | | | | | | | | | | | | Based on feedbacks from initial HA manager integration, added the '--active' command line option and appctl command "ovsdb-server/sync-status. See man page updates for details. Added the RPL_S_INIT state in the state machine. This state is not strictly necessary for the replication state machine, but is introduced to make sure the state is update immediately when the state machine is reset, via replication_init(). Without it ovsdb/sync-status may display "replicating" or crash, if the command is issued between after replication_init() is called, but before the state variable is updated from replication_run(). Added a test to simulate the integration of HA manager with OVSDB server using replication. Other documentation and API improvements. Tested-by: Numan Siddique <nusiddiq@redhat.com> Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ovsdb-idlc: Fix logic error in IDL parse function.Mickey Spiegel2016-09-021-1/+1
| | | | | | | | | | | | | | This was found due to a build error when adding an ovsschema column with "type": {"key": "string", "value": "integer"} with no min or max, only a single instance. I am rather unfamiliar with IDL, so no tests have been added yet. I could use some pointers, or someone familiar with IDL tests could take over. Signed-off-by: Mickey Spiegel <mickeys.dev@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovsdb-idlc: Make set and map update operations take const arguments.Ben Pfaff2016-08-311-19/+19
| | | | | | | | | | In a call like "ovsrec_bridge_update_ports_delvalue(bridge, port)", there's no reason for the port argument to be nonconst, because the call doesn't do anything to the port at all--it only searches the list of ports in the bridge for that particular port and, if it finds it, removes it. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Russell Bryant <russell@ovn.org>
* ovsdb: Reimplement replication. Using a state machine.Andy Zhou2016-08-313-302/+330
| | | | | | | | | Current replication uses blocking transactions, which are error prone in practice, especially in handling RPC connection flapping to the active server. Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ovsdb: (Re)hide struct db in ovsdb-server.cAndy Zhou2016-08-313-70/+104
| | | | | | | | | It seems odd that the currently replication implementation moves the struct db from ovsdb-server.c (file private) to replication.h (global). This patch moves the 'struct db' defintion back into ovsdb-server.c, Signed-off-by: Andy Zhou <azhou@ovn.org>
* ovsdb: Add request_idsAndy Zhou2016-08-311-4/+76
| | | | | | | | | | | | | When starting, the replication logic may issue multiple requests at a time, for example, one monitor request for each databases. The request_ids keeps track of all outsanding request IDs that are used for matching reply message with. It also provides the 'db' context for the reply. Future patches will make use of this facility. Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ovsdb: Add blacklist_tablesAndy Zhou2016-08-313-56/+158
| | | | | | | | | | | | | | Currently, 'sync-exclude-tables' command line options are simply stored in a string. Change the implementation to store it in an shash instead to improve modularity. One additional benefit of this change is that errors can be detected and reported to user earlier. Adde a 'dryrun' option to set_blacklist_tables() API to make this feature available to the command line option parsing and unixctl command parsing. Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ovsdb: Properly handle error returned from from reset_database()Andy Zhou2016-08-311-5/+9
| | | | | | | | | Fix a memory leak in case of error. The error object was not properly disposed. Since the error to reset DB is not expected, log it and exit. Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ovsdb-idlc: Fix memory leaks in add and remove clause functions.Ben Pfaff2016-08-301-8/+24
| | | | | | | Found by inspection. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Amitabha Biswas <abiswas@us.ibm.com>
* ovsdb: Fix reference to table's row on condition_add|remove_clauseLiran Schour2016-08-261-20/+20
| | | | | | | | Use struct uuid * on [add|remove]_clause on columns which are references to tables. That prevents use-after-free errors. Signed-off-by: Liran Schour <lirans@il.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Add read-only option to ovs-dpctl and ovs-ofctl commands.Ryan Moats2016-08-151-14/+14
| | | | | | | | | ovs-dpctl and ovs-ofctl lack a read-only option to prevent running of commands that perform read-write operations. Add it and the necessary scaffolding to each. Signed-off-by: Ryan Moats <rmoats@us.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovsdb: Make OVSDB backup sever read onlyAndy Zhou2016-08-149-42/+116
| | | | | | | | | | | | | When ovsdb-sever is running in the backup state, it would be nice to make sure there is no un-intended changes to the backup database. This patch makes the ovsdb server only accepts 'read' transactions as a backup server. When the server role is changed into an active server, all existing client connections will be reset. After reconnect, all clinet transactions will then be accepted. Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ovsdb: Fix bug, set rpc to NULL after freeing.Andy Zhou2016-08-141-1/+2
| | | | | | | | | Found by inspection. Tested-by: Daniel Levy <dlevy@us.ibm.com> Reported-at: http://openvswitch.org/pipermail/discuss/2016-August/022322.html Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ovsdb: Add replication waitAndy Zhou2016-08-143-0/+12
| | | | | | | | Poll_block() requires the run() function to be paired with a wait() function. Add one for replication. Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ovsdb: Rename replication related variable names.Andy Zhou2016-08-144-59/+59
| | | | | | | | | | | | Current replication code refers the other ovsdb-sever instance as a 'remote'. which is overloaded in ovsdb. Switching to use active/backup instead to make it less confusing. Active is the server that should be servicing the client, backup server is the server that boots with the --sync-from option. Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ovsdb: Add/use partial set updates.Ryan Moats2016-08-141-1/+64
| | | | | | | | | | | | | | | | | | | | This patchset mimics the changes introduced in f199df26 (ovsdb-idl: Add partial map updates functionality.) 010fe7ae (ovsdb-idlc.in: Autogenerate partial map updates functions.) 7251075c (tests: Add test for partial map updates.) b1048e6a (ovsdb-idl: Fix issues detected in Partial Map Update feature) but for columns that store sets of values rather than key-value pairs. These columns will now be able to use the OVSDB mutate operation to transmit deltas on the wire rather than use verify/update and transmit wait/update operations on the wire. Side effect of modifying the comments in the partial map update tests. Signed-off-by: Ryan Moats <rmoats@us.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovsdb: Use better error message for "timeout" without waiting.Ryan Moats2016-08-131-1/+2
| | | | | | | | | | | | | When setting a where clause, if the timeout is set to a value of 0, the clause is tested once and if it fails, a message of '"wait" timed out' is returned. This can be misleading because there wasn't any real time, so change the message to '"where" clause test failed'. Signed-off-by: Ryan Moats <rmoats@us.ibm.com> Reported-by: Ryan Moats <rmoats@us.ibm.com> Reported-at: http://openvswitch.org/pipermail/dev/2016-August/077083.html Fixes: f85f8ebb ("Initial implementation of OVSDB.") Signed-off-by: Ben Pfaff <blp@ovn.org>
* Windows: Local named pipe implementationAlin Serdean2016-08-032-4/+5
| | | | | | | | | | | | | | | | | | | | | Currently in the case of command line arguments punix/unix, on Windows we create a file, write a TCP port number to connect. This is a security concern. This patch adds support for the command line arguments punix/unix trying to mimic AF_UNIX behind a local named pipe. This patch drops the TCP socket implementation behind command line arguments punix/unix and switches to the local named pipe implementation. Since we do not write anything to the file created by the punix/unix arguments, switch tests to plain file existence. Man pages and code comments have been updated. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Paul Boca <pboca@cloudbasesolutions.com> Signed-off-by: Gurucharan Shetty <guru@ovn.org>
* ovsdb: Fix memory leak in execute_update.William Tu2016-08-021-0/+3
| | | | | | | | | | | | | | | | Valgrind testcase 1804 ovsdb-server.at:1023 insert rows, update rows by value reports the following leak. json_from_string (json.c:1025) execute_update (replication.c:614), similarily at execute_delete() process_table_update (replication.c:502) process_notification.part.5 (replication.c:445) process_notification (replication.c:402) check_for_notifications (replication.c:418) replication_run (replication.c:110) Signed-off-by: William Tu <u9012063@gmail.com> Acked-by: Andy Zhou <azhou@ovn.org> Signed-off-by: Andy Zhou <azhou@ovn.org>
* ovsdb: Fix OVSDB disconnect replication bugMario Cabrera2016-08-013-12/+23
| | | | | | | | | | | | | Currently disconnecting from the replicator server means closing the jsonrpc connection and destroying the monitored table names and blacklisted table names. This patch makes a distinction between disconnecting from the remote server, applicable when the replication incurs in an error, and destroying the remote server info, applicable when ovsdb-server exits gracefully. Signed-off-by: Mario Cabrera <mario.cabrera@hpe.com>
* ovsdb-client: Fix memory leak reported by Valgrind.William Tu2016-07-271-0/+1
| | | | | | | | | | | | Testcase 1857: ovsdb-monitor.at:538 monitor-cond-change reports the following definitely memory leak: ovsdb_schema_create (ovsdb.c:34) ovsdb_schema_from_json (ovsdb.c:196) fetch_schema (ovsdb-client.c:385) do_monitor_cond (ovsdb-client.c:1112) Signed-off-by: William Tu <u9012063@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovsdb: Fix memory leak in replication logicAndy Zhou2016-07-271-0/+2
| | | | | | | | Release the memory of reply message of the initial "monitor" request. Reported-at: http://openvswitch.org/pipermail/dev/2016-July/076075.html Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: William Tu <u9012063@gmail.com>
* ovsdb: Properly close replication rpc connectionAndy Zhou2016-07-272-0/+2
| | | | | | | | This patch removes rpc related memory leak reported below. Reported-at: http://openvswitch.org/pipermail/dev/2016-July/076075.html Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: William Tu <u9012063@gmail.com>
* ovsdb: Fix memory leak reported by valgrind.Liran Schour2016-07-271-0/+1
| | | | | | | | | Destroy shash on destroy of session's condition structure. Reported here: http://openvswitch.org/pipermail/dev/2016-July/075968.html Signed-off-by: Liran Schour <lirans@il.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: William Tu <u9012063@gmail.com>
* ovsdb: Weak references performance fixRodriguez Betancourt, Esteban2016-07-262-11/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prevents the cloning of rows with outgoing or incoming weak references when those rows aren't being modified. It improves the OVSDB Server performance when many rows with weak references are involved in a transaction. In the original code (dst_refs is created from scratch): old->dst_refs = all the rows that weak referenced old new->dst_refs = all the rows that weak referenced old and are still weak +referencing new + rows in the transaction that weak referenced new In the patch (dst_refs incrementally built): Old->dst_refs = all the rows that weak referenced old Ideally, but expansive to calculate: New->dst_refs = old->dst_refs - "weak references removed within this TXN" + +"weak references created within this TXN" What this patch implements: New->dst_refs = old->dst_refs - "weak references in old rows in TXN" + "weak +references in new rows in TXN" The resulting sets should be equal in both cases. We do some more optimizations: - If we know that the transactions must be successful at some point then, instead of cloning dst_refs we could just move the elements between the lists. - At that point we lost the rollback feature, but we aren't going to need it anyway (note that we didn't really touch the src_refs part). - The references in dst_refs must point to new instead than old. Previously we iterated over all the weak references in dst_refs to change that pointer, but using an UUID is easier, and prevents that iteration completely. For some more commentary, see: http://openvswitch.org/pipermail/dev/2016-July/074840.html Signed-off-by: Esteban Rodriguez Betancourt <estebarb@hpe.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* json: Move from lib to include/openvswitch.Terry Wilson2016-07-2222-28/+39
| | | | | | | | | | | | | | | To easily allow both in- and out-of-tree building of the Python wrapper for the OVS JSON parser (e.g. w/ pip), move json.h to include/openvswitch. This also requires moving lib/{hmap,shash}.h. Both hmap.h and shash.h were #include-ing "util.h" even though the headers themselves did not use anything from there, but rather from include/openvswitch/util.h. Fixing that required including util.h in several C files mostly due to OVS_NOT_REACHED and things like xmalloc. Signed-off-by: Terry Wilson <twilson@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovsdb: Add ovsdb-client options for testing lockAndy Zhou2016-07-222-0/+222
| | | | | | | | | | | | RFC 7047 lock operation has been fully implemented in ovsdb-server for a while, but it is not well covered in unit testing. This patch adds options for the ovsdb-client tool to issue lock operations. The next patch will make use those options. Please see ovsdb-client(1) changes for more details. Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
* ovsdb: Add unixctl commands for OVSDB replicationMario Cabrera2016-07-194-1/+133
| | | | | | | | | | | | | | | | | | | | | | | | | Set and get the server to replicate from: ovsdb-server/set-remote-ovsdb-server {server} ovsdb-server/get-remote-ovsdb-server Set and get the replicated table blacklist: ovsdb-server/set-sync-excluded-tables {DB:table,...} ovsdb-server/get-sync-excluded-tables Connect to the configured server and start replication: ovsdb-server/connect-remote-ovsdb-server Disconnect from the remote server and stop replication, without dropping the replicated data: ovsdb-server/disconnect-remote-ovsdb-server Signed-off-by: Mario Cabrera <mario.cabrera@hpe.com> Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* lib: add monitor_cond_change API to C IDL libLiran Schour2016-07-182-29/+363
| | | | | | | | | | Add to IDL API that allows the user to add and remove clauses on a table's condition iteratively. IDL maintain tables condition and send monitor_cond_change to the server upon condition change. Add tests for conditional monitoring to IDL. Signed-off-by: Liran Schour <lirans@il.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>