X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lbuild-initvm.sh;h=869bf76093a2cc9641dcce8157971a29475e1883;hb=0983811a1ab0848da6ee0207df63f8b2be127727;hp=f37f419be029df6b9c15e403ae07970e9e622702;hpb=7dd49f795015387df7b7e85a33b2216bbe326d29;p=build.git diff --git a/lbuild-initvm.sh b/lbuild-initvm.sh index f37f419b..869bf760 100755 --- a/lbuild-initvm.sh +++ b/lbuild-initvm.sh @@ -21,10 +21,10 @@ export PATH=$PATH:/bin:/sbin # XXX fixme : when creating a 32bits VM we need to call linux32 as appropriate...s -DEFAULT_FCDISTRO=f20 +DEFAULT_FCDISTRO=f21 DEFAULT_PLDISTRO=lxc DEFAULT_PERSONALITY=linux64 -DEFAULT_MEMORY=512 +DEFAULT_MEMORY=1024 ########## # constant @@ -73,7 +73,7 @@ function package_method () { fcdistro=$1; shift case $fcdistro in f[0-9]*|centos[0-9]*|sl[0-9]*) echo yum ;; - squeeze|wheezy|jessie|oneiric|precise|quantal|raring|saucy|trusty) echo debootstrap ;; + squeeze|wheezy|jessie|oneiric|precise|quantal|raring|saucy|trusty|utopic) echo debootstrap ;; *) echo Unknown distro $fcdistro ;; esac } @@ -165,10 +165,13 @@ function fedora_download() { MIRROR_URL=$FEDORA_MIRROR_BASE/releases/$release/Everything/$arch/os RELEASE_URL1="$MIRROR_URL/Packages/fedora-release-$release-1.noarch.rpm" # with fedora18 the rpms are scattered by first name - RELEASE_URL2="$MIRROR_URL/Packages/f/fedora-release-$release-1.noarch.rpm" + # first try the second version of fedora-release first + RELEASE_URL2="$MIRROR_URL/Packages/f/fedora-release-$release-2.noarch.rpm" + RELEASE_URL3="$MIRROR_URL/Packages/f/fedora-release-$release-1.noarch.rpm" + RELEASE_TARGET=$INSTALL_ROOT/fedora-release-$release.noarch.rpm found="" - for attempt in $RELEASE_URL1 $RELEASE_URL2; do + for attempt in $RELEASE_URL1 $RELEASE_URL2 $RELEASE_URL3; do if curl -f $attempt -o $RELEASE_TARGET ; then echo "Retrieved $attempt" found=true @@ -368,7 +371,7 @@ function debian_mirror () { case $fcdistro in squeeze|wheezy|jessie) echo http://ftp2.fr.debian.org/debian/ ;; - oneiric|precise|quantal|raring|saucy|trusty) + oneiric|precise|quantal|raring|saucy|trusty|utopic) echo http://mir1.ovh.net/ubuntu/ubuntu/ ;; *) echo unknown distro $fcdistro; exit 1;; esac @@ -453,9 +456,11 @@ function setup_lxc() { # Enable cgroup -- xxx -- is this really useful ? [ -d $lxc_root/cgroup ] || mkdir $lxc_root/cgroup - # set up resolv.conf + ### set up resolv.conf from host + # ubuntu precise and on, /etc/resolv.conf is a symlink to ../run/resolvconf/resolv.conf + [ -h $lxc_root/etc/resolv.conf ] && rm -f $lxc_root/etc/resolv.conf cp /etc/resolv.conf $lxc_root/etc/resolv.conf - # and /etc/hosts for at least localhost + ### and /etc/hosts for at least localhost [ -f $lxc_root/etc/hosts ] || echo "127.0.0.1 localhost localhost.localdomain" > $lxc_root/etc/hosts # grant ssh access from host to guest @@ -474,6 +479,15 @@ function setup_lxc() { return 0 } +# this part does not belong in a domain any more +# but goes in a network object of its own existence +# +# host-bridge +# +# +# +# + function write_lxc_xml_test () { lxc=$1; shift cat < - - host-bridge - - - EOF } @@ -645,7 +654,10 @@ function post_install () { if [ -n "$START_VM" ] ; then virsh -c lxc:/// start $lxc # manually run dhclient in guest - somehow this network won't start on its own - virsh -c lxc:/// lxc-enter-namespace $lxc /usr/bin/$personality /bin/bash -c "dhclient $VIF_GUEST" + # we need the --noseclabel flag with recent libvirt's + # was not required with f20/libvirt-1.2.5 + # but is now with f21/libvirt-1.2.9 + virsh -c lxc:/// lxc-enter-namespace --noseclabel $lxc /usr/bin/$personality /bin/bash -c "dhclient $VIF_GUEST" fi else post_install_myplc $lxc $personality