Index: root/xen-unstable.hg/tools/python/xen/xend/XendPIF.py =================================================================== --- root.orig/xen-unstable.hg/tools/python/xen/xend/XendPIF.py +++ root/xen-unstable.hg/tools/python/xen/xend/XendPIF.py @@ -31,6 +31,22 @@ log.setLevel(logging.TRACE) MAC_RE = re.compile(':'.join(['[0-9a-f]{2}'] * 6)) IP_IFACE_RE = re.compile(r'^\d+: (\w+):.*mtu (\d+) .* link/\w+ ([0-9a-f:]+)') +modprobed_8021q = False +ostype = os.uname() + +def linux_enable_vlan(): + global modprobed_8021q + if not os.path.exists("/proc/net/vlan"): + if not modprobed_8021q: + modprobed_8021q = True + rc, o = commands.getstatusoutput("modprobe 8021q") + if rc != 0: + log.warn("Could not enable VLAN feature in kernel.") + return False + else: + return False + return True + def linux_phy_to_virt(pif_name): return 'eth' + re.sub(r'^[a-z]+', '', pif_name) @@ -91,6 +107,9 @@ def linux_set_mtu(iface, mtu): return False def _create_VLAN(dev, vlan): + if ostype == "Linux" and linux_enable_vlan() == False: + return False + rc, _ = commands.getstatusoutput('vconfig add %s %d' % (dev, vlan)) if rc != 0: