From 6ef6a29b33b057008e4eb4603215b3da78b78291 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Fri, 10 Jan 2014 15:20:35 +0100 Subject: [PATCH] =?utf8?q?do=20not=20attempt=20to=20ssh-reach=20lbuild=20V?= =?utf8?q?M=E2=80=99s=20in=20build=20mode?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- lbuild-initvm.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) 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 } -- 2.43.0