diff options
author | Ethan Jackson <ethan@nicira.com> | 2011-10-14 17:29:35 -0700 |
---|---|---|
committer | Ethan Jackson <ethan@nicira.com> | 2011-10-17 15:03:03 -0700 |
commit | 70aa337d733c274c93cf43c68c00eb85ca28075b (patch) | |
tree | 870fe2052037b860d5bf511fa3f326158a8241d7 /vswitchd | |
parent | 15236eb49da2abff8b3d2482e45e0666732f1e18 (diff) |
vswitchd: Update link_state instantly.
With this patch, instead of updating an interface's link_state once
every 5 seconds, it's updated immediately when changed. To avoid
stressing the database, these updates are rate limited to once per
second.
Diffstat (limited to 'vswitchd')
-rw-r--r-- | vswitchd/bridge.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 1adf06f2..b3c62187 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -1274,11 +1274,6 @@ iface_refresh_status(struct iface *iface) ovsrec_interface_set_link_speed(iface->cfg, NULL, 0); } - ovsrec_interface_set_link_state(iface->cfg, - (netdev_get_carrier(iface->netdev) - ? "up" - : "down")); - error = netdev_get_mtu(iface->netdev, &mtu); if (!error) { mtu_64 = mtu; @@ -1578,6 +1573,7 @@ bridge_run(void) struct iface *iface; HMAP_FOR_EACH (iface, name_node, &br->iface_by_name) { + const char *link_state; int current; if (iface_is_synthetic(iface)) { @@ -1592,6 +1588,9 @@ bridge_run(void) } else { ovsrec_interface_set_lacp_current(iface->cfg, NULL, 0); } + + link_state = netdev_get_carrier(iface->netdev) ? "up" : "down"; + ovsrec_interface_set_link_state(iface->cfg, link_state); } } |