diff --git a/api-ref/source/v3/parameters.yaml b/api-ref/source/v3/parameters.yaml index 52a8182c03c..528a3268fe8 100644 --- a/api-ref/source/v3/parameters.yaml +++ b/api-ref/source/v3/parameters.yaml @@ -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. diff --git a/api-ref/source/v3/samples/versions/version-show-response.json b/api-ref/source/v3/samples/versions/version-show-response.json index 4d5fbb1f49a..5dfc2d47a9e 100644 --- a/api-ref/source/v3/samples/versions/version-show-response.json +++ b/api-ref/source/v3/samples/versions/version-show-response.json @@ -22,7 +22,7 @@ "min_version": "3.0", "status": "CURRENT", "updated": "2018-07-17T00:00:00Z", - "version": "3.60" + "version": "3.61" } ] } diff --git a/api-ref/source/v3/samples/versions/versions-response.json b/api-ref/source/v3/samples/versions/versions-response.json index 8145f5e58b3..ee73b288139 100644 --- a/api-ref/source/v3/samples/versions/versions-response.json +++ b/api-ref/source/v3/samples/versions/versions-response.json @@ -46,7 +46,7 @@ "min_version": "3.0", "status": "CURRENT", "updated": "2018-07-17T00:00:00Z", - "version": "3.60" + "version": "3.61" } ] -} \ No newline at end of file +} diff --git a/api-ref/source/v3/volumes-v3-volumes.inc b/api-ref/source/v3/volumes-v3-volumes.inc index 77c20129696..76f4b4a0efd 100644 --- a/api-ref/source/v3/volumes-v3-volumes.inc +++ b/api-ref/source/v3/volumes-v3-volumes.inc @@ -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 diff --git a/cinder/api/microversions.py b/cinder/api/microversions.py index 76936bd2aea..8134e0ae03d 100644 --- a/cinder/api/microversions.py +++ b/cinder/api/microversions.py @@ -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. diff --git a/cinder/api/openstack/api_version_request.py b/cinder/api/openstack/api_version_request.py index 3e42e4151c5..c50affb4b96 100644 --- a/cinder/api/openstack/api_version_request.py +++ b/cinder/api/openstack/api_version_request.py @@ -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" diff --git a/cinder/api/openstack/rest_api_version_history.rst b/cinder/api/openstack/rest_api_version_history.rst index 87e83b12455..6db8e6fc9cd 100644 --- a/cinder/api/openstack/rest_api_version_history.rst +++ b/cinder/api/openstack/rest_api_version_history.rst @@ -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. diff --git a/cinder/api/v3/views/volumes.py b/cinder/api/v3/views/volumes.py index e2bd03997e5..e72588dd0a2 100644 --- a/cinder/api/v3/views/volumes.py +++ b/cinder/api/v3/views/volumes.py @@ -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, diff --git a/releasenotes/notes/add-cluster-name-to-volume-details-ce01dd828faafcde.yaml b/releasenotes/notes/add-cluster-name-to-volume-details-ce01dd828faafcde.yaml new file mode 100644 index 00000000000..bd1b17636d5 --- /dev/null +++ b/releasenotes/notes/add-cluster-name-to-volume-details-ce01dd828faafcde.yaml @@ -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.