From 7036f1fd11cd3bbae743aee89908e8195e4ded40 Mon Sep 17 00:00:00 2001 From: Tee Ngo Date: Thu, 30 Jul 2020 19:02:20 -0400 Subject: [PATCH] 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 --- .../dcmanagerclient/commands/v1/subcloud_manager.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/distributedcloud-client/dcmanagerclient/commands/v1/subcloud_manager.py b/distributedcloud-client/dcmanagerclient/commands/v1/subcloud_manager.py index dc110fe..8d5ee2d 100644 --- a/distributedcloud-client/dcmanagerclient/commands/v1/subcloud_manager.py +++ b/distributedcloud-client/dcmanagerclient/commands/v1/subcloud_manager.py @@ -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)