[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [patch] xen udev rule interfering with openvpn



On Thu, 2012-04-19 at 07:39 +0100, Ian Campbell wrote:
> > > diff -r 8d92d1f34921 -r de3e65d804cc tools/python/xen/xend/image.py
> > > --- a/tools/python/xen/xend/image.py    Mon Apr 16 17:57:00 2012 +0100
> > > +++ b/tools/python/xen/xend/image.py    Tue Apr 17 11:26:06 2012 +0100
> > > @@ -921,7 +921,7 @@ class HVMImageHandler(ImageHandler):
> > >             if vifname:
> > >                 vifname = "tap-" + vifname
> > 
> > The above shouldn't it be:
> > 
> > vifname = "xentap-" + vifname
> 
> You are absolutely right, not sure how I missed that!
> 
> I'm out-of-office today but I'll resend later.

8<--------------------

# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1334912375 -3600
# Node ID fbc0dc31b6d71bed654a05ea85ec56c34ac2ef21
# Parent  f28eea0efe1223277400ff5408b1e85df5efdeac
libxl/xend: name tap devices with a xentap prefix

This prevents the udev scripts from operating on other tap devices (e.g.
openvpn etc)

Also add "xentap-" prefix to the tap device when an explicit name is given to
avoid a conflict with the vif device, which would otherwise have the same name.
Likewise correct the documentation for this option which suggested it applied
to HVM tap devices only.

Reported by Michael Young.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r f28eea0efe12 -r fbc0dc31b6d7 docs/misc/xl-network-configuration.markdown
--- a/docs/misc/xl-network-configuration.markdown       Fri Apr 20 09:59:12 
2012 +0100
+++ b/docs/misc/xl-network-configuration.markdown       Fri Apr 20 09:59:35 
2012 +0100
@@ -93,11 +93,14 @@ are:
 
 ### vifname
 
-This keyword is valid for HVM guest devices with `type=ioemu` only.
+Specifies the backend device name for the virtual device.
 
-Specifies the backend device name for an emulated device. The default
-is `tapDOMID.DEVID` where `DOMID` is the guest domain ID and `DEVID`
-is the device number.
+If the domain is an HVM domain then the associated emulated (tap)
+device will have a "xentap-" prefix added.
+
+The default name for the virtual device is `vifDOMID.DEVID` where
+`DOMID` is the guest domain ID and `DEVID` is the device
+number. Likewise the default tap name is `xentapDOMID.DEVID`.
 
 ### script
 
diff -r f28eea0efe12 -r fbc0dc31b6d7 tools/hotplug/Linux/vif-common.sh
--- a/tools/hotplug/Linux/vif-common.sh Fri Apr 20 09:59:12 2012 +0100
+++ b/tools/hotplug/Linux/vif-common.sh Fri Apr 20 09:59:35 2012 +0100
@@ -85,8 +85,8 @@ elif [ "$type_if" = tap ]; then
     : ${INTERFACE:?}
 
     # Get xenbus_path from device name.
-    # The name is built like that: "tap${domid}.${devid}".
-    dev_=${dev#tap}
+    # The name is built like that: "xentap${domid}.${devid}".
+    dev_=${dev#xentap}
     domid=${dev_%.*}
     devid=${dev_#*.}
 
diff -r f28eea0efe12 -r fbc0dc31b6d7 tools/hotplug/Linux/xen-backend.rules
--- a/tools/hotplug/Linux/xen-backend.rules     Fri Apr 20 09:59:12 2012 +0100
+++ b/tools/hotplug/Linux/xen-backend.rules     Fri Apr 20 09:59:35 2012 +0100
@@ -13,4 +13,4 @@ KERNEL=="blktap-control", NAME="xen/blkt
 KERNEL=="gntdev", NAME="xen/%k", MODE="0600"
 KERNEL=="pci_iomul", NAME="xen/%k", MODE="0600"
 KERNEL=="tapdev[a-z]*", NAME="xen/blktap-2/tapdev%m", MODE="0600"
-SUBSYSTEM=="net", KERNEL=="tap*", ACTION=="add", 
RUN+="/etc/xen/scripts/vif-setup $env{ACTION} type_if=tap"
+SUBSYSTEM=="net", KERNEL=="xentap*", ACTION=="add", 
RUN+="/etc/xen/scripts/vif-setup $env{ACTION} type_if=tap"
diff -r f28eea0efe12 -r fbc0dc31b6d7 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Fri Apr 20 09:59:12 2012 +0100
+++ b/tools/libxl/libxl_dm.c    Fri Apr 20 09:59:35 2012 +0100
@@ -212,9 +212,9 @@ static char ** libxl__build_device_model
                 char *ifname;
                 if (!vifs[i].ifname)
                     ifname = libxl__sprintf(gc,
-                                            "tap%d.%d", domid, vifs[i].devid);
+                                            "xentap%d.%d", domid, 
vifs[i].devid);
                 else
-                    ifname = vifs[i].ifname;
+                    ifname = libxl__sprintf(gc, "xentap-%s", vifs[i].ifname);
                 flexarray_vappend(dm_args,
                                 "-net", libxl__sprintf(gc, 
"nic,vlan=%d,macaddr=%s,model=%s",
                                                        vifs[i].devid, smac, 
vifs[i].model),
@@ -451,10 +451,10 @@ static char ** libxl__build_device_model
                                 LIBXL_MAC_FMT, LIBXL_MAC_BYTES(vifs[i].mac));
                 char *ifname;
                 if (!vifs[i].ifname) {
-                    ifname = libxl__sprintf(gc, "tap%d.%d",
+                    ifname = libxl__sprintf(gc, "xentap%d.%d",
                                             guest_domid, vifs[i].devid);
                 } else {
-                    ifname = vifs[i].ifname;
+                    ifname = libxl__sprintf(gc, "xentap-%s", vifs[i].ifname);
                 }
                 flexarray_append(dm_args, "-device");
                 flexarray_append(dm_args,
diff -r f28eea0efe12 -r fbc0dc31b6d7 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Fri Apr 20 09:59:12 2012 +0100
+++ b/tools/python/xen/xend/image.py    Fri Apr 20 09:59:35 2012 +0100
@@ -919,9 +919,9 @@ class HVMImageHandler(ImageHandler):
                        (nics, mac, model))
             vifname = devinfo.get('vifname')
             if vifname:
-                vifname = "tap-" + vifname
+                vifname = "xentap-" + vifname
             else:
-                vifname = "tap%d.%d" % (self.vm.getDomid(), nics-1)
+                vifname = "xentap%d.%d" % (self.vm.getDomid(), nics-1)
             ret.append("-net")
             ret.append("tap,vlan=%d,ifname=%s,bridge=%s" %
                        (nics, vifname, bridge))



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.