From 894e73146cd190e624b113ca09e4f3232e45c64a Mon Sep 17 00:00:00 2001 From: Eduardo Gonzalez Date: Tue, 29 Aug 2017 09:11:56 +0100 Subject: [PATCH] Fix gates out of disk space Sometimes gates fails due lack of disk space, This change mounts a second disk in opt and moves registry data to opt. Disk format commands are excepts from devstack-gate: https://github.com/openstack-infra/devstack-gate/blob/dc49f9e6eb18e42c6b175e4e146fa8f3b7633279/functions.sh#L306 Change-Id: I606aa491b8cbf678e83281bad1a0ff39d3920ff2 Closes-Bug: #1713652 --- tools/setup_Debian.sh | 19 +++++++++++++++++++ tools/setup_RedHat.sh | 19 +++++++++++++++++++ tools/setup_gate.sh | 4 ++-- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/tools/setup_Debian.sh b/tools/setup_Debian.sh index 10d08f0071..49684e770e 100755 --- a/tools/setup_Debian.sh +++ b/tools/setup_Debian.sh @@ -34,6 +34,25 @@ function setup_disk { DEV=$(losetup -a | awk -F: '/\/docker/ {print $1}') fi +# Excerpts from https://github.com/openstack-infra/devstack-gate/blob/dc49f9e6eb18e42c6b175e4e146fa8f3b7633279/functions.sh#L306 + if [ -b /dev/xvde ]; then + DEV2='/dev/xvde' + if mount | grep ${DEV2} > /dev/null; then + echo "*** ${DEV2} appears to already be mounted" + echo "*** ${DEV2} unmounting and reformating" + sudo umount ${DEV2} + fi + sudo parted ${DEV2} --script -- mklabel msdos + sync + sudo partprobe + sudo mkfs.ext4 ${DEV2} + sudo mount ${DEV2} /mnt + sudo find /opt/ -mindepth 1 -maxdepth 1 -exec mv {} /mnt/ \; + sudo umount /mnt + sudo mount ${DEV2} /opt + grep -q ${DEV2} /proc/mounts || exit 1 + fi + # Format Disks and setup Docker to use BTRFS sudo parted ${DEV} -s -- mklabel msdos sudo rm -rf /var/lib/docker diff --git a/tools/setup_RedHat.sh b/tools/setup_RedHat.sh index fe02691195..a77274a520 100755 --- a/tools/setup_RedHat.sh +++ b/tools/setup_RedHat.sh @@ -18,6 +18,25 @@ function setup_disk { DEV=$(losetup -a | awk -F: '/\/docker/ {print $1}') fi +# Excerpts from https://github.com/openstack-infra/devstack-gate/blob/dc49f9e6eb18e42c6b175e4e146fa8f3b7633279/functions.sh#L306 + if [ -b /dev/xvde ]; then + DEV2='/dev/xvde' + if mount | grep ${DEV2} > /dev/null; then + echo "*** ${DEV2} appears to already be mounted" + echo "*** ${DEV2} unmounting and reformating" + sudo umount ${DEV2} + fi + sudo parted ${DEV2} --script -- mklabel msdos + sync + sudo partprobe + sudo mkfs.ext4 ${DEV2} + sudo mount ${DEV2} /mnt + sudo find /opt/ -mindepth 1 -maxdepth 1 -exec mv {} /mnt/ \; + sudo umount /mnt + sudo mount ${DEV2} /opt + grep -q ${DEV2} /proc/mounts || exit 1 + fi + # Format Disks and setup Docker to use BTRFS sudo parted ${DEV} -s -- mklabel msdos sudo rm -rf /var/lib/docker diff --git a/tools/setup_gate.sh b/tools/setup_gate.sh index f0758fab0a..eec783d328 100755 --- a/tools/setup_gate.sh +++ b/tools/setup_gate.sh @@ -158,7 +158,7 @@ function setup_logging { } function prepare_images { - sudo docker run -d -p 4000:5000 --restart=always -v /tmp/kolla_registry/:/var/lib/registry --name registry registry:2 + sudo docker run -d -p 4000:5000 --restart=always -v /opt/kolla_registry/:/var/lib/registry --name registry registry:2 # NOTE(Jeffrey4l): Zuul adds all changes depend on to ZUUL_CHANGES # variable. if find "openstack/kolla:" string, it means this patch depends @@ -175,7 +175,7 @@ function prepare_images { filename=${BASE_DISTRO}-${INSTALL_TYPE}-registry-${BRANCH}.tar.gz wget -q -c -O "/tmp/$filename" \ "${NODEPOOL_TARBALLS_MIRROR}/kolla/images/${TMP_REGISTRY}${filename}" - sudo tar xzf "/tmp/$filename" -C /tmp/kolla_registry + sudo tar xzf "/tmp/$filename" -C /opt/kolla_registry fi }