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;
break;
}
- cfg_write();
- cfg_read();
+ error1 = cfg_write();
+ error2 = cfg_read();
- return 0;
+ return error1 ? error1 : error2;
}
static int
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();
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;
}
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;
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;
}
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();