From: Thierry Parmentelat <thierry.parmentelat@inria.fr>
Date: Thu, 23 Jan 2014 17:16:14 +0000 (+0100)
Subject: lxc root fs might be created already but almost empty, with the timestamp in it only
X-Git-Tag: before_libvirt_121~30
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=6e6862ddd3d654747afc7e2c953fcbc1da7c187e;p=build.git

lxc root fs might be created already but almost empty, with the timestamp in it only
---

diff --git a/lbuild-initvm.sh b/lbuild-initvm.sh
index 67e96ce1..82793edc 100755
--- a/lbuild-initvm.sh
+++ b/lbuild-initvm.sh
@@ -921,8 +921,6 @@ function main () {
 	    usage ;;
     esac
 
-    echo 'build mode=' $BUILD_MODE 'test mode=' $TEST_MODE
-
     # the set of preinstalled packages - depends on vbuild or vtest
     if [ -n "$BUILD_MODE" ] ; then
 	PREINSTALLED=devel.pkgs
@@ -949,8 +947,8 @@ function main () {
     lxc=$1 ; shift
     lxc_root=/vservers/$lxc
     # rainchecks
-    [ -d $lxc_root ] && \
-	{ echo "container $lxc already exists in filesystem - exiting" ; exit 1 ; }
+    almost_empty $lxc_root || \
+	{ echo "container $lxc already exists in $lxc_root - exiting" ; exit 1 ; }
     virsh -c lxc:/// domuuid $lxc >& /dev/null && \
 	{ echo "container $lxc already exists in libvirt - exiting" ; exit 1 ; }
     mkdir -p $lxc_root