diff --git a/devstack-vm-gate-wrap.sh b/devstack-vm-gate-wrap.sh index 7ce7c894..764302be 100755 --- a/devstack-vm-gate-wrap.sh +++ b/devstack-vm-gate-wrap.sh @@ -46,6 +46,31 @@ function setup_workspace { # Enabled detailed logging, since output of this function is redirected set -o xtrace + # HPcloud stopped adding the hostname to /etc/hosts with their + # precise images. + + HOSTNAME=`/bin/hostname` + if ! grep $HOSTNAME /etc/hosts >/dev/null + then + echo "Need to add hostname to /etc/hosts" + sudo bash -c 'echo "127.0.1.1 $HOSTNAME" >>/etc/hosts' + fi + + # Hpcloud provides no swap, but does have a virtual disk mounted + # at /mnt we can use. It also doesn't have enough space on / for + # two devstack installs, so we partition the vdisk: + if [ `grep SwapTotal /proc/meminfo | awk '{ print $2; }'` -eq 0 ] && \ + [ -b /dev/vdb ]; then + sudo umount /dev/vdb + sudo parted /dev/vdb --script -- mklabel msdos + sudo parted /dev/vdb --script -- mkpart primary linux-swap 0 8192 + sudo parted /dev/vdb --script -- mkpart primary ext2 8192 -1 + sudo mkswap /dev/vdb1 + sudo mkfs.ext4 /dev/vdb2 + sudo swapon /dev/vdb1 + sudo mount /dev/vdb2 /opt + fi + sudo mkdir -p $DEST sudo chown -R jenkins:jenkins $DEST cd $DEST @@ -142,31 +167,6 @@ function setup_host { # Enabled detailed logging, since output of this function is redirected set -o xtrace - # HPcloud stopped adding the hostname to /etc/hosts with their - # precise images. - - HOSTNAME=`/bin/hostname` - if ! grep $HOSTNAME /etc/hosts >/dev/null - then - echo "Need to add hostname to /etc/hosts" - sudo bash -c 'echo "127.0.1.1 $HOSTNAME" >>/etc/hosts' - fi - - # Hpcloud provides no swap, but does have a virtual disk mounted - # at /mnt we can use. It also doesn't have enough space on / for - # two devstack installs, so we partition the vdisk: - if [ `grep SwapTotal /proc/meminfo | awk '{ print $2; }'` -eq 0 ] && \ - [ -b /dev/vdb ]; then - sudo umount /dev/vdb - sudo parted /dev/vdb --script -- mklabel msdos - sudo parted /dev/vdb --script -- mkpart primary linux-swap 0 8192 - sudo parted /dev/vdb --script -- mkpart primary ext2 8192 -1 - sudo mkswap /dev/vdb1 - sudo mkfs.ext4 /dev/vdb2 - sudo swapon /dev/vdb1 - sudo mount /dev/vdb2 /opt - fi - # Make sure headers for the currently running kernel are installed: sudo apt-get install -y --force-yes linux-headers-`uname -r` @@ -491,13 +491,6 @@ if ! function_exists "gate_hook"; then } fi -echo "Triggered by: https://review.openstack.org/$ZUUL_CHANGE patchset $ZUUL_PATCHSET" -echo "Pipeline: $ZUUL_PIPELINE" -echo "IP configuration of this host:" -ip -f inet addr show - -setup_host &> $WORKSPACE/logs/devstack-gate-setup-host.txt - if [ "$DEVSTACK_GATE_GRENADE" -eq "1" ]; then ORIGBRANCH=$ZUUL_BRANCH ZUUL_BRANCH=$GRENADE_OLD_BRANCH @@ -506,6 +499,13 @@ if [ "$DEVSTACK_GATE_GRENADE" -eq "1" ]; then ZUUL_BRANCH=$ORIGBRANCH fi +echo "Triggered by: https://review.openstack.org/$ZUUL_CHANGE patchset $ZUUL_PATCHSET" +echo "Pipeline: $ZUUL_PIPELINE" +echo "IP configuration of this host:" +ip -f inet addr show + +setup_host &> $WORKSPACE/logs/devstack-gate-setup-host.txt + # Run pre test hook if we have one if function_exists "pre_test_hook"; then set -o xtrace