From 238d6e6cc9addab79993654d9bebd0494b4ae2f3 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Thu, 23 Jan 2014 15:28:23 +0100 Subject: [PATCH] repair logic, we were creating lcxroot before checking it was non-existent --- lbuild-initvm.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lbuild-initvm.sh b/lbuild-initvm.sh index 3bdd9fae..11d22d29 100755 --- a/lbuild-initvm.sh +++ b/lbuild-initvm.sh @@ -974,7 +974,12 @@ function main () { # parse fixed arguments [[ -z "$@" ]] && usage lxc=$1 ; shift - lxc_root=$path/$lxc + lxc_root=/vservers/$lxc + # rainchecks + [ -d $lxc_root ] && \ + { echo "container $lxc already exists in filesystem - exiting" ; exit 1 ; } + virsh -c lxc:/// domuuid $lxc >& /dev/null && \ + { echo "container $lxc already exists in libvirt - exiting" ; exit 1 ; } mkdir -p $lxc_root # check we've exhausted the arguments @@ -1032,12 +1037,6 @@ function main () { echo "the IP address of container $lxc is $IP, host virtual interface is $VIF_HOST" - # rainchecks - [ -d $lxc_root ] && \ - { echo "container $lxc already exists in filesystem - exiting" ; exit 1 ; } - virsh -c lxc:/// domuuid $lxc >& /dev/null && \ - { echo "container $lxc already exists in libvirt - exiting" ; exit 1 ; } - setup_lxc $lxc $fcdistro $pldistro $personality devel_or_vtest_tools $lxc $fcdistro $pldistro $personality -- 2.43.0