Skip to content

Commit de2ad0e

Browse files
committed
chore: rename 'requirement' to 'state' key for traits
1 parent b7e4daf commit de2ad0e

File tree

4 files changed

+31
-31
lines changed

4 files changed

+31
-31
lines changed

docs/design-guide/flavors.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Flavor definitions are YAML files validated against `schema/flavor.schema.json`.
5252
* **trait**: Trait name without `CUSTOM_` prefix (e.g., `NICX`, `GPU`, `NVME`)
5353
* Pattern: `^[A-Z][A-Z0-9_]*$` (uppercase alphanumeric and underscores)
5454
* `CUSTOM_` prefix is automatically added when interacting with Ironic
55-
* **requirement**: Either `required` (node must have trait) or `absent` (node must not have trait)
55+
* **state**: Either `required` (node must have trait) or `absent` (node must not have trait)
5656

5757
### Example: Generic Flavor
5858

@@ -74,7 +74,7 @@ name: m1.small.nicX
7474
resource_class: m1.small
7575
traits:
7676
- trait: NICX
77-
requirement: required
77+
state: required
7878
```
7979

8080
This matches only nodes with `resource_class=m1.small` AND the `CUSTOM_NICX` trait. Nova flavor properties still come from the device-type's `m1.small` resource class.
@@ -88,7 +88,7 @@ name: m1.small.no-gpu
8888
resource_class: m1.small
8989
traits:
9090
- trait: GPU
91-
requirement: absent
91+
state: absent
9292
```
9393

9494
This matches nodes with `resource_class=m1.small` that do NOT have the `CUSTOM_GPU` trait.
@@ -220,7 +220,7 @@ name: compute.gpu
220220
resource_class: m1.large
221221
traits:
222222
- trait: GPU
223-
requirement: required
223+
state: required
224224
```
225225

226226
Guarantees instances get hardware with GPU capabilities while using the `m1.large` resource class specifications for vCPUs/RAM/disk.
@@ -235,7 +235,7 @@ name: m1.small.mellanox-cx5
235235
resource_class: m1.small
236236
traits:
237237
- trait: NIC_MELLANOX_CX5
238-
requirement: required
238+
state: required
239239
```
240240

241241
Guarantees instances get nodes with Mellanox ConnectX-5 network cards.
@@ -255,7 +255,7 @@ name: m1.small.nvme
255255
resource_class: m1.small
256256
traits:
257257
- trait: NVME
258-
requirement: required
258+
state: required
259259
```
260260

261261
Users can choose between generic availability or guaranteed NVMe storage. Both flavors have identical Nova properties (derived from device-type `m1.small`), but different hardware selection criteria.
@@ -324,7 +324,7 @@ Flavor definitions undergo JSON schema validation checking:
324324
* Required field presence (name, resource_class)
325325
* Type correctness (strings for name/resource_class/traits)
326326
* Trait name patterns (uppercase alphanumeric with underscores)
327-
* Trait requirement enum values (`required` or `absent`)
327+
* Trait state enum values (`required` or `absent`)
328328

329329
Validation happens at:
330330

@@ -392,14 +392,14 @@ name: m1.small.nicX
392392
resource_class: m1.small
393393
traits:
394394
- trait: NICX
395-
requirement: required
395+
state: required
396396
---
397397
# Exclusion: nodes without GPU
398398
name: m1.small.no-gpu
399399
resource_class: m1.small
400400
traits:
401401
- trait: GPU
402-
requirement: absent
402+
state: absent
403403
```
404404

405405
All three Nova flavors have identical vCPUs/RAM/disk (from device-type `m1.small`), but select different subsets of hardware based on traits.

docs/design-guide/hardware-traits.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ name: compute.nvme
182182
resource_class: m1.medium
183183
traits:
184184
- trait: NVME
185-
requirement: required
185+
state: required
186186
```
187187
188188
Matches only nodes with NVMe storage in m1.medium resource class.
@@ -194,7 +194,7 @@ name: compute.no-gpu
194194
resource_class: m1.large
195195
traits:
196196
- trait: GPU
197-
requirement: absent
197+
state: absent
198198
```
199199
200200
Matches nodes without GPU in m1.large resource class.
@@ -206,9 +206,9 @@ name: compute.nvidia-nvme
206206
resource_class: m1.large
207207
traits:
208208
- trait: GPU_NVIDIA
209-
requirement: required
209+
state: required
210210
- trait: NVME
211-
requirement: required
211+
state: required
212212
```
213213
214214
Matches nodes with both NVIDIA GPU and NVMe storage.
@@ -265,9 +265,9 @@ name: compute.gpu-nvme
265265
resource_class: m1.medium
266266
traits:
267267
- trait: GPU_NVIDIA
268-
requirement: required
268+
state: required
269269
- trait: NVME
270-
requirement: required
270+
state: required
271271
```
272272

273273
**Result**: Node eligible for `compute.gpu-nvme` flavor, Nova flavor created with m1.medium resource class properties (32 vCPUs, 256GB RAM from device-type).

docs/operator-guide/flavors.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ name: m1.small.nicX
6262
resource_class: m1.small
6363
traits:
6464
- trait: NICX
65-
requirement: required
65+
state: required
6666
```
6767

6868
**Trait Requirements**:
6969

7070
* `trait`: Hardware trait name WITHOUT the `CUSTOM_` prefix (e.g., `NICX`, `GPU`, `NVME`)
7171
* Must be uppercase alphanumeric with underscores
7272
* The system automatically adds `CUSTOM_` prefix when interacting with Ironic
73-
* `requirement`: Either `required` (node must have trait) or `absent` (node must not have trait)
73+
* `state`: Either `required` (node must have trait) or `absent` (node must not have trait)
7474

7575
### 4. Add to Deployment
7676

@@ -128,7 +128,7 @@ This performs full JSON schema validation including:
128128
* Required field presence (name, resource_class)
129129
* Type correctness (strings)
130130
* Trait name patterns (uppercase alphanumeric with underscores)
131-
* Trait requirement enum values (`required` or `absent`)
131+
* Trait state enum values (`required` or `absent`)
132132

133133
Successful output:
134134

@@ -139,7 +139,7 @@ INFO Flavor definition is valid name=m1.small resource_class=m1.small
139139
Validation errors will show the specific issue:
140140

141141
```text
142-
Error: validation failed: traits[0].requirement: must be one of [required, absent]
142+
Error: validation failed: traits[0].state: must be one of [required, absent]
143143
Error: validation failed: traits[0].trait: does not match pattern ^[A-Z][A-Z0-9_]*$
144144
```
145145

@@ -262,7 +262,7 @@ name: compute.gpu
262262
resource_class: m1.large
263263
traits:
264264
- trait: GPU
265-
requirement: required
265+
state: required
266266
```
267267

268268
Guarantees instances get nodes with GPU hardware.
@@ -277,7 +277,7 @@ name: m1.small.mellanox-cx5
277277
resource_class: m1.small
278278
traits:
279279
- trait: NIC_MELLANOX_CX5
280-
requirement: required
280+
state: required
281281
```
282282

283283
Only matches nodes with Mellanox ConnectX-5 network cards.
@@ -292,9 +292,9 @@ name: compute.nvme-no-gpu
292292
resource_class: m1.medium
293293
traits:
294294
- trait: NVME
295-
requirement: required
295+
state: required
296296
- trait: GPU
297-
requirement: absent
297+
state: absent
298298
```
299299

300300
Requires NVMe storage but excludes GPU nodes.
@@ -346,9 +346,9 @@ Ensure both `name` and `resource_class` are present in the definition.
346346

347347
Trait names must be uppercase alphanumeric with underscores. Don't include the `CUSTOM_` prefix.
348348

349-
**Invalid requirement**:
349+
**Invalid state**:
350350

351-
The `requirement` field must be exactly `required` or `absent`.
351+
The `state` field must be exactly `required` or `absent`.
352352

353353
### ConfigMap Not Updating
354354

@@ -404,7 +404,7 @@ name: m1.small.nicX
404404
resource_class: m1.small
405405
traits:
406406
- trait: NICX
407-
requirement: required
407+
state: required
408408
```
409409

410410
Only matches nodes with the `CUSTOM_NICX` trait.
@@ -417,7 +417,7 @@ name: compute.gpu
417417
resource_class: m1.large
418418
traits:
419419
- trait: GPU
420-
requirement: required
420+
state: required
421421
```
422422

423423
Guarantees GPU hardware for compute workloads.
@@ -430,9 +430,9 @@ name: m1.medium.mellanox-cx5-nvme
430430
resource_class: m1.medium
431431
traits:
432432
- trait: NIC_MELLANOX_CX5
433-
requirement: required
433+
state: required
434434
- trait: NVME
435-
requirement: required
435+
state: required
436436
```
437437

438438
Requires both Mellanox ConnectX-5 and NVMe storage.

schema/flavor.schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
"type": "string",
2727
"pattern": "^[A-Z][A-Z0-9_]*$"
2828
},
29-
"requirement": {
29+
"state": {
3030
"description": "Whether the trait must be present (required) or absent",
3131
"type": "string",
3232
"enum": ["required", "absent"]
3333
}
3434
},
35-
"required": ["trait", "requirement"],
35+
"required": ["trait", "state"],
3636
"additionalProperties": false
3737
}
3838
}

0 commit comments

Comments
 (0)