From 83018c1b113aa57d07dedc074b675bbad007e683 Mon Sep 17 00:00:00 2001 From: Miroslav Vadkerti Date: Fri, 27 Oct 2023 11:48:48 +0200 Subject: [PATCH] Add hardware schema for GPU To be able to select machines according to the graphics card introduce the `gpu` key under `hardware`. According to discussion, use for now only `product` and `vendor` names to be available for filtering, those can be easily detected using the command: ``` lshw -C display ``` Resolves #2154 Signed-off-by: Miroslav Vadkerti --- spec/hardware/gpu.fmf | 14 ++++++++++++++ tests/unit/test_hardware.py | 2 ++ tmt/schemas/provision/hardware.yaml | 20 ++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 spec/hardware/gpu.fmf diff --git a/spec/hardware/gpu.fmf b/spec/hardware/gpu.fmf new file mode 100644 index 0000000000..ff2335bb79 --- /dev/null +++ b/spec/hardware/gpu.fmf @@ -0,0 +1,14 @@ +summary: + Choose system according to the available graphics processing unit (gpu) +example: + - | + # GPU-related stuff grouped together. + gpu: + # GPU device name name. + device-name: G86 [Quadro NVS 290] + # GPU vendor name. + vendor-name: NVIDIA Corporation + +# NOTE: not yet supported +# link: +# - implemented-by: /tmt/steps/provision/artemis.py diff --git a/tests/unit/test_hardware.py b/tests/unit/test_hardware.py index 50830f5301..e07b8a8c2a 100644 --- a/tests/unit/test_hardware.py +++ b/tests/unit/test_hardware.py @@ -109,6 +109,8 @@ def test_parse_maximal_constraint() -> None: disk: - size: 40 GiB - size: 120 GiB + gpu: + device-name: G86 [Quadro NVS 290] hostname: "~ .*.foo.redhat.com" memory: 8 GiB network: diff --git a/tmt/schemas/provision/hardware.yaml b/tmt/schemas/provision/hardware.yaml index f761d4d994..44d8364ff4 100644 --- a/tmt/schemas/provision/hardware.yaml +++ b/tmt/schemas/provision/hardware.yaml @@ -154,6 +154,23 @@ definitions: items: "$ref": "#/definitions/disk" + # HW requirements: single `gpu` item + gpu: + type: object + + properties: + device-name: + type: string + + vendor-name: + type: string + + additionalProperties: false + + # enforce at least one property - we don't care which one, but we don't want + # empty `gpu`. + minProperties: 1 + hostname: type: string @@ -273,6 +290,9 @@ definitions: disk: "$ref": "#/definitions/disks" + gpu: + "$ref": "#/definitions/gpu" + hostname: "$ref": "#/definitions/hostname"