mirror of https://github.com/xemu-project/xemu.git
hmp / net: Mark host_net_add/remove as deprecated
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>
This commit is contained in:
parent
f583dca9ad
commit
559964a1ad
|
@ -1296,7 +1296,7 @@ ETEXI
|
||||||
.name = "host_net_add",
|
.name = "host_net_add",
|
||||||
.args_type = "device:s,opts:s?",
|
.args_type = "device:s,opts:s?",
|
||||||
.params = "tap|user|socket|vde|netmap|bridge|vhost-user|dump [options]",
|
.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,
|
.cmd = hmp_host_net_add,
|
||||||
.command_completion = host_net_add_completion,
|
.command_completion = host_net_add_completion,
|
||||||
},
|
},
|
||||||
|
@ -1304,14 +1304,14 @@ ETEXI
|
||||||
STEXI
|
STEXI
|
||||||
@item host_net_add
|
@item host_net_add
|
||||||
@findex host_net_add
|
@findex host_net_add
|
||||||
Add host VLAN client.
|
Add host VLAN client. Deprecated, please use @code{netdev_add} instead.
|
||||||
ETEXI
|
ETEXI
|
||||||
|
|
||||||
{
|
{
|
||||||
.name = "host_net_remove",
|
.name = "host_net_remove",
|
||||||
.args_type = "vlan_id:i,device:s",
|
.args_type = "vlan_id:i,device:s",
|
||||||
.params = "vlan_id name",
|
.params = "vlan_id name",
|
||||||
.help = "remove host VLAN client",
|
.help = "remove host VLAN client (deprecated, use netdev_del instead)",
|
||||||
.cmd = hmp_host_net_remove,
|
.cmd = hmp_host_net_remove,
|
||||||
.command_completion = host_net_remove_completion,
|
.command_completion = host_net_remove_completion,
|
||||||
},
|
},
|
||||||
|
@ -1319,7 +1319,7 @@ ETEXI
|
||||||
STEXI
|
STEXI
|
||||||
@item host_net_remove
|
@item host_net_remove
|
||||||
@findex host_net_remove
|
@findex host_net_remove
|
||||||
Remove host VLAN client.
|
Remove host VLAN client. Deprecated, please use @code{netdev_del} instead.
|
||||||
ETEXI
|
ETEXI
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
13
net/net.c
13
net/net.c
|
@ -45,6 +45,7 @@
|
||||||
#include "qapi-visit.h"
|
#include "qapi-visit.h"
|
||||||
#include "qapi/opts-visitor.h"
|
#include "qapi/opts-visitor.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
|
#include "sysemu/qtest.h"
|
||||||
#include "net/filter.h"
|
#include "net/filter.h"
|
||||||
#include "qapi/string-output-visitor.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");
|
const char *opts_str = qdict_get_try_str(qdict, "opts");
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
QemuOpts *opts;
|
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)) {
|
if (!net_host_check_device(device)) {
|
||||||
monitor_printf(mon, "invalid host network device %s\n", 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;
|
NetClientState *nc;
|
||||||
int vlan_id = qdict_get_int(qdict, "vlan_id");
|
int vlan_id = qdict_get_int(qdict, "vlan_id");
|
||||||
const char *device = qdict_get_str(qdict, "device");
|
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);
|
nc = net_hub_find_client_by_name(vlan_id, device);
|
||||||
if (!nc) {
|
if (!nc) {
|
||||||
|
|
Loading…
Reference in New Issue