From efd2f3d8986cbf314d3edc3d10735440e58e5ae2 Mon Sep 17 00:00:00 2001 From: Stefan Bader Date: Sat, 8 Apr 2017 15:36:03 +0100 Subject: [PATCH 2/3] fanatic: Supply LXD storage if needed Newer versions of LXD require to specify the storage to use. Test for available storage locations and use the first one found for testing local LXD. Signed-off-by: Stefan Bader --- fanatic | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/fanatic b/fanatic index 88f9403..ffda206 100755 --- a/fanatic +++ b/fanatic @@ -898,6 +898,22 @@ payload_test() echo "__payload_test '$master' '$lip' '$rip'" } +get_local_lxd_storage() +{ + local list="" + + list="$(lxc storage list 2>/dev/null)" || return 1 + + echo "$list" | awk ' + FNR>3 && /^\|/{ + split($0, A, " ?| ?") + print A[2] + } + ' | head -1 + + return 0 +} + test_local_lxd() { local device="$1" @@ -927,8 +943,13 @@ test_local_lxd() #local series=$( lsb_release -sr ) local series='lts' + local storage_opt="$(get_local_lxd_storage)" + + if [ "$storage_opt" != "" ]; then + storage_opt="--storage $storage_opt" + fi echo "local lxd test: creating test container (Ubuntu:$series) ..." - lxc launch "ubuntu:$series" fanatic-test -p "$fan_bridge" + lxc launch "ubuntu:$series" fanatic-test $storage_opt -p "$fan_bridge" # wait for eth0 -- XXX: needs to timeout while : -- 2.7.4