Skip to content
Merged
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
8 changes: 8 additions & 0 deletions playbooks/templates/.github/workflows/tft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,16 @@ jobs:
tf_scope: private
api_key: ${{ secrets.TF_API_KEY_RH }}
update_pull_request_status: false
{%- endraw +%}
{%- if inventory_hostname == "network" %}
{%- raw %}
tmt_hardware: '{ "memory": ">= ${{ needs.prepare_vars.outputs.memory }} MB", "network": [{"type": "eth"},{"type": "eth"}]'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is ok for now - but it would be nice if there were some sort of configuration file (like provision.fmf) that would be in the role code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've asked about this above. This file exists but I cannot find syntax to populate it. Workflow reads memory from this file already, it would be ideal to read nics from it too. Do you know if specifying two NICs can be done in tests/provision.fmf without breaking anything?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is an example from the timesync role - https://github.com/linux-system-roles/timesync/blob/main/tests/provision.fmf

standard-inventory-qcow2:
  qemu:
    net_nic:
      # Use qemu-system-x86_64 -net nic,model=help for a list of available devices.
      model: e1000

which seems a different use case - so I don't think we can use provision.fmf for this.

But that is ok - we don't need to worry about this now - but at some point in the future if we need to add something similar to another role, we may need to use some sort of config file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we could use provision.fmf for this, but I think it would be a bad idea - here is the only place where the code is used in standard-inventory-qcow2:

    param_net_nic_model = str(fmf_get(['qemu', 'net_nic', 'model'], 'virtio'))

so we could do something like this which would not break standard-inventory-qcow2

standard-inventory-qcow2:
  qemu:
    net_nic:
      devices: [eth, eth]

but it's bad to override the format - the format is supposed to map directly to qemu command line parameters and values https://pagure.io/fork/fbo/standard-test-roles/tree/master - Flexible Metadata Format for default provisioner(s)

Supported parameters
standard-inventory-qcow2

    qemu.m - RAM size in megabytes. Optionally, a suffix of M or G.
    qemu.net_nic.model - Use qemu-system-x86_64 -net nic,model=help for a list of available devices.
    drive - has to contain dict of additional drive(s)
    drive.size - allows to specify additional drive with size in bytes (default size: 2G)
    drive.path - allows to specify additional drive with custom path to its backing file (default path: /tmp)

You can open a RFE ticket to extend supported parameters according to https://qemu.weilnetz.de/doc/qemu-doc.html

{%- endraw +%}
{% else %}
{%- raw %}
tmt_hardware: '{ "memory": ">= ${{ needs.prepare_vars.outputs.memory }} MB" }'
{%- endraw +%}
{%- endif %}
tmt_plan_filter: "tag:general,{{ inventory_hostname }}"

- name: Set final commit status
Expand Down