Skip to content

Commit

Permalink
bridge: Don't pay attention to columns that vswitchd doesn't need.
Browse files Browse the repository at this point in the history
Not replicating unneeded columns has some value in avoiding CPU time and
bandwidth to the database.  In ovs-vswitchd, setting cur_cfg as write-only
also have great value in avoiding extra reconfiguration steps.  When
ovs-vsctl is used in its default mode this essentially avoids half of the
reconfigurations that ovs-vswitchd currently does.  What happens now is:

    1. ovs-vsctl updates the database and increments next_cfg.
    2. ovs-vswitchd notices the change to the database, reconfigures
       itself, then increments cur_cfg to match next_cfg.
    3. The database sends the change to cur_cfg back to ovs-vswitchd.
    4. ovs-vswitchd reconfigures itself a second time.

By not replicating cur_cfg we avoid step 3 and save a whole reconfiguration
step.

Also, now that the database contains interface statistics, this avoids
reconfiguring every time that statistics are updated.
  • Loading branch information
blp committed Aug 11, 2010
1 parent c547535 commit e85bbd7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/ovsdb-idl.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,11 +641,19 @@ ovsdb_idl_row_update(struct ovsdb_idl_row *row, const struct json *row_json)
error = ovsdb_datum_from_json(&datum, &column->type, node->data, NULL);
if (!error) {
unsigned int column_idx = column - table->class->columns;
ovsdb_datum_swap(&row->old[column_idx], &datum);
ovsdb_datum_destroy(&datum, &column->type);
if (table->modes[column_idx] == OVSDB_IDL_MODE_RW) {
changed = true;
struct ovsdb_datum *old = &row->old[column_idx];

if (!ovsdb_datum_equals(old, &datum, &column->type)) {
ovsdb_datum_swap(old, &datum);
if (table->modes[column_idx] == OVSDB_IDL_MODE_RW) {
changed = true;
}
} else {
/* Didn't really change but the OVSDB monitor protocol always
* includes every value in a row. */
}

ovsdb_datum_destroy(&datum, &column->type);
} else {
char *s = ovsdb_error_to_string(error);
VLOG_WARN_RL(&syntax_rl, "error parsing column %s in row "UUID_FMT
Expand Down
13 changes: 13 additions & 0 deletions vswitchd/bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,19 @@ bridge_init(const char *remote)
/* Create connection to database. */
idl = ovsdb_idl_create(remote, &ovsrec_idl_class);

ovsdb_idl_set_write_only(idl, &ovsrec_open_vswitch_col_cur_cfg);
ovsdb_idl_set_write_only(idl, &ovsrec_open_vswitch_col_statistics);
ovsdb_idl_omit(idl, &ovsrec_open_vswitch_col_external_ids);

ovsdb_idl_omit(idl, &ovsrec_bridge_col_external_ids);

ovsdb_idl_omit(idl, &ovsrec_port_col_external_ids);
ovsdb_idl_omit(idl, &ovsrec_port_col_fake_bridge);

ovsdb_idl_set_write_only(idl, &ovsrec_interface_col_ofport);
ovsdb_idl_set_write_only(idl, &ovsrec_interface_col_statistics);
ovsdb_idl_omit(idl, &ovsrec_interface_col_external_ids);

/* Register unixctl commands. */
unixctl_command_register("fdb/show", bridge_unixctl_fdb_show, NULL);
unixctl_command_register("bridge/dump-flows", bridge_unixctl_dump_flows,
Expand Down

0 comments on commit e85bbd7

Please sign in to comment.