提交 5369e3c0 编写于 作者: M Markus Armbruster 提交者: Aurelien Jarno

monitor: Convert do_set_link() to QObject, QError

Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
上级 c9b26a4c
...@@ -1271,7 +1271,7 @@ void do_info_network(Monitor *mon) ...@@ -1271,7 +1271,7 @@ void do_info_network(Monitor *mon)
} }
} }
void do_set_link(Monitor *mon, const QDict *qdict) int do_set_link(Monitor *mon, const QDict *qdict, QObject **ret_data)
{ {
VLANState *vlan; VLANState *vlan;
VLANClientState *vc = NULL; VLANClientState *vc = NULL;
...@@ -1289,8 +1289,8 @@ void do_set_link(Monitor *mon, const QDict *qdict) ...@@ -1289,8 +1289,8 @@ void do_set_link(Monitor *mon, const QDict *qdict)
done: done:
if (!vc) { if (!vc) {
monitor_printf(mon, "could not find network device '%s'\n", name); qerror_report(QERR_DEVICE_NOT_FOUND, name);
return; return -1;
} }
vc->link_down = !up; vc->link_down = !up;
...@@ -1298,6 +1298,7 @@ done: ...@@ -1298,6 +1298,7 @@ done:
if (vc->info->link_status_changed) { if (vc->info->link_status_changed) {
vc->info->link_status_changed(vc); vc->info->link_status_changed(vc);
} }
return 0;
} }
void net_cleanup(void) void net_cleanup(void)
......
...@@ -118,7 +118,7 @@ int qemu_find_nic_model(NICInfo *nd, const char * const *models, ...@@ -118,7 +118,7 @@ int qemu_find_nic_model(NICInfo *nd, const char * const *models,
const char *default_model); const char *default_model);
void do_info_network(Monitor *mon); void do_info_network(Monitor *mon);
void do_set_link(Monitor *mon, const QDict *qdict); int do_set_link(Monitor *mon, const QDict *qdict, QObject **ret_data);
/* NIC info */ /* NIC info */
......
...@@ -989,7 +989,8 @@ ETEXI ...@@ -989,7 +989,8 @@ ETEXI
.args_type = "name:s,up:b", .args_type = "name:s,up:b",
.params = "name on|off", .params = "name on|off",
.help = "change the link status of a network adapter", .help = "change the link status of a network adapter",
.mhandler.cmd = do_set_link, .user_print = monitor_user_noop,
.mhandler.cmd_new = do_set_link,
}, },
STEXI STEXI
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册