config/sysinv/sysinv/sysinv/sysinv/api/controllers
jgauld 3c90e3b949 Add lifecycle hook to allow to_app application-update semantic checking
This adds new lifecycle update operation so that a semantic check lifecycle
step is run against the "to" application during application-update.

The application specific lifecycle code requires a custom semantic check
using the new hook (e.g., similar to the following):

if hook_info.lifecycle_type == constants.APP_LIFECYCLE_TYPE_SEMANTIC_CHECK:
    if hook_info.operation == constants.APP_UPDATE_OP:
        if hook_info[LifecycleConstants.EXTRA].get(LifecycleConstants.TO_APP, False):
            return self.update_check(app_op._dbapi, app)

Testing:
* VirtualBox: AIO-SX
* Created example application changes for platform-integ-apps using
  semantic check shown above, and prototype update_check() routine.
* Tested the following for both pass and fail semantic check cases:
  system application-update platform-integ-apps-1.0-29.tgz
* Tested that apps on the application-update are okay on an upgrade,
  as invoked in upgrade-scripts/65-k8s-app-upgrade.sh.
  i.e., system upgrade-activate

Semantic check passes, update proceeds to 1.0-29 "to" version,
the 1.0-27 "from" version is cleaned up.
Semantic check fails, application recovery proceeds to "from" version,
the 1.0-29 "to" version is cleaned up.

Example when semantic check fails,
system application-list
| platform-integ-apps      | 1.0-27  | platform-integration-manifest     | manifest.yaml \
| applied  | Application update from version 1.0-27 to version 1.0-29 aborted. \
             Application recover to version 1.0-27 completed. Please check logs for details

sysinv.log
sysinv 2021-04-19 09:32:53.422 3810926 INFO sysinv.conductor.kube_app [-] \
Starting recover Application platform-integ-apps from version: 1.0-29 to version: 1.0-27

Story: 2008829
Task: 42311

Signed-off-by: jgauld <james.gauld@windriver.com>
Change-Id: If0787e3e3806bdf5dc175fde64ac63e1f38fd852
2021-04-23 06:55:55 -04:00
..
v1 Add lifecycle hook to allow to_app application-update semantic checking 2021-04-23 06:55:55 -04:00
__init__.py StarlingX open source release updates 2018-05-31 07:35:52 -07:00
root.py Remove REST API for host-based snmp 2021-01-06 12:09:44 +00:00