Software deploy complete implementation
This commit implements the software deploy complete, it checks if the deployment is as "activate-done" and all hosts are running the ro-release. If all pass all validations it will delete the current deploy and deploy-host entities from software data storage, removes the config and data under the folders: [armada, config, deploy, fluxcd, helm, keyring, puppet, sysinv, nfv/vim] under /opt/platform/<folders>/<from_release> and also remove the folders: /var/lib/postgres/upgrade /var/lib/postgres/<from_release> /var/lib/rabbitmq/<from_release> /opt/etcd/<from_release> Test Plan: PASS: Folders deleted after software deploy complete PASS: Deployment entities deleted at /opt/software/software.json Story: 2010676 Task: 50022 clean up methods: Depends-On: https://review.opendev.org/c/starlingx/update/+/917073 get_current_deploy method: Depends-On: https://review.opendev.org/c/starlingx/update/+/916933 Change-Id: I35d54a8a9b485e90170d624d62721411ca2ca3df Signed-off-by: Luis Eduardo Bonatti <LuizEduardo.Bonatti@windriver.com>
This commit is contained in:
parent
ee78efb5f7
commit
d3db55103b
|
@ -58,6 +58,13 @@ DEBIAN_RELEASE = "bullseye"
|
|||
STARLINGX_RELEASE = SW_VERSION
|
||||
PATCH_SCRIPTS_STAGING_DIR = "/var/www/pages/updates/software-scripts"
|
||||
SYSROOT_OSTREE = "/sysroot/ostree/repo"
|
||||
RABBIT_PATH = '/var/lib/rabbitmq'
|
||||
ETCD_PATH = "/opt/etcd"
|
||||
ARMADA = "armada"
|
||||
KEYRING = ".keyring"
|
||||
UPGRADE = "upgrade"
|
||||
DEPLOY_COMPLETE_CLEANUP_FOLDERS_NAME = [ARMADA, CONFIG, DEPLOY, FLUXCD, HELM, KEYRING, PUPPET, SYSINV, VIM]
|
||||
|
||||
|
||||
LOOPBACK_INTERFACE_NAME = "lo"
|
||||
|
||||
|
|
|
@ -2647,13 +2647,15 @@ class PatchController(PatchService):
|
|||
return dict(info=msg_info, warning=msg_warning, error=msg_error)
|
||||
|
||||
def _deploy_complete(self):
|
||||
# TODO(bqian) complete the deploy
|
||||
# as deployment has been already activated, there is no return,
|
||||
# deploy complete can only succeed.
|
||||
# tasks for completion of deploy is to delete leftover data from
|
||||
# previous release. If some data could not be deleted, need to
|
||||
# automatically reattempt to delete it in later statge. (outside
|
||||
# a deployment)
|
||||
deploy = self.db_api_instance.get_current_deploy()
|
||||
to_release = deploy.get("to_release")
|
||||
from_release = deploy.get("from_release")
|
||||
major_to_release = utils.get_major_release_version(to_release)
|
||||
major_from_release = utils.get_major_release_version(from_release)
|
||||
if not is_all_host_running_release(major_to_release):
|
||||
raise SoftwareServiceError(f"Complete not allowed because there's some "
|
||||
f"host not running to release: {major_to_release}")
|
||||
clean_up_deployment_data(major_from_release)
|
||||
return True
|
||||
|
||||
@require_deploy_state([DEPLOY_STATES.ACTIVATE_DONE],
|
||||
|
|
Loading…
Reference in New Issue