From d647f0a7442e7c9a0aa6026f55de2c74734599af Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 7 Apr 2011 14:43:14 -0700 Subject: [PATCH] dpif: Better log unusual errors in dpif_port_query_by_name(). Logging these unusual errors at a low level means that we can remove a bit of higher-level code from ofproto. The ofproto change also changes behavior for these error cases, from doing nothing to removing the port, but I think that's OK. I've never noticed this log message. --- lib/dpif.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/dpif.c b/lib/dpif.c index 26d3dc2a..3786bb72 100644 --- a/lib/dpif.c +++ b/lib/dpif.c @@ -533,11 +533,14 @@ dpif_port_query_by_name(const struct dpif *dpif, const char *devname, } else { memset(port, 0, sizeof *port); - /* Log level is DBG here because all the current callers are interested - * in whether 'dpif' actually has a port 'devname', so that it's not an - * issue worth logging if it doesn't. */ - VLOG_DBG_RL(&error_rl, "%s: failed to query port %s: %s", - dpif_name(dpif), devname, strerror(error)); + /* For ENOENT or ENODEV we use DBG level because the caller is probably + * interested in whether 'dpif' actually has a port 'devname', so that + * it's not an issue worth logging if it doesn't. Other errors are + * uncommon and more likely to indicate a real problem. */ + VLOG_RL(&error_rl, + error == ENOENT || error == ENODEV ? VLL_DBG : VLL_WARN, + "%s: failed to query port %s: %s", + dpif_name(dpif), devname, strerror(error)); } return error; } -- 2.30.2