]> gitweb.fluxo.info Git - kvmx.git/commitdiff
Check for timeout on kvmx_up
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 10 Mar 2017 19:53:32 +0000 (16:53 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 10 Mar 2017 19:53:32 +0000 (16:53 -0300)
kvmx

diff --git a/kvmx b/kvmx
index 58e1aac0c637220d797eae548fba65794ce0c7a9..cf7364cc93771739874feb068c0e7f8e242a4c65 100755 (executable)
--- 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."