Skip to content

Commit d5a1269

Browse files
Merge pull request #545 from Mashimiao/fix-blockio-related-validation
fix blkio related validation
2 parents dd5e44a + 58832f9 commit d5a1269

File tree

2 files changed

+56
-155
lines changed

2 files changed

+56
-155
lines changed

schema/config-linux.json

Lines changed: 55 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,24 @@
66
"properties": {
77
"devices": {
88
"id": "https://opencontainers.org/schema/bundle/linux/devices",
9-
"oneOf": [
10-
{
11-
"type": "array",
12-
"items": {
13-
"$ref": "defs-linux.json#/definitions/Device"
14-
}
15-
},
16-
{
17-
"type": "null"
18-
}
19-
]
9+
"type": "array",
10+
"items": {
11+
"$ref": "defs-linux.json#/definitions/Device"
12+
}
2013
},
2114
"uidMappings": {
2215
"id": "https://opencontainers.org/schema/bundle/linux/uidMappings",
23-
"oneOf": [
24-
{
25-
"type": "array",
26-
"items": {
27-
"$ref": "defs.json#/definitions/IDMapping"
28-
}
29-
},
30-
{
31-
"type": "null"
32-
}
33-
]
16+
"type": "array",
17+
"items": {
18+
"$ref": "defs.json#/definitions/IDMapping"
19+
}
3420
},
3521
"gidMappings": {
3622
"id": "https://opencontainers.org/schema/bundle/linux/gidMappings",
37-
"oneOf": [
38-
{
39-
"type": "array",
40-
"items": {
41-
"$ref": "defs.json#/definitions/IDMapping"
42-
}
43-
},
44-
{
45-
"type": "null"
46-
}
47-
]
23+
"type": "array",
24+
"items": {
25+
"$ref": "defs.json#/definitions/IDMapping"
26+
}
4827
},
4928
"namespaces": {
5029
"id": "https://opencontainers.org/schema/bundle/linux/namespaces",
@@ -63,17 +42,10 @@
6342
"properties": {
6443
"devices": {
6544
"id": "https://opencontainers.org/schema/bundle/linux/resources/devices",
66-
"oneOf": [
67-
{
68-
"type": "array",
69-
"items": {
70-
"$ref": "defs-linux.json#/definitions/DeviceCgroup"
71-
}
72-
},
73-
{
74-
"type": "null"
75-
}
76-
]
45+
"type": "array",
46+
"items": {
47+
"$ref": "defs-linux.json#/definitions/DeviceCgroup"
48+
}
7749
},
7850
"oomScoreAdj": {
7951
"id": "https://opencontainers.org/schema/bundle/linux/resources/oomScoreAdj",
@@ -108,67 +80,37 @@
10880
},
10981
"blkioThrottleReadBpsDevice": {
11082
"id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/blkioThrottleReadBpsDevice",
111-
"oneOf": [
112-
{
113-
"type": "array",
114-
"items": [
115-
{
116-
"$ref": "defs-linux.json#/definitions/blockIODeviceThrottlePointer"
117-
}
118-
]
119-
},
120-
{
121-
"type": "null"
122-
}
123-
]
83+
"type": "array",
84+
"items": {
85+
"$ref": "defs-linux.json#/definitions/blockIODeviceThrottle"
86+
}
12487
},
12588
"blkioThrottleWriteBpsDevice": {
12689
"id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/blkioThrottleWriteBpsDevice",
127-
"oneOf": [
128-
{
129-
"type": "array",
130-
"items": {
131-
"$ref": "defs-linux.json#/definitions/blockIODeviceThrottlePointer"
132-
}
133-
},
134-
{
135-
"type": "null"
136-
}
137-
]
90+
"type": "array",
91+
"items": {
92+
"$ref": "defs-linux.json#/definitions/blockIODeviceThrottle"
93+
}
13894
},
13995
"blkioThrottleReadIopsDevice": {
14096
"id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/blkioThrottleReadIopsDevice",
141-
"oneOf": [
142-
{
143-
"type": "array",
144-
"items": {
145-
"$ref": "defs-linux.json#/definitions/blockIODeviceThrottlePointer"
146-
}
147-
},
148-
{
149-
"type": "null"
150-
}
151-
]
97+
"type": "array",
98+
"items": {
99+
"$ref": "defs-linux.json#/definitions/blockIODeviceThrottle"
100+
}
152101
},
153102
"blkioThrottleWriteIopsDevice": {
154103
"id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/blkioThrottleWriteIopsDevice",
155-
"oneOf": [
156-
{
157-
"type": "array",
158-
"items": {
159-
"$ref": "defs-linux.json#/definitions/blockIODeviceThrottlePointer"
160-
}
161-
},
162-
{
163-
"type": "null"
164-
}
165-
]
104+
"type": "array",
105+
"items": {
106+
"$ref": "defs-linux.json#/definitions/blockIODeviceThrottle"
107+
}
166108
},
167109
"blkioWeightDevice": {
168110
"id": "https://opencontainers.org/schema/bundle/linux/resources/blockIO/blkioWeightDevice",
169111
"type": "array",
170112
"items": {
171-
"$ref": "defs-linux.json#/definitions/blockIODeviceWeightPointer"
113+
"$ref": "defs-linux.json#/definitions/blockIODeviceWeight"
172114
}
173115
}
174116
}
@@ -213,29 +155,22 @@
213155
},
214156
"hugepageLimits": {
215157
"id": "https://opencontainers.org/schema/bundle/linux/resources/hugepageLimits",
216-
"oneOf": [
217-
{
218-
"type": "array",
219-
"items": {
220-
"type": "object",
221-
"properties": {
222-
"pageSize": {
223-
"type": "string"
224-
},
225-
"limit": {
226-
"$ref": "defs.json#/definitions/int64"
227-
}
228-
},
229-
"required": [
230-
"pageSize",
231-
"limit"
232-
]
158+
"type": "array",
159+
"items": {
160+
"type": "object",
161+
"properties": {
162+
"pageSize": {
163+
"type": "string"
164+
},
165+
"limit": {
166+
"$ref": "defs.json#/definitions/int64"
233167
}
234168
},
235-
{
236-
"type": "null"
237-
}
238-
]
169+
"required": [
170+
"pageSize",
171+
"limit"
172+
]
173+
}
239174
},
240175
"memory": {
241176
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory",
@@ -277,17 +212,10 @@
277212
},
278213
"priorities": {
279214
"id": "https://opencontainers.org/schema/bundle/linux/resources/network/priorities",
280-
"oneOf": [
281-
{
282-
"type": "array",
283-
"items": {
284-
"$ref": "defs-linux.json#/definitions/NetworkInterfacePriority"
285-
}
286-
},
287-
{
288-
"type": "null"
289-
}
290-
]
215+
"type": "array",
216+
"items": {
217+
"$ref": "defs-linux.json#/definitions/NetworkInterfacePriority"
218+
}
291219
}
292220
}
293221
}
@@ -311,17 +239,10 @@
311239
},
312240
"architectures": {
313241
"id": "https://opencontainers.org/schema/bundle/linux/seccomp/architectures",
314-
"oneOf": [
315-
{
316-
"type": "array",
317-
"items": {
318-
"$ref": "defs-linux.json#/definitions/SeccompArch"
319-
}
320-
},
321-
{
322-
"type": "null"
323-
}
324-
]
242+
"type": "array",
243+
"items": {
244+
"$ref": "defs-linux.json#/definitions/SeccompArch"
245+
}
325246
},
326247
"syscalls": {
327248
"id": "https://opencontainers.org/schema/bundle/linux/seccomp/syscalls",

schema/defs-linux.json

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,6 @@
196196
}
197197
]
198198
},
199-
"blockIODeviceWeightPointer": {
200-
"oneOf": [
201-
{
202-
"$ref": "#/definitions/blockIODeviceWeight"
203-
},
204-
{
205-
"type": "null"
206-
}
207-
]
208-
},
209199
"blockIODeviceThrottle": {
210200
"allOf": [
211201
{
@@ -215,22 +205,12 @@
215205
"type": "object",
216206
"properties": {
217207
"rate": {
218-
"$ref": "defs.json#/definitions/uint64Pointer"
208+
"$ref": "defs.json#/definitions/uint64"
219209
}
220210
}
221211
}
222212
]
223213
},
224-
"blockIODeviceThrottlePointer": {
225-
"oneOf": [
226-
{
227-
"$ref": "#/definitions/blockIODeviceThrottle"
228-
},
229-
{
230-
"type": "null"
231-
}
232-
]
233-
},
234214
"DeviceCgroup": {
235215
"type": "object",
236216
"properties": {

0 commit comments

Comments
 (0)