Skip to content

Conversation

@sever-sever
Copy link
Member

Change summary

Do not override already overridden drivers

Fixes this case:


Traceback (most recent call last):
  File "/usr/libexec/vyos/services/vyos-configd", line 156, in run_script
    script.apply(c)
  File "/usr/libexec/vyos/conf_mode/vpp.py", line 613, in apply
    control_host.override_driver(
  File "/usr/lib/python3/dist-packages/vyos/vpp/control_host.py", line 138, in override_driver
    Path('/sys/module/vfio_pci/drivers/pci:vfio-pci/new_id').write_text(
  File "/usr/lib/python3.11/pathlib.py", line 1079, in write_text
    with self.open(mode='w', encoding=encoding, errors=errors, newline=newline) as f:
FileExistsError: [Errno 17] File exists

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Related PR(s)

How to test / Smoketest result

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

@github-actions
Copy link

github-actions bot commented Nov 19, 2025

👍
No issues in PR Title / Commit Title

Fixes this case:

Traceback (most recent call last):
  File "/usr/libexec/vyos/services/vyos-configd", line 156, in run_script
    script.apply(c)
  File "/usr/libexec/vyos/conf_mode/vpp.py", line 613, in apply
    control_host.override_driver(
  File "/usr/lib/python3/dist-packages/vyos/vpp/control_host.py", line 138, in override_driver
    Path('/sys/module/vfio_pci/drivers/pci:vfio-pci/new_id').write_text(
  File "/usr/lib/python3.11/pathlib.py", line 1079, in write_text
    with self.open(mode='w', encoding=encoding, errors=errors, newline=newline) as f:
FileExistsError: [Errno 17] File exists
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a FileExistsError that occurs when VPP attempts to override a driver that has already been overridden. The fix adds exception handling to gracefully handle the case where the vendor/device ID pair is already registered with vfio-pci.

Key changes:

  • Added try-except block around the vfio-pci new_id write operation
  • FileExistsError is now silently ignored (expected behavior)
  • Generic exceptions are caught and logged as warnings
Comments suppressed due to low confidence (1)

python/vyos/vpp/control_host.py:144

  • 'except' clause does nothing but pass and there is no explanatory comment.
        except FileExistsError:

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

CI integration 👍 passed!

Details

CI logs

  • CLI Smoketests (no interfaces) 👍 passed
  • CLI Smoketests VPP 👍 passed
  • CLI Smoketests (interfaces only) 👍 passed
  • Config tests 👍 passed
  • Config tests VPP 👍 passed
  • RAID1 tests 👍 passed
  • TPM tests 👍 passed

@alexk37
Copy link
Contributor

alexk37 commented Nov 24, 2025

Fix works on AWS vm with ENA driver

vyos@VyOS-for-Smoke-Tests# set vpp settings int eth1 driver dpdk
[edit]
vyos@VyOS-for-Smoke-Tests# commit
[ vpp ]

WARNING: NOTE: Current dataplane capacity (estimated): 2.1 M IPv4
routes. Exceeding these values will lead to a dataplane out-of-memory
condition and a crash. Extensive use of features like ACLs, NAT and
others may reduce the numbers above. Please read the documentation for
details: https://docs.vyos.io/


[edit]
vyos@VyOS-for-Smoke-Tests# set vpp settings int eth2 driver dpdk
[edit]
vyos@VyOS-for-Smoke-Tests# commit
[ vpp ]

WARNING: NOTE: Current dataplane capacity (estimated): 2.1 M IPv4
routes. Exceeding these values will lead to a dataplane out-of-memory
condition and a crash. Extensive use of features like ACLs, NAT and
others may reduce the numbers above. Please read the documentation for
details: https://docs.vyos.io/


[edit]
vyos@VyOS-for-Smoke-Tests#

@zdc
Copy link
Contributor

zdc commented Nov 24, 2025

We have encountered a similar case with something in VPP before, and my previous response still applies here.

Whether the suggested solution is appropriate depends on understanding why the drivers are in unexpected states at the moment the function is called. This is what we need to investigate.

@dmbaturin dmbaturin changed the title T7819: VPP do not override driver if it is already done vpp: T7819: do not override driver if it is already done Nov 24, 2025
@sever-sever
Copy link
Member Author

@zdc Can you close the PR if the fix is not acceptable?
We don’t have another solution at the moment.

@sever-sever sever-sever marked this pull request as draft November 25, 2025 15:49
@sever-sever sever-sever marked this pull request as ready for review December 2, 2025 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants