diff options
author | Ben Pfaff <blp@nicira.com> | 2011-07-13 16:08:37 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2011-07-26 16:50:09 -0700 |
commit | a11f6164a801c093ef67b144167e55fc9e851626 (patch) | |
tree | 5db7185c850e96094ae17f337490f51eef6af705 /ovsdb | |
parent | 87fcbc60f28cde16939b3a9e139bdc67ca831010 (diff) |
ovsdb: Report the number of connections for inbound Managers.
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.
Diffstat (limited to 'ovsdb')
-rw-r--r-- | ovsdb/jsonrpc-server.c | 2 | ||||
-rw-r--r-- | ovsdb/jsonrpc-server.h | 1 | ||||
-rw-r--r-- | ovsdb/ovsdb-server.c | 4 |
3 files changed, 7 insertions, 0 deletions
diff --git a/ovsdb/jsonrpc-server.c b/ovsdb/jsonrpc-server.c index 06e3accd..14dd4254 100644 --- a/ovsdb/jsonrpc-server.c +++ b/ovsdb/jsonrpc-server.c @@ -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; } diff --git a/ovsdb/jsonrpc-server.h b/ovsdb/jsonrpc-server.h index 1d612cdf..16504483 100644 --- a/ovsdb/jsonrpc-server.h +++ b/ovsdb/jsonrpc-server.h @@ -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, diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c index e2fb9585..1b8d0be0 100644 --- a/ovsdb/ovsdb-server.c +++ b/ovsdb/ovsdb-server.c @@ -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); } |