Skip to content

Commit 1e6ccca

Browse files
committed
Add a config schema
To make easier editing within our editors. This format is compatible with multiple toml lsp, including taplo. Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
1 parent f3ff6ac commit 1e6ccca

2 files changed

Lines changed: 379 additions & 0 deletions

File tree

config-schema.json

Lines changed: 378 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,378 @@
1+
{
2+
"$defs": {
3+
"GuestToolsConfig": {
4+
"properties": {
5+
"download_url": {
6+
"title": "Download Url",
7+
"type": "string"
8+
},
9+
"win": {
10+
"additionalProperties": {
11+
"additionalProperties": true,
12+
"type": "object"
13+
},
14+
"title": "Win",
15+
"type": "object"
16+
},
17+
"other": {
18+
"additionalProperties": true,
19+
"title": "Other",
20+
"type": "object"
21+
},
22+
"installed": {
23+
"additionalProperties": {
24+
"additionalProperties": true,
25+
"type": "object"
26+
},
27+
"title": "Installed",
28+
"type": "object"
29+
}
30+
},
31+
"required": [
32+
"download_url"
33+
],
34+
"title": "GuestToolsConfig",
35+
"type": "object"
36+
},
37+
"HostConfig": {
38+
"properties": {
39+
"default_user": {
40+
"title": "Default User",
41+
"type": "string"
42+
},
43+
"default_password": {
44+
"title": "Default Password",
45+
"type": "string"
46+
},
47+
"default_password_hash": {
48+
"default": "",
49+
"title": "Default Password Hash",
50+
"type": "string"
51+
}
52+
},
53+
"required": [
54+
"default_user",
55+
"default_password"
56+
],
57+
"title": "HostConfig",
58+
"type": "object"
59+
},
60+
"InstallConfig": {
61+
"properties": {
62+
"answerfiles": {
63+
"additionalProperties": true,
64+
"title": "Answerfiles",
65+
"type": "object"
66+
},
67+
"isos": {
68+
"$ref": "#/$defs/InstallIsosConfig"
69+
},
70+
"iso_remaster": {
71+
"default": "",
72+
"title": "Iso Remaster",
73+
"type": "string"
74+
}
75+
},
76+
"required": [
77+
"isos"
78+
],
79+
"title": "InstallConfig",
80+
"type": "object"
81+
},
82+
"InstallIsosConfig": {
83+
"properties": {
84+
"base_url": {
85+
"title": "Base Url",
86+
"type": "string"
87+
},
88+
"cache_dir": {
89+
"title": "Cache Dir",
90+
"type": "string"
91+
},
92+
"definitions": {
93+
"additionalProperties": {
94+
"additionalProperties": true,
95+
"type": "object"
96+
},
97+
"title": "Definitions",
98+
"type": "object"
99+
}
100+
},
101+
"required": [
102+
"base_url",
103+
"cache_dir"
104+
],
105+
"title": "InstallIsosConfig",
106+
"type": "object"
107+
},
108+
"LintstorConfig": {
109+
"properties": {
110+
"redundancy": {
111+
"default": 2,
112+
"title": "Redundancy",
113+
"type": "integer"
114+
}
115+
},
116+
"title": "LintstorConfig",
117+
"type": "object"
118+
},
119+
"NetworkConfig": {
120+
"properties": {
121+
"mgmt": {
122+
"default": "Pool-wide network associated with eth0",
123+
"title": "Mgmt",
124+
"type": "string"
125+
},
126+
"free_nics": {
127+
"default": [],
128+
"items": {
129+
"type": "string"
130+
},
131+
"title": "Free Nics",
132+
"type": "array"
133+
}
134+
},
135+
"title": "NetworkConfig",
136+
"type": "object"
137+
},
138+
"PXEConfig": {
139+
"properties": {
140+
"config_server": {
141+
"title": "Config Server",
142+
"type": "string"
143+
},
144+
"arp_server": {
145+
"title": "Arp Server",
146+
"type": "string"
147+
}
148+
},
149+
"required": [
150+
"config_server",
151+
"arp_server"
152+
],
153+
"title": "PXEConfig",
154+
"type": "object"
155+
},
156+
"SSHConfig": {
157+
"properties": {
158+
"pubkey": {
159+
"title": "Pubkey",
160+
"type": "string"
161+
},
162+
"output_max_lines": {
163+
"default": 20,
164+
"title": "Output Max Lines",
165+
"type": "integer"
166+
},
167+
"ignore_banner": {
168+
"default": false,
169+
"title": "Ignore Banner",
170+
"type": "boolean"
171+
}
172+
},
173+
"required": [
174+
"pubkey"
175+
],
176+
"title": "SSHConfig",
177+
"type": "object"
178+
},
179+
"StorageConfig": {
180+
"properties": {
181+
"nfs": {
182+
"additionalProperties": {
183+
"type": "string"
184+
},
185+
"title": "Nfs",
186+
"type": "object"
187+
},
188+
"nfs4": {
189+
"additionalProperties": {
190+
"type": "string"
191+
},
192+
"title": "Nfs4",
193+
"type": "object"
194+
},
195+
"nfs_iso": {
196+
"additionalProperties": {
197+
"type": "string"
198+
},
199+
"title": "Nfs Iso",
200+
"type": "object"
201+
},
202+
"cifs_iso": {
203+
"additionalProperties": {
204+
"type": "string"
205+
},
206+
"title": "Cifs Iso",
207+
"type": "object"
208+
},
209+
"cephfs": {
210+
"additionalProperties": {
211+
"type": "string"
212+
},
213+
"title": "Cephfs",
214+
"type": "object"
215+
},
216+
"moosefs": {
217+
"additionalProperties": {
218+
"type": "string"
219+
},
220+
"title": "Moosefs",
221+
"type": "object"
222+
},
223+
"lvmohba": {
224+
"additionalProperties": {
225+
"type": "string"
226+
},
227+
"title": "Lvmohba",
228+
"type": "object"
229+
},
230+
"lvmoiscsi": {
231+
"additionalProperties": {
232+
"type": "string"
233+
},
234+
"title": "Lvmoiscsi",
235+
"type": "object"
236+
},
237+
"linstor": {
238+
"$ref": "#/$defs/LintstorConfig"
239+
}
240+
},
241+
"title": "StorageConfig",
242+
"type": "object"
243+
},
244+
"VMConfig": {
245+
"properties": {
246+
"def_url": {
247+
"title": "Def Url",
248+
"type": "string"
249+
},
250+
"cache_imported": {
251+
"title": "Cache Imported",
252+
"type": "boolean"
253+
},
254+
"default_sr": {
255+
"title": "Default Sr",
256+
"type": "string"
257+
},
258+
"images": {
259+
"$ref": "#/$defs/VMImagesConfig"
260+
},
261+
"equivalents": {
262+
"additionalProperties": {
263+
"type": "string"
264+
},
265+
"title": "Equivalents",
266+
"type": "object"
267+
}
268+
},
269+
"required": [
270+
"def_url",
271+
"cache_imported",
272+
"default_sr"
273+
],
274+
"title": "VMConfig",
275+
"type": "object"
276+
},
277+
"VMImagesConfig": {
278+
"additionalProperties": true,
279+
"properties": {},
280+
"title": "VMImagesConfig",
281+
"type": "object"
282+
},
283+
"XOConfig": {
284+
"properties": {
285+
"cli": {
286+
"default": "xo-cli",
287+
"title": "Cli",
288+
"type": "string"
289+
}
290+
},
291+
"title": "XOConfig",
292+
"type": "object"
293+
}
294+
},
295+
"properties": {
296+
"objects_name_prefix": {
297+
"anyOf": [
298+
{
299+
"type": "string"
300+
},
301+
{
302+
"type": "null"
303+
}
304+
],
305+
"default": null,
306+
"title": "Objects Name Prefix"
307+
},
308+
"dns_server": {
309+
"default": "1.1.1.1",
310+
"title": "Dns Server",
311+
"type": "string"
312+
},
313+
"host": {
314+
"$ref": "#/$defs/HostConfig"
315+
},
316+
"hosts": {
317+
"additionalProperties": {
318+
"additionalProperties": true,
319+
"type": "object"
320+
},
321+
"title": "Hosts",
322+
"type": "object"
323+
},
324+
"network": {
325+
"$ref": "#/$defs/NetworkConfig"
326+
},
327+
"pxe": {
328+
"$ref": "#/$defs/PXEConfig"
329+
},
330+
"vm": {
331+
"$ref": "#/$defs/VMConfig"
332+
},
333+
"install": {
334+
"$ref": "#/$defs/InstallConfig"
335+
},
336+
"guest_tools": {
337+
"$ref": "#/$defs/GuestToolsConfig"
338+
},
339+
"xo": {
340+
"$ref": "#/$defs/XOConfig"
341+
},
342+
"ssh": {
343+
"$ref": "#/$defs/SSHConfig"
344+
},
345+
"storage": {
346+
"$ref": "#/$defs/StorageConfig"
347+
},
348+
"volume_size": {
349+
"title": "Volume Size",
350+
"type": ["string", "integer"],
351+
"description": "Default size of VDIs created for storage tests. Accepts sizes like '1 GiB', '2.5TiB', or plain integers."
352+
},
353+
"write_volume_cap": {
354+
"title": "Write Volume Cap",
355+
"type": ["string", "integer"],
356+
"description": "Maximum amount of data written to a volume during storage tests. Accepts sizes like '2 GiB' or '500MiB'."
357+
},
358+
"write_volume_align": {
359+
"title": "Write Volume Align",
360+
"type": "integer"
361+
}
362+
},
363+
"required": [
364+
"host",
365+
"pxe",
366+
"vm",
367+
"install",
368+
"guest_tools",
369+
"ssh",
370+
"volume_size",
371+
"write_volume_cap",
372+
"write_volume_align"
373+
],
374+
"title": "XCP-ng Tests Configuration Schema",
375+
"type": "object",
376+
"$schema": "http://json-schema.org/draft-07/schema#",
377+
"description": "JSON Schema for validating config.toml, config.default.toml, and config.NAME.toml files"
378+
}

config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"$schema" = "./config-schema.json"
12
# Configuration file for XCP-ng tests
23
# To be customized for your environment
34

0 commit comments

Comments
 (0)