This allows its callers to avoid duplicating the code.

Signed-off-by: Ben Pfaff <b...@nicira.com>
---
 lib/netdev.c          |   10 ++++++++--
 utilities/ovs-dpctl.c |    2 --
 vswitchd/bridge.c     |    9 +--------
 3 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/lib/netdev.c b/lib/netdev.c
index 5ed6062..159ca51 100644
--- a/lib/netdev.c
+++ b/lib/netdev.c
@@ -386,8 +386,14 @@ netdev_set_config(struct netdev *netdev, const struct smap 
*args)
 {
     if (netdev->netdev_class->set_config) {
         const struct smap no_args = SMAP_INITIALIZER(&no_args);
-        return netdev->netdev_class->set_config(netdev,
-                                                args ? args : &no_args);
+        int error;
+
+        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));
+        }
     } else if (args && !smap_is_empty(args)) {
         VLOG_WARN("%s: arguments provided to device that is not configurable",
                   netdev_get_name(netdev));
diff --git a/utilities/ovs-dpctl.c b/utilities/ovs-dpctl.c
index 29f1151..bd99834 100644
--- a/utilities/ovs-dpctl.c
+++ b/utilities/ovs-dpctl.c
@@ -350,7 +350,6 @@ dpctl_add_if(int argc OVS_UNUSED, char *argv[])
 
         error = netdev_set_config(netdev, &args);
         if (error) {
-            ovs_error(error, "%s: failed to configure network device", name);
             goto next;
         }
 
@@ -459,7 +458,6 @@ dpctl_set_if(int argc, char *argv[])
         error = netdev_set_config(netdev, &args);
         smap_destroy(&args);
         if (error) {
-            ovs_error(error, "%s: failed to configure network device", name);
             goto next;
         }
 
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 2b11c5b..0b0e4d7 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -1343,14 +1343,7 @@ static int
 iface_set_netdev_config(const struct ovsrec_interface *iface_cfg,
                         struct netdev *netdev)
 {
-    int error;
-
-    error = netdev_set_config(netdev, &iface_cfg->options);
-    if (error) {
-        VLOG_WARN("could not configure network device %s (%s)",
-                  iface_cfg->name, ovs_strerror(error));
-    }
-    return error;
+    return netdev_set_config(netdev, &iface_cfg->options);
 }
 
 /* This function determines whether 'ofproto_port', which is attached to
-- 
1.7.10.4

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to