From: Ben Pfaff Date: Fri, 8 May 2009 17:46:19 +0000 (-0700) Subject: brcompatd: Log high-level actions and their results. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f734b3f297b7f355ae7a0a0d07a6c4d4437ab4b;p=openvswitch brcompatd: Log high-level actions and their results. brcompatd did not log the addbr, delbr, addif, and delif actions that it was taking. This commit adds that logging. --- diff --git a/vswitchd/brcompatd.c b/vswitchd/brcompatd.c index f2d06d0d..b72e095a 100644 --- a/vswitchd/brcompatd.c +++ b/vswitchd/brcompatd.c @@ -283,8 +283,9 @@ prune_ports(void) static int modify_config(const char *br_name, const char *port_name, enum bmc_action act) { - switch (act) { + int error1, error2; + switch (act) { case BMC_ADD_DP: cfg_add_entry("bridge.%s.port=%s", br_name, br_name); break; @@ -304,10 +305,10 @@ modify_config(const char *br_name, const char *port_name, enum bmc_action act) break; } - cfg_write(); - cfg_read(); + error1 = cfg_write(); + error2 = cfg_read(); - return 0; + return error1 ? error1 : error2; } static int @@ -316,14 +317,19 @@ add_bridge(const char *br_name) int retval; if (bridge_exists(br_name)) { + VLOG_WARN("addbr %s: bridge %s exists", br_name, br_name); return EEXIST; } retval = modify_config(br_name, NULL, BMC_ADD_DP); if (retval) { + VLOG_WARN("addbr %s: config file update failed: %s", + br_name, strerror(retval)); return retval; } + VLOG_INFO("addbr %s: success", br_name); + /* Ask vswitchd to reconfigure itself. */ force_reconfigure(); @@ -336,17 +342,22 @@ del_bridge(const char *br_name) int retval; if (!bridge_exists(br_name)) { + VLOG_WARN("delbr %s: no bridge named %s", br_name, br_name); return ENXIO; } retval = modify_config(br_name, NULL, BMC_DEL_DP); if (retval) { + VLOG_WARN("delbr %s: config file update failed: %s", + br_name, strerror(retval)); return retval; } /* Ask vswitchd to reconfigure itself. */ force_reconfigure(); + VLOG_INFO("delbr %s: success", br_name); + return 0; } @@ -394,6 +405,7 @@ static const struct nl_policy brc_port_policy[] = { static int handle_port_cmd(struct ofpbuf *buffer, bool add) { + const char *cmd_name = add ? "addif" : "delif"; struct nlattr *attrs[ARRAY_SIZE(brc_port_policy)]; const char *br_name, *port_name; int retval; @@ -407,6 +419,8 @@ handle_port_cmd(struct ofpbuf *buffer, bool add) port_name = nl_attr_get(attrs[BRC_GENL_A_PORT_NAME]); if (!bridge_exists(br_name)) { + VLOG_WARN("%s %s %s: no bridge named %s", + cmd_name, br_name, port_name, br_name); return EINVAL; } @@ -416,9 +430,13 @@ handle_port_cmd(struct ofpbuf *buffer, bool add) retval = modify_config(br_name, port_name, BMC_DEL_PORT); } if (retval) { + VLOG_WARN("%s %s %s: config file update failed: %s", + cmd_name, br_name, port_name, strerror(retval)); return retval; } + VLOG_INFO("%s %s %s: success", cmd_name, br_name, port_name); + /* Ask vswitchd to reconfigure itself. */ force_reconfigure();