summaryrefslogtreecommitdiff
path: root/ovsdb
Commit message (Collapse)AuthorAgeFilesLines
* libX: add new release / version info tagsAaron Conole2017-01-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit uses the $PACKAGE_VERSION automake variable to construct a release and version info combination which sets the library name to be: libfoo-$(OVS_MAJOR_VERSION).so.$(OVS_MINOR_VERSION).0.$(OVS_MICRO_VERSION) where formerly, it was always: libfoo.so.1.0.0 This allows releases of Open vSwitch libraries to reflect which specific versions they came with, and sets up a psuedo ABI-versioning scheme. In this fashion, future releases of Open vSwitch could be installed alongside older releases, allowing 3rd party utilities linked against previous versions to continue to function. ex: $ ldd /path/to/utility linux-vdso.so.1 (0x00007ffe92cf6000) libopenvswitch-2.so.6 => /lib64/libopenvswitch-2.so.6 (0x00007f733b7a3000) libssl.so.10 => /lib64/libssl.so.10 (0x00007f733b530000) ... Note the library name and version information. Signed-off-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* table: correct documented default format in man pagesLance Richardson2016-12-221-0/+2
| | | | | | | | | | | | | | | | | There are currently five users of the table formatting library, all of which default to "list" except for ovsdb-client which defaults to "table". The library current default is "table", and the table.man man page fragment only considers ovs-vsctl to use something other than "table" as a default.As a result, the man pages for ovn-sbctl and vtep-ctl are currently incorrect (these options aren't documented in the ovn-nbctl man page, which will need to be addressed in a future patch). Fix by making the library default format "list" and handling ovsdb-client as the exception. Signed-off-by: Lance Richardson <lrichard@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovsdb-idlc: Initialize nonnull string columns for inserted rows.Ben Pfaff2016-12-201-0/+5
| | | | | | | | | | | | | | | | | | | | When a schema column has type "exactly one string", the corresponding struct member has type "char *" and the documented and expected behavior is that the string should always be nonnull. (The code generator even adds a comment /* Always nonnull. */ in the struct definition.) In the case where a value is not available, the string is supposed to be initialized to "" instead of to NULL. However, the IDL code for inserting a new row did not properly initialize the column to "", instead leaving it NULL. This could cause null pointer dereferences in corner cases. This commit fixes the problem. Reported-by: Lance Richardson <lrichard@redhat.com> Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2016-December/326500.html Signed-off-by: Ben Pfaff <blp@ovn.org> Tested-by: Lance Richardson <lrichard@redhat.com>
* ovsdb-idl: Change interface to conditional monitoring.Ben Pfaff2016-12-191-191/+12
| | | | | | | | | | | | | | | | | | | | | | | | Most users of OVSDB react to whatever is currently in their view of the database, as opposed to keeping track of changes and reacting to those changes individually. The interface to conditional monitoring was different, in that it expected the client to say what to add or remove from monitoring instead of what to monitor. This seemed reasonable at the time, but in practice it turns out that the usual approach actually works better, because the condition is generally a function of the data visible in the database. This commit changes the approach. This commit also changes the meaning of an empty condition for a table. Previously, an empty condition meant to replicate every row. Now, an empty condition means to replicate no rows. This is more convenient for code that gradually constructs conditions, because it does not need special cases for replicating nothing. This commit also changes the internal implementation of conditions from linked lists to arrays. I just couldn't see an advantage to using linked lists. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Liran Schour <lirans@il.ibm.com>
* ovsdb-tool: Document database numbering scheme.Ben Pfaff2016-12-021-0/+25
| | | | | | | Prompted by an IRC discussion. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Russell Bryant <russell@ovn.org>
* ovsdb: Allow online compacting on Windows.Alin Serdean2016-11-301-11/+76
| | | | | | | | | | | | | | | | | | This patch allows online compacting to be done under Windows. To achieve the above we need to close all file handles before trying to rename the file, switch from rename to MoveFileEx (because rename/MoveFile fails if the destination exists), reopen the right type of log after the rename. If we could not reopen the compacted database or the original database after the close simply abort and rely on the service manager. This can be changed in the future. Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Co-authored-by: Ben Pfaff <blp@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org> Tested-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
* Add support for specifying SSL connection parameters to ovsdbEthan Rahn2016-11-104-5/+27
| | | | | Signed-off-by: Ethan Rahn <erahn@arista.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* ovsdb-server: Implement read-only remote connection type.Lance Richardson2016-11-014-2/+23
| | | | | | | | | | | Adds a new "read_only" column for remote connections. Operations that would alter the state of the database are not permitted on connections for which the "read_only" column is set to "true". Signed-off-by: Lance Richardson <lrichard@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* 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>