Skip to content

Commit

Permalink
Support cpu.model-name hardware requirement for mrack
Browse files Browse the repository at this point in the history
  • Loading branch information
skycastlelily committed May 9, 2024
1 parent 142f3d1 commit 1772ec5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
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"
20 changes: 20 additions & 0 deletions tmt/steps/provision/mrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class GuestInspectType(TypedDict):
'cpu.flag',
'cpu.processors',
'cpu.model',
'cpu.model_name',
'cpu.cores',
'disk.size',
'disk.model_name',
Expand Down Expand Up @@ -275,6 +276,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 @@ -439,6 +458,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

0 comments on commit 1772ec5

Please sign in to comment.