Merge "Show user_id when cinder snapshot-show"
This commit is contained in:
commit
9ce5bae121
@ -2093,6 +2093,13 @@ user_id:
|
|||||||
in: body
|
in: body
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
user_id_2:
|
||||||
|
description: |
|
||||||
|
The UUID of the user.
|
||||||
|
in: body
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
min_version: 3.41
|
||||||
user_message:
|
user_message:
|
||||||
description: |
|
description: |
|
||||||
The translated readable message corresponding to ``event_id``.
|
The translated readable message corresponding to ``event_id``.
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"volume_id": "5aa119a8-d25b-45a7-8d1b-88e127885635",
|
"volume_id": "5aa119a8-d25b-45a7-8d1b-88e127885635",
|
||||||
"size": 1,
|
"size": 1,
|
||||||
|
"user_id": "40c2102f4a554b848d96b14f3eec39ed",
|
||||||
"id": "ffa9bc5e-1172-4021-acaf-cdcd78a9584d",
|
"id": "ffa9bc5e-1172-4021-acaf-cdcd78a9584d",
|
||||||
"name": "snap-001"
|
"name": "snap-001"
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
"description": "Daily backup",
|
"description": "Daily backup",
|
||||||
"created_at": "2013-02-25T04:13:17.000000",
|
"created_at": "2013-02-25T04:13:17.000000",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
|
"user_id": "40c2102f4a554b848d96b14f3eec39ed",
|
||||||
"volume_id": "5aa119a8-d25b-45a7-8d1b-88e127885635",
|
"volume_id": "5aa119a8-d25b-45a7-8d1b-88e127885635",
|
||||||
"os-extended-snapshot-attributes:project_id": "0c2eba2c5af04d3f9e9d0d410b371fde",
|
"os-extended-snapshot-attributes:project_id": "0c2eba2c5af04d3f9e9d0d410b371fde",
|
||||||
"size": 1,
|
"size": 1,
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
"id": "4b502fcb-1f26-45f8-9fe5-3b9a0a52eaf2",
|
"id": "4b502fcb-1f26-45f8-9fe5-3b9a0a52eaf2",
|
||||||
"size": 1,
|
"size": 1,
|
||||||
"status": "available",
|
"status": "available",
|
||||||
|
"user_id": "40c2102f4a554b848d96b14f3eec39ed",
|
||||||
"volume_id": "2402b902-0b7a-458c-9c07-7435a826f794"
|
"volume_id": "2402b902-0b7a-458c-9c07-7435a826f794"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
},
|
},
|
||||||
"os-extended-snapshot-attributes:progress": "100%",
|
"os-extended-snapshot-attributes:progress": "100%",
|
||||||
"name": "test-volume-snapshot",
|
"name": "test-volume-snapshot",
|
||||||
|
"user_id": "40c2102f4a554b848d96b14f3eec39ed",
|
||||||
"volume_id": "173f7b48-c4c1-4e70-9acc-086b39073506",
|
"volume_id": "173f7b48-c4c1-4e70-9acc-086b39073506",
|
||||||
"os-extended-snapshot-attributes:project_id": "bab7d5c60cd041a0a36f7c4b6e1dd978",
|
"os-extended-snapshot-attributes:project_id": "bab7d5c60cd041a0a36f7c4b6e1dd978",
|
||||||
"created_at": "2015-11-29T02:25:51.000000",
|
"created_at": "2015-11-29T02:25:51.000000",
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
"name": "test"
|
"name": "test"
|
||||||
},
|
},
|
||||||
"name": "test-volume-snapshot",
|
"name": "test-volume-snapshot",
|
||||||
|
"user_id": "40c2102f4a554b848d96b14f3eec39ed",
|
||||||
"volume_id": "173f7b48-c4c1-4e70-9acc-086b39073506",
|
"volume_id": "173f7b48-c4c1-4e70-9acc-086b39073506",
|
||||||
"created_at": "2015-11-29T02:25:51.000000",
|
"created_at": "2015-11-29T02:25:51.000000",
|
||||||
"size": 1,
|
"size": 1,
|
||||||
|
@ -65,6 +65,7 @@ Response Parameters
|
|||||||
- description: description
|
- description: description
|
||||||
- created_at: created_at
|
- created_at: created_at
|
||||||
- name: name
|
- name: name
|
||||||
|
- user_id: user_id_2
|
||||||
- volume_id: volume_id
|
- volume_id: volume_id
|
||||||
- os-extended-snapshot-attributes:project_id: os-extended-snapshot-attributes:project_id
|
- os-extended-snapshot-attributes:project_id: os-extended-snapshot-attributes:project_id
|
||||||
- size: size
|
- size: size
|
||||||
@ -116,6 +117,7 @@ Response Parameters
|
|||||||
- created_at: created_at
|
- created_at: created_at
|
||||||
- name: name
|
- name: name
|
||||||
- snapshot: snapshot
|
- snapshot: snapshot
|
||||||
|
- user_id: user_id_2
|
||||||
- volume_id: volume_id
|
- volume_id: volume_id
|
||||||
- metadata: metadata
|
- metadata: metadata
|
||||||
- id: id
|
- id: id
|
||||||
@ -158,6 +160,7 @@ Response Parameters
|
|||||||
- description: description
|
- description: description
|
||||||
- created_at: created_at
|
- created_at: created_at
|
||||||
- name: name
|
- name: name
|
||||||
|
- user_id: user_id_2
|
||||||
- volume_id: volume_id
|
- volume_id: volume_id
|
||||||
- metadata: metadata
|
- metadata: metadata
|
||||||
- id: id
|
- id: id
|
||||||
@ -319,6 +322,7 @@ Response Parameters
|
|||||||
- created_at: created_at
|
- created_at: created_at
|
||||||
- name: name
|
- name: name
|
||||||
- snapshot: snapshot
|
- snapshot: snapshot
|
||||||
|
- user_id: user_id_2
|
||||||
- volume_id: volume_id
|
- volume_id: volume_id
|
||||||
- os-extended-snapshot-attributes:project_id: os-extended-snapshot-attributes:project_id
|
- os-extended-snapshot-attributes:project_id: os-extended-snapshot-attributes:project_id
|
||||||
- size: size
|
- size: size
|
||||||
@ -373,6 +377,7 @@ Response Parameters
|
|||||||
- created_at: created_at
|
- created_at: created_at
|
||||||
- name: name
|
- name: name
|
||||||
- snapshot: snapshot
|
- snapshot: snapshot
|
||||||
|
- user_id: user_id_2
|
||||||
- volume_id: volume_id
|
- volume_id: volume_id
|
||||||
- metadata: metadata
|
- metadata: metadata
|
||||||
- id: id
|
- id: id
|
||||||
|
@ -94,7 +94,7 @@ REST_API_VERSION_HISTORY = """
|
|||||||
* 3.38 - Add replication group API (Tiramisu).
|
* 3.38 - Add replication group API (Tiramisu).
|
||||||
* 3.39 - Add ``project_id`` admin filters support to limits.
|
* 3.39 - Add ``project_id`` admin filters support to limits.
|
||||||
* 3.40 - Add volume revert to its latest snapshot support.
|
* 3.40 - Add volume revert to its latest snapshot support.
|
||||||
|
* 3.41 - Add ``user_id`` field to snapshot list/detail and snapshot show.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# The minimum and maximum versions of the API supported
|
# The minimum and maximum versions of the API supported
|
||||||
@ -102,7 +102,7 @@ REST_API_VERSION_HISTORY = """
|
|||||||
# minimum version of the API supported.
|
# minimum version of the API supported.
|
||||||
# Explicitly using /v1 or /v2 endpoints will still work
|
# Explicitly using /v1 or /v2 endpoints will still work
|
||||||
_MIN_API_VERSION = "3.0"
|
_MIN_API_VERSION = "3.0"
|
||||||
_MAX_API_VERSION = "3.40"
|
_MAX_API_VERSION = "3.41"
|
||||||
_LEGACY_API_VERSION1 = "1.0"
|
_LEGACY_API_VERSION1 = "1.0"
|
||||||
_LEGACY_API_VERSION2 = "2.0"
|
_LEGACY_API_VERSION2 = "2.0"
|
||||||
|
|
||||||
|
@ -338,3 +338,7 @@ user documentation.
|
|||||||
3.40
|
3.40
|
||||||
----
|
----
|
||||||
Add volume revert to its latest snapshot support.
|
Add volume revert to its latest snapshot support.
|
||||||
|
|
||||||
|
3.41
|
||||||
|
----
|
||||||
|
Add ``user_id`` field to snapshot list/detail and snapshot show.
|
||||||
|
@ -29,5 +29,6 @@ class ViewBuilder(views_v2.ViewBuilder):
|
|||||||
if req_version.matches("3.14", None):
|
if req_version.matches("3.14", None):
|
||||||
snapshot_ref['snapshot']['group_snapshot_id'] = (
|
snapshot_ref['snapshot']['group_snapshot_id'] = (
|
||||||
snapshot.get('group_snapshot_id'))
|
snapshot.get('group_snapshot_id'))
|
||||||
|
if req_version.matches("3.41", None):
|
||||||
|
snapshot_ref['snapshot']['user_id'] = snapshot.get('user_id')
|
||||||
return snapshot_ref
|
return snapshot_ref
|
||||||
|
@ -68,7 +68,7 @@ class SnapshotApiTest(test.TestCase):
|
|||||||
self.controller = snapshots.SnapshotsController()
|
self.controller = snapshots.SnapshotsController()
|
||||||
self.ctx = context.RequestContext(fake.USER_ID, fake.PROJECT_ID, True)
|
self.ctx = context.RequestContext(fake.USER_ID, fake.PROJECT_ID, True)
|
||||||
|
|
||||||
@ddt.data('3.14', '3.13')
|
@ddt.data('3.14', '3.13', '3.41')
|
||||||
@mock.patch('cinder.db.snapshot_metadata_get', return_value=dict())
|
@mock.patch('cinder.db.snapshot_metadata_get', return_value=dict())
|
||||||
@mock.patch('cinder.objects.Volume.get_by_id')
|
@mock.patch('cinder.objects.Volume.get_by_id')
|
||||||
@mock.patch('cinder.objects.Snapshot.get_by_id')
|
@mock.patch('cinder.objects.Snapshot.get_by_id')
|
||||||
@ -98,8 +98,12 @@ class SnapshotApiTest(test.TestCase):
|
|||||||
self.assertIn('updated_at', resp_dict['snapshot'])
|
self.assertIn('updated_at', resp_dict['snapshot'])
|
||||||
if max_ver == '3.14':
|
if max_ver == '3.14':
|
||||||
self.assertIn('group_snapshot_id', resp_dict['snapshot'])
|
self.assertIn('group_snapshot_id', resp_dict['snapshot'])
|
||||||
|
self.assertNotIn('user_id', resp_dict['snapshot'])
|
||||||
elif max_ver == '3.13':
|
elif max_ver == '3.13':
|
||||||
self.assertNotIn('group_snapshot_id', resp_dict['snapshot'])
|
self.assertNotIn('group_snapshot_id', resp_dict['snapshot'])
|
||||||
|
self.assertNotIn('user_id', resp_dict['snapshot'])
|
||||||
|
elif max_ver == '3.41':
|
||||||
|
self.assertIn('user_id', resp_dict['snapshot'])
|
||||||
|
|
||||||
def test_snapshot_show_invalid_id(self):
|
def test_snapshot_show_invalid_id(self):
|
||||||
snapshot_id = INVALID_UUID
|
snapshot_id = INVALID_UUID
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- Add ``user_id`` field to snapshot list/detail and snapshot show.
|
Loading…
x
Reference in New Issue
Block a user