diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2017-04-02 13:54:48 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2017-04-02 13:54:48 -0300 |
commit | 3d7d4ab5e36c7b89bf6941b9eaf03c17f45d74a8 (patch) | |
tree | 0063470da84247509dec716b5775fbf9fa313342 | |
parent | 4c2e1386844796f83750ae2b86052b92a3ca1515 (diff) | |
download | kvmx-3d7d4ab5e36c7b89bf6941b9eaf03c17f45d74a8.tar.gz kvmx-3d7d4ab5e36c7b89bf6941b9eaf03c17f45d74a8.tar.bz2 |
Check for ssh_support at kvmx_up
-rwxr-xr-x | kvmx | 56 |
1 files changed, 29 insertions, 27 deletions
@@ -297,37 +297,39 @@ 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" == "20" ]; 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" - kvmx_stop - exit 1 - fi + if [ "$ssh_support" == "y" ]; then + 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" == "20" ]; 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" + kvmx_stop + exit 1 + fi - sleep 2 - done - echo " done." - #sleep 5 - #echo "" + sleep 2 + done + echo " done." + #sleep 5 + #echo "" - # Somehow it is starting before DBUS and then crashing, so we try to start again - echo "Ensure spice-vdagent is running..." - echo "sudo /usr/sbin/service spice-vdagent start" | kvmx_ssh + # Somehow it is starting before DBUS and then crashing, so we try to start again + echo "Ensure spice-vdagent is running..." + echo "sudo /usr/sbin/service spice-vdagent start" | kvmx_ssh - kvmx_hostname + kvmx_hostname - if [ ! -z "$shared_folder" ] && [ ! -z "$shared_folder_mountpoint" ]; then - echo "Mounting $shared_folder on $shared_folder_mountpoint on guest..." - echo "sudo mkdir -p $shared_folder_mountpoint" | kvmx_ssh - echo "sudo mount -t 9p -o trans=virtio shared $shared_folder_mountpoint -oversion=9p2000.L,posixacl,cache=loose" | kvmx_ssh - #echo "sudo mount //10.0.2.4/qemu $shared_folder_mountpint" | kvmx_ssh + if [ ! -z "$shared_folder" ] && [ ! -z "$shared_folder_mountpoint" ]; then + echo "Mounting $shared_folder on $shared_folder_mountpoint on guest..." + echo "sudo mkdir -p $shared_folder_mountpoint" | kvmx_ssh + echo "sudo mount -t 9p -o trans=virtio shared $shared_folder_mountpoint -oversion=9p2000.L,posixacl,cache=loose" | kvmx_ssh + #echo "sudo mount //10.0.2.4/qemu $shared_folder_mountpint" | kvmx_ssh + fi fi kvmx_status |