Merge "New preflight check for the undercloud: disk space"

This commit is contained in:
Zuul 2018-08-06 21:45:36 +00:00 committed by Gerrit Code Review
commit cf740bfcfa
4 changed files with 36 additions and 2 deletions

View File

@ -77,3 +77,5 @@ ENABLE_SSH_ADMIN_STATUS_INTERVAL = 5
ENABLE_SSH_ADMIN_SSH_PORT_TIMEOUT = 300 ENABLE_SSH_ADMIN_SSH_PORT_TIMEOUT = 300
ADDITIONAL_ARCHITECTURES = ['ppc64le'] ADDITIONAL_ARCHITECTURES = ['ppc64le']
ANSIBLE_VALIDATION_DIR = '/usr/share/openstack-tripleo-validations/validations'

View File

@ -0,0 +1,7 @@
---
---
features:
- Enable new preflight check on the undercloud, using ansible playbooks from
openstack-tripleo-validations.
- Check runs differently if we're on a brand new deploy or an upgrade, as we
don't need the same amount of free space.

View File

@ -556,7 +556,7 @@ def prepare_undercloud_deploy(upgrade=False, no_validations=False,
deploy_args += ['--hieradata-override=%s' % data_file] deploy_args += ['--hieradata-override=%s' % data_file]
if CONF.get('enable_validations') and not no_validations: if CONF.get('enable_validations') and not no_validations:
undercloud_preflight.check(verbose_level) undercloud_preflight.check(verbose_level, upgrade)
deploy_args += ['-e', os.path.join( deploy_args += ['-e', os.path.join(
tht_templates, "environments/tripleo-validations.yaml")] tht_templates, "environments/tripleo-validations.yaml")]

View File

@ -93,6 +93,30 @@ def _run_live_command(args, env=None, name=None, cwd=None, wait=True):
raise RuntimeError(message) raise RuntimeError(message)
def _check_diskspace(upgrade=False):
"""Check undercloud disk space
This runs a simple ansible playbook located in tripleo-validations
There are currently two playbooks:
- undercloud-disk-space.yaml
- undercloud-disk-space-pre-upgrade.yaml
First one checks minimal disk space for a brand new deploy.
Second one checks minimal disk space for an upgrade.
"""
if upgrade:
playbook = 'undercloud-disk-space-pre-upgrade.yaml'
else:
playbook = 'undercloud-disk-space.yaml'
utils.run_ansible_playbook(logger=LOG,
workdir=constants.ANSIBLE_VALIDATION_DIR,
playbook=playbook,
inventory='undercloud,',
retries=False,
connection='local',
output_callback='validation_output')
def _check_hostname(): def _check_hostname():
"""Check system hostname configuration """Check system hostname configuration
@ -457,7 +481,7 @@ def _validate_architecure_options():
_validate_ppc64le_exclusive_opts(error_handler) _validate_ppc64le_exclusive_opts(error_handler)
def check(verbose_level): def check(verbose_level, upgrade=False):
# Fetch configuration and use its log file param to add logging to a file # Fetch configuration and use its log file param to add logging to a file
utils.load_config(CONF, constants.UNDERCLOUD_CONF_PATH) utils.load_config(CONF, constants.UNDERCLOUD_CONF_PATH)
utils.configure_logging(LOG, verbose_level, CONF['undercloud_log_file']) utils.configure_logging(LOG, verbose_level, CONF['undercloud_log_file'])
@ -467,6 +491,7 @@ def check(verbose_level):
# Other validations # Other validations
_check_hostname() _check_hostname()
_check_memory() _check_memory()
_check_diskspace(upgrade)
_check_sysctl() _check_sysctl()
_validate_passwords_file() _validate_passwords_file()
# Heat templates validations # Heat templates validations