[PATCH 1/2] virsh: Add option 'model' for attach-interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allows to specify the NIC model type when attaching an interface,
it's an optional option.
---
 tools/virsh.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index 3e37b06..2da9489 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -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");
 
-- 
1.7.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]