-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Systemd to activate virtual functions
Rationale: - These can be used by other units to define an ordering e.g you may want to run some before the virtual functions are created and/or run something after. - The udev method isn't working for me on Rocky 9.4 with Infiniband virtual functions.
- Loading branch information
Showing
4 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[Unit] | ||
Description=Adds virtual functions for {{ device.name }} | ||
Requires=sys-subsystem-net-devices-{{ device.name }}.device | ||
After=sys-subsystem-net-devices-{{ device.name }}.device | ||
Requires=network-pre.target | ||
Before=network-pre.target | ||
{% if ansible_facts.os_family == "Debian" %} | ||
Requires=systemd-networkd.service | ||
Before=systemd-networkd.service | ||
{% endif %} | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/bin/sh -c 'echo {{ device.numvfs | default(sriov_numvfs) }} > /sys/class/net/{{ device.name }}/device/sriov_numvfs' | ||
RemainAfterExit=yes | ||
|
||
[Install] | ||
WantedBy=network-pre.target | ||
{% if ansible_facts.os_family == "Debian" %} | ||
WantedBy=systemd-networkd.service | ||
{% endif %} | ||
{% set required_by = device.numvfs_required_by | default(sriov_numvfs_required_by) %} | ||
{% for item in required_by %} | ||
RequiredBy={{ item }} | ||
{% endfor %} |