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

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.

1 participant