From: Giuseppe Lettieri <g.lettieri@iet.unipi.it>
Date: Thu, 20 Sep 2012 22:02:09 +0000 (+0200)
Subject: experimental remote-snapshot feature
X-Git-Tag: sliver-openvswitch-1.8.90-0~4
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=1b8dc556ec606a7db8709e4bb4c6dba6a4ad9cef;p=sliver-openvswitch.git

experimental remote-snapshot feature

With this new target you can (re)build the local cache if you now
the node names. Start with a conf.mk containig SLICE
and HOST_x = y for each host. Then do

rm -rf cache; rm -rf L
make -j remote-snapshot >> conf.mk
make
---

diff --git a/planetlab/exp-tool/Makefile b/planetlab/exp-tool/Makefile
index 9780280b4..a6b0103e2 100644
--- a/planetlab/exp-tool/Makefile
+++ b/planetlab/exp-tool/Makefile
@@ -60,6 +60,7 @@ SUDO ?= sudo -S
 
 ALL_NODE_IDS=$(sort $(foreach link,$(LINKS),$(call leftnode,$(link))) $(foreach link,$(LINKS),$(call rightnode,$(link))))
 ALL_LINK_IDS=$(addsuffix @1,$(LINKS)) $(addsuffix @2,$(LINKS))
+CONF_NODE_IDS=$(subst HOST_,,$(filter HOST_%,$(.VARIABLES)))
 
 ####################
 all+init: init all
@@ -183,6 +184,30 @@ shutdown: del-switchs del-dbs
 
 .PHONY: del-links del-switchs del-dbs shutdown
 
+
+### snapshots
+remote-snapshot: remote-snapshot-ips remote-snapshot-links
+	@true
+
+remote-snapshot-ips: $(addprefix cache/rsnap.ip.,$(CONF_NODE_IDS))
+	@cat /dev/null $^
+
+remote-snapshot-links: $(addprefix cache/rsnap.links.,$(CONF_NODE_IDS))
+	@sort -u /dev/null $^
+
+.PHONY: remote-snapshot remote-snapshot-ips remote-snapshot-links
+
+cache/rsnap.ip.%: 
+	@$(SSH) $(HOST_$*) $(SUDO) ovs-vsctl -- \
+		get interface $(BRIDGE) options:local_ip options:local_netmask |\
+		sed -n 's|"||g;1h;2{G;s|\(.*\)\n\(.*\)|IP_$* = \2/\1|p}' > $@ || \
+	 { rm $@; exit 1; }
+
+cache/rsnap.links.%: 
+	@$(SSH) $(HOST_$*) $(SUDO) ovs-vsctl list-ifaces $(BRIDGE) | \
+	 sed -n 's/^L/LINKS += /p' > $@ || \
+	 { rm $@; exit 1; }
+
 .SECONDEXPANSION:
 
 del-iface.%: cache/db.$$(call get,%)