From 4535a36a93331c03ad18d8e11e5a6e51332f58da Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 25 Apr 2012 12:55:57 +0100 Subject: libxl/xend: name tap devices vifX.Y-emu This prevents the udev scripts from operating on other tap devices (e.g. openvpn etc) Correct the documentation for the "vifname" option which suggested it applied to HVM tap devices only, which is not the case. Reported by Michael Young. Also fix the use of vifname with emulated devices. This is slightly complex. The current hotplug scripts rely on being able to parse the "tapX.Y" (now "vifX.Y-emu") name in order to locate the xenstore backend dir relating to the corresponding vif. This is because we cannot inject our own environment vars into the tap hotplug events. However this means that if the tap is initially named with a user specified name (which will not match the expected scheme) we fail to do anything useful with the device. So now we create the initial tap device with the standard "vifX.Y-emu" name and the hotplug script will handle the rename to the desired name. This is also how PV vif devices work -- they are always created by netback with the name vifX.Y and renamed in the script. Lastly also move libxl__device_* to a better place in the header, otherwise the comment about evgen stuff isn't next to the associated functions (noticed jsut because I was going to add nic_devname near to the setdefault functions) Signed-off-by: Ian Campbell Acked-by: Ian Jackson Committed-by: Ian Jackson --- tools/python/xen/xend/image.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'tools/python') diff --git a/tools/python/xen/xend/image.py b/tools/python/xen/xend/image.py index f3768b4612..e08417282d 100644 --- a/tools/python/xen/xend/image.py +++ b/tools/python/xen/xend/image.py @@ -917,11 +917,7 @@ class HVMImageHandler(ImageHandler): 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) + vifname = "vif%d.%d-emu" % (self.vm.getDomid(), nics-1) ret.append("-net") ret.append("tap,vlan=%d,ifname=%s,bridge=%s" % (nics, vifname, bridge)) -- cgit v1.2.3