2012-11-09 21:48:41 +00:00
|
|
|
if [ -z "$ISCSI_TARGET_IQN" ]; then
|
|
|
|
echo "iscsi_target_iqn is not defined"
|
2013-06-14 15:39:40 +00:00
|
|
|
troubleshoot
|
2012-11-09 21:48:41 +00:00
|
|
|
fi
|
|
|
|
|
2013-06-14 12:15:28 +00:00
|
|
|
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."
|
2013-06-14 15:39:40 +00:00
|
|
|
troubleshoot
|
2013-06-14 12:15:28 +00:00
|
|
|
fi
|
|
|
|
|
2012-11-09 21:48:41 +00:00
|
|
|
echo "start iSCSI target on $target_disk"
|
|
|
|
start_iscsi_target "$ISCSI_TARGET_IQN" "$target_disk" ALL
|
|
|
|
if [ $? -ne 0 ]; then
|
2013-06-14 12:15:28 +00:00
|
|
|
echo "Failed to start iscsi target."
|
2013-06-14 15:39:40 +00:00
|
|
|
troubleshoot
|
2012-11-09 21:48:41 +00:00
|
|
|
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
|
|
|
|
|