virsh: Add option 'model' for attach-interface

* tools/virsh.c: add missing option from the CLI to allows setting
  up the NIC model type when attaching an interface
* tools/virsh.pod: extend documentation
* AUTHORS: add Osier Yang to the list
This commit is contained in:
Osier Yang 2010-10-26 10:34:31 +02:00 committed by Daniel Veillard
parent 69b7552154
commit 1a29a14a2f
3 changed files with 9 additions and 2 deletions

View File

@ -133,6 +133,7 @@ Patches have also been contributed by:
Lai Jiangshan <laijs@cn.fujitsu.com>
Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
John Morrissey <jwm@horde.net>
Osier Yang <jyang@redhat.com>
[....send patches to get your name here....]

View File

@ -8292,6 +8292,7 @@ static const vshCmdOptDef opts_attach_interface[] = {
{"target", VSH_OT_DATA, 0, N_("target network name")},
{"mac", VSH_OT_DATA, 0, N_("MAC address")},
{"script", VSH_OT_DATA, 0, N_("script used to bridge network interface")},
{"model", VSH_OT_DATA, 0, N_("model type")},
{"persistent", VSH_OT_BOOL, 0, N_("persist interface attachment")},
{NULL, 0, 0, NULL}
};
@ -8300,7 +8301,7 @@ static int
cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom = NULL;
char *mac, *target, *script, *type, *source;
char *mac, *target, *script, *type, *source, *model;
int typ, ret = FALSE;
unsigned int flags;
virBuffer buf = VIR_BUFFER_INITIALIZER;
@ -8319,6 +8320,7 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
target = vshCommandOptString(cmd, "target", NULL);
mac = vshCommandOptString(cmd, "mac", NULL);
script = vshCommandOptString(cmd, "script", NULL);
model = vshCommandOptString(cmd, "model", NULL);
/* check interface type */
if (STREQ(type, "network")) {
@ -8345,6 +8347,8 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
virBufferVSprintf(&buf, " <mac address='%s'/>\n", mac);
if (script != NULL)
virBufferVSprintf(&buf, " <script path='%s'/>\n", script);
if (model != NULL)
virBufferVSprintf(&buf, " <model type='%s'/>\n", model);
virBufferAddLit(&buf, "</interface>\n");

View File

@ -647,7 +647,7 @@ although this use only replaces the media within the existing virtual cdrom or
floppy device; consider using B<update-device> for this usage instead.
I<mode> can specify the two specific mode I<readonly> or I<shareable>.
=item B<attach-interface> I<domain-id> I<type> I<source> optional I<--target target> I<--mac mac> I<--script script>
=item B<attach-interface> I<domain-id> I<type> I<source> optional I<--target target> I<--mac mac> I<--script script> I<--model model> I<--persistent>
Attach a new network interface to the domain.
I<type> can be either I<network> to indicate a physical network device or I<bridge> to indicate a bridge to a device.
@ -656,6 +656,8 @@ I<target> allows to indicate the target device in the guest.
I<mac> allows to specify the MAC address of the network interface.
I<script> allows to specify a path to a script handling a bridge instead of
the default one.
I<model> allows to specify the model type.
I<persistent> indicates the changes will affect the next boot of the domain.
=item B<detach-device> I<domain-id> I<FILE>