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
This commit is contained in:
Hugh Saunders 2016-03-07 16:37:02 +00:00 committed by Jesse Pretorius
parent 4ebf7974ef
commit ec14005f76
3 changed files with 7 additions and 5 deletions

View File

@ -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

View File

@ -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.

View File

@ -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: