From cc485f5d1a4e09a608312d6e4a0ada4d627f01bc Mon Sep 17 00:00:00 2001
From: Jesse Gross <jesse@nicira.com>
Date: Tue, 17 Aug 2010 18:09:53 -0400
Subject: [PATCH] netdev: Don't assume all netdevs are available at runtime.

Currently we print a warning if a user tries to configure a
netdev that is not in the list that userspace knows about.
However, it is possible that a given netdev maybe be enabled but
when it tries to create a device it finds out that it can't
(not supported by kernel module, hardware not present, etc.).
This makes the behavior the same in both cases.

Signed-off-by: Jesse Gross <jesse@nicira.com>
---
 lib/netdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/netdev.c b/lib/netdev.c
index 7d834ad09..3e3555814 100644
--- a/lib/netdev.c
+++ b/lib/netdev.c
@@ -272,8 +272,6 @@ create_device(struct netdev_options *options, struct netdev_dev **netdev_devp)
 
     netdev_class = shash_find_data(&netdev_classes, options->type);
     if (!netdev_class) {
-        VLOG_WARN("could not create netdev %s of unknown type %s",
-                  options->name, options->type);
         return EAFNOSUPPORT;
     }
 
@@ -312,6 +310,10 @@ netdev_open(struct netdev_options *options, struct netdev **netdevp)
     if (!netdev_dev) {
         error = create_device(options, &netdev_dev);
         if (error) {
+            if (error == EAFNOSUPPORT) {
+                VLOG_WARN("could not create netdev %s of unknown type %s",
+                          options->name, options->type);
+            }
             return error;
         }
         update_device_args(netdev_dev, options->args);
-- 
2.47.0