Skip to content

Commit

Permalink
Support system.vendor-name hardware requirement for mrack (#3314)
Browse files Browse the repository at this point in the history
  • Loading branch information
skycastlelily committed Oct 30, 2024
1 parent 7def3eb commit 414f9f6
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ tmt-1.39.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The :ref:`/plugins/provision/beaker` provision plugin gains
support for :ref:`system.model-name</spec/hardware/system>`
hardware requirement.
support for :ref:`system.model-name</spec/hardware/system>` and
:ref:`system.vendor-name</spec/hardware/system>` hardware requirements.


tmt-1.38.0
Expand Down
2 changes: 1 addition & 1 deletion spec/hardware/system.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ example:

link:
- implemented-by: /tmt/steps/provision/mrack.py
note: "``system.numa-nodes`` and ``system.model-name`` only"
note: "``system.vendor`` and ``system.model`` not implemented yet"
9 changes: 8 additions & 1 deletion tests/unit/provision/mrack/test_hw.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,14 @@ def test_maximal_constraint(root_logger: Logger) -> None:
{
'and': [
{'or': []},
{'or': []},
{
'system': {
'vendor': {
'_op': 'like',
'_value': 'Dell%',
},
},
},
{'or': []},
{
'system': {
Expand Down
18 changes: 18 additions & 0 deletions tmt/steps/provision/mrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,23 @@ def _transform_system_model_name(
children=[MrackHWBinOp('model', beaker_operator, actual_value)])


def _transform_system_vendor_name(
constraint: tmt.hardware.NumberConstraint,
logger: tmt.log.Logger) -> MrackBaseHWElement:
beaker_operator, actual_value, negate = operator_to_beaker_op(
constraint.operator,
str(constraint.value))

if negate:
return MrackHWNotGroup(children=[
MrackHWGroup('system',
children=[MrackHWBinOp('vendor', beaker_operator, actual_value)])
])

return MrackHWGroup('system',
children=[MrackHWBinOp('vendor', beaker_operator, actual_value)])


ConstraintTransformer = Callable[[
tmt.hardware.Constraint[Any], tmt.log.Logger], MrackBaseHWElement]

Expand Down Expand Up @@ -626,6 +643,7 @@ def _transform_system_model_name(
'zcrypt.mode': _transform_zcrypt_mode, # type: ignore[dict-item]
'system.numa_nodes': _transform_system_numa_nodes, # type: ignore[dict-item]
'system.model_name': _transform_system_model_name, # type: ignore[dict-item]
'system.vendor_name': _transform_system_vendor_name, # type: ignore[dict-item]
'iommu.is_supported': _transform_iommu_is_supported, # type: ignore[dict-item]
}

Expand Down

0 comments on commit 414f9f6

Please sign in to comment.