From ec14005f7608727896ac21877679d825b557a75a Mon Sep 17 00:00:00 2001 From: Hugh Saunders Date: Mon, 7 Mar 2016 16:37:02 +0000 Subject: [PATCH] Check correct minimum size for data disk Currently we choose the largest available disk as the data disk, however this may be too small to be useful. This patch checks disqualifies disks that are smaller than the minimum. It also sets the minimum to the proper value of 60GB free on the root disk or 60GB available on the designated secondary disk. The previous check was 60GB on root and 80GB on the secondary disk which is not the intented check as noted in the documentation. Change-Id: Id225dc55068e1eed2e19e1e27b0f626163f03db2 --- scripts/gate-check-commit.sh | 8 +++++--- tests/roles/bootstrap-host/defaults/main.yml | 2 +- tests/roles/bootstrap-host/tasks/check-requirements.yml | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/gate-check-commit.sh b/scripts/gate-check-commit.sh index 400c337aa4..ea3093c3d5 100755 --- a/scripts/gate-check-commit.sh +++ b/scripts/gate-check-commit.sh @@ -33,9 +33,11 @@ info_block "Checking for required libraries." 2> /dev/null || source $(dirname $ # Log some data about the instance and the rest of the system log_instance_info -# Determine the largest secondary disk device available for repartitioning -DATA_DISK_DEVICE=$(lsblk -brndo NAME,TYPE,RO,SIZE | \ - awk '/d[b-z]+ disk 0/{ if ($4>m){m=$4; d=$1}}; END{print d}') +# Get minimum disk size +DATA_DISK_MIN_SIZE="$((1024**3 * $(awk '/bootstrap_host_data_disk_min_size/{print $2}' $(dirname ${0})/../tests/roles/bootstrap-host/defaults/main.yml) ))" + +# Determine the largest secondary disk device that meets the minimum size +DATA_DISK_DEVICE=$(lsblk -brndo NAME,TYPE,RO,SIZE | awk '/d[b-z]+ disk 0/{ if ($4>m && $4>='$DATA_DISK_MIN_SIZE'){m=$4; d=$1}}; END{print d}') # Only set the secondary disk device option if there is one if [ -n "${DATA_DISK_DEVICE}" ]; then diff --git a/tests/roles/bootstrap-host/defaults/main.yml b/tests/roles/bootstrap-host/defaults/main.yml index ec6691d828..abdefe987b 100644 --- a/tests/roles/bootstrap-host/defaults/main.yml +++ b/tests/roles/bootstrap-host/defaults/main.yml @@ -80,7 +80,7 @@ bootstrap_host_data_disk_device_force: no # # If the storage capacity on this device is greater than or equal to this # size (in GB), the bootstrap process will use it. -bootstrap_host_data_disk_min_size: 80 +bootstrap_host_data_disk_min_size: 60 ### MongoDB Settings # MongoDB is installed on the host in the AIO for Ceilometer and Aodh to use. diff --git a/tests/roles/bootstrap-host/tasks/check-requirements.yml b/tests/roles/bootstrap-host/tasks/check-requirements.yml index 55f705f37f..14faa74d12 100644 --- a/tests/roles/bootstrap-host/tasks/check-requirements.yml +++ b/tests/roles/bootstrap-host/tasks/check-requirements.yml @@ -66,7 +66,7 @@ - name: Fail if there is not enough space available in / assert: that: | - (host_root_space_available_bytes | int) >= ((host_data_disk_min_size_bytes | int) * 0.75) + (host_root_space_available_bytes | int) >= (host_data_disk_min_size_bytes | int) when: - bootstrap_host_data_disk_device is not defined tags: