2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-11 13:57:52 +00:00

ovs-vswitchd: Log datapath ID in a more user-friendly way.

The layering between ofproto and ovs-vswitchd caused the datapath ID to be
logged in a needlessly confusing way.  First, ofproto would log its
default datapath ID:

     using datapath ID 0000505400000004

then the bridge code would immediately determine the datapath ID that it
wanted and call ofproto_set_datapath_id(), which would log the change

     datapath ID changed to 0000111122223333

This commit stops logging the default datapath ID, which is never actually
visible in OpenFlow.  This should make the log files easier to understand.

Bug #12164.
Reported-by: Jacob Cherkas <jcherkas@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Ben Pfaff
2012-06-26 14:43:08 -07:00
parent fbfa291126
commit e825ace22c
3 changed files with 11 additions and 6 deletions

View File

@@ -405,8 +405,6 @@ ofproto_create(const char *datapath_name, const char *datapath_type,
assert(ofproto->n_tables);
ofproto->datapath_id = pick_datapath_id(ofproto);
VLOG_INFO("%s: using datapath ID %016"PRIx64,
ofproto->name, ofproto->datapath_id);
init_ports(ofproto);
*ofprotop = ofproto;
@@ -428,15 +426,18 @@ ofproto_init_tables(struct ofproto *ofproto, int n_tables)
}
}
uint64_t
ofproto_get_datapath_id(const struct ofproto *ofproto)
{
return ofproto->datapath_id;
}
void
ofproto_set_datapath_id(struct ofproto *p, uint64_t datapath_id)
{
uint64_t old_dpid = p->datapath_id;
p->datapath_id = datapath_id ? datapath_id : pick_datapath_id(p);
if (p->datapath_id != old_dpid) {
VLOG_INFO("%s: datapath ID changed to %016"PRIx64,
p->name, p->datapath_id);
/* Force all active connections to reconnect, since there is no way to
* notify a controller that the datapath ID has changed. */
ofproto_reconnect_controllers(p);

View File

@@ -201,6 +201,7 @@ int ofproto_port_query_by_name(const struct ofproto *, const char *devname,
struct ofproto_port *);
/* Top-level configuration. */
uint64_t ofproto_get_datapath_id(const struct ofproto *);
void ofproto_set_datapath_id(struct ofproto *, uint64_t datapath_id);
void ofproto_set_controllers(struct ofproto *,
const struct ofproto_controller *, size_t n);

View File

@@ -754,7 +754,10 @@ bridge_configure_datapath_id(struct bridge *br)
memcpy(br->ea, ea, ETH_ADDR_LEN);
dpid = bridge_pick_datapath_id(br, ea, hw_addr_iface);
ofproto_set_datapath_id(br->ofproto, dpid);
if (dpid != ofproto_get_datapath_id(br->ofproto)) {
VLOG_INFO("bridge %s: using datapath ID %016"PRIx64, br->name, dpid);
ofproto_set_datapath_id(br->ofproto, dpid);
}
dpid_string = xasprintf("%016"PRIx64, dpid);
ovsrec_bridge_set_datapath_id(br->cfg, dpid_string);