From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LA45v-0004q8-Qn for qemu-devel@nongnu.org; Tue, 09 Dec 2008 10:01:51 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LA45t-0004p7-Nv for qemu-devel@nongnu.org; Tue, 09 Dec 2008 10:01:51 -0500 Received: from [199.232.76.173] (port=58163 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LA45t-0004oy-K4 for qemu-devel@nongnu.org; Tue, 09 Dec 2008 10:01:49 -0500 Received: from yw-out-1718.google.com ([74.125.46.154]:48936) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LA45t-0003Cq-MA for qemu-devel@nongnu.org; Tue, 09 Dec 2008 10:01:49 -0500 Received: by yw-out-1718.google.com with SMTP id 6so889618ywa.82 for ; Tue, 09 Dec 2008 07:01:48 -0800 (PST) Message-ID: <493E8858.2070300@codemonkey.ws> Date: Tue, 09 Dec 2008 09:01:44 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <> <1228820143-23580-1-git-send-email-markmc@redhat.com> <1228820143-23580-2-git-send-email-markmc@redhat.com> In-Reply-To: <1228820143-23580-2-git-send-email-markmc@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 1/4] Add 'set_link' monitor command Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mark McLoughlin Cc: Rusty Russell , qemu-devel@nongnu.org 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 > --- > 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