summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2010-03-26 09:07:11 +0100
committerAurelien Jarno <aurelien@aurel32.net>2010-04-18 23:55:19 +0200
commit5369e3c0b8997210a2558191d8451775f7643683 (patch)
tree47e8a4360fa1bd2e00fdb8469529cdd9e4d6cddf
parentc9b26a4cbe1e3ce71521b8a1ff0483f4cc4fa4bf (diff)
monitor: Convert do_set_link() to QObject, QError
Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
-rw-r--r--net.c7
-rw-r--r--net.h2
-rw-r--r--qemu-monitor.hx3
3 files changed, 7 insertions, 5 deletions
diff --git a/net.c b/net.c
index cdba8f357..378edfccd 100644
--- a/net.c
+++ b/net.c
@@ -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;
VLANClientState *vc = NULL;
@@ -1289,8 +1289,8 @@ void do_set_link(Monitor *mon, const QDict *qdict)
done:
if (!vc) {
- monitor_printf(mon, "could not find network device '%s'\n", name);
- return;
+ qerror_report(QERR_DEVICE_NOT_FOUND, name);
+ return -1;
}
vc->link_down = !up;
@@ -1298,6 +1298,7 @@ done:
if (vc->info->link_status_changed) {
vc->info->link_status_changed(vc);
}
+ return 0;
}
void net_cleanup(void)
diff --git a/net.h b/net.h
index 9f3c82fed..b83f61534 100644
--- a/net.h
+++ b/net.h
@@ -118,7 +118,7 @@ int qemu_find_nic_model(NICInfo *nd, const char * const *models,
const char *default_model);
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 */
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index 7b7dcf545..62fa3465b 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -989,7 +989,8 @@ ETEXI
.args_type = "name:s,up:b",
.params = "name on|off",
.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