Skip to content

Commit 862db53

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 f33ceae commit 862db53

2 files changed

Lines changed: 365 additions & 0 deletions

File tree

config-schema.json

Lines changed: 364 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,364 @@
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+
},
284+
"properties": {
285+
"objects_name_prefix": {
286+
"anyOf": [
287+
{
288+
"type": "string"
289+
},
290+
{
291+
"type": "null"
292+
}
293+
],
294+
"default": null,
295+
"title": "Objects Name Prefix"
296+
},
297+
"dns_server": {
298+
"default": "1.1.1.1",
299+
"title": "Dns Server",
300+
"type": "string"
301+
},
302+
"host": {
303+
"$ref": "#/$defs/HostConfig"
304+
},
305+
"hosts": {
306+
"additionalProperties": {
307+
"additionalProperties": true,
308+
"type": "object"
309+
},
310+
"title": "Hosts",
311+
"type": "object"
312+
},
313+
"network": {
314+
"$ref": "#/$defs/NetworkConfig"
315+
},
316+
"pxe": {
317+
"$ref": "#/$defs/PXEConfig"
318+
},
319+
"vm": {
320+
"$ref": "#/$defs/VMConfig"
321+
},
322+
"install": {
323+
"$ref": "#/$defs/InstallConfig"
324+
},
325+
"guest_tools": {
326+
"$ref": "#/$defs/GuestToolsConfig"
327+
},
328+
"ssh": {
329+
"$ref": "#/$defs/SSHConfig"
330+
},
331+
"storage": {
332+
"$ref": "#/$defs/StorageConfig"
333+
},
334+
"volume_size": {
335+
"title": "Volume Size",
336+
"type": ["string", "integer"],
337+
"description": "Default size of VDIs created for storage tests. Accepts sizes like '1 GiB', '2.5TiB', or plain integers."
338+
},
339+
"write_volume_cap": {
340+
"title": "Write Volume Cap",
341+
"type": ["string", "integer"],
342+
"description": "Maximum amount of data written to a volume during storage tests. Accepts sizes like '2 GiB' or '500MiB'."
343+
},
344+
"write_volume_align": {
345+
"title": "Write Volume Align",
346+
"type": "integer"
347+
}
348+
},
349+
"required": [
350+
"host",
351+
"pxe",
352+
"vm",
353+
"install",
354+
"guest_tools",
355+
"ssh",
356+
"volume_size",
357+
"write_volume_cap",
358+
"write_volume_align"
359+
],
360+
"title": "XCP-ng Tests Configuration Schema",
361+
"type": "object",
362+
"$schema": "http://json-schema.org/draft-07/schema#",
363+
"description": "JSON Schema for validating config.toml, config.default.toml, and config.NAME.toml files"
364+
}

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)