[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 11/17] hotplug: add FreeBSD vif-bridge
Add a simple vif-bridge script, that takes care of adding network backends (tap or xnb) to a pre-configured bridge. Signed-off-by: Roger Pau Monnà <roger.pau@xxxxxxxxxx> Cc: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> Cc: Ian Campbell <ian.campbell@xxxxxxxxxx> --- Changes since v1: - Remove "x" prefix from variable names. --- tools/hotplug/FreeBSD/Makefile | 2 +- tools/hotplug/FreeBSD/vif-bridge | 41 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletions(-) create mode 100644 tools/hotplug/FreeBSD/vif-bridge diff --git a/tools/hotplug/FreeBSD/Makefile b/tools/hotplug/FreeBSD/Makefile index c7ffc51..6480aa5 100644 --- a/tools/hotplug/FreeBSD/Makefile +++ b/tools/hotplug/FreeBSD/Makefile @@ -2,7 +2,7 @@ XEN_ROOT = $(CURDIR)/../../.. include $(XEN_ROOT)/tools/Rules.mk # Xen script dir and scripts to go there. -XEN_SCRIPTS = +XEN_SCRIPTS = vif-bridge XEN_SCRIPT_DATA = diff --git a/tools/hotplug/FreeBSD/vif-bridge b/tools/hotplug/FreeBSD/vif-bridge new file mode 100644 index 0000000..fa7570d --- /dev/null +++ b/tools/hotplug/FreeBSD/vif-bridge @@ -0,0 +1,41 @@ +#!/bin/sh -e +# +# FreeBSD hotplug script for attaching xnb* interfaces to bridges +# +# Parameters: +# $1: xenstore backend path of the vif +# $2: action, either "add" or "remove" +# +# Environment variables: +# $iface_dev: name of the backend device (xnb<domid>.<handle>) +# + +DIR=$(dirname "$0") +. "${DIR}/hotplugpath.sh" + +PATH=${BINDIR}:${SBINDIR}:${LIBEXEC}:${PRIVATE_BINDIR}:/bin:/usr/bin:/sbin:/usr/sbin +export PATH + +path=$1 +action=$2 + +case $action in +add) + bridge=$(xenstore-read "$path/bridge") + ifconfig $bridge addm $iface_dev + ifconfig $iface_dev up + exit 0 + ;; +remove) + if [ "$emulated" -eq 1 ]; then + bridge=$(xenstore-read "$path/bridge") + ifconfig $iface_dev down + ifconfig $bridge deletem $iface_dev + ifconfig $iface_dev destroy + fi + exit 0 + ;; +*) + exit 0 + ;; +esac -- 1.7.7.5 (Apple Git-26) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |