We likely don't want to maintain the legacy -net options forever,
so let's start informing the users that this option will be
removed in a future version. However, there are two cases where
we should not spill out a message yet: First is the "-net nic"
option which might still be required to configure on-board NICs
that can not be handled via "-netdev" yet, and second is the
"-net user" default option that is created automatically when
no other networking option has been specified.

Signed-off-by: Thomas Huth <th...@redhat.com>
---
 net/net.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/net.c b/net/net.c
index ade6051..2593961 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1006,6 +1006,12 @@ static int net_client_init1(const void *object, int 
is_netdev, Error **errp)
             return -1;
         }
 
+        if (opts->type != NET_CLIENT_OPTIONS_KIND_NIC &&
+            (!default_net || opts->type != NET_CLIENT_OPTIONS_KIND_USER)) {
+            error_report("Deprecated net option - "
+                         "this will be removed in a future version!");
+        }
+
         if (!net_client_init_fun[opts->type]) {
             error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "type",
                        "a net backend type (maybe it is not compiled "
-- 
1.8.3.1


Reply via email to