提交 1a29a14a 编写于 作者: O Osier Yang 提交者: Daniel Veillard

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
上级 69b75521
......@@ -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....]
......
......@@ -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");
......
......@@ -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>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册