From nobody Wed Oct 22 17:06:54 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1519148561963312.38973181871506; Tue, 20 Feb 2018 09:42:41 -0800 (PST) Received: from localhost ([::1]:56845 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eoBw8-0003jn-UP for importer@patchew.org; Tue, 20 Feb 2018 12:42:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eoBuB-0002UY-PH for qemu-devel@nongnu.org; Tue, 20 Feb 2018 12:40:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eoBuA-0000b6-6H for qemu-devel@nongnu.org; Tue, 20 Feb 2018 12:40:39 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:44036 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eoBu9-0000ac-W4 for qemu-devel@nongnu.org; Tue, 20 Feb 2018 12:40:38 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8DAB5EAEA0 for ; Tue, 20 Feb 2018 17:40:37 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-116-114.ams2.redhat.com [10.36.116.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id A7713AE7B6; Tue, 20 Feb 2018 17:40:34 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Jason Wang , "Dr. David Alan Gilbert" Date: Tue, 20 Feb 2018 18:40:04 +0100 Message-Id: <1519148406-15006-7-git-send-email-thuth@redhat.com> In-Reply-To: <1519148406-15006-1-git-send-email-thuth@redhat.com> References: <1519148406-15006-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 20 Feb 2018 17:40:37 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 20 Feb 2018 17:40:37 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v2 6/8] net: Remove the deprecated 'host_net_add' and 'host_net_remove' HMP commands X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" They are deprecated since QEMU v2.10, and so far nobody complained that these commands are still necessary for any reason - and since you can use 'netdev_add' and 'netdev_remove' instead, there also should not be any real reason. Since they are also standing in the way for the upcoming 'vlan' clean-up, it's now time to remove them. Reviewed-by: Paolo Bonzini Signed-off-by: Thomas Huth --- hmp-commands.hx | 30 ------------------ hmp.h | 3 -- monitor.c | 61 ------------------------------------ net/net.c | 94 ----------------------------------------------------= ---- qemu-doc.texi | 10 ------ tests/test-hmp.c | 2 -- 6 files changed, 200 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index d26eb41..964eb51 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1291,36 +1291,6 @@ Inject PCIe AER error ETEXI =20 { - .name =3D "host_net_add", - .args_type =3D "device:s,opts:s?", - .params =3D "tap|user|socket|vde|netmap|bridge|vhost-user|dump= [options]", - .help =3D "add host VLAN client (deprecated, use netdev_add = instead)", - .cmd =3D hmp_host_net_add, - .command_completion =3D host_net_add_completion, - }, - -STEXI -@item host_net_add -@findex host_net_add -Add host VLAN client. Deprecated, please use @code{netdev_add} instead. -ETEXI - - { - .name =3D "host_net_remove", - .args_type =3D "vlan_id:i,device:s", - .params =3D "vlan_id name", - .help =3D "remove host VLAN client (deprecated, use netdev_d= el instead)", - .cmd =3D hmp_host_net_remove, - .command_completion =3D host_net_remove_completion, - }, - -STEXI -@item host_net_remove -@findex host_net_remove -Remove host VLAN client. Deprecated, please use @code{netdev_del} instead. -ETEXI - - { .name =3D "netdev_add", .args_type =3D "netdev:O", .params =3D "[user|tap|socket|vde|bridge|hubport|netmap|vhost-= user],id=3Dstr[,prop=3Dvalue][,...]", diff --git a/hmp.h b/hmp.h index 1143db4..b897338 100644 --- a/hmp.h +++ b/hmp.h @@ -132,9 +132,6 @@ void migrate_set_capability_completion(ReadLineState *r= s, int nb_args, const char *str); void migrate_set_parameter_completion(ReadLineState *rs, int nb_args, const char *str); -void host_net_add_completion(ReadLineState *rs, int nb_args, const char *s= tr); -void host_net_remove_completion(ReadLineState *rs, int nb_args, - const char *str); void delvm_completion(ReadLineState *rs, int nb_args, const char *str); void loadvm_completion(ReadLineState *rs, int nb_args, const char *str); void hmp_rocker(Monitor *mon, const QDict *qdict); diff --git a/monitor.c b/monitor.c index 373bb8d..a4f1f28 100644 --- a/monitor.c +++ b/monitor.c @@ -3574,67 +3574,6 @@ void migrate_set_parameter_completion(ReadLineState = *rs, int nb_args, } } =20 -void host_net_add_completion(ReadLineState *rs, int nb_args, const char *s= tr) -{ - int i; - size_t len; - if (nb_args !=3D 2) { - return; - } - len =3D strlen(str); - readline_set_completion_index(rs, len); - for (i =3D 0; host_net_devices[i]; i++) { - if (!strncmp(host_net_devices[i], str, len)) { - readline_add_completion(rs, host_net_devices[i]); - } - } -} - -void host_net_remove_completion(ReadLineState *rs, int nb_args, const char= *str) -{ - NetClientState *ncs[MAX_QUEUE_NUM]; - int count, i, len; - - len =3D strlen(str); - readline_set_completion_index(rs, len); - if (nb_args =3D=3D 2) { - count =3D qemu_find_net_clients_except(NULL, ncs, - NET_CLIENT_DRIVER_NONE, - MAX_QUEUE_NUM); - for (i =3D 0; i < MIN(count, MAX_QUEUE_NUM); i++) { - int id; - char name[16]; - - if (net_hub_id_for_client(ncs[i], &id)) { - continue; - } - snprintf(name, sizeof(name), "%d", id); - if (!strncmp(str, name, len)) { - readline_add_completion(rs, name); - } - } - return; - } else if (nb_args =3D=3D 3) { - count =3D qemu_find_net_clients_except(NULL, ncs, - NET_CLIENT_DRIVER_NIC, - MAX_QUEUE_NUM); - for (i =3D 0; i < MIN(count, MAX_QUEUE_NUM); i++) { - int id; - const char *name; - - if (ncs[i]->info->type =3D=3D NET_CLIENT_DRIVER_HUBPORT || - net_hub_id_for_client(ncs[i], &id)) { - continue; - } - name =3D ncs[i]->name; - if (!strncmp(str, name, len)) { - readline_add_completion(rs, name); - } - } - return; - } -} - static void vm_completion(ReadLineState *rs, const char *str) { size_t len; diff --git a/net/net.c b/net/net.c index cbd553d..2d05808 100644 --- a/net/net.c +++ b/net/net.c @@ -60,25 +60,6 @@ static VMChangeStateEntry *net_change_state_entry; static QTAILQ_HEAD(, NetClientState) net_clients; =20 -const char *host_net_devices[] =3D { - "tap", - "socket", -#ifdef CONFIG_NET_BRIDGE - "bridge", -#endif -#ifdef CONFIG_NETMAP - "netmap", -#endif -#ifdef CONFIG_SLIRP - "user", -#endif -#ifdef CONFIG_VDE - "vde", -#endif - "vhost-user", - NULL, -}; - /***********************************************************/ /* network device redirectors */ =20 @@ -1174,81 +1155,6 @@ static int net_client_init(QemuOpts *opts, bool is_n= etdev, Error **errp) return ret; } =20 - -static int net_host_check_device(const char *device) -{ - int i; - for (i =3D 0; host_net_devices[i]; i++) { - if (!strncmp(host_net_devices[i], device, - strlen(host_net_devices[i]))) { - return 1; - } - } - - return 0; -} - -void hmp_host_net_add(Monitor *mon, const QDict *qdict) -{ - const char *device =3D qdict_get_str(qdict, "device"); - const char *opts_str =3D qdict_get_try_str(qdict, "opts"); - Error *local_err =3D NULL; - QemuOpts *opts; - static bool warned; - - if (!warned && !qtest_enabled()) { - error_report("host_net_add is deprecated, use netdev_add instead"); - warned =3D true; - } - - if (!net_host_check_device(device)) { - monitor_printf(mon, "invalid host network device %s\n", device); - return; - } - - opts =3D qemu_opts_parse_noisily(qemu_find_opts("net"), - opts_str ? opts_str : "", false); - if (!opts) { - return; - } - - qemu_opt_set(opts, "type", device, &error_abort); - - net_client_init(opts, false, &local_err); - if (local_err) { - error_report_err(local_err); - monitor_printf(mon, "adding host network device %s failed\n", devi= ce); - } -} - -void hmp_host_net_remove(Monitor *mon, const QDict *qdict) -{ - NetClientState *nc; - int vlan_id =3D qdict_get_int(qdict, "vlan_id"); - const char *device =3D qdict_get_str(qdict, "device"); - static bool warned; - - if (!warned && !qtest_enabled()) { - error_report("host_net_remove is deprecated, use netdev_del instea= d"); - warned =3D true; - } - - nc =3D net_hub_find_client_by_name(vlan_id, device); - if (!nc) { - error_report("Host network device '%s' on hub '%d' not found", - device, vlan_id); - return; - } - if (nc->info->type =3D=3D NET_CLIENT_DRIVER_NIC) { - error_report("invalid host network device '%s'", device); - return; - } - - qemu_del_net_client(nc->peer); - qemu_del_net_client(nc); - qemu_opts_del(qemu_opts_find(qemu_find_opts("net"), device)); -} - void netdev_add(QemuOpts *opts, Error **errp) { net_client_init(opts, true, errp); diff --git a/qemu-doc.texi b/qemu-doc.texi index 97025c2..36acfc9 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -2756,16 +2756,6 @@ by the ``convert -l snapshot_param'' argument instea= d. "autoload" parameter is now ignored. All bitmaps are automatically loaded from qcow2 images. =20 -@section System emulator human monitor commands - -@subsection host_net_add (since 2.10.0) - -The ``host_net_add'' command is replaced by the ``netdev_add'' command. - -@subsection host_net_remove (since 2.10.0) - -The ``host_net_remove'' command is replaced by the ``netdev_del'' command. - @section System emulator devices =20 @subsection ivshmem (since 2.6.0) diff --git a/tests/test-hmp.c b/tests/test-hmp.c index 5b7e447..5352c9c 100644 --- a/tests/test-hmp.c +++ b/tests/test-hmp.c @@ -37,10 +37,8 @@ static const char *hmp_cmds[] =3D { "dump-guest-memory /dev/null 0 4096", "dump-guest-memory /dev/null", "gdbserver", - "host_net_add user id=3Dnet0", "hostfwd_add tcp::43210-:43210", "hostfwd_remove tcp::43210-:43210", - "host_net_remove 0 net0", "i /w 0", "log all", "log none", --=20 1.8.3.1