New preflight check for the undercloud: disk space

Enable disk space check on the undercloud in order to ensure we have
at least the minimal at disposal.
The check itself comes from the tripleo-validations repository in order
to avoid inconsistencies and do a first step toward ansible-driven
validations.

Change-Id: Ieea72ce2695683c5fb083887195044acbd6b92ee
changes/41/586541/7
Cédric Jeanneret 4 years ago
parent 0879570c5d
commit 54e5ae9be6
  1. 2
      tripleoclient/constants.py
  2. 7
      tripleoclient/v1/releasenotes/notes/check-undercloud-disk-space-709ebf574e91ae3a.yaml
  3. 2
      tripleoclient/v1/undercloud_config.py
  4. 27
      tripleoclient/v1/undercloud_preflight.py

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

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

@ -561,7 +561,7 @@ def prepare_undercloud_deploy(upgrade=False, no_validations=False,
deploy_args += ['--hieradata-override=%s' % data_file]
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(
tht_templates, "environments/tripleo-validations.yaml")]

@ -93,6 +93,30 @@ def _run_live_command(args, env=None, name=None, cwd=None, wait=True):
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():
"""Check system hostname configuration
@ -457,7 +481,7 @@ def _validate_architecure_options():
_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
utils.load_config(CONF, constants.UNDERCLOUD_CONF_PATH)
utils.configure_logging(LOG, verbose_level, CONF['undercloud_log_file'])
@ -467,6 +491,7 @@ def check(verbose_level):
# Other validations
_check_hostname()
_check_memory()
_check_diskspace(upgrade)
_check_sysctl()
_validate_passwords_file()
# Heat templates validations

Loading…
Cancel
Save