Ian Campbell
2012-Jun-06 13:21 UTC
[PATCH] xend: do not run a hotplug script from qemu on Linux
# HG changeset patch # User Ian Campbell <ian.campbell@citrix.com> # Date 1338988396 -3600 # Node ID 76d9122d2740b9d9fe9c50497110bd6ccaad9fa3 # Parent beca28fe812ffd3c8e50aa5fc6ba89c6b706d5e2 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 <ian.campbell@citrix.com> diff -r beca28fe812f -r 76d9122d2740 tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py Wed Jun 06 14:12:25 2012 +0100 +++ b/tools/python/xen/xend/image.py Wed Jun 06 14:13:16 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 beca28fe812f -r 76d9122d2740 tools/python/xen/xend/osdep.py --- a/tools/python/xen/xend/osdep.py Wed Jun 06 14:12:25 2012 +0100 +++ b/tools/python/xen/xend/osdep.py Wed Jun 06 14:13:16 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)
Ian Jackson
2012-Jun-06 13:58 UTC
Re: [PATCH] xend: do not run a hotplug script from qemu on Linux
Ian Campbell writes ("[PATCH] xend: do not run a hotplug script from qemu on Linux"):> 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).Sounds plausible. Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson
2012-Jun-07 17:45 UTC
Re: [PATCH] xend: do not run a hotplug script from qemu on Linux
Ian Jackson writes ("Re: [Xen-devel] [PATCH] xend: do not run a hotplug script from qemu on Linux"):> Ian Campbell writes ("[PATCH] xend: do not run a hotplug script from qemu on Linux"): > > xend: do not run a hotplug script from qemu on Linux> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>