From 35eba646d62169a14b2bfcdd8b343d08a2c8e79b Mon Sep 17 00:00:00 2001 From: Athrey Vinay Date: Tue, 19 May 2026 10:12:26 +0100 Subject: [PATCH 1/3] add specification for reusable hardware presets --- spec/hardware/preset.fmf | 80 ++++++++++++++++++++++++++++++++ tmt/schemas/hardware-preset.yaml | 12 +++++ 2 files changed, 92 insertions(+) create mode 100644 spec/hardware/preset.fmf create mode 100644 tmt/schemas/hardware-preset.yaml diff --git a/spec/hardware/preset.fmf b/spec/hardware/preset.fmf new file mode 100644 index 0000000000..91b7936346 --- /dev/null +++ b/spec/hardware/preset.fmf @@ -0,0 +1,80 @@ +summary: | + Reference predefined hardware configurations from external preset files. + +description: | + .. code-block:: yaml + + provision: + hardware: + import-preset: + - https://github.com/my-team/project/presets.yaml + - file:///home/user/config/tmt/presets.yaml + - ~/.config/tmt/presets.yaml + and: + - preset: AMD__ROME + - preset: MEMORY_MIN_64G + - cpu: + model: 97 + + Rules: + + * ``import-preset`` is allowed only at the top level of the ``hardware`` + key. + * ``import-preset`` accepts a single string or a list of strings. Each + string identifies a preset source and is interpreted automatically: + * An ``http://`` or ``https://`` URL — fetched remotely. + * A ``file://`` URL — read from the given absolute local path. + * Any other string — treated as a local file path (absolute, relative, + or using ``~`` for the home directory). + * ``preset`` is a string referencing a single named preset. To apply + multiple presets, combine them with ``and`` (or ``or``). + + Preset files use YAML format with a dictionary mapping preset names to + their hardware definitions: + + .. code-block:: yaml + + # presets.yaml + AMD__ROME: + cpu: + family: 23 + model: 49 + MEMORY_MIN_64G: + memory: ">= 64 GB" + +example: + - | + # Use a remote preset + provision: + hardware: + import-preset: https://github.com/my-team/presets.yaml + preset: AMD__ROME + - | + # Use a local preset file + provision: + hardware: + import-preset: ~/.config/tmt/presets.yaml + preset: BIG_MEMORY + - | + # Use a local preset file via file:// URL + provision: + hardware: + import-preset: file:///home/user/config/tmt/presets.yaml + preset: BIG_MEMORY + - | + # Combine multiple presets and additional constraints + provision: + hardware: + import-preset: + - https://github.com/my-team/project/presets.yaml + - file:///home/user/config/tmt/presets.yaml + - ~/.config/tmt/presets.yaml + and: + - preset: AMD__ROME + - preset: BIG_MEMORY + - cpu: + model: 97 + +# NOTE: not yet supported +# link: +# - implemented-by: /tmt/steps/provision/artemis.py diff --git a/tmt/schemas/hardware-preset.yaml b/tmt/schemas/hardware-preset.yaml new file mode 100644 index 0000000000..6869b225fd --- /dev/null +++ b/tmt/schemas/hardware-preset.yaml @@ -0,0 +1,12 @@ +--- + +# +# JSON Schema definition for tmt hardware preset files +# + +$id: /schemas/hardware-preset +$schema: https://json-schema.org/draft-07/schema + +type: object +additionalProperties: + $ref: "/schemas/provision/hardware#/definitions/hardware" From bb0ca04b7dcd4412d34f9645e2a11a738b217f83 Mon Sep 17 00:00:00 2001 From: Athrey Vinay Date: Wed, 20 May 2026 09:11:05 +0100 Subject: [PATCH 2/3] fix indentation... --- spec/hardware/preset.fmf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/hardware/preset.fmf b/spec/hardware/preset.fmf index 91b7936346..6770b635eb 100644 --- a/spec/hardware/preset.fmf +++ b/spec/hardware/preset.fmf @@ -20,12 +20,15 @@ description: | * ``import-preset`` is allowed only at the top level of the ``hardware`` key. + * ``import-preset`` accepts a single string or a list of strings. Each string identifies a preset source and is interpreted automatically: + * An ``http://`` or ``https://`` URL — fetched remotely. * A ``file://`` URL — read from the given absolute local path. * Any other string — treated as a local file path (absolute, relative, or using ``~`` for the home directory). + * ``preset`` is a string referencing a single named preset. To apply multiple presets, combine them with ``and`` (or ``or``). From ac929f05472d1cb3502ec614e2014dfb2dd7fa29 Mon Sep 17 00:00:00 2001 From: Athrey Vinay Date: Wed, 20 May 2026 09:52:42 +0100 Subject: [PATCH 3/3] deduplicate description... --- spec/hardware/preset.fmf | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/spec/hardware/preset.fmf b/spec/hardware/preset.fmf index 6770b635eb..382a68bde9 100644 --- a/spec/hardware/preset.fmf +++ b/spec/hardware/preset.fmf @@ -10,11 +10,13 @@ description: | - https://github.com/my-team/project/presets.yaml - file:///home/user/config/tmt/presets.yaml - ~/.config/tmt/presets.yaml - and: - - preset: AMD__ROME - - preset: MEMORY_MIN_64G - - cpu: - model: 97 + preset: BIG_MEMORY + cpu: + model: 97 + + In the example above, both the ``BIG_MEMORY`` preset and the + ``cpu.model: 97`` constraint must be satisfied — sibling keys under + ``hardware`` are combined with implicit ``and`` glue. Rules: