]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: Add option 'model' for attach-interface
authorOsier Yang <jyang@redhat.com>
Tue, 26 Oct 2010 08:34:31 +0000 (10:34 +0200)
committerDaniel Veillard <veillard@redhat.com>
Tue, 26 Oct 2010 08:36:40 +0000 (10:36 +0200)
* 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

AUTHORS
tools/virsh.c
tools/virsh.pod

diff --git a/AUTHORS b/AUTHORS
index e2a3f72934917d08cc26a9d9c558ac1dfe510cb3..cb1fc11d337bdfda633181fb1ed963ae0ecd2929 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -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....]
 
index 3e37b063293eade9e225b8e5a394b617e306644b..2da9489ffd49c5e61618b279c6f8c9ccb5df6c9e 100644 (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");
 
index 61875af936d6061ed3b384d45484bde961fd7d04..d904800f07c5f48f3f5439703dc6f0d0ed489f54 100644 (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>