Skip to content

Commit

Permalink
Parse the cpu.hyper-threading hardware requirement (#2949)
Browse files Browse the repository at this point in the history
  • Loading branch information
skycastlelily authored Jul 11, 2024
1 parent 85f02d3 commit 986e7fe
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions spec/hardware/cpu.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ description: |
- "!= flag4"
...

# Request a CPU with hyper-threading enabled.
hyper-threading: true|false

See e.g. https://virtual-dba.com/blog/sockets-cores-and-threads/ for the
socket, core and thread distinction.

Expand Down Expand Up @@ -97,6 +100,11 @@ example:
cpu:
cores: ">= 4"

- |
# Request a CPU with hyper-threading enabled.
cpu:
hyper-threading: true

link:
- implemented-by: /tmt/steps/provision/artemis.py
- implemented-by: /tmt/steps/provision/mrack.py
Expand Down
8 changes: 8 additions & 0 deletions tmt/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,14 @@ def _parse_cpu(spec: Spec) -> BaseConstraint:

group.constraints += [flag_group]

if 'hyper-threading' in spec:
group.constraints += [
FlagConstraint.from_specification(
'cpu.hyper_threading',
spec['hyper-threading'],
allowed_operators=[Operator.EQ, Operator.NEQ])
]

return group


Expand Down
2 changes: 2 additions & 0 deletions tmt/schemas/provision/hardware.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ definitions:
anyOf:
- type: string
- type: integer
hyper-threading:
type: boolean

additionalProperties: false

Expand Down

0 comments on commit 986e7fe

Please sign in to comment.