Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for disk.count hardware requirement #2789

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions spec/hardware/disk.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ description: |
# String, disk driver requested.
- driver: "well-known disk driver"

# Number or string, the count of disks
- count: 2|">= 2"

.. versionchanged:: 1.32
Added `driver` and `model-name` into specification.

Expand All @@ -42,6 +45,13 @@ example:
- model-name: 'PERC H310'
- driver: '~ sas.*'

- |
# Requested multiple disks with the requested properties
disk:
- size: '>= 2 GB'
- model-name: 'PERC H310'
- driver: '~ sas.*'
- count: 2
link:
- implemented-by: /tmt/steps/provision/artemis.py
note: "``size`` only"
Expand Down
10 changes: 10 additions & 0 deletions tmt/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,16 @@ def _parse_disk(spec: Spec, disk_index: int) -> BaseConstraint:
if constraint_name in spec
]

group.constraints += [
NumberConstraint.from_specification(
f'disk[{disk_index}].{constraint_name}',
str(spec[constraint_name]),
allowed_operators=[
Operator.EQ, Operator.NEQ, Operator.LT, Operator.LTE, Operator.GT, Operator.GTE])
for constraint_name in ('count',)
if constraint_name in spec
]

return group


Expand Down
5 changes: 5 additions & 0 deletions tmt/schemas/provision/hardware.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ definitions:
driver:
type: string

count:
anyOf:
- type: string
- type: integer

additionalProperties: false

# enforce at least one property - we don't care which one, but we don't want
Expand Down
Loading