Skip to content

Commit

Permalink
Support system.vendor-name hardware requirement for mrack
Browse files Browse the repository at this point in the history
  • Loading branch information
skycastlelily committed Oct 24, 2024
1 parent 3fb98b9 commit 56f40bc
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
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 @@ -281,7 +281,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 56f40bc

Please sign in to comment.