Add support for preemptible GCP instances

This commit is contained in:
Michael Vines
2019-10-14 23:11:29 -07:00
parent 60141e0c2c
commit 9267931ef6
6 changed files with 86 additions and 5 deletions

View File

@ -840,6 +840,32 @@ stop() {
echo "Stopping nodes took $SECONDS seconds"
}
checkPremptibleInstances() {
# The fullnodeIpList nodes may be preemptible instances that can disappear at
# any time. Try to detect when a fullnode has been preempted to help the user
# out.
#
# Of course this isn't airtight as an instance could always disappear
# immediately after its successfully pinged.
for ipAddress in "${fullnodeIpList[@]}"; do
(
set -x
ping -o -t 4 "$ipAddress"
) || {
cat <<EOF
Warning: $ipAddress may have been preempted.
Run |./gce.sh config| to restart it
EOF
exit 1
}
done
}
checkPremptibleInstances
case $command in
restart)
prepare_deploy