summaryrefslogtreecommitdiff
path: root/ofproto
diff options
context:
space:
mode:
authorAndrew Evans <aevans@nicira.com>2011-03-09 10:45:26 -0800
committerAndrew Evans <aevans@nicira.com>2011-03-09 10:45:26 -0800
commit24190e86c8ddedc3b20669e5eeb0ab5fc00a6255 (patch)
treec30e93e3dfbcd19c892ac644abc085230b15356f /ofproto
parent16ceb69e8f8f7a6988a90e6c70f4654bcf62818b (diff)
downloadopenvswitch-24190e86c8ddedc3b20669e5eeb0ab5fc00a6255.tar.gz
ofproto: Report time connected or disconnected, not time in rconn state.
Commit bffc058934 (bridge: Add controller status to Controller table.) exposed the underlying time in a particular connection state for each controller, but this turns out not to be very useful, because controller state tends to fluctuate even when the connection is unbroken. Change to set "time_connected" or "time_disconnected" keys in the status column of the Controller table. Bug #4833.
Diffstat (limited to 'ofproto')
-rw-r--r--ofproto/ofproto.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 49f99cbba..c7872baf7 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -1396,9 +1396,15 @@ ofproto_get_ofproto_controller_info(const struct ofproto * ofproto,
cinfo->pairs.values[cinfo->pairs.n++] =
xstrdup(rconn_get_state(rconn));
- cinfo->pairs.keys[cinfo->pairs.n] = "time_in_state";
- cinfo->pairs.values[cinfo->pairs.n++] =
- xasprintf("%u", rconn_get_state_elapsed(rconn));
+ if (rconn_is_admitted(rconn)) {
+ cinfo->pairs.keys[cinfo->pairs.n] = "time_connected";
+ cinfo->pairs.values[cinfo->pairs.n++] =
+ xasprintf("%ld", time_now() - rconn_get_last_connection(rconn));
+ } else {
+ cinfo->pairs.keys[cinfo->pairs.n] = "time_disconnected";
+ cinfo->pairs.values[cinfo->pairs.n++] =
+ xasprintf("%d", rconn_failure_duration(rconn));
+ }
}
}