From e8fed48eadb73152ab4442b166cf9f668d2b11f8 Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Mon, 26 Sep 2011 19:50:43 -0700 Subject: [PATCH] use /opt/stack instead of /opt --- build_lxc.sh | 57 +++++++++++++++++++++++++-------------------- files/keystone.conf | 2 +- stack.sh | 5 +++- upload_image.sh | 9 +++---- 4 files changed, 42 insertions(+), 31 deletions(-) diff --git a/build_lxc.sh b/build_lxc.sh index b97f8db..1f85b33 100755 --- a/build_lxc.sh +++ b/build_lxc.sh @@ -22,6 +22,7 @@ CONTAINER_NETMASK=${CONTAINER_NETMASK:-255.255.255.0} CONTAINER_GATEWAY=${CONTAINER_GATEWAY:-192.168.1.1} NAMESERVER=${NAMESERVER:-$CONTAINER_GATEWAY} COPYENV=${COPYENV:-1} +DEST=${DEST:-/opt/stack} # Param string to pass to stack.sh. Like "EC2_DMZ_HOST=192.168.1.1 MYSQL_USER=nova" STACKSH_PARAMS=${STACKSH_PARAMS:-} @@ -94,21 +95,27 @@ if [ ! -d $CACHEDIR ]; then chroot $CACHEDIR pip install `cat files/pips/*` fi +# Clean out code repos if directed to do so +if [ "$CLEAN" = "1" ]; then + rm -rf $NOVA_REPO $CACHEDIR/$DEST +fi + # Cache openstack code -git_clone $NOVA_REPO $CACHEDIR/opt/nova $NOVA_BRANCH -git_clone $GLANCE_REPO $CACHEDIR/opt/glance $GLANCE_BRANCH -git_clone $KEYSTONE_REPO $CACHEDIR/opt/keystone $KEYSTONE_BRANCH -git_clone $NOVNC_REPO $CACHEDIR/opt/novnc $NOVNC_BRANCH -git_clone $DASH_REPO $CACHEDIR/opt/dash $DASH_BRANCH $DASH_TAG -git_clone $NIXON_REPO $CACHEDIR/opt/nixon $NIXON_BRANCH -git_clone $NOVACLIENT_REPO $CACHEDIR/opt/python-novaclient $NOVACLIENT_BRANCH -git_clone $OPENSTACKX_REPO $CACHEDIR/opt/openstackx $OPENSTACKX_BRANCH -git_clone $MUNIN_REPO $CACHEDIR/opt/openstack-munin $MUNIN_BRANCH +mkdir -p $CACHEDIR/$DEST +git_clone $NOVA_REPO $CACHEDIR/$DEST/nova $NOVA_BRANCH +git_clone $GLANCE_REPO $CACHEDIR/$DEST/glance $GLANCE_BRANCH +git_clone $KEYSTONE_REPO $CACHEDIR/$DESTkeystone $KEYSTONE_BRANCH +git_clone $NOVNC_REPO $CACHEDIR/$DEST/novnc $NOVNC_BRANCH +git_clone $DASH_REPO $CACHEDIR/$DEST/dash $DASH_BRANCH $DASH_TAG +git_clone $NIXON_REPO $CACHEDIR/$DEST/nixon $NIXON_BRANCH +git_clone $NOVACLIENT_REPO $CACHEDIR/$DEST/python-novaclient $NOVACLIENT_BRANCH +git_clone $OPENSTACKX_REPO $CACHEDIR/$DEST/openstackx $OPENSTACKX_BRANCH +git_clone $MUNIN_REPO $CACHEDIR/$DEST/openstack-munin $MUNIN_BRANCH # Use this version of devstack? if [ "$USE_CURRENT_DEVSTACK" = "1" ]; then - rm -rf $CACHEDIR/opt/devstack - cp -pr $CWD $CACHEDIR/opt/devstack + rm -rf $CACHEDIR/$DEST/devstack + cp -pr $CWD $CACHEDIR/$DEST/devstack fi # Destroy the old container @@ -128,7 +135,7 @@ ROOTFS=/var/lib/lxc/$CONTAINER/rootfs/ # Create a stack user that is a member of the libvirtd group so that stack # is able to interact with libvirt. chroot $ROOTFS groupadd libvirtd -chroot $ROOTFS useradd stack -s /bin/bash -d /opt -G libvirtd +chroot $ROOTFS useradd stack -s /bin/bash -d $DEST -G libvirtd # a simple password - pass echo stack:pass | chroot $ROOTFS chpasswd @@ -151,19 +158,19 @@ function cp_it { # Copy over your ssh keys and env if desired if [ "$COPYENV" = "1" ]; then - cp_it ~/.ssh $ROOTFS/opt/.ssh - cp_it ~/.ssh/id_rsa.pub $ROOTFS/opt/.ssh/authorized_keys - cp_it ~/.gitconfig $ROOTFS/opt/.gitconfig - cp_it ~/.vimrc $ROOTFS/opt/.vimrc - cp_it ~/.bashrc $ROOTFS/opt/.bashrc + cp_it ~/.ssh $ROOTFS/$DEST/.ssh + cp_it ~/.ssh/id_rsa.pub $ROOTFS/$DEST/.ssh/authorized_keys + cp_it ~/.gitconfig $ROOTFS/$DEST/.gitconfig + cp_it ~/.vimrc $ROOTFS/$DEST/.vimrc + cp_it ~/.bashrc $ROOTFS/$DEST/.bashrc fi # Make our ip address hostnames look nice at the command prompt -echo "export PS1='${debian_chroot:+($debian_chroot)}\\u@\\H:\\w\\$ '" >> $ROOTFS/opt/.bashrc +echo "export PS1='${debian_chroot:+($debian_chroot)}\\u@\\H:\\w\\$ '" >> $ROOTFS/$DEST/.bashrc echo "export PS1='${debian_chroot:+($debian_chroot)}\\u@\\H:\\w\\$ '" >> $ROOTFS/etc/profile -# Give stack ownership over /opt so it may do the work needed -chroot $ROOTFS chown -R stack /opt +# Give stack ownership over /$DEST so it may do the work needed +chroot $ROOTFS chown -R stack /$DEST # Configure instance network INTERFACES=$ROOTFS/etc/network/interfaces @@ -179,7 +186,7 @@ iface eth0 inet static EOF # Configure the runner -RUN_SH=$ROOTFS/opt/run.sh +RUN_SH=$ROOTFS/$DEST/run.sh cat > $RUN_SH < /opt/run.sh.log +cd /$DEST/devstack && $STACKSH_PARAMS ./stack.sh > /$DEST/run.sh.log EOF # Make the run.sh executable @@ -205,7 +212,7 @@ chmod 755 $RUN_SH RC_LOCAL=$ROOTFS/etc/rc.local cat > $RC_LOCAL <