ovn-controller: Log OpenFlow errors at "info" level.
authorJustin Pettit <jpettit@ovn.org>
Tue, 21 Jun 2016 21:06:29 +0000 (14:06 -0700)
committerJustin Pettit <jpettit@ovn.org>
Wed, 13 Jul 2016 04:14:02 +0000 (21:14 -0700)
Otherwise, errors are logged at "debug" level.  Errors when pushing
flows can then seemingly be silently lost.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
ovn/controller/ofctrl.c

index 52bf0cd..b451453 100644 (file)
@@ -469,23 +469,32 @@ queue_msg(struct ofpbuf *msg)
     return xid;
 }
 
+static void
+log_openflow_rl(struct vlog_rate_limit *rl, enum vlog_level level,
+                const struct ofp_header *oh, const char *title)
+{
+    if (!vlog_should_drop(&this_module, level, rl)) {
+        char *s = ofp_to_string(oh, ntohs(oh->length), 2);
+        vlog(&this_module, level, "%s: %s", title, s);
+        free(s);
+    }
+}
+
 static void
 ofctrl_recv(const struct ofp_header *oh, enum ofptype type)
 {
     if (type == OFPTYPE_ECHO_REQUEST) {
         queue_msg(make_echo_reply(oh));
+    } else if (type == OFPTYPE_ERROR) {
+        static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(30, 300);
+        log_openflow_rl(&rl, VLL_INFO, oh, "OpenFlow error");
     } else if (type != OFPTYPE_ECHO_REPLY &&
                type != OFPTYPE_BARRIER_REPLY &&
                type != OFPTYPE_PACKET_IN &&
                type != OFPTYPE_PORT_STATUS &&
                type != OFPTYPE_FLOW_REMOVED) {
-        if (VLOG_IS_DBG_ENABLED()) {
-            static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(30, 300);
-
-            char *s = ofp_to_string(oh, ntohs(oh->length), 2);
-            VLOG_DBG_RL(&rl, "OpenFlow packet ignored: %s", s);
-            free(s);
-        }
+        static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(30, 300);
+        log_openflow_rl(&rl, VLL_DBG, oh, "OpenFlow packet ignored");
     }
 }
 \f