File tree 3 files changed +35
-25
lines changed
nova/api/openstack/placement
3 files changed +35
-25
lines changed Original file line number Diff line number Diff line change 17
17
import webob
18
18
19
19
from nova .api .openstack .placement import microversion
20
+ from nova .api .openstack .placement .schemas import usage as schema
20
21
from nova .api .openstack .placement import util
21
22
from nova .api .openstack .placement import wsgi_wrapper
22
23
from nova import exception
23
24
from nova .i18n import _
24
25
from nova .objects import resource_provider as rp_obj
25
26
26
27
27
- # Represents the allowed query string parameters to GET /usages
28
- GET_USAGES_SCHEMA_1_9 = {
29
- "type" : "object" ,
30
- "properties" : {
31
- "project_id" : {
32
- "type" : "string" ,
33
- "minLength" : 1 ,
34
- "maxLength" : 255 ,
35
- },
36
- "user_id" : {
37
- "type" : "string" ,
38
- "minLength" : 1 ,
39
- "maxLength" : 255 ,
40
- },
41
- },
42
- "required" : [
43
- "project_id"
44
- ],
45
- "additionalProperties" : False ,
46
- }
47
-
48
-
49
28
def _serialize_usages (resource_provider , usage ):
50
29
usage_dict = {resource .resource_class : resource .usage
51
30
for resource in usage }
@@ -111,9 +90,7 @@ def get_total_usages(req):
111
90
context = req .environ ['placement.context' ]
112
91
want_version = req .environ [microversion .MICROVERSION_ENVIRON ]
113
92
114
- schema = GET_USAGES_SCHEMA_1_9
115
-
116
- util .validate_query_params (req , schema )
93
+ util .validate_query_params (req , schema .GET_USAGES_SCHEMA_1_9 )
117
94
118
95
project_id = req .GET .get ('project_id' )
119
96
user_id = req .GET .get ('user_id' )
Original file line number Diff line number Diff line change
1
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may
2
+ # not use this file except in compliance with the License. You may obtain
3
+ # a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10
+ # License for the specific language governing permissions and limitations
11
+ # under the License.
12
+ """Placement API schemas for usage information."""
13
+
14
+ # Represents the allowed query string parameters to GET /usages
15
+ GET_USAGES_SCHEMA_1_9 = {
16
+ "type" : "object" ,
17
+ "properties" : {
18
+ "project_id" : {
19
+ "type" : "string" ,
20
+ "minLength" : 1 ,
21
+ "maxLength" : 255 ,
22
+ },
23
+ "user_id" : {
24
+ "type" : "string" ,
25
+ "minLength" : 1 ,
26
+ "maxLength" : 255 ,
27
+ },
28
+ },
29
+ "required" : [
30
+ "project_id"
31
+ ],
32
+ "additionalProperties" : False ,
33
+ }
You can’t perform that action at this time.
0 commit comments