del-switch.%: del-bridge.%
@echo "Shutting down switch on $(call display,$*)"
- @if [ -f cache/switch.$* ]; then \
- $(SSH) $(HOST_$*) $(SUDO) ovs-appctl exit;\
- fi
+ @[ -f cache/switch.$* ] && $(SSH) $(HOST_$*) $(SUDO) sliver-ovs stop-switch
@rm -f cache/switch.$*
del-db.%:
@echo "Shutting down db on $(call display,$*)"
- @if [ -f cache/db.$* ]; then \
- $(SSH) $(HOST_$*) $(SUDO) ovs-appctl --target=$(VARRUN)/ovsdb-server.$$(cat cache/db.$*).ctl exit;\
- fi
+ @[ -f cache/db.$* ] && $(SSH) $(HOST_$*) $(SUDO) sliver-ovs stop-db
@rm -f cache/db.$*
-del-links: $(addprefix U/,$(notdir $(wildcard L/*)))
+del-links: $(addprefix U/,$(notdir $(filter-out %.log,$(wildcard L/*))))
-del-switchs: $(addprefix del-,$(notdir $(wildcard cache/switch.*)))
+del-switchs: $(addprefix del-,$(notdir $(filter-out %.log,$(wildcard cache/switch.*))))
-del-dbs: $(addprefix del-,$(notdir $(wildcard cache/db.*)))
+del-dbs: $(addprefix del-,$(notdir $(filter-out %.log,$(wildcard cache/db.*))))
-shutdown: del-switches del-dbs
+shutdown: del-switchs del-dbs
.PHONY: del-links del-switchs del-dbs shutdown
&& touch $@
####################
-CLEANTARGETS=$(addprefix del-,$(notdir $(wildcard cache/bridge.*)))
+CLEANTARGETS=$(addprefix del-,$(notdir $(filter-out %.log,$(wildcard cache/bridge.*))))
clean: $(CLEANTARGETS)
distclean:
rm -rf L U cache
DB_SCHEMA=/usr/share/openvswitch/vswitch.ovsschema
DB_PID_FILE=/var/run/openvswitch/db.pid
DB_LOG=/var/log/ovs-db.log
+DB_CTL_PATTERN='ovsdb-server.*.ctl'
##
DB_SOCKET=/var/run/openvswitch/db.sock
##
echo 'ovsdb-server appears to be running already, *not* starting'
fi
wait_server $DB_PID_FILE ovsdb-server 30
+ echo $DB_PID_FILE
}
-function stop_db () { pkill ovsdb-server; }
-
-
function start_switch () {
[[ -n "$@" ]] && error "Usage: $COMMAND start-switch"
wait_server $SWITCH_PID_FILE ovs-vswitchd 30
}
-function stop_switch () { pkill ovs-vswitchd ; }
+# first dumb stab just read "pkill ovsdb-server" and "pkill ovs-vswitchd"
+# quick and dirty : we locate the control file through a search in /var/run
+# caller should be requested to remember and provide this pid instead
+function stop_db () {
+ controlfile=$(ls $RUN_DIR/$DB_CTL_PATTERN)
+ [ -f $controlfile ] && ovs-appctl --target=$controlfile exit
+}
+
+function stop_switch () {
+ ovs-appctl --target=$SWITCH_SOCKET exit || :
+}
function status () {
pids=$(pgrep '^ovs')