CONF_NODE_IDS=$(subst HOST_,,$(filter HOST_%,$(.VARIABLES)))
####################
-init+all: init all
+init_all: init all
init:
@[ -d L ] || ( echo Creating tmp dir L; mkdir L)
@[ -d log ] || (echo Creating tmp dir log; mkdir log)
@[ -d cache ] || ( echo Creating tmp dir cache; mkdir cache)
-.PHONY: init+all init
+.PHONY: init_all init
FORCE:
.PHONY: sshchecks
ovsversions: $(foreach id,$(ALL_NODE_IDS),ovsversion-$(id))
.PHONY: ovsversions
+# more general form; run with make sshs SSH-COMMAND="bla bla bla"
+sshs: $(foreach id,$(ALL_NODE_IDS),ssh-$(id))
+.PHONY: sshs
DBS=$(foreach id,$(ALL_NODE_IDS),cache/db.$(id))
dbs: $(DBS)
controllers: $(CONTROLLERS)
.PHONY: controllers
+del-controllers: $(foreach id,$(ALL_NODE_IDS),del-controller-$(id))
+.PHONY: del-controllers
+
### node-oriented targets
# check ssh connectivity
sshcheck-%: FORCE
ovsversion-%: FORCE
@OVSVERSION=$$($(SSH) $(HOST_$*) rpm -q sliver-openvswitch); echo $(call display,$*) has $$OVSVERSION
+ssh-%: FORCE
+ @$(SSH) $(HOST_$*) $(SUDO) $(SSH-COMMAND)
+
# should probably replace sshcheck
cache/status.%: FORCE
@echo "=== DB and SWITCH processes on $(call display,$*)"
- @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs status
+ @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs status ||:
cache/host.%:
@echo "IP lookup for $(call display,$*)"
# xxx this probably needs a more thorough cleanup in cache/
cache/stop.%: del-bridge.%
@echo "Stopping switch & db on $(call display,$*)"
- @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs stop && rm cache/switch.% cache/db.%
+ @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs stop && rm cache/switch.$* cache/db.$*
### link-oriented targets
# L/<nodeid>-<node_id>
@$(SSH) $(HOST_$*) $(SUDO) sliver-ovs stop-db
@rm -f cache/db.$*
+del-controller.%:
+ @echo "Removing controller for $(call display,$*)"
+ @$(SSH) $(HOST_$*) $(SUDO) sliver-ovs del-controller $(BRIDGE)
+ @rm -f cache/controller.$*
+
del-links: $(addprefix U/,$(notdir $(filter-out %.log,$(wildcard L/*))))
del-switchs: $(addprefix del-,$(notdir $(filter-out %.log,$(wildcard cache/switch.*))))
CLEANTARGETS=$(addprefix del-,$(notdir $(filter-out %.log,$(wildcard cache/bridge.*))))
clean: $(CLEANTARGETS)
distclean:
- rm -rf L U cache
+ rm -rf L log cache
.PHONY: clean distclean
####################