9fe9afb159
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
41 lines
870 B
Plaintext
41 lines
870 B
Plaintext
if [ -z "$ISCSI_TARGET_IQN" ]; then
|
|
echo "iscsi_target_iqn is not defined"
|
|
echo "Starting troubleshooting shell."
|
|
bash
|
|
fi
|
|
|
|
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 "Failed to start iscsi target."
|
|
echo "Starting troubleshooting shell."
|
|
bash
|
|
fi
|
|
|
|
echo "request boot server to deploy image"
|
|
d="i=$DEPLOYMENT_ID&k=$DEPLOYMENT_KEY&a=$BOOT_IP_ADDRESS&n=$ISCSI_TARGET_IQN"
|
|
wget --post-data "$d" "http://$BOOT_SERVER:10000"
|
|
|
|
echo "waiting for notice of complete"
|
|
nc -l -p 10000
|
|
|
|
echo "stop iSCSI target on $target_disk"
|
|
|
|
stop_iscsi_target
|
|
|