Add --force option when managing a subcloud

When managing a subcloud, allow a --force option to be
specified. The force option will allow an offline subcloud
to be managed.

This is necessary in cases where the user has (mistakenly)
unmanaged a subcloud that is offline and the subcloud
cannot be recovered while it is unmanaged. One example is
a failure during DC upgrade orchestration that leaves the
subcloud offline. To rerun upgrade orchestration and
recover the subcloud, the subcloud must be managed.

Story: 2007403
Task: 40467
Change-Id: I0c0fa0f489208c322b463d0c3b889c26575d06f4
Signed-off-by: Tee Ngo <tee.ngo@windriver.com>
This commit is contained in:
Tee Ngo 2020-07-30 19:02:20 -04:00
parent b51808f02f
commit 7036f1fd11

View File

@ -361,6 +361,14 @@ class ManageSubcloud(base.DCManagerShowOne):
'subcloud',
help='Name or ID of the subcloud to manage.'
)
parser.add_argument(
'--force',
required=False,
action='store_true',
help='Disregard subcloud availability status, intended for \
some upgrade recovery scenarios.'
)
return parser
def _get_resources(self, parsed_args):
@ -368,6 +376,9 @@ class ManageSubcloud(base.DCManagerShowOne):
dcmanager_client = self.app.client_manager.subcloud_manager
kwargs = dict()
kwargs['management-state'] = 'managed'
if parsed_args.force:
kwargs['force'] = 'true'
try:
return dcmanager_client.subcloud_manager.update_subcloud(
subcloud_ref, files=None, data=kwargs)