qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: qemu-devel@nongnu.org, peter.maydell@linaro.org
Cc: Thomas Huth <thuth@redhat.com>, Jason Wang <jasowang@redhat.com>
Subject: [Qemu-devel] [PULL 5/9] hmp / net: Mark host_net_add/remove as deprecated
Date: Tue, 23 May 2017 10:43:55 +0800	[thread overview]
Message-ID: <1495507439-1784-6-git-send-email-jasowang@redhat.com> (raw)
In-Reply-To: <1495507439-1784-1-git-send-email-jasowang@redhat.com>

From: Thomas Huth <thuth@redhat.com>

The netdev_add and netdev_del commands should be used nowadays instead.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 hmp-commands.hx |  8 ++++----
 net/net.c       | 13 +++++++++++++
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/hmp-commands.hx b/hmp-commands.hx
index 0aca984..baeac47 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1296,7 +1296,7 @@ ETEXI
         .name       = "host_net_add",
         .args_type  = "device:s,opts:s?",
         .params     = "tap|user|socket|vde|netmap|bridge|vhost-user|dump [options]",
-        .help       = "add host VLAN client",
+        .help       = "add host VLAN client (deprecated, use netdev_add instead)",
         .cmd        = hmp_host_net_add,
         .command_completion = host_net_add_completion,
     },
@@ -1304,14 +1304,14 @@ ETEXI
 STEXI
 @item host_net_add
 @findex host_net_add
-Add host VLAN client.
+Add host VLAN client. Deprecated, please use @code{netdev_add} instead.
 ETEXI
 
     {
         .name       = "host_net_remove",
         .args_type  = "vlan_id:i,device:s",
         .params     = "vlan_id name",
-        .help       = "remove host VLAN client",
+        .help       = "remove host VLAN client (deprecated, use netdev_del instead)",
         .cmd        = hmp_host_net_remove,
         .command_completion = host_net_remove_completion,
     },
@@ -1319,7 +1319,7 @@ ETEXI
 STEXI
 @item host_net_remove
 @findex host_net_remove
-Remove host VLAN client.
+Remove host VLAN client. Deprecated, please use @code{netdev_del} instead.
 ETEXI
 
     {
diff --git a/net/net.c b/net/net.c
index 0ac3b9e..6235aab 100644
--- a/net/net.c
+++ b/net/net.c
@@ -45,6 +45,7 @@
 #include "qapi-visit.h"
 #include "qapi/opts-visitor.h"
 #include "sysemu/sysemu.h"
+#include "sysemu/qtest.h"
 #include "net/filter.h"
 #include "qapi/string-output-visitor.h"
 
@@ -1149,6 +1150,12 @@ void hmp_host_net_add(Monitor *mon, const QDict *qdict)
     const char *opts_str = qdict_get_try_str(qdict, "opts");
     Error *local_err = NULL;
     QemuOpts *opts;
+    static bool warned;
+
+    if (!warned && !qtest_enabled()) {
+        error_report("host_net_add is deprecated, use netdev_add instead");
+        warned = true;
+    }
 
     if (!net_host_check_device(device)) {
         monitor_printf(mon, "invalid host network device %s\n", device);
@@ -1175,6 +1182,12 @@ void hmp_host_net_remove(Monitor *mon, const QDict *qdict)
     NetClientState *nc;
     int vlan_id = qdict_get_int(qdict, "vlan_id");
     const char *device = qdict_get_str(qdict, "device");
+    static bool warned;
+
+    if (!warned && !qtest_enabled()) {
+        error_report("host_net_remove is deprecated, use netdev_del instead");
+        warned = true;
+    }
 
     nc = net_hub_find_client_by_name(vlan_id, device);
     if (!nc) {
-- 
2.7.4

  parent reply	other threads:[~2017-05-23  2:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-23  2:43 [Qemu-devel] [PULL 0/9] Net patches Jason Wang
2017-05-23  2:43 ` [Qemu-devel] [PULL 1/9] net/tap: Replace tap-haiku.c and tap-aix.c by a generic tap-stub.c Jason Wang
2017-05-23  2:43 ` [Qemu-devel] [PULL 2/9] net/dump: Issue a warning for the deprecated "-net dump" Jason Wang
2017-05-23  2:43 ` [Qemu-devel] [PULL 3/9] virtio-net: fix wild pointer when remove virtio-net queues Jason Wang
2017-05-23  2:43 ` [Qemu-devel] [PULL 4/9] COLO-compare: Improve tcp compare trace event readability Jason Wang
2017-05-23  2:43 ` Jason Wang [this message]
2017-05-23  2:43 ` [Qemu-devel] [PULL 6/9] net/filter-mirror.c: Remove duplicate check code Jason Wang
2017-05-23  2:43 ` [Qemu-devel] [PULL 7/9] net/filter-mirror.c: Rename filter_mirror_send() and fix codestyle Jason Wang
2017-05-23  2:43 ` [Qemu-devel] [PULL 8/9] net/filter-rewriter: Remove unused option in filter-rewriter Jason Wang
2017-05-23  2:43 ` [Qemu-devel] [PULL 9/9] e1000e: Fix ICR "Other" causes clear logic Jason Wang
2017-05-23 13:54 ` [Qemu-devel] [PULL 0/9] Net patches Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1495507439-1784-6-git-send-email-jasowang@redhat.com \
    --to=jasowang@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).