OSDN Git Service

net: hub: suppress warnings of no host network for qtest
authorJason Wang <jasowang@redhat.com>
Tue, 4 Dec 2018 03:53:44 +0000 (11:53 +0800)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 4 Dec 2018 11:06:15 +0000 (11:06 +0000)
If we want to qtest through hub, it would be much more simpler and
safer to configure the hub without host network. So silent this
warnings for qtest.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-id: 20181204035347.6148-3-jasowang@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
net/hub.c

index 78b671e..5795a67 100644 (file)
--- a/net/hub.c
+++ b/net/hub.c
@@ -20,6 +20,7 @@
 #include "hub.h"
 #include "qemu/iov.h"
 #include "qemu/error-report.h"
+#include "sysemu/qtest.h"
 
 /*
  * A hub broadcasts incoming packets to all its ports except the source port.
@@ -346,7 +347,7 @@ void net_hub_check_clients(void)
         if (has_host_dev && !has_nic) {
             warn_report("hub %d with no nics", hub->id);
         }
-        if (has_nic && !has_host_dev) {
+        if (has_nic && !has_host_dev && !qtest_enabled()) {
             warn_report("hub %d is not connected to host network", hub->id);
         }
     }