From aa62a8090ec3aa988bad89e2eb7535059fe8131f Mon Sep 17 00:00:00 2001 From: Maurice Escher Date: Tue, 22 Sep 2020 09:42:49 +0200 Subject: [PATCH] add additional driver data to migration get progress view new field `details` is introduced with microversion 2.59 Change-Id: I91d455c585ff546cc65e57e8560f126a280eac8d Closes-Bug: #1902854 --- api-ref/source/parameters.yaml | 7 +++++++ api-ref/source/share-migration.inc | 1 + manila/api/openstack/api_version_request.py | 3 ++- manila/api/openstack/rest_api_version_history.rst | 5 +++++ manila/api/views/share_migration.py | 10 ++++++++-- manila/tests/api/v2/test_shares.py | 2 +- ...ils-to-migration-get-progress-df8b3f2c524db1bd.yaml | 5 +++++ 7 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/add-details-to-migration-get-progress-df8b3f2c524db1bd.yaml diff --git a/api-ref/source/parameters.yaml b/api-ref/source/parameters.yaml index 653cbcd7f1..2387d58520 100644 --- a/api-ref/source/parameters.yaml +++ b/api-ref/source/parameters.yaml @@ -1473,6 +1473,13 @@ migration_complete: in: body required: true type: object +migration_progress_details: + description: | + Additional driver specific details of the migration progress. + in: body + required: true + type: object + min_version: 2.59 mount_snapshot_support: description: | Boolean extra spec used for filtering of back ends diff --git a/api-ref/source/share-migration.inc b/api-ref/source/share-migration.inc index 6c3e2efdde..36ab5dfe52 100644 --- a/api-ref/source/share-migration.inc +++ b/api-ref/source/share-migration.inc @@ -189,6 +189,7 @@ Response parameters .. rest_parameters:: parameters.yaml + - details: migration_progress_details - total_progress: total_progress - task_state: task_state diff --git a/manila/api/openstack/api_version_request.py b/manila/api/openstack/api_version_request.py index d7a9cf41eb..55b1930829 100644 --- a/manila/api/openstack/api_version_request.py +++ b/manila/api/openstack/api_version_request.py @@ -158,13 +158,14 @@ REST_API_VERSION_HISTORY = """ 'share_server_reset_task_state' * 2.58 - Added 'share_groups' and 'share_group_snapshots' to the limits view. + * 2.59 - Add driver ``details`` field to migration get progress. """ # The minimum and maximum versions of the API supported # The default api version request is defined to be the # minimum version of the API supported. _MIN_API_VERSION = "2.0" -_MAX_API_VERSION = "2.58" +_MAX_API_VERSION = "2.59" DEFAULT_API_VERSION = _MIN_API_VERSION diff --git a/manila/api/openstack/rest_api_version_history.rst b/manila/api/openstack/rest_api_version_history.rst index 04d22f6e91..bb65f059ca 100644 --- a/manila/api/openstack/rest_api_version_history.rst +++ b/manila/api/openstack/rest_api_version_history.rst @@ -318,3 +318,8 @@ user documentation. 2.58 ---- Added 'share_groups' and 'share_group_snapshots' to the limits view. + +2.59 +---- + Added 'details' field to migration get progress api, which optionally may hold + additional driver data related to the progress of share migration. diff --git a/manila/api/views/share_migration.py b/manila/api/views/share_migration.py index 819762f7c3..f21a1cb950 100644 --- a/manila/api/views/share_migration.py +++ b/manila/api/views/share_migration.py @@ -20,13 +20,19 @@ class ViewBuilder(common.ViewBuilder): """Model share migration view data response as a python dictionary.""" _collection_name = 'share_migration' - _detail_version_modifiers = [] + _detail_version_modifiers = [ + 'add_progress_details', + ] def get_progress(self, request, share, progress): """View of share migration job progress.""" result = { - 'total_progress': progress['total_progress'], + 'total_progress': progress.pop('total_progress'), 'task_state': share['task_state'], } self.update_versioned_resource_dict(request, result, progress) return result + + @common.ViewBuilder.versioned_method('2.59') + def add_progress_details(self, context, progress_dict, progress): + progress_dict['details'] = progress diff --git a/manila/tests/api/v2/test_shares.py b/manila/tests/api/v2/test_shares.py index 67608180be..0d66d290a7 100644 --- a/manila/tests/api/v2/test_shares.py +++ b/manila/tests/api/v2/test_shares.py @@ -1160,7 +1160,7 @@ class ShareAPITest(test.TestCase): mock.Mock(return_value=share)) self.mock_object(share_api.API, 'migration_get_progress', - mock.Mock(return_value=expected)) + mock.Mock(return_value=copy.deepcopy(expected))) response = self.controller.migration_get_progress(req, share['id'], body) diff --git a/releasenotes/notes/add-details-to-migration-get-progress-df8b3f2c524db1bd.yaml b/releasenotes/notes/add-details-to-migration-get-progress-df8b3f2c524db1bd.yaml new file mode 100644 index 0000000000..e232dbc3dd --- /dev/null +++ b/releasenotes/notes/add-details-to-migration-get-progress-df8b3f2c524db1bd.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Microversion 2.59 adds optional driver `details` to the response of + migration get progress.