From: Giuseppe Lettieri <g.lettieri@iet.unipi.it>
Date: Thu, 27 Sep 2012 14:27:47 +0000 (+0200)
Subject: move set-controller to sliver-ovs
X-Git-Tag: sliver-openvswitch-1.8.90-3~4
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=621ffea966bf3aedaa8ceadbb43f3cd642854ad6;p=sliver-openvswitch.git

move set-controller to sliver-ovs
---

diff --git a/planetlab/exp-tool/Makefile b/planetlab/exp-tool/Makefile
index 09560eeb4..0e523721c 100644
--- a/planetlab/exp-tool/Makefile
+++ b/planetlab/exp-tool/Makefile
@@ -147,7 +147,7 @@ cache/bridge.%: cache/switch.%
 
 cache/controller.%: cache/bridge.%
 	@echo "Setting controller on $(call display,$*) - logs in $(call log,$@)"
-	@$(SSH) $(HOST_$*) $(SUDO) ovs-vsctl set-controller $(BRIDGE) $(CONTROLLER_$*) &> $(call log,$@) || { rm $@; exit 1; }
+	@$(SSH) $(HOST_$*) $(SUDO) sliver-ovs set-controller $(BRIDGE) $(CONTROLLER_$*) &> $(call log,$@) || { rm $@; exit 1; }
 
 # xxx this probably needs a more thorough cleanup in cache/
 cache/stop.%: del-bridge.%
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 () {