On Tue, 2011-06-28 at 09:05 -0700, Ben Pfaff wrote:
> On Mon, Jun 27, 2011 at 06:57:31PM -0700, Andrew Evans wrote:
> > Currently there's a lag of up to five seconds before the status and
> > statistics
> > columns in the Interface table are populated when a port is first added to a
> > bridge. This may confuse systems that expect those columns to be populated
> > right away.
> >
> > Bug #5820.
>
> Do you think that we could do this just in the case where we added a
> new port?
Ok. I had to resort to checking the mtu column in the Interface row to
reliably determine when we need to do this. The patch now looks like:
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index d0a5764..dbd18a1 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -195,7 +195,9 @@ static void iface_set_mac(struct iface *);
static void iface_set_ofport(const struct ovsrec_interface *, int64_t ofport);
static void iface_configure_qos(struct iface *, const struct ovsrec_qos *);
static void iface_configure_cfm(struct iface *);
-static bool iface_refresh_cfm_stats(struct iface *iface);
+static bool iface_refresh_cfm_stats(struct iface *);
+static void iface_refresh_stats(struct iface *);
+static void iface_refresh_status(struct iface *);
static bool iface_get_carrier(const struct iface *);
static bool iface_is_synthetic(const struct iface *);
@@ -828,6 +830,19 @@ bridge_refresh_ofp_port(struct bridge *br)
}
}
+static int64_t *
+iface_get_mtu(const struct iface *iface)
+{
+ const struct ovsdb_datum *datum =
+ ovsrec_interface_get_mtu(iface->cfg, OVSDB_TYPE_INTEGER);
+
+ if (datum && datum->keys) {
+ return &(datum->keys[0].integer);
+ }
+
+ return NULL;
+}
+
/* Add an ofproto port for any "struct iface" that doesn't have one.
* Delete any "struct iface" for which this fails.
* Delete any "struct port" that thereby ends up with no ifaces. */
@@ -866,6 +881,12 @@ bridge_add_ofproto_ports(struct bridge *br)
iface->name, strerror(error));
}
+ /* Populate stats columns in new Interface rows. */
+ if (!iface_get_mtu(iface)) {
+ iface_refresh_stats(iface);
+ iface_refresh_status(iface);
+ }
+
/* Add the port, if necessary. */
if (iface->netdev && iface->ofp_port < 0) {
uint16_t ofp_port;
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev