add additional driver data to migration get progress view

new field `details` is introduced with microversion 2.59

Change-Id: I91d455c585ff546cc65e57e8560f126a280eac8d
Closes-Bug: #1902854
This commit is contained in:
Maurice Escher 2020-09-22 09:42:49 +02:00
parent dcdc1a98bb
commit aa62a8090e
No known key found for this signature in database
GPG Key ID: CC56DEC23EE46750
7 changed files with 29 additions and 4 deletions

View File

@ -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

View File

@ -189,6 +189,7 @@ Response parameters
.. rest_parameters:: parameters.yaml
- details: migration_progress_details
- total_progress: total_progress
- task_state: task_state

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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)

View File

@ -0,0 +1,5 @@
---
features:
- |
Microversion 2.59 adds optional driver `details` to the response of
migration get progress.