From: Thierry Parmentelat Date: Fri, 10 Jan 2014 14:20:35 +0000 (+0100) Subject: do not attempt to ssh-reach lbuild VM’s in build mode X-Git-Tag: before_libvirt_121~85 X-Git-Url: http://git.onelab.eu/?p=build.git;a=commitdiff_plain;h=6ef6a29b33b057008e4eb4603215b3da78b78291 do not attempt to ssh-reach lbuild VM’s in build mode --- diff --git a/lbuild-initvm.sh b/lbuild-initvm.sh index ee669c19..c4a83e21 100755 --- a/lbuild-initvm.sh +++ b/lbuild-initvm.sh @@ -607,7 +607,7 @@ function setup_lxc() { # and /etc/hosts for at least localhost [ -f $rootfs_path/etc/hosts ] || echo "127.0.0.1 localhost localhost.localdomain" > $rootfs_path/etc/hosts - # ssh access to lxc + # grant ssh access from host to guest mkdir $rootfs_path/root/.ssh cat /root/.ssh/id_rsa.pub >> $rootfs_path/root/.ssh/authorized_keys @@ -718,13 +718,14 @@ function devel_or_vtest_tools () { } function post_install () { + lxc=$1; shift if [ -n "$BUILD_MODE" ] ; then - post_install_build "$@" + post_install_build $lxc else - post_install_myplc "$@" + post_install_myplc $lxc + wait_for_ssh $lxc fi # setup localtime from the host - lxc=$1; shift cp /etc/localtime $rootfs_path/etc/localtime } @@ -829,6 +830,16 @@ function start_lxc() { virsh -c lxc:// start $lxc + return 0 +} + +function wait_for_ssh () { + set -x + set -e + #trap failure ERR INT + + lxc=$1; shift + echo $IP is up, waiting for ssh... #wait max 5 min for sshd to start @@ -847,7 +858,6 @@ function start_lxc() { # Thierry: this is fatal, let's just exit with a failure here [ -z $ssh_up ] && { echo "SSHD in container $lxc is not running" ; exit 1 ; } - return 0 }