From: Giuseppe Lettieri Date: Fri, 5 Oct 2012 10:49:19 +0000 (+0200) Subject: arbitary options to create-bridge X-Git-Tag: sliver-openvswitch-1.8.90-5~15^2 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=c7e5161da9b470f6ee80b1d1956ad9e2ad72cc05 arbitary options to create-bridge One can put additional options for bridge creation on node x in BROPTIONS_x (defaults to BROPTIONS if not set). By setting BROPTIONS=set-controller $(BRIDGE) tcp:... we can create bridges that start already connected to a controller. --- diff --git a/planetlab/exp-tool/Makefile b/planetlab/exp-tool/Makefile index d58e9f18f..bda2b091f 100644 --- a/planetlab/exp-tool/Makefile +++ b/planetlab/exp-tool/Makefile @@ -161,7 +161,8 @@ cache/switch.%: | cache/db.% cache/bridge.%: | cache/db.% @echo "Creating bridge on $(call display,$*) - logs in $(call log,$@)" - @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs create-bridge $(BRIDGE) $(IP_$*) &> $(call log,$@) \ + @$(SSH) $(HOST_$*) $(SUDO) \ + sliver-ovs create-bridge $(BRIDGE) $(IP_$*) $(call default,BROPTIONS,$*) &> $(call log,$@) \ && touch $@ cache/controller.%: cache/bridge.% diff --git a/planetlab/scripts/sliver-ovs.in b/planetlab/scripts/sliver-ovs.in index 0bf2fc337..804ec16fb 100755 --- a/planetlab/scripts/sliver-ovs.in +++ b/planetlab/scripts/sliver-ovs.in @@ -29,7 +29,7 @@ function error { function get_params { params=$1; shift err_msg="$COMMAND $SUBCOMMAND $(echo $params | perl -pe 's/\S+/<$&>/g')" - for p in $(echo $params); do + for p in $params; do [[ -z "$@" ]] && error "$err_msg" pname=$(echo -n $p|perl -pe 's/\W/_/g') eval $pname="$1"; shift @@ -157,7 +157,8 @@ function stop () { #################### create functions function create_bridge () { - get_params "bridge IP/PREFIX" "$@" + get_params "bridge IP/PREFIX" "$1" "$2" + shift; shift; IP=${IP_PREFIX%/*} PREFIX=${IP_PREFIX#*/} @@ -174,7 +175,8 @@ function create_bridge () { set -e ovs-vsctl --db=unix:$DB_SOCKET $W -- --may-exist add-br "$bridge" \ -- set bridge "$bridge" datapath_type=planetlab \ - -- set interface "$bridge" options:local_ip="$IP" option:local_netmask="$PREFIX" + -- set interface "$bridge" options:local_ip="$IP" option:local_netmask="$PREFIX" \ + -- "$@" } function create_port () {