summaryrefslogtreecommitdiffstats
path: root/build/instack.sh
diff options
context:
space:
mode:
authorTim Rozet <trozet@redhat.com>2015-12-31 09:56:24 -0500
committerTim Rozet <trozet@redhat.com>2016-01-05 16:47:50 -0500
commitc475784616c60546f228fbdd75f3fe547f5079ac (patch)
treeb102d00f925a057cea1f18003c871becfda3c6db /build/instack.sh
parent3c78ff4776a98ef9f69bdcbe506c56d4a456a80c (diff)
Image fix to force flavor to be 39GB
Testing if this fixes current CI breakage Change-Id: Ib4f75a9a1772c5363afab6d24b7a254f8cf6f6f8 Signed-off-by: Tim Rozet <trozet@redhat.com>
Diffstat (limited to 'build/instack.sh')
-rwxr-xr-xbuild/instack.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/build/instack.sh b/build/instack.sh
index 57af7f9..e52e3e5 100755
--- a/build/instack.sh
+++ b/build/instack.sh
@@ -254,6 +254,22 @@ LIBGUESTFS_BACKEND=direct virt-customize --upload ../opendaylight-puppet-neutron
## END WORK AROUND
popd
+# resize instack machine
+echo "Checking if instack needs to be resized..."
+instack_size=$(LIBGUESTFS_BACKEND=direct virt-filesystems --long -h --all -a stack/instack.qcow2 |grep device | grep -Eo "[0-9\.]+G" | sed -n 's/\([0-9][0-9]*\).*/\1/p')
+if [ "$instack_size" -lt 30 ]; then
+ qemu-img create -f qcow2 -o preallocation=metadata newinstack.qcow2 30G
+ LIBGUESTFS_BACKEND=direct virt-resize --expand /dev/sda1 stack/instack.qcow2 newinstack.qcow2;
+ LIBGUESTFS_BACKEND=direct virt-customize -a newinstack.qcow2 --run-command 'xfs_growfs -d /dev/sda1 || true'
+ LIBGUESTFS_BACKEND=direct virt-sparsify newinstack.qcow2 stack/instack.qcow2
+ new_size=$(LIBGUESTFS_BACKEND=direct virt-filesystems --long -h --all -a stack/instack.qcow2 |grep device | grep -Eo "[0-9\.]+G" | sed -n 's/\([0-9][0-9]*\).*/\1/p')
+ if [ "$new_size" -lt 30 ]; then
+ echo "Error resizing instack machine, disk size is ${new_size}"
+ exit 1
+ else
+ echo "instack successfully resized"
+ fi
+fi
# move and Sanitize private keys from instack.json file
mv stack/instackenv.json instackenv-virt.json
sed -i '/pm_password/c\ "pm_password": "INSERT_STACK_USER_PRIV_KEY",' instackenv-virt.json