Skip to contentSkip to conversation

libxl: simple fix to enable user to configure vif names

PATCH In review Wei Liu 5 participants 11 messages Dec 29, 2011 – Jan 5, 2012

lore
Share & tools
lore
author
#1 lore raw

PATCH 1/2 libxl: print out vifname in create dryrun.

---
 tools/libxl/xl_cmdimpl.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
tools/libxl/xl_cmdimpl.c +2 -0
index 8270f34..8da8b88 100644
@@ -419,6 +419,8 @@ static void printf_info(int domid,
     for (i = 0; i < d_config->num_vifs; i++) {
         printf("\t(device\n");
         printf("\t\t(vif\n");
+        if (d_config->vifs[i].ifname)
+            printf("\t\t\t(vifname %s)\n", d_config->vifs[i].ifname);
         printf("\t\t\t(backend_domid %d)\n", d_config->vifs[i].backend_domid);
         printf("\t\t\t(frontend_domid %d)\n", domid);
         printf("\t\t\t(devid %d)\n", d_config->vifs[i].devid);
Signature · 1 line
1.7.2.5
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] libxl: print out vifname in create dryrun.

Quoted 1 line · Wei Liu
Quoted 17 lines
---
 tools/libxl/xl_cmdimpl.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
tools/libxl/xl_cmdimpl.c +2 -0
index 8270f34..8da8b88 100644
@@ -419,6 +419,8 @@ static void printf_info(int domid,
     for (i = 0; i < d_config->num_vifs; i++) {
         printf("\t(device\n");
         printf("\t\t(vif\n");
+        if (d_config->vifs[i].ifname)
+            printf("\t\t\t(vifname %s)\n", d_config->vifs[i].ifname);
         printf("\t\t\t(backend_domid %d)\n", d_config->vifs[i].backend_domid);
         printf("\t\t\t(frontend_domid %d)\n", domid);
         printf("\t\t\t(devid %d)\n", d_config->vifs[i].devid);
author
#3 lore raw

PATCH 2/2 libxl: write vifname in xenstore if set.

In reply to Wei Liu

Simple fix to enable user to specify vif names.

---
 tools/libxl/libxl.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
tools/libxl/libxl.c +6 -0
index 2b8f8f4..3c086d5 100644
@@ -1534,6 +1534,12 @@ int libxl_device_nic_add(libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic)
                                           libxl_xen_script_dir_path(),
                                           nic->script));
     }
+
+    if (nic->ifname) {
+        flexarray_append(back, "vifname");
+        flexarray_append(back, nic->ifname);
+    }
+
     flexarray_append(back, "mac");
     flexarray_append(back,libxl__sprintf(gc,
                                     LIBXL_MAC_FMT, LIBXL_MAC_BYTES(nic->mac)));
Signature · 1 line
1.7.2.5
Acked-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] libxl: write vifname in xenstore if set.

Quoted 1 line · Wei Liu

Simple fix to enable user to specify vif names.

Thanks. It is worth noting that the naming of the vif is implemented by the hotplug scripts and not by netback (which always uses vifX.Y).

Quoted 1 line
Quoted 21 lines
---
 tools/libxl/libxl.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
tools/libxl/libxl.c +6 -0
index 2b8f8f4..3c086d5 100644
@@ -1534,6 +1534,12 @@ int libxl_device_nic_add(libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic)
                                           libxl_xen_script_dir_path(),
                                           nic->script));
     }
+
+    if (nic->ifname) {
+        flexarray_append(back, "vifname");
+        flexarray_append(back, nic->ifname);
+    }
+
     flexarray_append(back, "mac");
     flexarray_append(back,libxl__sprintf(gc,
                                     LIBXL_MAC_FMT, LIBXL_MAC_BYTES(nic->mac)));
author
#5 lore raw

Re: [PATCH 2/2] libxl: write vifname in xenstore if set.

Quoted 6 lines · Ian Campbell
Quoted 1 line · Wei Liu

Simple fix to enable user to specify vif names.

Thanks. It is worth noting that the naming of the vif is implemented by the hotplug scripts and not by netback (which always uses vifX.Y).

Yes, I knew that after digging into hotplug scripts. :)

It seems that we need to backport these patches to earlier versions as well.

Wei.

#6 lore raw

Re: [PATCH 2/2] libxl: write vifname in xenstore if set.

This applies against 4.1.2, but untested, as I still have my Athlon X2 xen boot trouble.

libxl/libxl.c +0 -0
index 2b8f8f4..3c086d5 100644
@@ -1229,6 +1229,12 @@ int libxl_device_nic_add(libxl_ctx *ctx, uint32_t

domid, libxl_device_nic *nic)

     flexarray_append(back, libxl__sprintf(&gc, "%d", 1));
     flexarray_append(back, "script");
     flexarray_append(back, nic->script);

+
+ if (nic->ifname) {
+ flexarray_append(back, "vifname");
+ flexarray_append(back, nic->ifname);
+ }
+

     flexarray_append(back, "mac");
     flexarray_append(back, libxl__sprintf(&gc,
"%02x:%02x:%02x:%02x:%02x:%02x",
                                                  nic->mac[0],

nic->mac[1], nic->mac[2],

libxl/xl_cmdimpl.c +2 -0
index 8270f34..8da8b88 100644
@@ -393,6 +393,8 @@
     for (i = 0; i < d_config->num_vifs; i++) {
         printf("\t(device\n");
         printf("\t\t(vif\n");
+        if (d_config->vifs[i].ifname)
+            printf("\t\t\t(vifname %s)\n", d_config->vifs[i].ifname);
         printf("\t\t\t(backend_domid %d)\n",
d_config->vifs[i].backend_domid);
         printf("\t\t\t(frontend_domid %d)\n", domid);
         printf("\t\t\t(devid %d)\n", d_config->vifs[i].devid);

Am 03.01.2012 11:39, schrieb Wei Liu:

Quoted 14 lines · Ian Campbell
Quoted 6 lines · Wei Liu
Quoted 1 line

Simple fix to enable user to specify vif names.

Thanks. It is worth noting that the naming of the vif is implemented by the hotplug scripts and not by netback (which always uses vifX.Y).

Yes, I knew that after digging into hotplug scripts. :)

It seems that we need to backport these patches to earlier versions as well.

Quoted 8 lines

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

author
#9 lore raw
Quoted 10 lines · Florian Heigl

Hi Wei,

2011/12/29 Wei Liu <[email protected]>:

Quoted 4 lines

This feature is required by some of our users.

Wow, thank you! :))

Hi Florian

Have you tested these patches (patch 2 is essential)? Do they work for you? I only took a glimpse of the code, I thought they should work. If you encounter any further issue, please let me know.

Wei.