Show cluster_name in volume details

cluster_name attribute is useful for admin users in Active/Active
deployments.

Change-Id: Ifab99457b8d49207e8fc7869bd82d3cdfec7a911
Closes-Bug: #1874414i
This commit is contained in:
Ivan Kolodyazhny 2020-07-24 23:24:34 +03:00
parent c31fb0ba2d
commit c5e15b3869
9 changed files with 31 additions and 4 deletions

View File

@ -782,6 +782,13 @@ cluster_mutex:
in: body
required: false
type: string
cluster_name:
description: |
The cluster name of volume backend.
in: body
required: false
type: string
min_version: 3.61
connection_info:
description: |
The connection info used for server to connect the volume.

View File

@ -22,7 +22,7 @@
"min_version": "3.0",
"status": "CURRENT",
"updated": "2018-07-17T00:00:00Z",
"version": "3.60"
"version": "3.61"
}
]
}

View File

@ -46,7 +46,7 @@
"min_version": "3.0",
"status": "CURRENT",
"updated": "2018-07-17T00:00:00Z",
"version": "3.60"
"version": "3.61"
}
]
}
}

View File

@ -377,6 +377,7 @@ Response Parameters
- volume_type: volume_type_vol
- service_uuid: service_uuid
- shared_targets: shared_targets
- cluster_name: cluster_name
Response Example

View File

@ -161,6 +161,8 @@ SUPPORT_TRANSFER_PAGINATION = '3.59'
VOLUME_TIME_COMPARISON_FILTER = '3.60'
VOLUME_CLUSTER_NAME = '3.61'
def get_mv_header(version):
"""Gets a formatted HTTP microversion header.

View File

@ -139,6 +139,8 @@ REST_API_VERSION_HISTORY = """
time comparison operators for the volume summary list
("GET /v3/{project_id}/volumes") and volume detail list
("GET /v3/{project_id}/volumes/detail") requests.
* 3.61 - Add ``cluster_name`` attribute to response body of volume details
for admin.
"""
# The minimum and maximum versions of the API supported
@ -146,7 +148,7 @@ REST_API_VERSION_HISTORY = """
# minimum version of the API supported.
# Explicitly using /v2 endpoints will still work
_MIN_API_VERSION = "3.0"
_MAX_API_VERSION = "3.60"
_MAX_API_VERSION = "3.61"
_LEGACY_API_VERSION2 = "2.0"
UPDATED = "2018-07-17T00:00:00Z"

View File

@ -468,3 +468,8 @@ Support volume transfer pagination.
Users may apply time comparison filters to the volume summary list and volume
detail list requests by using the ``created_at`` or ``updated_at`` fields.
Time must be expressed in ISO 8601 format.
3.61
----
Add ``cluster_name`` attribute to response body of volume details for admin in
Active/Active HA mode.

View File

@ -61,6 +61,11 @@ class ViewBuilder(views_v2.ViewBuilder):
volume_ref['volume']['service_uuid'] = volume.get(
'service_uuid', None)
if (request.environ['cinder.context'].is_admin and req_version.matches(
mv.VOLUME_CLUSTER_NAME, None)):
volume_ref['volume']['cluster_name'] = volume.get(
'cluster_name', None)
return volume_ref
def _list_view(self, func, request, volumes, volume_count,

View File

@ -0,0 +1,5 @@
---
features:
- |
Added new APIs on microversion 3.61 to show ``cluster_name`` attribute in
the response body of volume details for admin.