diff --git a/distributedcloud-client/dcmanagerclient/api/v1/subcloud_manager.py b/distributedcloud-client/dcmanagerclient/api/v1/subcloud_manager.py index 2067cf1..403ac37 100644 --- a/distributedcloud-client/dcmanagerclient/api/v1/subcloud_manager.py +++ b/distributedcloud-client/dcmanagerclient/api/v1/subcloud_manager.py @@ -1,5 +1,5 @@ # Copyright (c) 2017 Ericsson AB. -# Copyright (c) 2017-2023 Wind River Systems, Inc. +# Copyright (c) 2017-2024 Wind River Systems, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -75,16 +75,6 @@ class subcloud_manager(base.ResourceManager): resource.append(self.json_to_resource(json_object)) return resource - def subcloud_migrate(self, url, data): - data = json.dumps(data) - resp = self.http_client.patch(url, data) - if resp.status_code != 200: - self._raise_api_exception(resp) - json_object = get_json(resp) - subcloud = self.resource_class.from_payload(self, json_object) - resource = [subcloud] - return resource - def _subcloud_prestage(self, url, data): data = json.dumps(data) resp = self.http_client.patch(url, data) @@ -160,8 +150,3 @@ class subcloud_manager(base.ResourceManager): data = kwargs.get('data') url = '/subclouds/%s/redeploy' % subcloud_ref return self.subcloud_redeploy(url, files, data) - - def migrate_subcloud(self, subcloud_ref, **kwargs): - data = kwargs.get('data') - url = '/subclouds/%s/migrate' % subcloud_ref - return self.subcloud_migrate(url, data) diff --git a/distributedcloud-client/dcmanagerclient/commands/v1/subcloud_manager.py b/distributedcloud-client/dcmanagerclient/commands/v1/subcloud_manager.py index fa1111d..11b19a1 100644 --- a/distributedcloud-client/dcmanagerclient/commands/v1/subcloud_manager.py +++ b/distributedcloud-client/dcmanagerclient/commands/v1/subcloud_manager.py @@ -1,5 +1,5 @@ # Copyright (c) 2017 Ericsson AB. -# Copyright (c) 2017-2023 Wind River Systems, Inc. +# Copyright (c) 2017-2024 Wind River Systems, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -958,48 +958,3 @@ class PrestageSubcloud(base.DCManagerShowOne): print(e) error_msg = "Unable to prestage subcloud %s" % (subcloud_ref) raise exceptions.DCManagerClientException(error_msg) - - -class MigrateSubcloud(base.DCManagerShowOne): - """Migrate a secondary status subcloud.""" - def _get_format_function(self): - return detail_format - - def get_parser(self, prog_name): - parser = super(MigrateSubcloud, self).get_parser(prog_name) - - parser.add_argument( - 'subcloud', - help='Name or ID of the subcloud to migrate.' - ) - - parser.add_argument( - '--sysadmin-password', - required=False, - help='sysadmin password of the subcloud to be configured, ' - 'if not provided you will be prompted.' - ) - return parser - - def _get_resources(self, parsed_args): - subcloud_ref = parsed_args.subcloud - dcmanager_client = self.app.client_manager.subcloud_manager - data = dict() - if parsed_args.sysadmin_password is not None: - data['sysadmin_password'] = base64.b64encode( - parsed_args.sysadmin_password.encode("utf-8")).decode("utf-8") - else: - password = utils.prompt_for_password() - data["sysadmin_password"] = base64.b64encode( - password.encode("utf-8")).decode("utf-8") - - try: - result = dcmanager_client.subcloud_manager.migrate_subcloud( - subcloud_ref=subcloud_ref, data=data) - update_fields_values(result) - return result - - except Exception as e: - print(e) - error_msg = "Unable to migrate subcloud %s" % (subcloud_ref) - raise exceptions.DCManagerClientException(error_msg) diff --git a/distributedcloud-client/dcmanagerclient/shell.py b/distributedcloud-client/dcmanagerclient/shell.py index c809d8a..d852365 100644 --- a/distributedcloud-client/dcmanagerclient/shell.py +++ b/distributedcloud-client/dcmanagerclient/shell.py @@ -1,5 +1,5 @@ # Copyright 2015 - Ericsson AB. -# Copyright (c) 2017-2023 Wind River Systems, Inc. +# Copyright (c) 2017-2024 Wind River Systems, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -542,7 +542,6 @@ class DCManagerShell(app.App): 'subcloud redeploy': sm.RedeploySubcloud, 'subcloud restore': sm.RestoreSubcloud, 'subcloud prestage': sm.PrestageSubcloud, - 'subcloud migrate': sm.MigrateSubcloud, 'subcloud-backup create': sbm.CreateSubcloudBackup, 'subcloud-backup delete': sbm.DeleteSubcloudBackup, 'subcloud-backup restore': sbm.RestoreSubcloudBackup, diff --git a/distributedcloud-client/dcmanagerclient/tests/v1/test_subcloud_manager.py b/distributedcloud-client/dcmanagerclient/tests/v1/test_subcloud_manager.py index b09a31a..7703112 100644 --- a/distributedcloud-client/dcmanagerclient/tests/v1/test_subcloud_manager.py +++ b/distributedcloud-client/dcmanagerclient/tests/v1/test_subcloud_manager.py @@ -1,5 +1,5 @@ # Copyright (c) 2017 Ericsson AB. -# Copyright (c) 2017-2023 Wind River Systems, Inc. +# Copyright (c) 2017-2024 Wind River Systems, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -387,16 +387,3 @@ class TestCLISubcloudManagerV1(base.BaseCommandTest): base.SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID + (base.SOFTWARE_VERSION,), actual_call_with_release[1]) - - def test_migrate_subcloud(self): - self.client.subcloud_manager.migrate_subcloud. \ - return_value = [base.SUBCLOUD_RESOURCE] - actual_call_without_release = self.call( - subcloud_cmd.MigrateSubcloud, - app_args=[base.ID, - '--sysadmin-password', 'testpassword']) - self.assertEqual( - base.SUBCLOUD_FIELD_RESULT_LIST_WITH_PEERID, - actual_call_without_release[1]) - self.assertRaises(SystemExit, self.call, - subcloud_cmd.MigrateSubcloud, app_args=[])