deploy element: Call find_disk in loop w/ timeout.

Updates our deploy element's init script so that it calls
find_disk in a loop until it returns true (meaning we have a disk).

Previously on some bare metal machines find_disk would return ""
which causes the subsequent iscsi target commands to fail due to
a bad backing store.

This commit also updates the error message when start_iscsi_target
fails to be a bit more accurate as well.

Fixes LP Bug #1190984.

Change-Id: I3cd535d6672c197c1c3c539c83bba36be7a14e18
This commit is contained in:
Dan Prince 2013-06-14 08:15:28 -04:00
parent 4e428c6844
commit 9fe9afb159

View File

@ -4,11 +4,25 @@ if [ -z "$ISCSI_TARGET_IQN" ]; then
bash
fi
target_disk=`find_disk "$DISK"`
t=0
while ! target_disk=$(find_disk "$DISK"); do
if [ $t -eq 10 ]; then
break
fi
t=$(($t + 1))
sleep 1
done
if [ -z "$target_disk" ]; then
echo "Could not find disk to use."
echo "Starting troubleshooting shell."
bash
fi
echo "start iSCSI target on $target_disk"
start_iscsi_target "$ISCSI_TARGET_IQN" "$target_disk" ALL
if [ $? -ne 0 ]; then
echo "Could not find disk to use."
echo "Failed to start iscsi target."
echo "Starting troubleshooting shell."
bash
fi