aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-03-10 16:53:32 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-03-10 16:53:32 -0300
commit167289f8346f0f720c4424a44cb88a9e41e77c01 (patch)
tree773560e0c398e837de534f5ad46c6808a4170427
parent09ad3d69e39230ca669c0324fc7b3f95777de80a (diff)
downloadkvmx-167289f8346f0f720c4424a44cb88a9e41e77c01.tar.gz
kvmx-167289f8346f0f720c4424a44cb88a9e41e77c01.tar.bz2
Check for timeout on kvmx_up
-rwxr-xr-xkvmx10
1 files changed, 10 insertions, 0 deletions
diff --git a/kvmx b/kvmx
index 58e1aac..cf7364c 100755
--- a/kvmx
+++ b/kvmx
@@ -116,10 +116,20 @@ function kvmx_up {
kvmx_spice
fi
+ let ssh_attempts="0"
echo -n "Waiting for machine to boot..."
while true; do
echo true | $SSH_COMMAND -o ConnectTimeout=2 -o NumberOfPasswordPrompts=0 -p $SSH $SSH_LOGIN@127.0.0.1 &> /dev/null && break
echo -n "."
+ let ssh_attempts++
+
+ if [ "$ssh_attempts" == "10" ]; then
+ echo "$BASENAME: timeout or access denied when trying to SSH into $VM."
+ echo "$BASENAME: please check if the image is in a good state and if it accepts passwordless ssh connections using kvmx insecure privkey"
+ kvmx_stop
+ exit 1
+ fi
+
sleep 2
done
echo " done."