From 06b4550b3fb1c13827cdbbc2b58d42e5ec6d259a Mon Sep 17 00:00:00 2001 From: Loys Ollivier Date: Wed, 3 Jan 2018 18:04:59 +0100 Subject: jjb/common: lava-labs-prepare.sh fix polling on reserved boards The script would still wait for 60 seconds and retry on boards that are not in the reserved state. Fix this and poll for a change of status only if the board is reserved. Fixes: 1ae347940236 ("jjb/common: lava-labs-prepare.sh") Change-Id: I4ce71979f7cb2856768de748c1afb6a1cfb47ca2 Signed-off-by: Loys Ollivier --- jjb/common/include-agl-lava-labs-prepare.sh | 30 +++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'jjb/common/include-agl-lava-labs-prepare.sh') diff --git a/jjb/common/include-agl-lava-labs-prepare.sh b/jjb/common/include-agl-lava-labs-prepare.sh index 8a40704a..35d3541c 100644 --- a/jjb/common/include-agl-lava-labs-prepare.sh +++ b/jjb/common/include-agl-lava-labs-prepare.sh @@ -96,6 +96,22 @@ for lab in "${!labs[@]}"; do do # device is only available if "idle" or "running" device_available=0 + if [ x"$device_status" = x"reserved" ]; then + sleep 60s + # Look if the status of the board has changed from reserved in the lab + echo -n "Checking for $lava_device at $full_url... " + line=$(lava-tool devices-list $full_url | grep $lava_device) + line=$(echo "$line" | tr -d '[:space:]') + + if [ -z "$line" ]; then + echo "not found." + continue + fi + IFS='|' + arr=($line) + device_status=${arr[2]} + IFS=${OFS} + fi if [ x"$device_status" = x"idle" ]; then device_available=1 break @@ -103,20 +119,6 @@ for lab in "${!labs[@]}"; do device_available=1; break fi - sleep 60s - # Find the LAVA Lab that has the device available to run the job - echo -n "Checking for $lava_device at $full_url... " - line=$(lava-tool devices-list $full_url | grep $lava_device) - line=$(echo "$line" | tr -d '[:space:]') - - if [ -z "$line" ]; then - echo "not found." - continue - fi - IFS='|' - arr=($line) - device_status=${arr[2]} - IFS=${OFS} done if [ $device_available = 0 ]; then -- cgit 1.2.3-korg