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

Support cpu.model-name hardware requirement for mrack #2921

Merged
merged 2 commits into from
May 23, 2024
Merged
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
2 changes: 1 addition & 1 deletion spec/hardware/cpu.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ example:
link:
- implemented-by: /tmt/steps/provision/artemis.py
- implemented-by: /tmt/steps/provision/mrack.py
note: "``cpu.flag``, ``cpu.processors``, ``cpu.model``, ``cpu.cores`` only"
note: "``cpu.flag``, ``cpu.processors``, ``cpu.model``, ``cpu.cores``, ``cpu.model-name`` only"
12 changes: 11 additions & 1 deletion tests/unit/provision/mrack/test_hw.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,17 @@ def test_maximal_constraint(root_logger: Logger) -> None:
},
{'or': []},
{'or': []},
{'or': []},
{
'not':
{
'cpu': {
'model_name': {
'_op': 'like',
'_value': 'Haswell'
}
}
},
},
{
'and': [
{
Expand Down
19 changes: 19 additions & 0 deletions tmt/steps/provision/mrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,24 @@ def _transform_cpu_cores(
children=[MrackHWBinOp('cores', beaker_operator, actual_value)])


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

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

return MrackHWGroup(
'cpu',
children=[MrackHWBinOp('model_name', beaker_operator, actual_value)])


def _transform_disk_driver(
constraint: tmt.hardware.TextConstraint,
logger: tmt.log.Logger) -> MrackBaseHWElement:
Expand Down Expand Up @@ -423,6 +441,7 @@ def _transform_zcrypt_mode(
'cpu.model': _transform_cpu_model, # type: ignore[dict-item]
'cpu.processors': _transform_cpu_processors, # type: ignore[dict-item]
'cpu.cores': _transform_cpu_cores, # type: ignore[dict-item]
'cpu.model_name': _transform_cpu_model_name, # type: ignore[dict-item]
'disk.driver': _transform_disk_driver, # type: ignore[dict-item]
'disk.model_name': _transform_disk_model_name, # type: ignore[dict-item]
'disk.size': _transform_disk_size, # type: ignore[dict-item]
Expand Down
Loading