Ian Campbell
2011-Mar-04 10:02 UTC
[Xen-devel] [PATCH 0 of 2] vif hotplug script configuration fixes
The follow short series makes it possible to use alternative vif hotplug scripts with tap devices. Previously the default vif-bridge hotplug script would be run for such devices even if /etc/xen/xl.conf, /etc/xen/xend-config.sxp or the domain cfg said otherwise. The series also improves xl compatibility with the xm vif script syntax which does not require the user to enter an absolute path. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2011-Mar-04 10:02 UTC
[Xen-devel] [PATCH 1 of 2] libxl: use full path to vif hotplug script script
# HG changeset patch # User Ian Campbell <ian.campbell@citrix.com> # Date 1299232872 0 # Node ID 61357fd45fd75880c2683fdc643bf2563659e37e # Parent 0126a6729e8d8cf19ae5fedab2a0c79570e3ddbb libxl: use full path to vif hotplug script script. This improves compatibility with xm styke config files since xend does this (see NetifController.getDeviceDetails() in tools/python/xen/xend/server/netif.py) and tools/hotplug/Linux/vif-setup expects an absolute path to the script. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> diff -r 0126a6729e8d -r 61357fd45fd7 tools/libxl/libxl.c --- a/tools/libxl/libxl.c Thu Mar 03 16:51:19 2011 +0000 +++ b/tools/libxl/libxl.c Fri Mar 04 10:01:12 2011 +0000 @@ -1228,7 +1228,8 @@ int libxl_device_nic_add(libxl_ctx *ctx, flexarray_append(back, "state"); flexarray_append(back, libxl__sprintf(&gc, "%d", 1)); flexarray_append(back, "script"); - flexarray_append(back, nic->script); + flexarray_append(back, libxl__sprintf(&gc, "%s/%s", + libxl_xen_script_dir_path(), nic->script)); flexarray_append(back, "mac"); flexarray_append(back, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x", nic->mac[0], nic->mac[1], nic->mac[2], _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2011-Mar-04 10:02 UTC
[Xen-devel] [PATCH 2 of 2] tools/hotplug/Linux: read script for tapX.Y devices from xenstore
# HG changeset patch # User Ian Campbell <ian.campbell@citrix.com> # Date 1299232872 0 # Node ID 37b2d5372baab8b2fac860f9a9fff7348f74153c # Parent 61357fd45fd75880c2683fdc643bf2563659e37e tools/hotplug/Linux: read script for tapX.Y devices from xenstore. This variable is not present in the $environment for tap hotplug events in the way it is for vif hotplug events. Therefore we need to look up the script in xenbus. vif-common.sh already takes care of most of the environmental differences but we need the script much earlier. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> diff -r 61357fd45fd7 -r 37b2d5372baa tools/hotplug/Linux/vif-setup --- a/tools/hotplug/Linux/vif-setup Fri Mar 04 10:01:12 2011 +0000 +++ b/tools/hotplug/Linux/vif-setup Fri Mar 04 10:01:12 2011 +0000 @@ -1,4 +1,18 @@ #!/bin/bash + +# tap devices do not get the same environment as vif devices so we may +# need to discover the script from xenbus. +# +# Try and only match the tap<domid>.<devid> naming scheme which Xen +# uses, to avoid interfering with other uses of tap devices. +if [ -z "$script" ] && echo $* | grep -qw type_if=tap ; then + xbpath=$(echo ${INTERFACE} | sed -ne ''s,tap\([0-9][0-9]\?\)\.\([0-9][0-9]\?\),backend/vif/\1/\2,p'') + if [ -n "$xbpath" ] ; then + script=`xenstore-read "${xbpath}/script"` + fi + + export script +fi if test "$script" then _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel