mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-31 05:51:53 -06:00
net: Remove the deprecated 'host_net_add' and 'host_net_remove' HMP commands
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 <pbonzini@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
parent
857d20873d
commit
7cc28cb061
6 changed files with 0 additions and 200 deletions
94
net/net.c
94
net/net.c
|
@ -60,25 +60,6 @@
|
|||
static VMChangeStateEntry *net_change_state_entry;
|
||||
static QTAILQ_HEAD(, NetClientState) net_clients;
|
||||
|
||||
const char *host_net_devices[] = {
|
||||
"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 */
|
||||
|
||||
|
@ -1174,81 +1155,6 @@ static int net_client_init(QemuOpts *opts, bool is_netdev, Error **errp)
|
|||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int net_host_check_device(const char *device)
|
||||
{
|
||||
int i;
|
||||
for (i = 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 = qdict_get_str(qdict, "device");
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
||||
opts = 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", device);
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
error_report("Host network device '%s' on hub '%d' not found",
|
||||
device, vlan_id);
|
||||
return;
|
||||
}
|
||||
if (nc->info->type == 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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue