Use validation framework for running undercloud checkdisk

The validations playbook is own and moved under the VF
ansible dir.
The undercloud preflight check should use VF for running it.

Change-Id: Id853b1e80d690734ac9c32a1b914e49608f6cc43
This commit is contained in:
Mathieu Bultel 2020-09-23 16:33:06 +02:00
parent 85e6624f39
commit 3dd2c83883
1 changed files with 13 additions and 10 deletions

View File

@ -30,6 +30,9 @@ from oslo_config import cfg
from tripleoclient import constants from tripleoclient import constants
from tripleoclient import utils from tripleoclient import utils
from validations_libs import constants as v_consts
from validations_libs.validation_actions import ValidationActions
class FailedValidation(Exception): class FailedValidation(Exception):
pass pass
@ -76,7 +79,7 @@ def _run_live_command(args, env=None, name=None, cwd=None, wait=True):
raise RuntimeError(message) raise RuntimeError(message)
def _check_diskspace(upgrade=False, verbose_level=0): def _check_diskspace(upgrade=False):
"""Check undercloud disk space """Check undercloud disk space
This runs a simple ansible playbook located in tripleo-validations This runs a simple ansible playbook located in tripleo-validations
@ -92,15 +95,15 @@ def _check_diskspace(upgrade=False, verbose_level=0):
playbook_args = constants.DEPLOY_ANSIBLE_ACTIONS['preflight-deploy'] playbook_args = constants.DEPLOY_ANSIBLE_ACTIONS['preflight-deploy']
with utils.TempDirs() as tmp: with utils.TempDirs() as tmp:
utils.run_ansible_playbook( # @matbu: todo: removed this when [1] will be merged
workdir=tmp, # [1] https://review.opendev.org/753845
v_consts.VALIDATION_ANSIBLE_ARTIFACT_PATH = "{}/artifacts".format(tmp)
actions = ValidationActions()
actions.run_validations(
inventory='undercloud', inventory='undercloud',
connection='local', log_path=tmp,
output_callback='validation_output', validations_dir=constants.ANSIBLE_VALIDATION_DIR,
playbook_dir=constants.ANSIBLE_VALIDATION_DIR, validation_name=playbook_args['playbook'])
verbosity=verbose_level,
**playbook_args
)
def _check_memory(): def _check_memory():
@ -494,7 +497,7 @@ def check(verbose_level, upgrade=False):
_checking_status('Memory') _checking_status('Memory')
_check_memory() _check_memory()
_checking_status('Disk space') _checking_status('Disk space')
_check_diskspace(upgrade, verbose_level) _check_diskspace(upgrade)
_checking_status('Sysctl') _checking_status('Sysctl')
_check_sysctl() _check_sysctl()
_checking_status('Password file') _checking_status('Password file')