Skip to content

Commit 97362c0

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 08dd0f1 commit 97362c0

2 files changed

Lines changed: 313 additions & 0 deletions

File tree

config-schema.json

Lines changed: 312 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,312 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "XCP-ng Tests Configuration Schema",
4+
"description": "JSON Schema for validating config.toml, config.default.toml, and config.NAME.toml files",
5+
"type": "object",
6+
"properties": {
7+
"$schema": {
8+
"type": "string",
9+
"description": "JSON Schema reference (for editor support)"
10+
},
11+
"objects_name_prefix": {
12+
"type": ["string", "null"],
13+
"description": "Prefix added to name-label of all XAPI objects created by tests (VMs, SRs, etc.). Empty string means use the current username."
14+
},
15+
"dns_server": {
16+
"type": "string",
17+
"description": "A working DNS server not used by any VM images, used in Windows VM DNS tests"
18+
},
19+
"host": {
20+
"type": "object",
21+
"description": "Default credentials for connecting to hosts via XAPI (not SSH)",
22+
"properties": {
23+
"default_user": {
24+
"type": "string",
25+
"description": "Default user for host XAPI access"
26+
},
27+
"default_password": {
28+
"type": "string",
29+
"description": "Default password for host XAPI access"
30+
},
31+
"default_password_hash": {
32+
"type": "string",
33+
"description": "SHA512 hash of default_password (auto-computed if not provided)"
34+
}
35+
},
36+
"additionalProperties": false
37+
},
38+
"hosts": {
39+
"type": "object",
40+
"description": "Per-host configuration overrides (keyed by hostname or IP)",
41+
"additionalProperties": {
42+
"type": "object",
43+
"properties": {
44+
"user": { "type": "string" },
45+
"password": { "type": "string" },
46+
"skip_xo_config": { "type": "boolean" }
47+
},
48+
"additionalProperties": true
49+
}
50+
},
51+
"network": {
52+
"type": "object",
53+
"description": "Network configuration",
54+
"properties": {
55+
"mgmt": {
56+
"type": "string",
57+
"description": "Name of the pool-wide management network",
58+
"default": "Pool-wide network associated with eth0"
59+
}
60+
},
61+
"additionalProperties": false
62+
},
63+
"pxe": {
64+
"type": "object",
65+
"description": "PXE boot configuration for automated XCP-ng installation",
66+
"properties": {
67+
"config_server": {
68+
"type": "string",
69+
"description": "PXE configuration server hostname or IP"
70+
},
71+
"arp_server": {
72+
"type": "string",
73+
"description": "Server on MGMT network where ARP tables can reveal MACs"
74+
}
75+
},
76+
"additionalProperties": false
77+
},
78+
"vm": {
79+
"type": "object",
80+
"description": "Virtual machine configuration",
81+
"properties": {
82+
"def_url": {
83+
"type": "string",
84+
"description": "Default base URL for VM images; relative image paths are appended to this"
85+
},
86+
"cache_imported": {
87+
"type": "boolean",
88+
"description": "Cache imported VMs in the target SR; clones VM at start of each test module"
89+
},
90+
"default_sr": {
91+
"type": "string",
92+
"description": "SR to use for test VM disks: 'default', 'local', or a SR UUID"
93+
},
94+
"images": {
95+
"type": "object",
96+
"description": "VM image name to filename/URL mappings",
97+
"additionalProperties": {
98+
"type": "string"
99+
}
100+
},
101+
"equivalents": {
102+
"type": "object",
103+
"description": "Image equivalence mappings for caching/deduplication",
104+
"additionalProperties": {
105+
"type": "string"
106+
}
107+
}
108+
},
109+
"additionalProperties": false
110+
},
111+
"install": {
112+
"type": "object",
113+
"description": "Installation test configuration",
114+
"properties": {
115+
"answerfiles": {
116+
"type": "object",
117+
"description": "Base answerfile definitions (INSTALL, UPGRADE, RESTORE)",
118+
"additionalProperties": {
119+
"type": "object",
120+
"additionalProperties": true
121+
}
122+
},
123+
"iso_remaster": {
124+
"type": "string",
125+
"description": "Path to the iso-remaster utility script used to build custom installer ISOs"
126+
},
127+
"isos": {
128+
"type": "object",
129+
"description": "XCP-ng installer ISO configuration",
130+
"properties": {
131+
"base_url": {
132+
"type": "string",
133+
"description": "Base URL for XCP-ng installer ISOs"
134+
},
135+
"cache_dir": {
136+
"type": "string",
137+
"description": "Local directory to cache downloaded ISOs"
138+
},
139+
"definitions": {
140+
"type": "object",
141+
"description": "ISO version definitions keyed by version name",
142+
"additionalProperties": {
143+
"type": "object",
144+
"properties": {
145+
"path": { "type": "string" },
146+
"net-url": { "type": "string" },
147+
"net-only": { "type": "boolean" },
148+
"unsigned": { "type": "boolean" }
149+
},
150+
"additionalProperties": false
151+
}
152+
}
153+
},
154+
"additionalProperties": false
155+
}
156+
},
157+
"additionalProperties": false
158+
},
159+
"guest_tools": {
160+
"type": "object",
161+
"description": "Guest tools ISO and installation configuration",
162+
"properties": {
163+
"download_url": {
164+
"type": "string",
165+
"description": "Base URL for downloading guest tool ISOs"
166+
},
167+
"win": {
168+
"type": "object",
169+
"description": "Windows guest tool ISO definitions keyed by label (e.g. 'stable')",
170+
"additionalProperties": {
171+
"type": "object",
172+
"properties": {
173+
"name": { "type": "string", "description": "ISO name on SR or subpath of download_url" },
174+
"download": { "type": "boolean", "description": "Whether to download from download_url" },
175+
"package": { "type": "string", "description": "ISO-relative path of MSI file" },
176+
"xenclean_path": { "type": "string", "description": "ISO-relative path of XenClean script" },
177+
"testsign_cert": { "type": "string", "description": "ISO-relative path of root cert file (optional)" },
178+
"onboard_family": { "type": "string", "description": "WinPV VENDOR_NAME value for onboard tools" }
179+
},
180+
"additionalProperties": true
181+
}
182+
},
183+
"other": {
184+
"type": "object",
185+
"description": "ISO containing other (non-Windows-native) guest tools to test",
186+
"properties": {
187+
"name": { "type": "string", "description": "ISO name on SR or subpath of download_url" },
188+
"download": { "type": "boolean", "description": "Whether to download from download_url" }
189+
},
190+
"additionalProperties": true
191+
},
192+
"installed": {
193+
"type": "object",
194+
"description": "Other guest tool definitions contained in guest_tools.other ISO",
195+
"additionalProperties": {
196+
"type": "object",
197+
"properties": {
198+
"type": { "type": "string", "description": "Installation type: 'msi', 'inf', or absent for Windows Update" },
199+
"path": { "type": "string", "description": "ISO-relative path of this guest tool" },
200+
"package": { "type": "string", "description": "Path-relative path of MSI or driver files" },
201+
"testsign_cert": { "type": "string", "description": "Relative path of root cert file (optional)" },
202+
"vendor_device": { "type": "boolean", "description": "Whether vendor device should be activated" },
203+
"upgradable": { "type": "boolean", "description": "Whether auto-upgrade from this tool is supported" },
204+
"onboarding_phase": { "type": "string", "description": "Expected onboarding phase after XenClean (optional)" }
205+
},
206+
"additionalProperties": true
207+
}
208+
}
209+
},
210+
"additionalProperties": false
211+
},
212+
"ssh": {
213+
"type": "object",
214+
"description": "SSH configuration for the test runner",
215+
"properties": {
216+
"pubkey": {
217+
"type": "string",
218+
"description": "Public SSH key(s) injected into installed hosts' authorized_keys"
219+
},
220+
"output_max_lines": {
221+
"type": "integer",
222+
"description": "Maximum SSH output lines to log before truncating",
223+
"default": 20,
224+
"minimum": 0
225+
},
226+
"ignore_banner": {
227+
"type": "boolean",
228+
"description": "Strip SSH banners from command output",
229+
"default": false
230+
}
231+
},
232+
"additionalProperties": false
233+
},
234+
"storage": {
235+
"type": "object",
236+
"description": "Storage backend device configurations",
237+
"properties": {
238+
"nfs": {
239+
"type": "object",
240+
"description": "NFS storage configuration",
241+
"additionalProperties": { "type": "string" }
242+
},
243+
"nfs4": {
244+
"type": "object",
245+
"description": "NFSv4 storage configuration",
246+
"additionalProperties": { "type": "string" }
247+
},
248+
"nfs_iso": {
249+
"type": "object",
250+
"description": "NFS ISO storage configuration",
251+
"additionalProperties": { "type": "string" }
252+
},
253+
"cifs_iso": {
254+
"type": "object",
255+
"description": "CIFS ISO storage configuration",
256+
"additionalProperties": { "type": "string" }
257+
},
258+
"cephfs": {
259+
"type": "object",
260+
"description": "CephFS storage configuration",
261+
"additionalProperties": { "type": "string" }
262+
},
263+
"moosefs": {
264+
"type": "object",
265+
"description": "MooseFS storage configuration",
266+
"additionalProperties": { "type": "string" }
267+
},
268+
"lvmoiscsi": {
269+
"type": "object",
270+
"description": "LVM over iSCSI storage configuration",
271+
"additionalProperties": { "type": "string" }
272+
}
273+
},
274+
"additionalProperties": false
275+
}
276+
},
277+
"additionalProperties": false,
278+
"examples": [
279+
{
280+
"objects_name_prefix": "[TEST]",
281+
"dns_server": "1.1.1.1",
282+
"host": {
283+
"default_user": "root",
284+
"default_password": ""
285+
},
286+
"hosts": {
287+
"10.0.0.1": { "user": "root", "password": "secret" }
288+
},
289+
"pxe": {
290+
"config_server": "pxe",
291+
"arp_server": "pxe"
292+
},
293+
"vm": {
294+
"def_url": "http://pxe/images/",
295+
"cache_imported": false,
296+
"default_sr": "default"
297+
},
298+
"install": {
299+
"isos": {
300+
"base_url": "https://updates.xcp-ng.org/isos/",
301+
"cache_dir": "/home/user/iso"
302+
}
303+
},
304+
"guest_tools": {
305+
"download_url": "http://pxe/isos/"
306+
},
307+
"ssh": {
308+
"pubkey": "ssh-ed25519 AAAA..."
309+
}
310+
}
311+
]
312+
}

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)