Adding semantic check on platform-integ-apps reapply operation

The reapply operation needs to do the same checks done on the apply
operation. These checks prevent reapplying the application on
some ceph or system scenarios.

Moreover, on the method pre_auto_apply_check, it is possible that
conductor_object._ceph (CephOperator) is not initialized yet, and trying
to access its methods will raise an AttributeError exception. As this is
a possible scenario, this case is now tested, and a
LifecycleSemanticCheckException is raised.

Test Plan:

    PASS: (AIO-DX) Check that platform-integ-apps is on uploaded state
    PASS: (AIO-DX) Unmanage ceph-mon
    PASS: (AIO-DX) Stop ceph-mon service
    PASS: (AIO-DX) Restart sysinv-conductor service
    PASS: (AIO-DX) Check on sysinv logs that the new Exception is
          being logged and the platform-integ-apps still trying to
          be applied
    PASS: (AIO-DX) Manage ceph-mon
    PASS: (AIO-DX) Start ceph-mon service
    PASS: (AIO-DX) After the Ceph cluster has become responsive,
          check that platform-integ-apps is being successfully
          applied.

    PASS: (AIO-DX) Check that platform-integ-apps is on applied state
    PASS: (AIO-DX) Unmanage ceph-mon
    PASS: (AIO-DX) Stop ceph-mon service
    PASS: (AIO-DX) Restart sysinv-conductor service
    PASS: (AIO-DX) Check on sysinv logs that the new Exception is
          being logged and the platform-integ-apps still trying
          to be applied.
    PASS: (AIO-DX) Wait until platform-integ-apps is on
          apply-failed state

Closes-bug: 2052315

Change-Id: I8c3318cc6f002671cb2e4bf81b14238ac4467131
Signed-off-by: Guilherme Costa <guilherme.costa@windriver.com>
This commit is contained in:
Guilherme Costa 2024-01-30 15:25:23 -03:00 committed by Guilherme Rodrigues Costa
parent 5d3806316f
commit 788991a76d

View File

@ -38,7 +38,8 @@ class PlatformAppLifecycleOperator(base.AppLifecycleOperator):
# Semantic checks
if hook_info.lifecycle_type == constants.APP_LIFECYCLE_TYPE_SEMANTIC_CHECK:
if hook_info.mode == constants.APP_LIFECYCLE_MODE_AUTO and \
hook_info.operation == constants.APP_APPLY_OP and \
hook_info.operation in [constants.APP_APPLY_OP,
constants.APP_EVALUATE_REAPPLY_OP] and \
hook_info.relative_timing == constants.APP_LIFECYCLE_TIMING_PRE:
return self.pre_auto_apply_check(conductor_obj)
@ -83,6 +84,12 @@ class PlatformAppLifecycleOperator(base.AppLifecycleOperator):
if not os.path.isfile(crushmap_flag_file):
raise exception.LifecycleSemanticCheckException(
"Crush map not applied")
# conductor_obj._ceph (CephOperator) may not be initialized
# at this point, as it depends on ceph and system conditions
# to start the thread that initializes it
if conductor_obj._ceph is None:
raise exception.LifecycleSemanticCheckException(
"CephOperator is not initialized yet")
if not conductor_obj._ceph.have_ceph_monitor_access():
raise exception.LifecycleSemanticCheckException(
"Monitor access error")