repair logic, we were creating lcxroot before checking it was non-existent
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Thu, 23 Jan 2014 14:28:23 +0000 (15:28 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Thu, 23 Jan 2014 14:28:23 +0000 (15:28 +0100)
lbuild-initvm.sh

index 3bdd9fa..11d22d2 100755 (executable)
@@ -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