diff --git a/spec/hardware/disk.fmf b/spec/hardware/disk.fmf index ec2e99f357..55c764b763 100644 --- a/spec/hardware/disk.fmf +++ b/spec/hardware/disk.fmf @@ -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. @@ -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" diff --git a/tmt/hardware.py b/tmt/hardware.py index eabd04ebf8..8950929522 100644 --- a/tmt/hardware.py +++ b/tmt/hardware.py @@ -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 diff --git a/tmt/schemas/provision/hardware.yaml b/tmt/schemas/provision/hardware.yaml index 8136f1e1a1..3e54dd9a0e 100644 --- a/tmt/schemas/provision/hardware.yaml +++ b/tmt/schemas/provision/hardware.yaml @@ -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