Skip to content

Commit

Permalink
Add support for disk.driver hardware requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
skycastlelily authored and psss committed Mar 5, 2024
1 parent 9fbd946 commit c1e75f7
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ tmt-1.32
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The hardware specification for :ref:`/spec/hardware/disk` has been
extended with the new ``model-name`` key. Users can provision
Beaker guests with a given disk model using the
extended with the new keys ``driver`` and ``model-name``. Users
can provision Beaker guests with a given disk model using the
:ref:`/spec/plans/provision/beaker` plugin.


Expand Down
13 changes: 12 additions & 1 deletion spec/hardware/disk.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ description: |
# Number or string, the amount of storage requested.
# Bytes are assumed when no unit is specified.
- size: 1234|">= 512 GiB"

# String, disk model requested.
- model-name: "well-known disk model"

# String, disk driver requested.
- driver: "well-known disk driver"

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

example:
- |
Expand All @@ -26,15 +30,22 @@ example:
disk:
- model-name: 'PERC H310'

- |
# Require a disk with specified driver
disk:
- driver: mpt3sas

- |
# Multiple disks can be requested as well
disk:
- size: '>= 2 GB'
- model-name: 'PERC H310'
- driver: '~ sas.*'

link:
- implemented-by: /tmt/steps/provision/artemis.py
note: "``size`` only"
- implemented-by: /tmt/steps/provision/mrack.py
note: "``size`` and ``model-name`` only"
- implemented-by: /tmt/steps/provision/testcloud.py
note: "``size`` only with ``=``, ``>=`` and ``<=`` operators only"
10 changes: 10 additions & 0 deletions tmt/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,16 @@ def _parse_disk(spec: Spec, disk_index: int) -> BaseConstraint:
if constraint_name in spec
]

group.constraints += [
TextConstraint.from_specification(
f'disk[{disk_index}].{constraint_name}',
str(spec[constraint_name]),
allowed_operators=[
Operator.EQ, Operator.NEQ, Operator.MATCH, Operator.NOTMATCH])
for constraint_name in ('driver',)
if constraint_name in spec
]

return group


Expand Down
3 changes: 3 additions & 0 deletions tmt/schemas/provision/hardware.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ definitions:
model-name:
type: string

driver:
type: string

additionalProperties: false

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

0 comments on commit c1e75f7

Please sign in to comment.