From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [patch] xen udev rule interfering with openvpn Date: Tue, 22 May 2012 14:19:39 +0100 Message-ID: <1337692779.10118.126.camel@zakaz.uk.xensource.com> References: <1334658395.23948.6.camel@zakaz.uk.xensource.com> <1334817587.11493.44.camel@dagon.hellion.org.uk> <1334912603.28331.2.camel@zakaz.uk.xensource.com> <20369.15528.270106.567037@mariner.uk.xensource.com> <1334918900.28331.47.camel@zakaz.uk.xensource.com> <20369.16555.46229.798603@mariner.uk.xensource.com> <1334919613.28331.53.camel@zakaz.uk.xensource.com> <20369.17085.330843.561841@mariner.uk.xensource.com> <1335347949.28015.19.camel@zakaz.uk.xensource.com> <20375.52677.287182.934829@mariner.uk.xensource.com> <1335348880.28015.24.camel@zakaz.uk.xensource.com> <1335358736.28015.41.camel@zakaz.uk.xensource.com> <20397.10224.96552.711065@mariner.uk.xensource.com> <1336861837.3891.29.camel@dagon.hellion.org.uk> <1337603519.24660.116.camel@zakaz.uk.xensource.com> <1337605458.24660.122.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Teck Choon Giam Cc: "xen-devel@lists.xen.org" , Roger Pau Monne , Ian Jackson , M A Young List-Id: xen-devel@lists.xenproject.org On Mon, 2012-05-21 at 14:16 +0100, Teck Choon Giam wrote: > vif5.0-emu Link encap:Ethernet HWaddr 1A:58:5C:16:5C:02 > inet6 addr: fe80::1858:5cff:fe16:5c02/64 Scope:Link > UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 > RX packets:0 errors:0 dropped:0 overruns:0 frame:0 > TX packets:4 errors:0 dropped:0 overruns:0 carrier:0 > collisions:0 txqueuelen:500 > RX bytes:0 (0.0 b) TX bytes:280 (280.0 b) The fact that this interface is up at this point is interesting, didn't you mention something about this at another time? In the tap dev case I made the rename into: do_or_die ifconfig "$dev" down do_or_die ip link set "$dev" name "$vifname" which seemed to workaround the issue for me. I think the reason this effects xm and not xl is that libxl uses script=none to disable qemu-ifup while xend does not and instead ends up using qemu-ifup which does some fiddling with the device too, including bringing it up. The proper fix is probably to change xend, I'm a bit wary of this, especially for a 4.1 backport, but the following looks right and works for me. It's a bit more complex since in libxl we seem to only do this for Linux (i.e. not NetBSD) and I guess we should do the same in xend too. Ian # HG changeset patch # User Ian Campbell # Date 1337692747 -3600 # Node ID 426bbf58cea4559464b6e5d3ff0f65324a5f5926 # Parent 72ca5bc4eb6b91fa8dff51d439bd05f5586179df xend: do not run a hotplug script from qemu on Linux The current vif-hotplug-common.sh for renaming the tap device is failing because it is racing with this script and therefore the device is unexpectedly up when we come to rename it. Fix this in the same way as libxl does, by disabling the script (only on Linux). Signed-off-by: Ian Campbell diff -r 72ca5bc4eb6b -r 426bbf58cea4 tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py Tue May 22 11:29:50 2012 +0100 +++ b/tools/python/xen/xend/image.py Tue May 22 14:19:07 2012 +0100 @@ -919,8 +919,13 @@ class HVMImageHandler(ImageHandler): (nics, mac, model)) 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)) + if osdep.tapif_script is not None: + script=",script=%s,downscript=%s" % \ + (osdep.tapif_script, osdep.tapif_script) + else: + script="" + ret.append("tap,vlan=%d,ifname=%s,bridge=%s%s" % + (nics, vifname, bridge, script)) if nics == 0: ret.append("-net") diff -r 72ca5bc4eb6b -r 426bbf58cea4 tools/python/xen/xend/osdep.py --- a/tools/python/xen/xend/osdep.py Tue May 22 11:29:50 2012 +0100 +++ b/tools/python/xen/xend/osdep.py Tue May 22 14:19:07 2012 +0100 @@ -30,6 +30,10 @@ _vif_script = { "SunOS": "vif-vnic" } +_tapif_script = { + "Linux": "no", +} + PROC_XEN_BALLOON = '/proc/xen/balloon' SYSFS_XEN_MEMORY = '/sys/devices/system/xen_memory/xen_memory0' @@ -257,6 +261,7 @@ def _get(var, default=None): xend_autorestart = _get(_xend_autorestart) vif_script = _get(_vif_script, "vif-bridge") +tapif_script = _get(_tapif_script) lookup_balloon_stat = _get(_balloon_stat, _linux_balloon_stat) get_cpuinfo = _get(_get_cpuinfo, _linux_get_cpuinfo) prefork = _get(_get_prefork, _default_prefork)