Skip to contentSkip to conversation

static vif/tap names

DISCUSSION Jim Fehlig 3 participants 4 messages Oct 14, 2009 – Oct 16, 2009

lore
Share & tools
lore

Jim Fehlig

author
#0 lore raw

I have received user requests for static vif/tap names. The use case is certainly valid: dom0 tools require consistent and predefined names of virtual network interfaces.

The Xen vifname parameter satisfies this use case for pv vifs, but emulated vifs are named dynamically, e.g. tapX.Y. My initial thought was to honor the vifname parameter when generating the qemu args, but there are cases when both pv and emulated vifs are created - e.g. when vif config contains no 'type=' param or when 'type=ioemu'.

Two options I have considered are:

1. Appending vifname, if specified, to "tap" (tap-<vifname>), otherwise use current dynamic tapX.Y
2. Add a 'tapname=' parameter to vif config. This would allow controlling the vif and tap interface names independently.

Is once of these solutions acceptable? Any alternate suggestions?

Regards,
Jim

#1 lore raw
Quoted 6 lines · Jim Fehlig

1. Appending vifname, if specified, to "tap" (tap-<vifname>), otherwise use current dynamic tapX.Y
2. Add a 'tapname=' parameter to vif config. This would allow controlling the vif and tap interface names independently.

Is once of these solutions acceptable? Any alternate suggestions?

Option (1) sounds nice and straightforward.

-- Keir

author
#2 lore raw
Quoted 8 lines · Keir Fraser
Quoted 5 lines · Jim Fehlig

1. Appending vifname, if specified, to "tap" (tap-<vifname>), otherwise use current dynamic tapX.Y
2. Add a 'tapname=' parameter to vif config. This would allow controlling the vif and tap interface names independently.

Quoted 5 lines
Quoted 2 lines

Is once of these solutions acceptable? Any alternate suggestions?

Option (1) sounds nice and straightforward.

Thanks. Patch attached.

Regards,
Jim

tools/python/xen/xend/image.py +7 -2
diff -r 18758847bf31 tools/python/xen/xend/image.py
@@ -869,9 +869,14 @@
             ret.append("-net")
             ret.append("nic,vlan=%d,macaddr=%s,model=%s" %
                        (nics, mac, model))
+            vifname = devinfo.get('vifname')
+            if vifname:
+                vifname = "tap-" + vifname
+            else:
+                vifname = "tap%d.%d" % (self.vm.getDomid(), nics-1)
             ret.append("-net")
-            ret.append("tap,vlan=%d,ifname=tap%d.%d,bridge=%s" %
-                       (nics, self.vm.getDomid(), nics-1, bridge))
+            ret.append("tap,vlan=%d,ifname=%s,bridge=%s" %
+                       (nics, vifname, bridge))
 
         if nics == 0:
             ret.append("-net")

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

Acked-by
#3 lore raw
Quoted 18 lines

Subject: Re: [Xen-devel] static vif/tap names

Quoted 5 lines · Keir Fraser
Quoted 2 lines · Jim Fehlig

1. Appending vifname, if specified, to "tap" (tap-<vifname>), otherwise use current dynamic tapX.Y 2. Add a 'tapname=' parameter

to

Quoted 8 lines
Quoted 5 lines

vif config. This would allow controlling the vif and tap interface names independently.

Is once of these solutions acceptable? Any alternate suggestions?

Option (1) sounds nice and straightforward.

Quoted 7 lines

Thanks. Patch attached.

Regards,
Jim

Much better than the current solution.