config/sysinv/sysinv/sysinv/sysinv/api
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
..
controllers Add lifecycle hook to allow to_app application-update semantic checking 2021-04-23 06:55:55 -04:00
middleware Resolving invalid-all-object pylint error 2020-12-14 10:39:50 -05:00
__init__.py StarlingX open source release updates 2018-05-31 07:35:52 -07:00
acl.py Sysinv. Cleanup import statements for pep8 2018-06-29 13:43:53 -04:00
app.py Update load import and delete APIs 2020-05-29 11:55:11 -04:00
config.py B&R: Add /v1/ihosts/wipe_osds public sysinv API 2019-09-13 16:43:41 +03:00
hooks.py Update load import and delete APIs 2020-05-29 11:55:11 -04:00