Skip to content

Commit

Permalink
vswitch: ratelimit the device add log
Browse files Browse the repository at this point in the history
It's possible that a port added to the system with certain kinds
of invalid parameters will cause the 'could not add' log to be
triggered.  When this happens, the vswitch run loop can continually
re-attempt adding the port.  While the parameters remain invalid
the vswitch run loop will re-trigger the warning, flooding the
syslog.

This patch adds a simple rate limit to the log.

Acked-by: William Tu <[email protected]>
Signed-off-by: Aaron Conole <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
apconole authored and blp committed Sep 23, 2019
1 parent 8720575 commit 45bd8c5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions vswitchd/bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -1816,8 +1816,13 @@ iface_do_create(const struct bridge *br,
*ofp_portp = iface_pick_ofport(iface_cfg);
error = ofproto_port_add(br->ofproto, netdev, ofp_portp);
if (error) {
VLOG_WARN_BUF(errp, "could not add network device %s to ofproto (%s)",
iface_cfg->name, ovs_strerror(error));
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);

*errp = xasprintf("could not add network device %s to ofproto (%s)",
iface_cfg->name, ovs_strerror(error));
if (!VLOG_DROP_WARN(&rl)) {
VLOG_WARN("%s", *errp);
}
goto error;
}

Expand Down

0 comments on commit 45bd8c5

Please sign in to comment.