Browse Source

Add project id and user id information in os-server-group API

APIImpact: Project id and user id information will
be returned for os-server-group API

Change-Id: I167141676ef4f597a1c022c1fd5dc96fd55d02ad
blueprint add-project-id-and-user-id
Partial-Bug: 1481210
changes/17/209917/23
Kevin_Zheng 4 years ago
parent
commit
3ce62edb2a
1 changed files with 241 additions and 0 deletions
  1. 241
    0
      specs/mitaka/approved/add-project-id-in-os-server-groups-api.rst

+ 241
- 0
specs/mitaka/approved/add-project-id-in-os-server-groups-api.rst View File

@@ -0,0 +1,241 @@
1
+..
2
+ This work is licensed under a Creative Commons Attribution 3.0 Unported
3
+ License.
4
+
5
+ http://creativecommons.org/licenses/by/3.0/legalcode
6
+
7
+=======================================================================
8
+Show the 'project_id' and 'user_id' information in os-server-groups API
9
+=======================================================================
10
+
11
+https://blueprints.launchpad.net/nova/+spec/add-project-id-and-user-id
12
+
13
+Show the 'project_id' and 'user_id' information of the server
14
+groups in os-server-groups API. This fix will allow admin user
15
+to identify server group easier.
16
+
17
+
18
+Problem description
19
+===================
20
+
21
+The os-server-groups API currently allows admin user to list server
22
+groups for all projects and the response body doesn't contain project
23
+id information of each server group, it will be hard to identify which
24
+server group belong to which project in multi-tenant env.
25
+
26
+
27
+Use Cases
28
+---------
29
+
30
+As a cloud administrator, I want to easily identify which server group
31
+belongs to which project when sending GET request.
32
+
33
+
34
+Proposed change
35
+===============
36
+
37
+Add a new API microversion to the os-server-groups API extension such that if:
38
+ * The version on the API 'list' request satisfies the minimum version include
39
+   the 'project_id' and 'user_id' information of server groups in the
40
+   response data.
41
+ * The version on the API 'show' request satisfies the minimum version include
42
+   the 'project_id' and 'user_id' information of server groups in the response
43
+   data.
44
+ * The version on the API 'create' request satisfies the minimum version
45
+   include the 'project_id' and 'user_id' information of server groups in
46
+   the response data.
47
+
48
+Alternatives
49
+------------
50
+
51
+None
52
+
53
+Data model impact
54
+-----------------
55
+
56
+None
57
+
58
+REST API impact
59
+---------------
60
+
61
+The proposed change updates the GET response data in the os-server-groups
62
+API extension to include the 'project_id' and 'user_id' field if the request
63
+has a minimum supported version.
64
+
65
+The proposed change also updates the POST response data in the
66
+os-server-groups API extension to include the 'project_id' and 'user_id'
67
+field if the request has a minimum supported version.
68
+
69
+* Modifications for the method
70
+
71
+  * Add project id information to the current response data.
72
+  * Add user id information to the current response data.
73
+  * GET requests response data will be affected.
74
+  * POST requests response data will be affected.
75
+
76
+* Example use case:
77
+
78
+Request:
79
+
80
+GET --header "X-OpenStack-Nova-API-Version: 2.12" \
81
+http://127.0.0.1:8774/v2.1/e0c1f4c0b9444fa086fa13881798144f/os-server-groups
82
+
83
+Response:
84
+
85
+::
86
+
87
+   {
88
+    "server_groups": [
89
+    {
90
+      "user_id": "ed64bccd0227444fa02dbd7695769a7d",
91
+      "policies": [
92
+        "affinity"
93
+      ],
94
+      "name": "test1",
95
+      "members": [],
96
+      "project_id": "b8112a8d8227490eba99419b8a8c2555",
97
+      "id": "e64b6ae1-4d05-4faa-9f53-72c71f8e6f1a",
98
+      "metadata": {}
99
+    },
100
+    {
101
+      "user_id": "9128b975e91846f882eb63dc35c2ffd8",
102
+      "policies": [
103
+        "anti-affinity"
104
+      ],
105
+      "name": "test2",
106
+      "members": [],
107
+      "project_id": "b8112a8d8227490eba99419b8a8c2555",
108
+      "id": "b1af831c-69b5-4d42-be44-d710f2b8954c",
109
+      "metadata": {}
110
+    }
111
+    ]
112
+    }
113
+
114
+Request:
115
+
116
+GET --header "X-OpenStack-Nova-API-Version: 2.12" \
117
+http://127.0.0.1:8774/v2.1/e0c1f4c0b9444fa086fa13881798144f/os-server-groups/
118
+e64b6ae1-4d05-4faa-9f53-72c71f8e6f1a
119
+
120
+Response:
121
+
122
+::
123
+
124
+   {
125
+      "user_id": "ed64bccd0227444fa02dbd7695769a7d",
126
+      "policies": [
127
+        "affinity"
128
+      ],
129
+      "name": "test1",
130
+      "members": [],
131
+      "project_id": "b8112a8d8227490eba99419b8a8c2555",
132
+      "id": "e64b6ae1-4d05-4faa-9f53-72c71f8e6f1a",
133
+      "metadata": {}
134
+    }
135
+
136
+Request:
137
+
138
+POST --header "X-OpenStack-Nova-API-Version: 2.12" \
139
+http://127.0.0.1:8774/v2.1/e0c1f4c0b9444fa086fa13881798144f/os-server-groups \
140
+-d {"server_group": { "name": "test", "policies": [ "affinity" ] }}
141
+
142
+Response:
143
+
144
+::
145
+
146
+    {
147
+      "user_id": "ed64bccd0227444fa02dbd7695769a7d",
148
+      "policies": [
149
+        "affinity"
150
+      ],
151
+      "name": "test",
152
+      "members": [],
153
+      "project_id": "b8112a8d8227490eba99419b8a8c2555",
154
+      "id": "e64b6ae1-4d05-4faa-9f53-72c71f8e6f1a",
155
+      "metadata": {}
156
+    }
157
+
158
+* There should not be any impacts to policy.json files for this change.
159
+
160
+Security impact
161
+---------------
162
+
163
+None
164
+
165
+Notifications impact
166
+--------------------
167
+
168
+None
169
+
170
+Other end user impact
171
+---------------------
172
+
173
+* The python-novaclient server-group-list, server-group-show
174
+  server-group-create command will be updated to handle microversions
175
+  to show the 'project_id' and 'user_id' information in it's output
176
+  if the requested microversion provides that infomation.
177
+
178
+Performance Impact
179
+------------------
180
+
181
+None
182
+
183
+Other deployer impact
184
+---------------------
185
+
186
+None; if a deployer is using the required minimum version of the API to get
187
+the 'project_id' and 'user_id' data they can begin using it, otherwise they
188
+won't see a change.
189
+
190
+Developer impact
191
+----------------
192
+
193
+None
194
+
195
+
196
+Implementation
197
+==============
198
+
199
+Assignee(s)
200
+-----------
201
+
202
+Primary assignee:
203
+  Zhenyu Zheng <zhengzhenyu@huawei.com>
204
+
205
+Work Items
206
+----------
207
+
208
+* Add a new microversion and change
209
+  nova/api/openstack/compute/server_groups.py to use it to determine
210
+  if the 'project_id' and 'user_id' information of the server group
211
+  should be returned.
212
+
213
+
214
+Dependencies
215
+============
216
+
217
+None
218
+
219
+
220
+Testing
221
+=======
222
+
223
+* Unit tests and API samples functional tests in the nova tree.
224
+* There are currently not any compute API microversions tested in Tempest
225
+  beyond v2.1. We could add support for testing the new version in Tempest
226
+  but so far the API is already at least at v2.10 without changes to Tempest.
227
+
228
+
229
+Documentation Impact
230
+====================
231
+
232
+ * nova/api/openstack/rest_api_version_history.rst document will be updated.
233
+ * api-ref at https://github.com/openstack/api-site will be updated.
234
+
235
+
236
+References
237
+==========
238
+
239
+* Originally reported as a bug:
240
+    https://bugs.launchpad.net/python-novaclient/+bug/1481210
241
+

Loading…
Cancel
Save