diff --git a/api-ref/source/api-ref-dcmanager-v1.rst b/api-ref/source/api-ref-dcmanager-v1.rst index 80c940140..e7b77632c 100644 --- a/api-ref/source/api-ref-dcmanager-v1.rst +++ b/api-ref/source/api-ref-dcmanager-v1.rst @@ -611,73 +611,6 @@ Response Example .. literalinclude:: samples/subclouds/subcloud-patch-update_status-response.json :language: json -***************************************** -Migrate a specific subcloud -***************************************** - -.. rest_method:: PATCH /v1.0/subclouds/{subcloud}/migrate - - -**Normal response codes** - -200 - -**Error response codes** - -badRequest (400), unauthorized (401), forbidden (403), badMethod (405), -HTTPUnprocessableEntity (422), internalServerError (500), -serviceUnavailable (503) - -**Request parameters** - -.. rest_parameters:: parameters.yaml - - - subcloud: subcloud_uri - - sysadmin_password: sysadmin_password - -Request Example ----------------- - -.. literalinclude:: samples/subclouds/subcloud-patch-migrate-request.json - :language: json - -**Response parameters** - -.. rest_parameters:: parameters.yaml - - - id: subcloud_id - - group_id: group_id - - name: subcloud_name - - description: subcloud_description - - location: subcloud_location - - software-version: software_version - - availability-status: availability_status - - error-description: error_description - - deploy-status: deploy_status - - backup-status: backup_status - - backup-datetime: backup_datetime - - openstack-installed: openstack_installed - - management-state: management_state - - systemcontroller-gateway-ip: systemcontroller_gateway_ip - - management-start-ip: management_start_ip - - management-end-ip: management_end_ip - - management-subnet: management_subnet - - management-gateway-ip: management_gateway_ip - - rehome_data: rehome_data - - created-at: created_at - - updated-at: updated_at - - data_install: data_install - - data_upgrade: data_upgrade - - endpoint_sync_status: endpoint_sync_status - - sync_status: sync_status - - endpoint_type: sync_status_type - -Response Example ----------------- - -.. literalinclude:: samples/subclouds/subcloud-patch-migrate-response.json - :language: json - ***************************** Deletes a specific subcloud ***************************** diff --git a/api-ref/source/samples/subclouds/subcloud-patch-migrate-request.json b/api-ref/source/samples/subclouds/subcloud-patch-migrate-request.json deleted file mode 100644 index fdca254fe..000000000 --- a/api-ref/source/samples/subclouds/subcloud-patch-migrate-request.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "sysadmin_password": "XXXXXXX" -} \ No newline at end of file diff --git a/api-ref/source/samples/subclouds/subcloud-patch-migrate-response.json b/api-ref/source/samples/subclouds/subcloud-patch-migrate-response.json deleted file mode 100644 index 7e45544e6..000000000 --- a/api-ref/source/samples/subclouds/subcloud-patch-migrate-response.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "id": 20, - "name": "testsub", - "description": "des", - "location": "CA", - "software-version": "23.09", - "management-state": "unmanaged", - "availability-status": "offline", - "deploy-status": "secondary", - "backup-status": null, - "backup-datetime": null, - "error-description": "No errors present", - "management-subnet": "192.168.97.0/24", - "management-start-ip": "192.168.97.2", - "management-end-ip": "192.168.97.200", - "management-gateway-ip": "192.168.97.1", - "openstack-installed": false, - "systemcontroller-gateway-ip": "192.168.10.1", - "data_install": null, - "data_upgrade": null, - "created-at": "2023-08-01 05:44:07.722249", - "updated-at": "2023-08-01 05:47:32.950772", - "group_id": 1, - "peer_group_id": "123", - "rehome_data": "{\"saved_payload\": {\"system_mode\": \"simplex\", \"name\": \"testsub\", \"description\": \"dddd\", \"location\": \"PEK SE Lab\", \"external_oam_subnet\": \"128.224.119.0/24\", \"external_oam_gateway_address\": \"128.224.119.1\", \"external_oam_floating_address\": \"128.224.119.55\", \"management_subnet\": \"192.168.97.0/24\", \"management_start_address\": \"192.168.97.2\", \"management_end_address\": \"192.168.97.200\", \"management_gateway_address\": \"192.168.97.1\", \"systemcontroller_gateway_address\": \"192.168.10.1\", \"docker_http_proxy\": \"http://147.11.252.42:9090\", \"docker_https_proxy\": \"http://147.11.252.42:9090\", \"docker_no_proxy\": [], \"bootstrap-address\": \"128.224.119.56\", \"software_version\": \"23.09\"}}" -} \ No newline at end of file diff --git a/distributedcloud/dcmanager/api/controllers/v1/subclouds.py b/distributedcloud/dcmanager/api/controllers/v1/subclouds.py index adbf31819..7192e3bc2 100644 --- a/distributedcloud/dcmanager/api/controllers/v1/subclouds.py +++ b/distributedcloud/dcmanager/api/controllers/v1/subclouds.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"); you may @@ -288,38 +288,6 @@ class SubcloudsController(object): else dccommon_consts.DEPLOY_CONFIG_UP_TO_DATE return sync_status - def _validate_migrate(self, payload, subcloud): - # Verify rehome data - if not subcloud.rehome_data: - LOG.exception("Unable to migrate subcloud %s, " - "required rehoming data is missing" % subcloud.name) - pecan.abort(500, _("Unable to migrate subcloud %s, " - "required rehoming data is missing" % subcloud.name)) - rehome_data = json.loads(subcloud.rehome_data) - if 'saved_payload' not in rehome_data: - LOG.exception("Unable to migrate subcloud %s, " - "saved_payload is missing in rehoming data" % subcloud.name) - pecan.abort(500, _("Unable to migrate subcloud %s, " - "saved_payload is missing in rehoming data" % subcloud.name)) - saved_payload = rehome_data['saved_payload'] - # Validate saved_payload - if len(saved_payload) == 0: - LOG.exception("Unable to migrate subcloud %s, " - "saved_payload is empty" % subcloud.name) - pecan.abort(500, _("Unable to migrate subcloud %s, " - "saved_payload is empty" % subcloud.name)) - if 'bootstrap-address' not in saved_payload: - LOG.exception("Unable to migrate subcloud %s, " - "bootstrap-address is missing in rehoming data" % subcloud.name) - pecan.abort(500, _("Unable to migrate subcloud %s, " - "bootstrap-address is missing in rehoming data" % subcloud.name)) - # Validate sysadmin_password is in payload - if 'sysadmin_password' not in payload: - LOG.exception("Unable to migrate subcloud %s, " - "need sysadmin_password" % subcloud.name) - pecan.abort(500, _("Unable to migrate subcloud %s, " - "need sysadmin_password" % subcloud.name)) - def _validate_rehome_pending(self, subcloud, management_state): unmanaged = dccommon_consts.MANAGEMENT_UNMANAGED error_msg = None @@ -909,29 +877,6 @@ class SubcloudsController(object): except Exception: LOG.exception("Unable to prestage subcloud %s" % subcloud.name) pecan.abort(500, _('Unable to prestage subcloud')) - elif verb == 'migrate': - try: - # Reject if not in secondary/rehome-failed/rehome-prep-failed state - if subcloud.deploy_status not in [consts.DEPLOY_STATE_SECONDARY, - consts.DEPLOY_STATE_REHOME_FAILED, - consts.DEPLOY_STATE_REHOME_PREP_FAILED]: - LOG.exception("Unable to migrate subcloud %s, " - "must be in secondary or rehome failure state" % subcloud.name) - pecan.abort(400, _("Unable to migrate subcloud %s, " - "must be in secondary or rehome failure state" % - subcloud.name)) - payload = json.loads(request.body) - self._validate_migrate(payload, subcloud) - - # Call migrate - self.dcmanager_rpc_client.migrate_subcloud(context, subcloud.id, payload) - return db_api.subcloud_db_model_to_dict(subcloud) - except RemoteError as e: - pecan.abort(422, e.value) - except Exception: - LOG.exception( - "Unable to migrate subcloud %s" % subcloud.name) - pecan.abort(500, _('Unable to migrate subcloud')) @utils.synchronized(LOCK_NAME) @index.when(method='delete', template='json') diff --git a/distributedcloud/dcmanager/api/policies/subclouds.py b/distributedcloud/dcmanager/api/policies/subclouds.py index 907e64d44..e8e7b68e8 100644 --- a/distributedcloud/dcmanager/api/policies/subclouds.py +++ b/distributedcloud/dcmanager/api/policies/subclouds.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2022 Wind River Systems, Inc. +# Copyright (c) 2022-2024 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -84,10 +84,6 @@ subclouds_rules = [ { 'method': 'PATCH', 'path': '/v1.0/subclouds/{subcloud}/update_status' - }, - { - 'method': 'PATCH', - 'path': '/v1.0/subclouds/{subcloud}/migrate' } ] ) diff --git a/distributedcloud/dcmanager/manager/peer_group_audit_manager.py b/distributedcloud/dcmanager/manager/peer_group_audit_manager.py index f370a5270..3db16dc7a 100644 --- a/distributedcloud/dcmanager/manager/peer_group_audit_manager.py +++ b/distributedcloud/dcmanager/manager/peer_group_audit_manager.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Wind River Systems, Inc. +# Copyright (c) 2023-2024 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -156,12 +156,11 @@ class PeerGroupAuditManager(manager.Manager): raise e self.require_audit_flag = False - # if remote subcloud peer group's migration_status is 'complete' - # or self.require_audit_flag is True, get remote subclouds. - # For 'managed+online' subclouds, set 'unmanaged+secondary' to - # local on same subclouds + # if remote subcloud peer group's migration_status is 'complete', + # get remote subclouds. For 'managed+online' subclouds, + # set 'unmanaged+secondary' to local on same subclouds elif remote_peer_group.get("migration_status") == \ - consts.PEER_GROUP_MIGRATION_COMPLETE or self.require_audit_flag: + consts.PEER_GROUP_MIGRATION_COMPLETE: remote_subclouds = \ self._get_subclouds_by_peer_group_from_system_peer( system_peer, diff --git a/distributedcloud/dcmanager/manager/service.py b/distributedcloud/dcmanager/manager/service.py index ae58c19b5..fec561762 100644 --- a/distributedcloud/dcmanager/manager/service.py +++ b/distributedcloud/dcmanager/manager/service.py @@ -1,4 +1,4 @@ -# 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. You may obtain # a copy of the License at @@ -295,12 +295,6 @@ class DCManagerService(service.Service): subcloud_id, deploy_status) - @request_context - def migrate_subcloud(self, context, subcloud_ref, payload): - LOG.info("Handling migrate_subcloud request for: %s", - subcloud_ref) - return self.subcloud_manager.migrate_subcloud(context, subcloud_ref, payload) - @run_in_thread @request_context def subcloud_deploy_resume(self, context, subcloud_id, subcloud_name, diff --git a/distributedcloud/dcmanager/rpc/client.py b/distributedcloud/dcmanager/rpc/client.py index 5491c3b9d..9cb188445 100644 --- a/distributedcloud/dcmanager/rpc/client.py +++ b/distributedcloud/dcmanager/rpc/client.py @@ -1,4 +1,4 @@ -# 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. You may obtain # a copy of the License at @@ -248,11 +248,6 @@ class ManagerClient(RPCClient): payload=payload, deploy_states_to_run=deploy_states_to_run)) - def migrate_subcloud(self, ctxt, subcloud_ref, payload): - return self.cast(ctxt, self.make_msg('migrate_subcloud', - subcloud_ref=subcloud_ref, - payload=payload)) - def get_subcloud_name_by_region_name(self, ctxt, subcloud_region): return self.call(ctxt, self.make_msg('get_subcloud_name_by_region_name', subcloud_region=subcloud_region))