From: Thierry Parmentelat Date: Thu, 23 Jan 2014 14:28:23 +0000 (+0100) Subject: repair logic, we were creating lcxroot before checking it was non-existent X-Git-Tag: before_libvirt_121~34 X-Git-Url: http://git.onelab.eu/?p=build.git;a=commitdiff_plain;h=238d6e6cc9addab79993654d9bebd0494b4ae2f3 repair logic, we were creating lcxroot before checking it was non-existent --- 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