implement some make targets to ease testing of a bootCD layout, esp. wrt the ping_nod...
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Thu, 5 Mar 2015 18:42:05 +0000 (19:42 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Thu, 5 Mar 2015 18:42:05 +0000 (19:42 +0100)
Makefile
ping-node.md [new file with mode: 0644]

index 01f8495..0c07e51 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,3 +4,56 @@ tags:
        find . -type f -a '!' '(' -name '*.x86' -o -name '*.x86_64' ')' | egrep -v '/\.(svn|git)/' | xargs $(ETAGS)
 
 .PHONY: tags
+
+#####
+# make sync is a little more convoluted than the other variants
+# so we call it make bootcdsync for that reason
+#
+# it expects the following env variables
+#
+# export BUILD=2015.03.05--f21
+# export PLCHOSTLXC=deathvegas.pl.sophia.inria.fr
+# export GUESTNAME=2015.03.05--f21-1-vplc12
+# export GUESTHOSTNAME=vplc12.pl.sophia.inria.fr
+# export KVMHOST=boxtops.pl.sophia.inria.fr
+# export NODE=vnode03.pl.sophia.inria.fr
+#
+# and it also expects there is a reference iso file
+
+KVMDIR=/vservers/$(BUILD)/qemu-$(NODE)
+KVMSSH=$(KVMHOST):$(KVMDIR)
+
+# initialize the workdir on the KVM side
+# mount iso file, and unwrap .img files into bootcd/ and overlay/
+sync-unwrap:
+       ssh root@$(KVMHOST) "(cd $(KVMDIR); [ -f $(NODE).iso.ref ] && exit 0; \
+                             cp $(NODE).iso $(NODE).iso.ref; \
+                             mkdir iso.ref; mount -o ro,loop $(NODE).iso.ref iso.ref; \
+                             rsync -ad iso.ref/ iso/; \
+                             mkdir bootcd.ref; ( cd bootcd.ref; gzip -dc ../iso/bootcd.img | cpio -diu); \
+                             mkdir overlay.ref; ( cd overlay.ref; gzip -dc ../iso/overlay.img | cpio -diu); \
+                             rsync -a bootcd.ref/ bootcd/ ; rsync -a overlay.ref/ overlay/; \
+                            )"
+
+sync-clean:
+       ssh root@$(KVMHOST) "(cd $(KVMDIR); [ -f $(NODE).iso.ref ] || exit 0; \
+                             umount iso.ref; \
+                             rm -rf iso.ref iso bootcd overlay bootcd.ref overlay.ref; \
+                             mv -f $(NODE).iso.ref $(NODE).iso; \
+                            )"
+
+# once sync-mount is OK you can start tweaking the contents of bootcd/ and overlay/ manually
+#
+# and then use this to rebuild a new .iso
+
+# same as in build.sh
+MKISOFS_OPTS="-R -J -r -f -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table"
+
+sync-rewrap:
+       ssh root@$(KVMHOST) "(cd $(KVMDIR); \
+                            echo "Rewrapping bootcd.img"; \
+                            (cd overlay && find . | cpio --quiet -c -o) | gzip -9 > iso/overlay.img; \
+                            echo "Rewrapping overlay.img"; \
+                            (cd bootcd && find . | cpio --quiet -c -o) | gzip -9 > iso/bootcd.img; \
+                            mkisofs -o $(NODE).iso $(MKISOFS_OPTS) iso/; \
+                           )"
diff --git a/ping-node.md b/ping-node.md
new file mode 100644 (file)
index 0000000..3048b5e
--- /dev/null
@@ -0,0 +1,51 @@
+# Purpose
+Let us try to shorten the devel loop when playing with changes to the bootcd internals.
+And namely, the set of systemd files that describe booting off the CD image
+
+
+# Environment
+
+## the 'try this out several times' utility
+
+* The utility sits in `git/tests/system`  
+
+* you can push it onto a specific build using `make sync` as usual
+
+* and then run it on the testmaster side like this
+
+    iterate-ping-node <nb_iterations>
+
+* This allows to run a given bootcd (the iso computed for one node) several times over, and to gather all logs from qemu
+* This is **only** restarting the kvm/qemu node several times, nothing is done to recompute the .iso itself (see below for that). So the game is to easily simulate how a change to `bootcd` would affect a node ISO without rebuilding the whole damn thing.
+
+## Easily redo a .iso
+
+* select a running test in testmaster/; like e.g. one that has failed the `ping_node` step already
+
+* you will need 2 local terminals with that
+  * one in `git/bootcd`
+  * one in `git/tests` 
+
+* do the usual routine on running `exp`, exposing variables in both terminals,
+
+* then run `make sync` from workdir `tests/system` (just for `iterate-ping-node`)
+
+* and run `make sync-unwrap` from workdir bootcd
+
+At that point there will be the following files and subdirs on the KVM host (in my case boxtops)
+
+* the normal node bootCD iso, like e.g. 
+  * `vnode01.pl.sophia.inria.fr.iso` 
+* a copy of that file, like e.g. 
+  * `vnode01.pl.sophia.inria.fr.iso.ref` 
+* a read-only copy of the bootcd image in `bootcd.ref/`
+* a writable version of this in `bootcd/`
+* a read-only copy of the overlay image in `overlay.ref/`
+* a writable version of this in `overlay/`
+
+The workflow from then on is you can change the layout/contents of the bootcd/ directory, and then repeatedly run
+
+* `make sync-rewrap` from the `bootcd/` workdir, and then
+* `iterate-ping-node` from the `tests/` workdir
+
+Once you're satisfied you can make a difference between bootcd/ and bootcd.ref/ to see how the changes need to be implemented in `build.sh` and/or `prep.sh`