|
From: | Anthony Liguori |
Subject: | [Qemu-devel] Re: [PATCH 1/4] Add 'set_link' monitor command |
Date: | Tue, 09 Dec 2008 09:01:44 -0600 |
User-agent: | Thunderbird 2.0.0.17 (X11/20080925) |
Mark McLoughlin wrote:
Add a monitor command to setting a given network device's link status to 'up' or 'down'. Allows simulation of network cable disconnect. Signed-off-by: Mark McLoughlin <address@hidden> --- monitor.c | 1 + net.c | 41 ++++++++++++++++++++++++++++++++++++++++- net.h | 2 ++ 3 files changed, 43 insertions(+), 1 deletions(-) diff --git a/monitor.c b/monitor.c index f142a87..ac74711 100644 --- a/monitor.c +++ b/monitor.c @@ -1497,6 +1497,7 @@ static const term_cmd_t term_cmds[] = { "value", "set maximum speed (in bytes) for migrations" }, { "balloon", "i", do_balloon, "target", "request VM to change it's memory allocation (in MB)" }, + { "set_link", "iis", do_set_link, "vlan_id dev_idx [up|down]" }, { NULL, NULL, }, };
This command seems reasonable to me but the dev_idx thing is a bit too hacky.
+ for(vc = vlan->first_client; vc != NULL; vc = vc->next) + if (i++ == device_idx) + break;
I think a better way would be to allow a user to specify an id for the nic that gets saved early on. info nics should print the id and a default id should be assigned. I think you could argue either way as to whether the ids should be vlan local or global.
I sort of think that making them global has a number of advantages. You could also use a string to identify the nics globally, it's up to you.
Regards, Anthony Liguori
[Prev in Thread] | Current Thread | [Next in Thread] |