
This commit adds the command "subcloud deploy abort" to dcmanager. It allows the user to abort the on-going execution of a playbook against the subcloud. Any task will be aborted immediately if the unabortable flag is not set by the playbook [1]. If current operation is install, a shutdown command will also be issued. Test Plan: Success cases: - PASS: Trigger an abort during installation and verify that the playbook execution was aborted immediately, the subcloud was shut dows after it and the RVMC pod and job were terminated. - PASS: Trigger an abort during config and verify that the playbook execution was aborted immediately. - PASS: Trigger an abort during bootstrap without the presence of unabortable flag and verify that the playbook execution was aborted immidiately. - PASS: Trigger an abort during bootstrap with the presence of unabortable flag and verify that the playbook execution was aborted only after the flag was deleted. - PASS: Trigger an abort directly calling the API (using CURL instead of using the CLI. Failure cases: - PASS: Verify that the abort request is rejected if deploy state is not 'installing', 'bootstrapping' or 'configuring'. - PASS: Abort when an unabortable task is running and then force an external error during this task restarting dcmanager-manager service, verify that deploy state is set to a failed state e.g. bootstrap-failed. - PASS: Abort when an unabortable task is running and then force an internal error during this task using ansible.builtin.fail module, verify that deploy state is set to a failed state e.g. bootstrap-failed. - PASS: Abort when an unabortable task is running and then force the playbook to halt the execution during this task using ansible.builtin.pause module, verify that deploy state is set to a failed state after 10 minutes e.g. bootstrap-failed. Story: 2010756 Task: 48102 Co-Authored-By: Gustavo Herzmann <gustavo.herzmann@windriver.com> Signed-off-by: Victor Romano <victor.gluzromano@windriver.com> Change-Id: Ic5311324a76bf7ce1215692e934d5577ff82868e
53 lines
1.4 KiB
Python
53 lines
1.4 KiB
Python
#
|
|
# Copyright (c) 2023 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
from dcmanager.api.policies import base
|
|
from oslo_policy import policy
|
|
|
|
POLICY_ROOT = 'dc_api:phased_subcloud_deploy:%s'
|
|
|
|
|
|
phased_subcloud_deploy_rules = [
|
|
policy.DocumentedRuleDefault(
|
|
name=POLICY_ROOT % 'create',
|
|
check_str='rule:' + base.ADMIN_IN_SYSTEM_PROJECTS,
|
|
description="Create a subcloud",
|
|
operations=[
|
|
{
|
|
'method': 'POST',
|
|
'path': '/v1.0/phased-subcloud-deploy'
|
|
}
|
|
]
|
|
),
|
|
policy.DocumentedRuleDefault(
|
|
name=POLICY_ROOT % 'modify',
|
|
check_str='rule:' + base.ADMIN_IN_SYSTEM_PROJECTS,
|
|
description="Modify the subcloud deployment.",
|
|
operations=[
|
|
{
|
|
'method': 'PATCH',
|
|
'path': '/v1.0/phased-subcloud-deploy/{subcloud}/abort'
|
|
},
|
|
{
|
|
'method': 'PATCH',
|
|
'path': '/v1.0/phased-subcloud-deploy/{subcloud}/install'
|
|
},
|
|
{
|
|
'method': 'PATCH',
|
|
'path': '/v1.0/phased-subcloud-deploy/{subcloud}/bootstrap'
|
|
},
|
|
{
|
|
'method': 'PATCH',
|
|
'path': '/v1.0/phased-subcloud-deploy/{subcloud}/configure'
|
|
}
|
|
]
|
|
)
|
|
]
|
|
|
|
|
|
def list_rules():
|
|
return phased_subcloud_deploy_rules
|