Make several attempts to get a valid cell if there is a failure

Change-Id: I1d2e55bbf80cdb549372cd0a3bae2d662350d2d0
diff --git a/jjb/onos/onos-run-stc-hag.sh b/jjb/onos/onos-run-stc-hag.sh
index ae6bb02..2a036c1 100644
--- a/jjb/onos/onos-run-stc-hag.sh
+++ b/jjb/onos/onos-run-stc-hag.sh
@@ -1,8 +1,5 @@
 #!/bin/bash
 
-# exit on errors
-set -eu -o pipefail
-
 # initialize build environment
 ONOS_ROOT=`pwd`
 . tools/build/envDefaults
@@ -19,8 +16,24 @@
 
 trap cleanup EXIT
 
+let err=0
 # grab a cell to run on
-cell borrow 30 3+1 jenkins-${ONOS_VERSION}
+for i in 1 2 3 4 5; do
+    cell borrow 30 3+1 jenkins-${ONOS_VERSION}
+    if [ $? -eq 0 ]; then
+        let err=0
+        break
+    fi
+    let err=$err+1
+    cell return
+done
+
+if [ $? -ne 0 ]; then
+    exit 1
+fi
+
+# exit on errors
+set -eu -o pipefail
 
 # build onos bits
 onos-buck build onos