Move chroot cache dirs out of devstack dir
This commit is contained in:
parent
5372f43387
commit
4cbb267679
2 changed files with 36 additions and 33 deletions
34
build_nfs.sh
34
build_nfs.sh
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
CHROOTCACHE=${CHROOTCACHE:-/root/cache}
|
||||||
|
|
||||||
# Source params
|
# Source params
|
||||||
source ./stackrc
|
source ./stackrc
|
||||||
|
|
||||||
|
@ -12,24 +14,24 @@ DEST="/nfs/$NAME"
|
||||||
rm -rf $DEST
|
rm -rf $DEST
|
||||||
|
|
||||||
# build a proto image - natty + packages that will install (optimization)
|
# build a proto image - natty + packages that will install (optimization)
|
||||||
if [ ! -d proto ]; then
|
if [ ! -d $CHROOTCACHE/proto ]; then
|
||||||
debootstrap natty proto
|
debootstrap natty $CHROOTCACHE/proto
|
||||||
cp files/sources.list proto/etc/apt/sources.list
|
cp files/sources.list $CHROOTCACHE/proto/etc/apt/sources.list
|
||||||
chroot proto apt-get update
|
chroot $CHROOTCACHE/proto apt-get update
|
||||||
chroot proto apt-get install -y `cat files/apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin|mysql-server)"`
|
chroot $CHROOTCACHE/proto apt-get install -y `cat files/apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin|mysql-server)"`
|
||||||
chroot proto pip install `cat files/pips/*`
|
chroot $CHROOTCACHE/proto pip install `cat files/pips/*`
|
||||||
git_clone $NOVA_REPO proto/opt/nova $NOVA_BRANCH
|
git_clone $NOVA_REPO $CHROOTCACHE/proto/opt/nova $NOVA_BRANCH
|
||||||
git_clone $GLANCE_REPO proto/opt/glance $GLANCE_BRANCH
|
git_clone $GLANCE_REPO $CHROOTCACHE/proto/opt/glance $GLANCE_BRANCH
|
||||||
git_clone $KEYSTONE_REPO proto/opt/keystone $KEYSTONE_BRANCH
|
git_clone $KEYSTONE_REPO $CHROOTCACHE/proto/opt/keystone $KEYSTONE_BRANCH
|
||||||
git_clone $NOVNC_REPO proto/opt/novnc $NOVNC_BRANCH
|
git_clone $NOVNC_REPO $CHROOTCACHE/proto/opt/novnc $NOVNC_BRANCH
|
||||||
git_clone $DASH_REPO proto/opt/dash $DASH_BRANCH $DASH_TAG
|
git_clone $DASH_REPO $CHROOTCACHE/proto/opt/dash $DASH_BRANCH $DASH_TAG
|
||||||
git_clone $NOVACLIENT_REPO proto/opt/python-novaclient $NOVACLIENT_BRANCH
|
git_clone $NOVACLIENT_REPO $CHROOTCACHE/proto/opt/python-novaclient $NOVACLIENT_BRANCH
|
||||||
git_clone $OPENSTACKX_REPO proto/opt/openstackx $OPENSTACKX_BRANCH
|
git_clone $OPENSTACKX_REPO $CHROOTCACHE/proto/opt/openstackx $OPENSTACKX_BRANCH
|
||||||
chroot proto mkdir -p /opt/files
|
chroot $CHROOTCACHE/proto mkdir -p /opt/files
|
||||||
wget -c http://images.ansolabs.com/tty.tgz -O proto/opt/files/tty.tgz
|
wget -c http://images.ansolabs.com/tty.tgz -O $CHROOTCACHE/proto/opt/files/tty.tgz
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp -pr proto $DEST
|
cp -pr $CHROOTCACHE/proto $DEST
|
||||||
|
|
||||||
# set hostname
|
# set hostname
|
||||||
echo $NAME > $DEST/etc/hostname
|
echo $NAME > $DEST/etc/hostname
|
||||||
|
|
|
@ -7,44 +7,45 @@ if [ ! "$#" -eq "1" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PROGDIR=`dirname $0`
|
PROGDIR=`dirname $0`
|
||||||
|
CHROOTCACHE=${CHROOTCACHE:-/root/cache}
|
||||||
|
|
||||||
# Source params
|
# Source params
|
||||||
source ./stackrc
|
source ./stackrc
|
||||||
|
|
||||||
# clean install of natty
|
# clean install of natty
|
||||||
if [ ! -d natty-base ]; then
|
if [ ! -d $CHROOTCACHE/natty-base ]; then
|
||||||
$PROGDIR/make_image.sh -C natty natty-base
|
$PROGDIR/make_image.sh -C natty $CHROOTCACHE/natty-base
|
||||||
# copy kernel modules...
|
# copy kernel modules...
|
||||||
# NOTE(ja): is there a better way to do this?
|
# NOTE(ja): is there a better way to do this?
|
||||||
cp -pr /lib/modules/`uname -r` natty-base/lib/modules
|
cp -pr /lib/modules/`uname -r` $CHROOTCACHE/natty-base/lib/modules
|
||||||
# a simple password - pass
|
# a simple password - pass
|
||||||
echo root:pass | chroot natty-base chpasswd
|
echo root:pass | chroot $CHROOTCACHE/natty-base chpasswd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# prime natty with as many apt/pips as we can
|
# prime natty with as many apt/pips as we can
|
||||||
if [ ! -d primed ]; then
|
if [ ! -d $CHROOTCACHE/natty-dev ]; then
|
||||||
rsync -azH natty-base/ primed/
|
rsync -azH $CHROOTCACHE/natty-base/ $CHROOTCACHE/natty-dev/
|
||||||
chroot primed apt-get install -y `cat files/apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin|mysql-server)"`
|
chroot $CHROOTCACHE/natty-dev apt-get install -y `cat files/apts/* | cut -d\# -f1 | egrep -v "(rabbitmq|libvirt-bin|mysql-server)"`
|
||||||
chroot primed pip install `cat files/pips/*`
|
chroot $CHROOTCACHE/natty-dev pip install `cat files/pips/*`
|
||||||
|
|
||||||
# Create a stack user that is a member of the libvirtd group so that stack
|
# Create a stack user that is a member of the libvirtd group so that stack
|
||||||
# is able to interact with libvirt.
|
# is able to interact with libvirt.
|
||||||
chroot primed groupadd libvirtd
|
chroot $CHROOTCACHE/natty-dev groupadd libvirtd
|
||||||
chroot primed useradd stack -s /bin/bash -d /opt -G libvirtd
|
chroot $CHROOTCACHE/natty-dev useradd stack -s /bin/bash -d /opt -G libvirtd
|
||||||
|
|
||||||
# a simple password - pass
|
# a simple password - pass
|
||||||
echo stack:pass | chroot primed chpasswd
|
echo stack:pass | chroot $CHROOTCACHE/natty-dev chpasswd
|
||||||
|
|
||||||
# and has sudo ability (in the future this should be limited to only what
|
# and has sudo ability (in the future this should be limited to only what
|
||||||
# stack requires)
|
# stack requires)
|
||||||
echo "stack ALL=(ALL) NOPASSWD: ALL" >> primed/etc/sudoers
|
echo "stack ALL=(ALL) NOPASSWD: ALL" >> $CHROOTCACHE/natty-dev/etc/sudoers
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# clone git repositories onto the system
|
# clone git repositories onto the system
|
||||||
# ======================================
|
# ======================================
|
||||||
|
|
||||||
if [ ! -d cloned ]; then
|
if [ ! -d $CHROOTCACHE/natty-stack ]; then
|
||||||
rsync -azH primed/ cloned/
|
rsync -azH $CHROOTCACHE/natty-dev/ $CHROOTCACHE/natty-stack/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# git clone only if directory doesn't exist already. Since ``DEST`` might not
|
# git clone only if directory doesn't exist already. Since ``DEST`` might not
|
||||||
|
@ -53,7 +54,7 @@ fi
|
||||||
function git_clone {
|
function git_clone {
|
||||||
|
|
||||||
# clone new copy or fetch latest changes
|
# clone new copy or fetch latest changes
|
||||||
CHECKOUT=cloned$2
|
CHECKOUT=$CHROOTCACHE/natty-stack$2
|
||||||
if [ ! -d $CHECKOUT ]; then
|
if [ ! -d $CHECKOUT ]; then
|
||||||
mkdir -p $CHECKOUT
|
mkdir -p $CHECKOUT
|
||||||
git clone $1 $CHECKOUT
|
git clone $1 $CHECKOUT
|
||||||
|
@ -73,7 +74,7 @@ function git_clone {
|
||||||
popd
|
popd
|
||||||
|
|
||||||
# give ownership to the stack user
|
# give ownership to the stack user
|
||||||
chroot cloned/ chown -R stack $2
|
chroot $CHROOTCACHE/natty-stack/ chown -R stack $2
|
||||||
}
|
}
|
||||||
|
|
||||||
git_clone $NOVA_REPO /opt/stack/nova $NOVA_BRANCH
|
git_clone $NOVA_REPO /opt/stack/nova $NOVA_BRANCH
|
||||||
|
@ -97,7 +98,7 @@ mkfs.ext2 -F $IMG
|
||||||
# mount blank image loopback and load it
|
# mount blank image loopback and load it
|
||||||
mkdir -p $MNT
|
mkdir -p $MNT
|
||||||
mount -o loop $IMG $MNT
|
mount -o loop $IMG $MNT
|
||||||
rsync -azH cloned/ $MNT
|
rsync -azH $CHROOTCACHE/natty-stack/ $MNT
|
||||||
|
|
||||||
# umount and cleanup
|
# umount and cleanup
|
||||||
umount $MNT
|
umount $MNT
|
||||||
|
|
Loading…
Reference in a new issue