From: Ben Pfaff Date: Fri, 5 Aug 2011 21:14:18 +0000 (-0700) Subject: bridge: Add port to datapath before trying to retrieve device stats. X-Git-Tag: v1.2.1~9 X-Git-Url: http://git.cascardo.eti.br/?a=commitdiff_plain;h=7283dda1fd672b1f8326df9bb6f54062cbf02116;p=cascardo%2Fovs.git bridge: Add port to datapath before trying to retrieve device stats. Virtual ports such as GRE tunnels don't exist until after the port is added to the datapath, so without this change adding such a port yields a warning like the following: netdev|WARN|failed to retrieve MTU for network device gre0: No such device --- diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 6491590a9..bd369eb7e 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -871,12 +871,6 @@ bridge_add_ofproto_ports(struct bridge *br) iface->name, strerror(error)); } - /* Populate stats columns in new Interface rows. */ - if (iface->netdev && !iface->cfg->mtu) { - iface_refresh_stats(iface); - iface_refresh_status(iface); - } - /* Add the port, if necessary. */ if (iface->netdev && iface->ofp_port < 0) { uint16_t ofp_port; @@ -892,6 +886,12 @@ bridge_add_ofproto_ports(struct bridge *br) } } + /* Populate stats columns in new Interface rows. */ + if (iface->netdev && !iface->cfg->mtu) { + iface_refresh_stats(iface); + iface_refresh_status(iface); + } + /* Delete the iface if */ if (iface->netdev && iface->ofp_port >= 0) { VLOG_DBG("bridge %s: interface %s is on port %d",