From: Giuseppe Lettieri Date: Thu, 27 Sep 2012 14:47:27 +0000 (+0200) Subject: Merge branch 'master' of ssh://git.onelab.eu/git/sliver-openvswitch X-Git-Tag: sliver-openvswitch-1.8.90-3~2 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=2425084b63eec2c4898e6e4eb3b6263a9b617c1f;hp=04024badd2cf7d26b224d26ad20111262cc90ab1;p=sliver-openvswitch.git Merge branch 'master' of ssh://git.onelab.eu/git/sliver-openvswitch --- diff --git a/planetlab/exp-tool/Makefile b/planetlab/exp-tool/Makefile index a6b0103e2..d151a6648 100644 --- a/planetlab/exp-tool/Makefile +++ b/planetlab/exp-tool/Makefile @@ -38,6 +38,7 @@ opp=$(call linkpart,$(1))@$(call flip,$(call endpart,$(1))) # rget(x-y@2) = x rget=$(call get,$(call opp,$(1))) ### +default=$(if $($(1)_$(2)),$($(1)_$(2)),$($(1))) solve=$(HOST_$(1)) solve_ip=$(IP_$(1)) # can be redefined in conf.mk if that's not the expected behaviour @@ -113,6 +114,10 @@ BRIDGES=$(foreach id,$(ALL_NODE_IDS),cache/bridge.$(id)) bridges: $(BRIDGES) .PHONY: bridges +CONTROLLERS=$(foreach id,$(ALL_NODE_IDS),cache/controller.$(id)) +controllers: $(CONTROLLERS) +.PHONY: controllers + ### node-oriented targets # check ssh connectivity cache/sshcheck.%: FORCE @@ -141,6 +146,10 @@ cache/bridge.%: cache/switch.% @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs create-bridge $(BRIDGE) $(IP_$*) > $@ 2> $(call log,$@) || { rm $@; exit 1; } @echo Created bridge with tap $$(cat $@) on $(call display,$*) +cache/controller.%: cache/bridge.% + @echo "Setting controller $(call default,CONTROLLER,$*) on $(call display,$*) - logs in $(call log,$@)" + @$(SSH) $(HOST_$*) $(SUDO) ovs-vsctl set-controller $(BRIDGE) $(call default,CONTROLLER,$*) &> $(call log,$@) || { rm $@; exit 1; } + # xxx this probably needs a more thorough cleanup in cache/ cache/stop.%: del-bridge.% @echo "Stopping switch & db on $(call display,$*)" diff --git a/planetlab/scripts/sliver-ovs.in b/planetlab/scripts/sliver-ovs.in index dfd596f9f..9b7495013 100755 --- a/planetlab/scripts/sliver-ovs.in +++ b/planetlab/scripts/sliver-ovs.in @@ -197,6 +197,17 @@ function set_remote_endpoint () { options:remote_port=$remote_UDP_port } +function set_controller () { + + get_params "bridge_name controller" "$@" + + # ensure ovs-vswitchd is running + is_switch_running || { echo "ovs-vswitchd not running" >&2 ; exit 1 ; } + + set -e + ovs-vsctl --db=unix:$DB_SOCKET set-controller "$bridge_name" "$controller" +} + #################### del functions function del_bridge () {