Skip to content

Commit

Permalink
ovsdb: Report the number of connections for inbound Managers.
Browse files Browse the repository at this point in the history
Inbound managers (e.g. "ptcp:") can have multiple active connections, but
the database schema doesn't allow us to report the status of more than one
at a time.  This commit adds a status key-value pair that, when there is
more than one active connection, reports the number that are active.  This
at least helps to clarify the issue.
  • Loading branch information
blp committed Jul 26, 2011
1 parent 87fcbc6 commit a11f616
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ovsdb/jsonrpc-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,8 @@ ovsdb_jsonrpc_session_get_status(const struct ovsdb_jsonrpc_remote *remote,
status->sec_since_disconnect = rstats.msec_since_disconnect == UINT_MAX
? UINT_MAX : rstats.msec_since_disconnect / 1000;

status->n_connections = list_size(&remote->sessions);

return true;
}

Expand Down
1 change: 1 addition & 0 deletions ovsdb/jsonrpc-server.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ struct ovsdb_jsonrpc_remote_status {
unsigned int sec_since_connect;
unsigned int sec_since_disconnect;
bool is_connected;
int n_connections;
};
bool ovsdb_jsonrpc_server_get_remote_status(
const struct ovsdb_jsonrpc_server *, const char *target,
Expand Down
4 changes: 4 additions & 0 deletions ovsdb/ovsdb-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,10 @@ update_remote_row(const struct ovsdb_row *row, struct ovsdb_txn *txn,
values[n++] =
xstrdup(ovs_retval_to_string(status.last_error));
}
if (status.n_connections > 1) {
keys[n] = xstrdup("n_connections");
values[n++] = xasprintf("%d", status.n_connections);
}
write_string_string_column(rw_row, "status", keys, values, n);
}

Expand Down
17 changes: 17 additions & 0 deletions vswitchd/vswitch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2191,6 +2191,23 @@
database (in seconds). Value is empty if manager has never
disconnected.</dd>
</dl>
<dl>
<dt><code>n_connections</code></dt>
<dd>
<p>
When <ref column="target"/> specifies a connection method that
listens for inbound connections (e.g. <code>ptcp:</code> or
<code>pssl:</code>) and more than one connection is actually
active, the value is the number of active connections.
Otherwise, this key-value pair is omitted.
</p>
<p>
When multiple connections are active, status columns and
key-value pairs (other than this one) report the status of one
arbitrarily chosen connection.
</p>
</dd>
</dl>
</column>
</group>
</table>
Expand Down

0 comments on commit a11f616

Please sign in to comment.