Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sriov: don't generate duplicate entries in the rebind.service file #437

Merged
merged 3 commits into from
Jan 25, 2024

Conversation

daniloegea
Copy link
Collaborator

@daniloegea daniloegea commented Jan 23, 2024

Description

The sriov-rebind.service will have duplicates when multiple VFs are being created. See below:

$ cat run/systemd/system/netplan-sriov-rebind.service
[Unit]
Description=(Re-)bind SR-IOV Virtual Functions to their driver
After=network.target
After=sys-subsystem-net-devices-enp3s0f0np0.device
After=sys-subsystem-net-devices-enp3s0f0np0.device
After=sys-subsystem-net-devices-enp3s0f0np0.device
After=sys-subsystem-net-devices-enp3s0f1np1.device
After=sys-subsystem-net-devices-enp3s0f1np1.device
After=sys-subsystem-net-devices-enp3s0f1np1.device

[Service]
Type=oneshot
ExecStart=/usr/sbin/netplan rebind enp3s0f0np0 enp3s0f0np0 enp3s0f0np0 enp3s0f1np1 enp3s0f1np1 enp3s0f1np1

Checklist

  • Runs make check successfully.
  • Retains 100% code coverage (make check-coverage).
  • New/changed keys in YAML format are documented.
  • (Optional) Adds example YAML for new feature.
  • (Optional) Closes an open bug in Launchpad.

We are not checking if the systemd units generated are correct.
This test is currently failing due to interface duplicates being added
to the list.
When multiple VFs are present in the configuration, we end up generating
many duplicates in the netplan-sriov-rebind.service file.

Use a hash set to store the PFs and automatically deduplicate entries.
@daniloegea daniloegea marked this pull request as ready for review January 23, 2024 15:10
Copy link
Collaborator

@slyon slyon left a comment

Choose a reason for hiding this comment

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

LGTM

@daniloegea daniloegea merged commit d55ae65 into canonical:main Jan 25, 2024
13 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants