/* Reconfigures the device 'netdev' with 'args'. 'args' may be empty
* or NULL if none are needed. */
int
-netdev_set_config(struct netdev *netdev, const struct smap *args)
+netdev_set_config(struct netdev *netdev, const struct smap *args, char **errp)
OVS_EXCLUDED(netdev_mutex)
{
if (netdev->netdev_class->set_config) {
error = netdev->netdev_class->set_config(netdev,
args ? args : &no_args);
if (error) {
- VLOG_WARN("%s: could not set configuration (%s)",
- netdev_get_name(netdev), ovs_strerror(error));
+ VLOG_WARN_BUF(errp, "%s: could not set configuration (%s)",
+ netdev_get_name(netdev), ovs_strerror(error));
}
return error;
} else if (args && !smap_is_empty(args)) {
- VLOG_WARN("%s: arguments provided to device that is not configurable",
- netdev_get_name(netdev));
+ VLOG_WARN_BUF(errp, "%s: arguments provided to device that is not configurable",
+ netdev_get_name(netdev));
}
return 0;
}
ofp_port_t ofp_port);
static void iface_set_mac(const struct bridge *, const struct port *, struct iface *);
static void iface_set_ofport(const struct ovsrec_interface *, ofp_port_t ofport);
-static void iface_clear_db_record(const struct ovsrec_interface *if_cfg);
+static void iface_clear_db_record(const struct ovsrec_interface *if_cfg, char *errp);
static void iface_configure_qos(struct iface *, const struct ovsrec_qos *);
static void iface_configure_cfm(struct iface *);
static void iface_refresh_cfm_stats(struct iface *);
ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_cfm_remote_opstate);
ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_bfd_status);
ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_lacp_current);
+ ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_error);
ovsdb_idl_omit(idl, &ovsrec_interface_col_external_ids);
ovsdb_idl_omit_alert(idl, &ovsrec_controller_col_is_connected);
LIST_FOR_EACH (iface, port_elem, &port->ifaces) {
iface_set_ofport(iface->cfg, iface->ofp_port);
+ /* Clear eventual previous errors */
+ ovsrec_interface_set_error(iface->cfg, NULL);
iface_configure_cfm(iface);
iface_configure_qos(iface, port->cfg->qos);
iface_set_mac(br, port, iface);
}
if (strcmp(ofproto_port.type, iface->type)
- || netdev_set_config(iface->netdev, &iface->cfg->options)) {
+ || netdev_set_config(iface->netdev, &iface->cfg->options, NULL)) {
/* The interface is the wrong type or can't be configured.
* Delete it. */
goto delete;
* Returns 0 if successful, otherwise a positive errno value. */
static int
iface_set_netdev_config(const struct ovsrec_interface *iface_cfg,
- struct netdev *netdev)
+ struct netdev *netdev, char **errp)
{
- return netdev_set_config(netdev, &iface_cfg->options);
+ return netdev_set_config(netdev, &iface_cfg->options, errp);
}
/* Opens a network device for 'if_cfg' and configures it. Adds the network
iface_do_create(const struct bridge *br,
const struct ovsrec_interface *iface_cfg,
const struct ovsrec_port *port_cfg,
- ofp_port_t *ofp_portp, struct netdev **netdevp)
+ ofp_port_t *ofp_portp, struct netdev **netdevp,
+ char **errp)
{
struct netdev *netdev = NULL;
int error;
error = netdev_open(iface_cfg->name,
iface_get_type(iface_cfg, br->cfg), &netdev);
if (error) {
- VLOG_WARN("could not open network device %s (%s)",
- iface_cfg->name, ovs_strerror(error));
+ VLOG_WARN_BUF(errp, "could not open network device %s (%s)",
+ iface_cfg->name, ovs_strerror(error));
goto error;
}
- error = iface_set_netdev_config(iface_cfg, netdev);
+ error = iface_set_netdev_config(iface_cfg, netdev, errp);
if (error) {
goto error;
}
struct iface *iface;
ofp_port_t ofp_port;
struct port *port;
+ char *errp = NULL;
int error;
/* Do the bits that can fail up front. */
ovs_assert(!iface_lookup(br, iface_cfg->name));
- error = iface_do_create(br, iface_cfg, port_cfg, &ofp_port, &netdev);
+ error = iface_do_create(br, iface_cfg, port_cfg, &ofp_port, &netdev, &errp);
if (error) {
- iface_clear_db_record(iface_cfg);
+ iface_clear_db_record(iface_cfg, errp);
+ free(errp);
return false;
}
* This is appropriate when 'if_cfg''s interface cannot be created or is
* otherwise invalid. */
static void
-iface_clear_db_record(const struct ovsrec_interface *if_cfg)
+iface_clear_db_record(const struct ovsrec_interface *if_cfg, char *errp)
{
if (!ovsdb_idl_row_is_synthetic(&if_cfg->header_)) {
iface_set_ofport(if_cfg, OFPP_NONE);
+ ovsrec_interface_set_error(if_cfg, errp);
ovsrec_interface_set_status(if_cfg, NULL);
ovsrec_interface_set_admin_state(if_cfg, NULL);
ovsrec_interface_set_duplex(if_cfg, NULL);