Add missing updated_at
field in share-instance show.
Share_replicas (which are internally share_instances with replica_state not null) have "updated_at" in its view/API call. However same field is missing in share-instance show command. Closes-Bug: #1965122 Change-Id: Ia69f3615d82e0044e3e9f81556dc8355637ef146
This commit is contained in:
parent
cbf142912d
commit
aa9f03d542
@ -7,6 +7,7 @@
|
||||
"availability_zone": "nova",
|
||||
"replica_state": null,
|
||||
"created_at": "2015-09-07T08:41:20.000000",
|
||||
"updated_at": "2015-09-07T08:43:10.000000",
|
||||
"share_network_id": "713df749-aac0-4a54-af52-10f6c991e80c",
|
||||
"cast_rules_to_readonly": false,
|
||||
"share_server_id": "ba11930a-bf1a-4aa7-bae4-a8dfbaa3cc73",
|
||||
@ -22,6 +23,7 @@
|
||||
"availability_zone": "nova",
|
||||
"replica_state": null,
|
||||
"created_at": "2015-09-07T08:51:34.000000",
|
||||
"updated_at": "2015-09-10T02:01:22.000000",
|
||||
"share_network_id": "713df749-aac0-4a54-af52-10f6c991e80c",
|
||||
"cast_rules_to_readonly": false,
|
||||
"share_server_id": "ba11930a-bf1a-4aa7-bae4-a8dfbaa3cc73",
|
||||
@ -37,6 +39,7 @@
|
||||
"availability_zone": "nova",
|
||||
"replica_state": null,
|
||||
"created_at": "2015-09-07T09:01:15.000000",
|
||||
"updated_at": "2015-09-07T09:02:30.000000",
|
||||
"share_network_id": "713df749-aac0-4a54-af52-10f6c991e80c",
|
||||
"cast_rules_to_readonly": false,
|
||||
"share_server_id": "ba11930a-bf1a-4aa7-bae4-a8dfbaa3cc73",
|
||||
|
@ -6,6 +6,7 @@
|
||||
"availability_zone": "nova",
|
||||
"replica_state": null,
|
||||
"created_at": "2015-09-07T08:51:34.000000",
|
||||
"updated_at": "2015-09-07T08:52:20.000000",
|
||||
"cast_rules_to_readonly": false,
|
||||
"share_network_id": "713df749-aac0-4a54-af52-10f6c991e80c",
|
||||
"share_server_id": "ba11930a-bf1a-4aa7-bae4-a8dfbaa3cc73",
|
||||
|
@ -56,6 +56,7 @@ Response parameters
|
||||
- progress: progress_share_instance
|
||||
- availability_zone: availability_zone
|
||||
- created_at: created_at
|
||||
- updated_at: updated_at
|
||||
- replica_state: replica_state
|
||||
- export_location: export_location
|
||||
- export_locations: export_locations
|
||||
@ -116,6 +117,7 @@ Response parameters
|
||||
- progress: progress_share_instance
|
||||
- availability_zone: availability_zone
|
||||
- created_at: created_at
|
||||
- updated_at: updated_at
|
||||
- replica_state: replica_state
|
||||
- export_location: export_location
|
||||
- export_locations: export_locations
|
||||
|
@ -185,6 +185,7 @@ REST_API_VERSION_HISTORY = """
|
||||
* 2.70 - Added support for multiple share network subnets in the same
|
||||
availability zone. Also, users can add subnets for an in-use share
|
||||
network.
|
||||
* 2.71 - Added 'updated_at' field in share instance show API output.
|
||||
|
||||
"""
|
||||
|
||||
@ -192,7 +193,7 @@ REST_API_VERSION_HISTORY = """
|
||||
# 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.70"
|
||||
_MAX_API_VERSION = "2.71"
|
||||
DEFAULT_API_VERSION = _MIN_API_VERSION
|
||||
|
||||
|
||||
|
@ -392,3 +392,7 @@ ____
|
||||
for an in-use share network. To distinguish this update support a new
|
||||
property called 'network_allocation_update_support' was added in the share
|
||||
network and share server.
|
||||
|
||||
2.71
|
||||
----
|
||||
Added 'updated_at' field in share instance show API output.
|
||||
|
@ -28,6 +28,7 @@ class ViewBuilder(common.ViewBuilder):
|
||||
"add_cast_rules_to_readonly_field",
|
||||
"add_progress_field",
|
||||
"translate_creating_from_snapshot_status",
|
||||
"add_updated_at_field",
|
||||
]
|
||||
|
||||
def detail_list(self, request, instances):
|
||||
@ -106,3 +107,7 @@ class ViewBuilder(common.ViewBuilder):
|
||||
@common.ViewBuilder.versioned_method("2.54")
|
||||
def add_progress_field(self, context, instance_dict, share_instance):
|
||||
instance_dict['progress'] = share_instance.get('progress')
|
||||
|
||||
@common.ViewBuilder.versioned_method("2.71")
|
||||
def add_updated_at_field(self, context, instance_dict, share_instance):
|
||||
instance_dict['updated_at'] = share_instance.get('updated_at')
|
||||
|
@ -133,7 +133,7 @@ class ShareInstancesAPITest(test.TestCase):
|
||||
self.mock_policy_check.assert_called_once_with(
|
||||
req_context, self.resource_name, 'index')
|
||||
|
||||
@ddt.data('2.3', '2.54')
|
||||
@ddt.data('2.3', '2.54', '2.71')
|
||||
def test_show(self, version):
|
||||
test_instance = db_utils.create_share(size=1).instance
|
||||
id = test_instance['id']
|
||||
@ -147,6 +147,12 @@ class ShareInstancesAPITest(test.TestCase):
|
||||
self.assertIn("progress", actual_result['share_instance'])
|
||||
else:
|
||||
self.assertNotIn("progress", actual_result['share_instance'])
|
||||
if (api_version_request.APIVersionRequest(version) >=
|
||||
api_version_request.APIVersionRequest("2.71")):
|
||||
self.assertIn("updated_at", actual_result['share_instance'])
|
||||
else:
|
||||
self.assertNotIn("updated_at", actual_result['share_instance'])
|
||||
|
||||
self.mock_policy_check.assert_called_once_with(
|
||||
self.admin_context, self.resource_name, 'show')
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
In order to let user know when was the last time share instance updated, a
|
||||
field ``updated_at`` is added in the response of share instance show API.
|
Loading…
x
Reference in New Issue
Block a user