Blob Blame History Raw
From daf0de96b084099693fd56314d57747b389c7413 Mon Sep 17 00:00:00 2001
From: Xiao Wang <jasowang@redhat.com>
Date: Fri, 11 Jan 2019 07:59:01 +0000
Subject: [PATCH 06/11] net: hub: suppress warnings of no host network for
 qtest
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

RH-Author: Xiao Wang <jasowang@redhat.com>
Message-id: <20190111075904.2030-7-jasowang@redhat.com>
Patchwork-id: 83982
O-Subject: [RHEL8 qemu-kvm PATCH 6/9] net: hub: suppress warnings of no host network for qtest
Bugzilla: 1636784
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
RH-Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>

Notes: Conflict since we're lacking
       442da403ead80525761898ab0d8036a9cd3c6829 ("net: Get rid of
       'vlan' terminology and use 'hub' instead in the source files")

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>
(cherry picked from commit 56512e1dc1c6a00d37da09baa35981908fb9b5c7)
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
 net/hub.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/hub.c b/net/hub.c
index 5e84a9a..70a6de2 100644
--- 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.
@@ -347,7 +348,7 @@ void net_hub_check_clients(void)
         if (has_host_dev && !has_nic) {
             warn_report("vlan %d with no nics", hub->id);
         }
-        if (has_nic && !has_host_dev) {
+        if (has_nic && !has_host_dev && !qtest_enabled()) {
             warn_report("vlan %d is not connected to host network", hub->id);
         }
     }
-- 
1.8.3.1