From e825ace22c8f863e806ff2ac9a6f58a4e112ee5c Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 26 Jun 2012 14:43:08 -0700 Subject: [PATCH] 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 Signed-off-by: Ben Pfaff --- ofproto/ofproto.c | 11 ++++++----- ofproto/ofproto.h | 1 + vswitchd/bridge.c | 5 ++++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 425da91c..709713d0 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -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); diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h index ea988e7b..0919d813 100644 --- a/ofproto/ofproto.h +++ b/ofproto/ofproto.h @@ -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); diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 67e29d2d..3a3e58b1 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -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); -- 2.30.2